CrossChainOPTellerWithMultiAssetSupport

Git Source

Inherits: CrossChainTellerBase

LayerZero implementation of CrossChainTeller

State Variables

messenger

ICrossDomainMessenger public immutable messenger;

peer

address public peer;

maxMessageGas

uint32 public maxMessageGas;

minMessageGas

uint32 public minMessageGas;

nonce

uint128 public nonce;

Functions

constructor

constructor(
    address _owner,
    address _vault,
    address _accountant,
    address _messenger
)
    CrossChainTellerBase(_owner, _vault, _accountant);

setPeer

Callable by OWNER_ROLE.

function setPeer(address _peer) external requiresAuth;

Parameters

NameTypeDescription

_peer

address

new peer to set

setGasBounds

Callable by OWNER_ROLE.

function setGasBounds(uint32 newMinMessageGas, uint32 newMaxMessageGas) external requiresAuth;

Parameters

NameTypeDescription

newMinMessageGas

uint32

the new minMessageGas bound

newMaxMessageGas

uint32

the new maxMessageGas bound

receiveBridgeMessage

Function for OP Messenger to call to receive a message and mint the shares on this chain

function receiveBridgeMessage(address receiver, uint256 shareMintAmount, bytes32 messageId) external;

Parameters

NameTypeDescription

receiver

address

to receive the shares

shareMintAmount

uint256

amount of shares to mint

messageId

bytes32

_bridge

the virtual bridge function to execute Optimism messenger sendMessage()

function _bridge(uint256 shareAmount, BridgeData calldata data) internal override returns (bytes32 messageId);

Parameters

NameTypeDescription

shareAmount

uint256

data

BridgeData

bridge data

Returns

NameTypeDescription

messageId

bytes32

messageId

_beforeBridge

before bridge hook to check gas bound and revert if someone's paying a fee

function _beforeBridge(BridgeData calldata data) internal override;

Parameters

NameTypeDescription

data

BridgeData

bridge data

_quote

the virtual function to override to get bridge fees, always zero for OP

function _quote(uint256 shareAmount, BridgeData calldata data) internal view override returns (uint256);

Parameters

NameTypeDescription

shareAmount

uint256

to send

data

BridgeData

bridge data

Errors

CrossChainOPTellerWithMultiAssetSupport_OnlyMessenger

error CrossChainOPTellerWithMultiAssetSupport_OnlyMessenger();

CrossChainOPTellerWithMultiAssetSupport_OnlyPeerAsSender

error CrossChainOPTellerWithMultiAssetSupport_OnlyPeerAsSender();

CrossChainOPTellerWithMultiAssetSupport_NoFee

error CrossChainOPTellerWithMultiAssetSupport_NoFee();

CrossChainOPTellerWithMultiAssetSupport_GasOutOfBounds

error CrossChainOPTellerWithMultiAssetSupport_GasOutOfBounds(uint32);