GlobalVariables

LayerZero(Cross Chain) transactions like data transfers and token transfers are performed in this contract.

Write Functions

send

function send(
    FunctionToDo functionToDo,
    IBorrowing.AssetName assetName,
    MessagingFee memory fee,
    bytes memory options,
    address refundAddress
) external payable
enum FunctionToDo {
    DUMMY,
    UPDATE_GLOBAL,
    UPDATE_INDIVIDUAL,
    TOKEN_TRANSFER,
    COLLATERAL_TRANSFER,
    BOTH_TRANSFER
}

struct MessagingFee {
    uint256 nativeFee;
    uint256 lzTokenFee;
}
Param Name
Param Type
Description

functionToDo

enum FunctionToDo

What function needs to be done in destination chain.

assetName

Collateral type to update the amount of collaterals.

fee

struct MessagingFee

Native fee needs to pay for LZ transaction.

options

bytes

Gas limit.

refundAddress

address

Address where the remaining native fee should be sent.

msg.value

uint256

Native fee.

Send the LZ transaction to do the specified function in the destination chain.

sendForLiquidation

function sendForLiquidation(
    FunctionToDo functionToDo,
    uint128 liqIndex,
    CDSInterface.LiquidationInfo memory liquidationInfo,
    IBorrowing.AssetName assetName,
    MessagingFee memory fee,
    bytes memory options,
    address refundAddress
) external payable
Param Name
Param Type
Description

functionToDo

FunctionToDo

What function needs to be done in destination chain.

liqIndex

uint128

Liquidation index to map to the data.

liquidtionInfo

LiquidationInfo

Liquidation Info to store.

assetName

AssetName

Liquidated asset.

fee

MessagingFee

Native fee for lz send.

options

bytes

Gas limit.

refundAddress

address

Address where the remaining native fee should be sent.

msg.value

uint256

Native fee.

Send the LZ transaction to do the specified function in the destination chain.

oftOrCollateralReceiveFromOtherChains

function oftOrCollateralReceiveFromOtherChains(
    FunctionToDo functionToDo,
    USDaOftTransferData memory oftTransferData,
    CollateralTokenTransferData memory collateralTokenTransferData,
    CallingFunction callingFunction,
    address refundAddress
) external payable
Param Name
Param Type
Description

functionToDo

FunctionToDo

What function needs to be done in destination chain.

oftTransferData

USDaOftTransferData

Details contains receiver address and amount of USDa to get.

collateralTokenTransferData

CollateralTokenTransferData

Details contains receiver address and amount of Collateral to get.

callingFunction

CallingFunction

Which function is calling this function.

refundAddress

address

Address where the remaining native fee should be sent.

Gets the required USDa or Collateral from destination chain.

_lzReceive

function _lzReceive(
    Origin calldata /*_origin*/,
    bytes32 /*_guid*/,
    bytes calldata payload,
    address /*_executor*/,
    bytes calldata /*_extraData*/
) internal override {
Param Name
Param Type
Description

payload

bytes calldata

payload data received from source chain

Performs the function mentioned in payload.

Setter Functions

setDstEid

function setDstEid(uint32 eid)

Sets the destination endpoint id for the contract.

setTreasury

function setTreasury(address _treasury)

Sets the treasury contract interface.

setOmniChainData

function setOmniChainData(OmniChainData memory _omniChainData)

Updates the omnichain data to be stored in other chain.

setBorrowing

function setBorrowing(address _borrow)

Sets the borrowing contract instance.

setBorrowLiq

function setBorrowLiq(address _borrowLiq)

Sets the borrow liquidation contract address.

setDstGlobalVariablesAddress

function setDstGlobalVariablesAddress(
    address _globalVariables
)

Sets the destination chain global variables contract address.

Read Functions

quote

function quote(
    FunctionToDo functionToDo,
    IBorrowing.AssetName assetName,
    bytes memory options,
    bool payInLzToken
)
Param Name
Param Type
Description

functionToDo

FunctionToDo

What function needs to be done in destination chain.

assetName

AssetName

Collateral type to update the amount of collaterals.

options

bytes

Gas value

payInLzToken

bool

Whether the fee is paying in lzToken

Returns the native fee needs to be pay for the lz send transaction.

Last updated