Solidity API

RelayPoolNativeGateway

Gateway contract for depositing and withdrawing native ETH to/from WETH-based RelayPools

Handles wrapping/unwrapping of ETH and provides slippage protection for all operations

EthTransferFailed

error EthTransferFailed()

Error when ETH transfer fails

OnlyWethCanSendEth

error OnlyWethCanSendEth()

Error when contract receives ETH from non-WETH address

RemainingEth

error RemainingEth()

Error when ETH remains in contract after operation

SlippageExceeded

error SlippageExceeded()

Error when slippage protection is triggered

WETH

contract IWETH WETH

The Wrapped ETH (WETH) contract

Used to wrap/unwrap native ETH for pool operations

constructor

constructor(address wethAddress) public

Initializes the gateway with the WETH contract address

Parameters

NameTypeDescription
wethAddressaddressAddress of the Wrapped Native token contract

deposit

function deposit(address pool, address receiver, uint256 minSharesOut) external payable returns (uint256 shares)

Deposits native ETH into a WETH-based pool

Wraps ETH to WETH, then deposits to the pool with slippage protection

Parameters

NameTypeDescription
pooladdressThe address of the ERC4626 pool to deposit into
receiveraddressThe address that will receive the pool shares
minSharesOutuint256Minimum amount of shares to receive (slippage protection)

Return Values

NameTypeDescription
sharesuint256The amount of pool shares minted to the receiver

mint

function mint(address pool, address receiver, uint256 minSharesOut) external payable returns (uint256 shares)

Mints pool shares by depositing native ETH

Wraps ETH, calculates shares, then mints with slippage protection

Parameters

NameTypeDescription
pooladdressThe address of the ERC4626 pool to mint shares from
receiveraddressThe address that will receive the pool shares
minSharesOutuint256Minimum amount of shares to receive (slippage protection)

Return Values

NameTypeDescription
sharesuint256The amount of pool shares minted to the receiver

withdraw

function withdraw(address pool, uint256 assets, address receiver, uint256 maxSharesIn) external virtual returns (uint256 shares)

Withdraws a specific amount of native ETH from a WETH-based pool

Withdraws WETH from pool, unwraps to ETH, with slippage protection

Parameters

NameTypeDescription
pooladdressThe address of the ERC4626 pool to withdraw from
assetsuint256Amount of native ETH to withdraw
receiveraddressThe address that will receive the native ETH
maxSharesInuint256Maximum amount of shares to burn (slippage protection)

Return Values

NameTypeDescription
sharesuint256The amount of pool shares burned

redeem

function redeem(address pool, uint256 shares, address receiver, uint256 minAssetsOut) external virtual returns (uint256 assets)

Redeems pool shares for native ETH

Redeems shares for WETH, unwraps to ETH, with slippage protection

Parameters

NameTypeDescription
pooladdressThe address of the ERC4626 pool to redeem from
sharesuint256Amount of pool shares to redeem
receiveraddressThe address that will receive the native ETH
minAssetsOutuint256Minimum amount of ETH to receive (slippage protection)

Return Values

NameTypeDescription
assetsuint256The amount of native ETH sent to receiver

safeTransferETH

function safeTransferETH(address to, uint256 value) internal

Safely transfers ETH to an address

Reverts if the ETH transfer fails

Parameters

NameTypeDescription
toaddressRecipient of the ETH transfer
valueuint256Amount of ETH to transfer

receive

receive() external payable

Receives ETH only from WETH contract

Required for WETH unwrapping operations