Skip to content

DDLayerZeroHub

senamakel edited this page Aug 26, 2024 · 1 revision

Solidity API

DDLayerZeroHub

A direct deposit module that sends ZAI to an L2 chain

Assumes that the destination on the L2 chain is a valid contract with proper controls.

destinationL2

bytes32 destinationL2

oftAdapter

contract IOFT oftAdapter

bridged

uint256 bridged

dstEid

uint32 dstEid

ethRefundAddress

address ethRefundAddress

initialize

function initialize(address _hub, address _zai, bytes32 _destinationL2, address _oftAdapter, uint32 _dstEid) external

receive

receive() external payable

deposit

function deposit(uint256 wad) external

Deposit assets (ZAI) in the external pool.

If the external pool requires a different amount to be passed in, the conversion should occur here as the Hub passes ZAI amounts. msg.sender must be the hub.

Parameters

Name Type Description
wad uint256

depositToBridge

function depositToBridge(uint256 wad) external payable

withdraw

function withdraw(uint256 wad) external

Withdraw assets (ZAI) from the external pool.

Any withdrawn amount will be held in the contract

Parameters

Name Type Description
wad uint256

preDebtChange

function preDebtChange() external

Some external pools require actions before debt changes

postDebtChange

function postDebtChange() external

Some external pools require actions after debt changes

assetBalance

function assetBalance() external view returns (uint256)

Balance of assets this pool "owns".

This could be greater than the amount the pool can withdraw due to lack of liquidity.

Return Values

Name Type Description
[0] uint256 uint256 number of assets in ZAI

maxDeposit

function maxDeposit() external pure returns (uint256)

Maximum number of assets the pool could deposit at present.

Return Values

Name Type Description
[0] uint256 uint256 number of assets in ZAI

maxWithdraw

function maxWithdraw() external view returns (uint256)

Maximum number of assets the pool could withdraw at present.

Return Values

Name Type Description
[0] uint256 uint256 number of assets in ZAI

redeemable

function redeemable() external view returns (address)

returns address of redeemable tokens (if any)

Clone this wiki locally