WETH
Inherits: CustomToken
Author: See https://github.com/agglayer/vault-bridge
based on https://github.com/gnosis/canonical-weth/blob/master/contracts/WETH9.sol
State Variables
_WETH_STORAGE
The storage slot at which WETH storage starts, following the EIP-7201 standard.
Calculated as keccak256(abi.encode(uint256(keccak256("agglayer.vault-bridge.WETH.storage")) - 1)) & ~bytes32(uint256(0xff))
.
bytes32 private constant _WETH_STORAGE = hex"df8caff5d0161908572492829df972cd19b1aabe3c3078d95299408cd561dc00";
Functions
constructor
constructor();
onlyNativeConverter
modifier onlyNativeConverter();
onlyIfGasTokenIsEth
modifier onlyIfGasTokenIsEth();
reinitialize
function reinitialize(
address owner_,
uint8 originalUnderlyingTokenDecimals_,
address lxlyBridge_,
address nativeConverter_
) external reinitializer(2);
_getWETHStorage
function _getWETHStorage() private pure returns (WETHStorage storage $);
bridgeBackingToLayerX
function bridgeBackingToLayerX(uint256 amount)
external
whenNotPaused
onlyIfGasTokenIsEth
onlyNativeConverter
nonReentrant;
receive
receive() external payable whenNotPaused onlyIfGasTokenIsEth nonReentrant;
deposit
Same as WETH9 deposit function.
function deposit() external payable whenNotPaused onlyIfGasTokenIsEth nonReentrant;
_deposit
function _deposit() internal;
withdraw
Same as WETH9 withdraw function, but liqudity is guaranteed only up to a certain percentage.
function withdraw(uint256 value) external whenNotPaused onlyIfGasTokenIsEth nonReentrant;
Events
Deposit
event Deposit(address indexed from, uint256 value);
Withdrawal
event Withdrawal(address indexed to, uint256 value);
Errors
AssetsTooLarge
error AssetsTooLarge(uint256 availableAssets, uint256 requestedAssets);
FunctionNotSupportedOnThisNetwork
error FunctionNotSupportedOnThisNetwork();
Structs
WETHStorage
Storage of WETH contract.
It's implemented on a custom ERC-7201 namespace to reduce the risk of storage collisions when using with upgradeable contracts.
Note: storage-location: erc7201:agglayer.vault-bridge.WETH.storage
struct WETHStorage {
bool _gasTokenIsEth;
}