IFastBridge

Git Source

Functions

bridge

Initiates bridge on origin chain to be relayed by off-chain relayer

function bridge(BridgeParams memory params) external payable;

Parameters

NameTypeDescription
paramsBridgeParamsThe parameters required to bridge

relay

Relays destination side of bridge transaction by off-chain relayer

function relay(bytes memory request) external payable;

Parameters

NameTypeDescription
requestbytesThe encoded bridge transaction to relay on destination chain

prove

Provides proof on origin side that relayer provided funds on destination side of bridge transaction

function prove(bytes memory request, bytes32 destTxHash) external;

Parameters

NameTypeDescription
requestbytesThe encoded bridge transaction to prove on origin chain
destTxHashbytes32The destination tx hash proving bridge transaction was relayed

claim

Completes bridge transaction on origin chain by claiming originally deposited capital

function claim(bytes memory request, address to) external;

Parameters

NameTypeDescription
requestbytesThe encoded bridge transaction to claim on origin chain
toaddressThe recipient address of the funds

dispute

Disputes an outstanding proof in case relayer provided dest chain tx is invalid

function dispute(bytes32 transactionId) external;

Parameters

NameTypeDescription
transactionIdbytes32The transaction id associated with the encoded bridge transaction to dispute

refund

Refunds an outstanding bridge transaction in case optimistic bridging failed

function refund(bytes memory request) external;

Parameters

NameTypeDescription
requestbytesThe encoded bridge transaction to refund

getBridgeTransaction

Decodes bridge request into a bridge transaction

function getBridgeTransaction(bytes memory request) external pure returns (BridgeTransaction memory);

Parameters

NameTypeDescription
requestbytesThe bridge request to decode

canClaim

Checks if the dispute period has passed so bridge deposit can be claimed

function canClaim(bytes32 transactionId, address relayer) external view returns (bool);

Parameters

NameTypeDescription
transactionIdbytes32The transaction id associated with the encoded bridge transaction to check
relayeraddressThe address of the relayer attempting to claim

Events

BridgeRequested

event BridgeRequested(
    bytes32 indexed transactionId,
    address indexed sender,
    bytes request,
    uint32 destChainId,
    address originToken,
    address destToken,
    uint256 originAmount,
    uint256 destAmount,
    bool sendChainGas
);

BridgeRelayed

event BridgeRelayed(
    bytes32 indexed transactionId,
    address indexed relayer,
    address indexed to,
    uint32 originChainId,
    address originToken,
    address destToken,
    uint256 originAmount,
    uint256 destAmount,
    uint256 chainGasAmount
);

BridgeProofProvided

event BridgeProofProvided(bytes32 indexed transactionId, address indexed relayer, bytes32 transactionHash);

BridgeProofDisputed

event BridgeProofDisputed(bytes32 indexed transactionId, address indexed relayer);

BridgeDepositClaimed

event BridgeDepositClaimed(
    bytes32 indexed transactionId, address indexed relayer, address indexed to, address token, uint256 amount
);

BridgeDepositRefunded

event BridgeDepositRefunded(bytes32 indexed transactionId, address indexed to, address token, uint256 amount);

Structs

BridgeTransaction

struct BridgeTransaction {
    uint32 originChainId;
    uint32 destChainId;
    address originSender;
    address destRecipient;
    address originToken;
    address destToken;
    uint256 originAmount;
    uint256 destAmount;
    uint256 originFeeAmount;
    bool sendChainGas;
    uint256 deadline;
    uint256 nonce;
}

BridgeProof

struct BridgeProof {
    uint96 timestamp;
    address relayer;
}

BridgeParams

struct BridgeParams {
    uint32 dstChainId;
    address sender;
    address to;
    address originToken;
    address destToken;
    uint256 originAmount;
    uint256 destAmount;
    bool sendChainGas;
    uint256 deadline;
}