IonZapper

Git Source

A peripheral helper contract to interact with the IonPool and the wstETH GemJoin even when holding StEth and native Ether. At the core level, the IonPool only interacts with wstETH and WETH. This contract will allow users to deposit StEth and native Ether into the IonPool by auto-wrapping on the user's behalf.

State Variables

POOL

IonPool public immutable POOL;

WETH

IWETH9 public immutable WETH;

STETH

IERC20 public immutable STETH;

WSTETH

IWstEth public immutable WSTETH;

WSTETH_JOIN

GemJoin public immutable WSTETH_JOIN;

WHITELIST

Whitelist public immutable WHITELIST;

Functions

onlyWhitelistedLenders

Checks if msg.sender is on the whitelist.

This contract will be on the protocolControlledWhitelist. As such, it will validate that users are on the whitelist itself and be able to bypass the whitelist check on IonPool.

modifier onlyWhitelistedLenders(bytes32[] memory proof);

Parameters

NameTypeDescription

proof

bytes32[]

to validate the whitelist check.

constructor

Creates a new IonZapper instance.

constructor(IonPool _ionPool, IWETH9 _weth, IERC20 _stEth, IWstEth _wstEth, GemJoin _wstEthJoin, Whitelist _whitelist);

Parameters

NameTypeDescription

_ionPool

IonPool

IonPool contract address.

_weth

IWETH9

WETH9 contract address.

_stEth

IERC20

StEth contract address.

_wstEth

IWstEth

wstETH contract address.

_wstEthJoin

GemJoin

GemJoin contract address associated with wstETH.

_whitelist

Whitelist

Whitelist contract address.

zapSupply

Deposits WETH into the IonPool by auto-wrapping the user's native ether on their behalf.

function zapSupply(bytes32[] calldata proof) external payable onlyWhitelistedLenders(proof);

Parameters

NameTypeDescription

proof

bytes32[]

to validate the whitelist check.

zapRepay

Repays WETH into the IonPool by auto-wrapping the user's native ether on their behalf.

function zapRepay(uint8 ilkIndex) external payable;

Parameters

NameTypeDescription

ilkIndex

uint8

of the collateral.

zapJoinWstEth

Deposits wstETH into the wstETH GemJoin by auto-wrapping the user's StEth on their behalf.

function zapJoinWstEth(uint256 amountStEth) external;

Parameters

NameTypeDescription

amountStEth

uint256

to gem-join. [WAD]