CrossChainTellerBase

Git Source

Inherits: TellerWithMultiAssetSupport

Base contract for the CrossChainTeller, includes functions to overload with specific bridge method

Functions

constructor

constructor(
    address _owner,
    address _vault,
    address _accountant
)
    TellerWithMultiAssetSupport(_owner, _vault, _accountant);

depositAndBridge

function to deposit into the vault AND bridge crosschain in 1 call

function depositAndBridge(
    ERC20 depositAsset,
    uint256 depositAmount,
    uint256 minimumMint,
    BridgeData calldata data
)
    external
    payable
    requiresAuth
    nonReentrant;

Parameters

previewFee

Preview fee required to bridge shares in a given feeToken.

function previewFee(uint256 shareAmount, BridgeData calldata data) external view returns (uint256 fee);

bridge

bridging code to be done without deposit, for users who already have vault tokens

function bridge(
    uint256 shareAmount,
    BridgeData calldata data
)
    public
    payable
    requiresAuth
    returns (bytes32 messageId);

Parameters

_bridge

the virtual bridge function to be overridden

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

Parameters

Returns

_quote

the virtual function to override to get bridge fees

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

Parameters

_beforeBridge

after bridge code, just an emit but can be overridden

the before bridge hook to perform additional checks

function _beforeBridge(BridgeData calldata data) internal virtual;

Parameters

_afterBridge

after bridge code, just an emit but can be overridden

function _afterBridge(uint256 shareAmount, BridgeData calldata data, bytes32 messageId) internal virtual;

Parameters

_beforeReceive

a before receive hook to call some logic before a receive is processed

function _beforeReceive() internal virtual;

_afterReceive

a hook to execute after receiving

function _afterReceive(uint256 shareAmount, address destinationChainReceiver, bytes32 messageId) internal virtual;

Parameters

Events

MessageSent

event MessageSent(bytes32 messageId, uint256 shareAmount, address to);

MessageReceived

event MessageReceived(bytes32 messageId, uint256 shareAmount, address to);