TradableSideVault
- This contract handles reception of funds for users on the chain it is hosted on and sending the data related to the deposit to the base chain vault contract for further validation
- In order to carry out deposit which can be of two types liquidity provision or Margin funding the different base vaults will be called to validate the deposit.
- This Contract also takes care of creation and storing of margin funding contracts which is a contract that recieves and routes user funds for margin deposit.
- This is where the function to accept tokens is done and the function to validate if a token is accepted.
- This contract only has the deposit and withdrawal request function available for external calls the other functions are called as instructions sent from the base chain using instruction mnemonics.
- The sendMessage function is used to send responses to the base chain and so send data the base chain for confirmation as in the case of depsoit and withdrawal.
function marginAccountDeposit(address user, address token, uint256 amount) external { ..... }
Name | Type | Description |
user | address | address of the user that initiated the deposit transaction |
token | address | address of the token being transacted |
amount | uint256 | amount of tokens that is being deposited |
function stakingAccountDeposit(address token, uint256 amount) external { ..... }
Name | Type | Description |
token | address | address of the token being transacted |
amount | uint256 | amount of tokens that is being staked |
function withdrawalRequest(WithdrawalType withdrawalType, address token, uint256 amount) external { ..... }
Name | Type | Description |
withdrawalType | address | type of withdrawal that is being requested for which is either Stake or Margin |
token | address | address of the token being transacted |
amount | uint256 | amount of tokens that is being withdrawn |
function getAcceptedTokenInfo(address token) AddressNotNull(token) view public returns(AcceptedToken memory) { ..... }
Name | Type | Description |
token | address | address of the token being gotten |
Name | Type | Description |
getAcceptedTokenInfo | AcceptedToken | struct of type AcceptedToken |
function tokenExists(address token) AddressNotNull(token) view public returns(bool) { ..... }
Name | Type | Description |
token | address | address of the token being gotten |
Name | Type | Description |
tokenExists | bool | true if token is registerred |
function getUserFundingAccount(address user) AddressNotNull(user) view external returns(address) { ..... }
Name | Type | Description |
user | address | address of the user whose funding account address is being gotten |
Name | Type | Description |
getUserFundingAccount | address | address of SideMarginFundingAccount contract |
event SideChainWithdrawalInitiated(address user, address token, uint256 amount);
event SideChainWithdrawalProcessed(address user, address token, uint256 amount);
event SideChainStakeDepositInitiated(address user, address token, uint256 amount);
event SideChainMarginDepositInitiated(address user, address token, uint256 amount);
event FundingAccountCreated(address user, address fundingAccount);
event AcceptedTokenAdded(address _token, uint8 _decimals, bool _isActive);
event AcceptedTokenRemoved(address _token);
event AcceptedTokenEdited(address _token, uint8 _decimals, bool _isActive);