OCPBridge

OCPBridge

router

contract IOCPRouter router

gasLookup

mapping(uint16 => mapping(uint8 => uint256)) gasLookup

useLzToken

bool useLzToken

constructor

constructor(address _lzEndpoint) public

omniMint

function omniMint(uint16 _remoteChainId, address payable _refundAddress, uint8 _type, struct Structs.MintObj _mintParams, bytes _payload, struct Structs.LzTxObj _lzTxParams) external payable

_mint token on remote chain

Requirements:

  • onlyRouter

  • _remoteChainId must be valid

  • _refundAddress must be valid

  • _type must be valid

  • _lzTxParams must be valid

  • _payload must be valid

  • _mintParams must be valid

  • lzTxParams must be valid

Parameters

NameTypeDescription

_remoteChainId

uint16

remote chain id

_refundAddress

address payable

address to refund

_type

uint8

mint type

_mintParams

struct Structs.MintObj

mint params

_payload

bytes

user payload

_lzTxParams

struct Structs.LzTxObj

layer zero tx params

quoteLayerZeroFee

function quoteLayerZeroFee(uint16 _remoteChainId, uint8 _type, bytes _userPayload, struct Structs.LzTxObj _lzTxParams) external view returns (uint256, uint256)

_quote mint token on remote chain

quoteLayerZeroFee is a helper function to estimate the fees for minting a token on a remote chain.

_type is the type of minting operation to be performed on the remote chain.

If _type is TYPE_DEPLOY_AND_MINT, then _userPayload is the payload to be sent to the remote chain.

_userPayload is the payload to be sent to the remote chain.

Requirements:

  • _remoteChainId must be valid

  • _type must be valid

  • _lzTxParams must be valid

  • payload must be valid

Parameters

NameTypeDescription

_remoteChainId

uint16

remote chain id

_type

uint8

mint type

_userPayload

bytes

user payload

_lzTxParams

struct Structs.LzTxObj

layer zero tx params

_txParamBuilder

function _txParamBuilder(uint16 _chainId, uint8 _type, struct Structs.LzTxObj _lzTxParams) internal view returns (bytes)

_build tx params

gasLookup is a helper function to estimate the fees for minting a token on a remote chain.

_type is the type of minting operation to be performed on the remote chain.

If _type is TYPE_DEPLOY_AND_MINT, then _userPayload is the payload to be sent to the remote chain.

_userPayload is the payload to be sent to the remote chain.

Requirements:

  • _chainId must be valid

  • _type must be valid

  • lzTxParams must be valid

Parameters

NameTypeDescription

_chainId

uint16

remote chain id

_type

uint8

mint type

_lzTxParams

struct Structs.LzTxObj

layer zero tx params

Return Values

NameTypeDescription

[0]

bytes

lzTxParam layer zero tx params

_blockingLzReceive

function _blockingLzReceive(uint16 _srcChainId, bytes _srcAddress, uint64 _nonce, bytes _payload) internal virtual

_receive token from remote chain

If _type is TYPE_DEPLOY_AND_MINT, then _userPayload is the payload to be sent to the remote chain.

_userPayload is the payload to be sent to the remote chain.

If _type is TYPE_DEPLOY_AND_MINT, it will invoke omniMintRemote on the router contract.

Requirements:

  • onlyRouter

  • _srcChainId must be valid

  • _srcAddress must be valid

  • _nonce must be valid

  • payload must be valid

Parameters

NameTypeDescription

_srcChainId

uint16

remote chain id

_srcAddress

bytes

address to refund

_nonce

uint64

nonce

_payload

bytes

user payload

updateGasLookup

function updateGasLookup(uint16[] _chainIds, uint8[] _types, uint256[] _gas) external

_update gas lookup

updateGasLookup is a helper function to update the gas lookup table.

_chainIds is the chain ids to be updated.

_types is the types to be updated.

The length of _chainIds, _types and _gas must be the same.

Requirements:

  • onlyOwner

  • _chainIds, _types, gas must be valid

Parameters

NameTypeDescription

_chainIds

uint16[]

remote chain ids

_types

uint8[]

mint types

_gas

uint256[]

gas

updateRouter

function updateRouter(address _router) external

_update router

updateRouter is a helper function to update the router contract.

_router is the new router contract address.

Requirements:

  • onlyOwner

  • router must be valid

Parameters

NameTypeDescription

_router

address

router address