Developer GuideLiquid
Liquid Eth Vault Contract
LiquidETHVault
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 Liquid.
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 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()- 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.
Last updated on