TradableStaking
- This contract is in charge of handling and tracking the staking balance of liquidity providers.
- When the stake method is called it means that funds have already gotten into the side vault and the user balance in our system has already been stored in the vault owned by the staking contract.
- Staking creates a struct store that is mapped to a user address that contains all the details including timestamp of stake, shares and balance of a user's staking position.
- The details stored in the Stake struct is used to calculate the share of the total reward generated by liquidity providers that a specific provider has.
- When the method unstake is called it is used to withdraw from a liquidity provider staking position depending on the side of the reward pool.
- It should be recognized that no fund is being handled in this contract during staking and unstaking it just hold and verifies that funds can be withdrawn and that funds were deposited.
- All funds holding is done in the side vault.
- Once withdrawal is confirmed a callback message is sent to the side vault to approve sending of funds to the user using the sendMessage method.
Name | Type | Description |
user | address | address of the user that initiated the withdrawal transaction |
selectedToken | ITradableSettings.AcceptedToken | struct holding the important information about one of the accepted tokens |
amount | uint256 | amount of tokens that is being withdrawn |
dstVault | address | address of the vault that is going to send the tokens out to the user |
function depositValidation(address caller, address user, ITradableSettings.AcceptedToken memory selectedToken, uint256 amount) external { ..... }
Name | Type | Description |
user | address | address of the user that initiated the withdrawal transaction |
selectedToken | ITradableSettings.AcceptedToken | struct holding the important information about one of the accepted tokens |
amount | uint256 | amount of tokens that is being withdrawn |
caller | address | address to specify a special deposit caller attached to the user in a case where it is needed. |