Vault
https://github.com/Into-the-Fathom/fathom-dao-smart-contracts/blob/master/contracts/dao/staking/vault/packages/VaultPackage.sol
VaultProxy
is proxy, and its implementation is VaultPackage
.
The VaultPackage
contract manages the operations and state related to supported tokens and their deposits within the vault. It handles the addition and removal of tokens, depositing of tokens for rewards, and managing migration of tokens to a new vault package.
State Variables:
deposited (mapping(address => uint256))
Description: Tracks the total amount of each token that has been deposited into the vault.
Key: Token address.
Value: Amount deposited.
isSupportedToken (mapping(address => bool))
Description: Indicates whether a token is supported by the vault.
Key: Token address.
Value: Boolean indicating support.
listOfSupportedTokens (address[])
Description: An array of token addresses that are currently supported by the vault.
migrated (bool)
Description: A boolean flag indicating if the vault has been migrated to a new package.
Set Functions:
deposit(address _token, uint256 _amount)
Deposits a specified amount of a supported token into the vault.
Parameters:
_token
(address): The token's address._amount
(uint256): Amount of the token to deposit.
Returns: None.
payRewards(address _user, address _token, uint256 _amount)
Pays out rewards to a user from the deposited tokens.
Parameters:
_user
(address): The user's address._token
(address): The token's address._amount
(uint256): Amount of the token to pay out.
Returns: None.
addSupportedToken(address _token)
Adds a token to the list of supported tokens.
Parameters:
_token
(address): The token's address.
Returns: None.
removeSupportedToken(address _token)
Removes a token from the list of supported tokens.
Parameters:
_token
(address): The token's address.
Returns: None.
migrate(address newVaultPackage)
Migrates the vault to a new package.
Parameters:
newVaultPackage
(address): The new vault package's address.
Returns: None.
withdrawExtraSupportedTokens(address _withdrawTo)
Withdraws excess balances of supported tokens.
Parameters:
_withdrawTo
(address): Address to which the tokens will be withdrawn.
Returns: None.
withdrawExtraUnsupportedToken(address _token, address _withdrawTo)
Withdraws all balances of an unsupported token.
Parameters:
_token
(address): The token's address._withdrawTo
(address): Address to which the tokens will be withdrawn.
Returns: None.
Events:
TokenAdded
Emitted when a token is added to the list of supported tokens.
Parameters:
tokenAddress
(address indexed): Address of the token added.addedBy
(address indexed): Address of the user who added the token.timestamp
(uint256): Time at which the token was added.
TokenRemoved
Emitted when a token is removed from the list of supported tokens.
Parameters:
tokenAddress
(address indexed): Address of the token removed.removedBy
(address indexed): Address of the user who removed the token.timestamp
(uint256): Time at which the token was removed.
Last updated