IFastBridge
Functions
bridge
Initiates bridge on origin chain to be relayed by off-chain relayer
function bridge(BridgeParams memory params) external payable;
Parameters
Name | Type | Description |
---|---|---|
params | BridgeParams | The parameters required to bridge |
relay
Relays destination side of bridge transaction by off-chain relayer
function relay(bytes memory request) external payable;
Parameters
Name | Type | Description |
---|---|---|
request | bytes | The 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
Name | Type | Description |
---|---|---|
request | bytes | The encoded bridge transaction to prove on origin chain |
destTxHash | bytes32 | The 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
Name | Type | Description |
---|---|---|
request | bytes | The encoded bridge transaction to claim on origin chain |
to | address | The 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
Name | Type | Description |
---|---|---|
transactionId | bytes32 | The 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
Name | Type | Description |
---|---|---|
request | bytes | The encoded bridge transaction to refund |
getBridgeTransaction
Decodes bridge request into a bridge transaction
function getBridgeTransaction(bytes memory request) external pure returns (BridgeTransaction memory);
Parameters
Name | Type | Description |
---|---|---|
request | bytes | The 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
Name | Type | Description |
---|---|---|
transactionId | bytes32 | The transaction id associated with the encoded bridge transaction to check |
relayer | address | The 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;
}