Description
A minimal ERC-20 holding contract. Anyone can deposit, but only authorized callers can withdraw. It holds funds that pay the Alchemist's liquidator fee when a liquidated account cannot cover it from its own collateral, or when the Alchemist is globally undercollateralized.
Inherits from AbstractFeeVault for authorization and helpers.
Functions
User Actions
Functions that can be called by anyone.
deposit(uint256 amount)
- Description - Transfers an amount, denominated in the contract token from the caller into this contract.
@param amount- Quantity of ERC-20 tokens to deposit (in underlying token units).
- Visibility Specifier - external
- State Mutability Specifier - nonpayable
- Reverts
ZeroAmount()- whenamount == 0.- If the caller has insufficient allowance/balance.
- Emits
Authorized Actions
Functions guarded by the
onlyAuthorizedmodifier.
withdraw(address recipient, uint256 amount)
- Description - Transfers an amount denominated in the contract token to the
recipientaddress.@param recipient- Destination address to receive tokens.@param amount- Quantity to withdraw denominated in underlying token units.
- Visibility Specifier - external
- State Mutability Specifier - nonpayable
- Reverts
ZeroAddress()- whenrecipient == address(0).ZeroAmount()- whenamount == 0.- Reverts via OpenZeppelin's
safeTransferif the contract has insufficient token balance.
- Emits
Reading State
Reads derived, calculated, or internal state.
totalDeposits()
- Description - Returns the vault's current ERC-20 balance of contract token.
- Visibility Specifier - public
- State Mutability Specifier - view
Events
-
Deposited(address indexed from, uint256 amount)- emitted after a successful deposit. -
Withdrawn(address indexed recipient, uint256 amount)- emitted after a successful withdrawal.