Skip to content

Instantly share code, notes, and snippets.

@blutarche
Last active March 18, 2022 11:37
Show Gist options
  • Save blutarche/d5c03e3d291aa300d82efab0f9136819 to your computer and use it in GitHub Desktop.
Save blutarche/d5c03e3d291aa300d82efab0f9136819 to your computer and use it in GitHub Desktop.
function: Deposit
parameters: Amount, Deadline
code:
- Check if function Caller transfer asset to this contract by at least the Amount.
- if not, reject transaction
- Increase function Caller's balance by Amount.
- Lock this chunk of asset with the deadline.
function: Withdraw
parameters: Amount
code:
- Check if function Caller's balance is at least Amount
- if not, reject transaction
- Check if there's at least an Amount worth of assets unlocked by this time.
- if not, reject transaction
- Re-calculate locked assets.
- Decrease function Caller's balance by Amount.
- Transfer an Amount of asset to function Caller.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment