AssetVault
AssetVault
_During the normal operation time, only Metahub contract is allowed to initiate asset return to the original asset owner. In case of emergency, the vault admin can switch vault to recovery mode, therefore allowing anyone to initiate asset return.
NOTE: There is no way to transfer asset from the vault to an arbitrary address. The asset can only be returned to the rightful owner.
Warning: All tokens transferred to the vault contract directly (not by Metahub contract) will be lost forever!!!_
_recovery
bool _recovery
Vault recovery mode state.
_metahub
address _metahub
Metahub address.
_aclContract
contract IACL _aclContract
ACL contract.
whenAssetDepositAllowed
modifier whenAssetDepositAllowed(address operator)
Modifier to check asset deposit possibility.
whenAssetReturnAllowed
modifier whenAssetReturnAllowed()
Modifier to check asset return possibility.
whenNotRecovery
modifier whenNotRecovery()
Modifier to make a function callable only when the vault is not in recovery mode.
constructor
constructor(address metahubContract, address aclContract) internal
Constructor.
Name | Type | Description |
---|---|---|
metahubContract | address | Metahub contract address. |
aclContract | address | ACL contract address. |
pause
function pause() external
Pauses the vault.
unpause
function unpause() external
Unpauses the vault.
switchToRecoveryMode
function switchToRecoveryMode() external
Activates asset recovery mode. Emits a {RecoveryModeActivated} event.
withdrawERC20Tokens
function withdrawERC20Tokens(contract IERC20 token, address to, uint256 amount) external
Send ERC20 tokens to an address.
metahub
function metahub() external view returns (address)
Returns the Metahub address.
isRecovery
function isRecovery() external view returns (bool)
Returns vault recovery mode flag state.
Name | Type | Description |
---|---|---|
[0] | bool | True when the vault is in recovery mode. |
supportsInterface
function supportsInterface(bytes4 interfaceId) public view virtual returns (bool)
_Returns true if this contract implements the interface defined by `interfaceId`. See the corresponding https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section] to learn more about how these ids are created.
This function call must use less than 30 000 gas._
_acl
function _acl() internal view returns (contract IACL)
return the IACL address