Skip to main content

AbstractFeeVault

Description​

The base contract for holding vaults used to fulfill Alchemist 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

Modifiers​

onlyAuthorized
  • Description - Restricts function access to addresses enabled in the authorized mapping.
  • Reverts
    • Unauthorized() - when msg.sender is 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 - true to authorize, false to de-authorize.
  • Visibility Specifier - external
  • State Mutability Specifier - nonpayable
  • Reverts
    • ZeroAddress() - when account == 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 the recipient.
    • @param recipient - Destination address.
    • @param amount - Amount to withdraw denominated in token decimals.
  • 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​

  • Unauthorized() - thrown when a caller attempts an action requiring authorization but is not enabled in the authorized mapping.
  • 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.