AlchemistETHVault
Descriptionโ
A minimal ETH/WETH holding contract. It accepts native ETH or WETH, but always holds the balance as ETH, unwrapping the WETH if need be. Anyone can deposit, but only authorized callers can withdraw. It is used to escrow extra funds that may be used to cover obligations to liquidators and redeemers on the Alchemist.
Inherits from AbstractFeeVault for authorization and helpers.
Functionsโ
User Actionsโ
deposit()
- Description - Used to deposit native ETH into the vault, using
msg.valueas the amount to deposit. - Visibility Specifier - external payable
- State Mutability Specifier - payable
- Reverts
ZeroAmount()- whenmsg.value == 0.
- Emits
depositWETH(uint256 amount)
- Description - Transfers WETH from the caller, unwraps to ETH, and records the deposit.
@param amount- Amount of WETH to deposit.
- Visibility Specifier - external
- State Mutability Specifier - nonpayable
- Reverts
ZeroAmount()- whenamount == 0.- If the sender has insufficient allowance/balance.
- Emits
receive()
- Description - Fallback function to accept ETH transfers.
- Visibility Specifier - external payable
- State Mutability Specifier - payable
- Reverts - none
- Emits - none
Authorized Actionsโ
Functions guarded by the
onlyAuthorizedmodifier.
withdraw(address recipient, uint256 amount)
- Description - Transfers native ETH to the
recipient.@param recipient- Address to receive ETH.@param amount- The amount of ETH to send.
- Visibility Specifier - external
- State Mutability Specifier - nonpayable
- Reverts
ZeroAmount()- whenamount == 0.InsufficientBalance()- whenamount > address(this).balance.TransferFailed()- when the ETH transfer fails.
- Emits
Internal Operationsโ
_deposit(address depositor, uint256 amount)
- Description - Internal functions that emits
Deposited(depositor, amount). - Visibility Specifier - internal
- State Mutability Specifier - nonpayable
- Reverts - none
- Emits
Reading Stateโ
Reads derived, calculated, or internal state.
totalDeposits()
- Description - Returns current ETH balance of the vault.
- Visibility Specifier - public
- State Mutability Specifier - view
Eventsโ
-
Deposited(address indexed from, uint256 amount)- emitted after a successful ETH/WETH deposit. -
Withdrawn(address indexed recipient, uint256 amount)- emitted after a successful authorized ETH withdrawal.