Skip to main content

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.value as the amount to deposit.
  • Visibility Specifier - external payable
  • State Mutability Specifier - payable
  • Reverts
    • ZeroAmount() - when msg.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() - when amount == 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 onlyAuthorized modifier.

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() - when amount == 0.
    • InsufficientBalance() - when amount > address(this).balance.
    • TransferFailed() - when the ETH transfer fails.
  • Emits

Internal Operationsโ€‹

_deposit(address depositor, uint256 amount)

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.