Developer GuideLiquid
Abstract Fee Vault Contract
AbstractFeeVault
Description
The base contract for holding vaults used to fulfill Liquid obligations in the event that it's own funds are not sufficient
Variables
token
- Description - The address of the asset this vault is parameterized for. For ERC-20 vaults this is the token address. For the ETH vault this holds the WETH address.
- Type -
address - Read By
token()
authorized
- Description - Allowlist of accounts permitted to withdraw from the vault, such as the Liquid and owner.
- Type -
mapping(address => bool) - Used By
- Updated By
- Read By
authorized(address)
Modifiers
onlyAuthorized
- Description - Restricts function access to addresses enabled in the
authorizedmapping. - Reverts
Unauthorized()- whenmsg.senderis not authorized.
Functions
Owner Actions
Functions guarded by the onlyOwner modifier
setAuthorization(address account, bool status)
- Description - Enables or disables an address from the withdraw allowlist.
@param account- Address to authorize or de-authorize.@param status-trueto authorize,falseto de-authorize.
- Visibility Specifier - external
- State Mutability Specifier - nonpayable
- Reverts
ZeroAddress()- whenaccount == address(0).
- Emits
Internal Operations
_checkNonZeroAddress(address account)
- Description - Validates
account != address(0). - Visibility Specifier - internal
- State Mutability Specifier - pure
- Reverts
ZeroAddress()- when the address passed is the zero address.
_checkNonZeroAmount(uint256 amount)
- Description - Validates
amount > 0. - Visibility Specifier - internal (pure)
- State Mutability Specifier - pure
- Reverts
ZeroAmount()- when the amount passed is 0.
Abstract Functions
Virtual functions that should be implemented by child contracts
withdraw(address recipient, uint256 amount)
- Description - Transfer
amount, denominated in the contracts token, of vault asset to therecipient.@param recipient- Destination address.@param amount- Amount to withdraw denominated intokendecimals.
- Visibility Specifier - external
- State Mutability Specifier - nonpayable
totalDeposits()
- Description - Returns the total asset balance controlled by the vault.
- Visibility Specifier - external
- State Mutability Specifier - view
Events
-
Deposited(address indexed from, uint256 amount)- emitted when funds are deposited into a child vault. -
Withdrawn(address indexed to, uint256 amount)- emitted when funds are withdrawn by an authorized account. -
AuthorizationUpdated(address indexed account, bool status)- emitted when an account’s authorization state changes.
Errors
-
ZeroAddress()- thrown when a zero address is provided where a valid nonzero address is required. -
ZeroAmount()- thrown when a function receives a zero amount where a positive value is required. -
InsufficientBalance()- thrown when the vault does not hold enough assets to fulfill a withdrawal or transfer request.
Last updated on