There are four anchor instructions:
- initialize: initializes an empty vault.
- refreshReserve: lets the vaultAdmin top off the tokenVault (the reserve)
- deposit: lets users deposit and specify the lockup time
- withdraw: lets users withdraw after specified lockup time
There is a test script with 4 mocha tests:
- initializes an empty vault
- refreshes it (tops it off)
- airdrops SOL + FEET token to user and deposits 100,000 FEET
- waits 4 seconds and then withdraws tokens + interest
This is a mvp with some limitations, all which are easily fixable:
- A user cannot have multiple deposit boxes.
- A user cannot deposit more funds in the same box.
- The admin is given mint authority, which means they can mint tokens themselves as well (my people would say that this is "no bueno")
- There are a few lazy castings between signed/unsigned integers and f64's that I would want to think more about re: security.
I am aware a set of keypairs (admin, mint, user) are attached to this; this is something I am doing only for the purpose of this demo.