IFastBridgeV2
Inherits: IFastBridge
Functions
bridgeV2
Initiates bridge on origin chain to be relayed by off-chain relayer, with the ability to provide temporary exclusivity fill rights for the quote relayer.
function bridgeV2(BridgeParams memory params, BridgeParamsV2 memory paramsV2) external payable;
Parameters
Name | Type | Description |
---|---|---|
params | BridgeParams | The parameters required to bridge |
paramsV2 | BridgeParamsV2 | The parameters for exclusivity fill rights (optional, can be left empty) |
relayV2
Relays destination side of bridge transaction by off-chain relayer
function relayV2(bytes memory request, address relayer) external payable;
Parameters
Name | Type | Description |
---|---|---|
request | bytes | The encoded bridge transaction to relay on destination chain |
relayer | address | The address of the relaying entity which should have control of the origin funds when claimed |
proveV2
Provides proof on origin side that relayer provided funds on destination side of bridge transaction
function proveV2(bytes32 transactionId, bytes32 destTxHash, address relayer) external;
Parameters
Name | Type | Description |
---|---|---|
transactionId | bytes32 | The transaction id associated with the encoded bridge transaction to prove |
destTxHash | bytes32 | The destination tx hash proving bridge transaction was relayed |
relayer | address | The address of the relaying entity which should have control of the origin funds when claimed |
claimV2
Completes bridge transaction on origin chain by claiming originally deposited capital.
Can only send funds to the relayer address on the proof.
function claimV2(bytes memory request) external;
Parameters
Name | Type | Description |
---|---|---|
request | bytes | The encoded bridge transaction to claim on origin chain |
cancelV2
Cancels an outstanding bridge transaction in case optimistic bridging failed and returns the full amount to the original sender.
function cancelV2(bytes memory request) external;
Parameters
Name | Type | Description |
---|---|---|
request | bytes | The encoded bridge transaction to refund |
bridgeRelays
Checks if a transaction has been relayed
function bridgeRelays(bytes32 transactionId) external view returns (bool);
Parameters
Name | Type | Description |
---|---|---|
transactionId | bytes32 | The ID of the transaction to check |
Returns
Name | Type | Description |
---|---|---|
<none> | bool | True if the transaction has been relayed, false otherwise |
bridgeStatuses
Returns the status of a bridge transaction
function bridgeStatuses(bytes32 transactionId) external view returns (BridgeStatus);
Parameters
Name | Type | Description |
---|---|---|
transactionId | bytes32 | The ID of the bridge transaction |
Returns
Name | Type | Description |
---|---|---|
<none> | BridgeStatus | BridgeStatus Status of the bridge transaction |
bridgeProofs
Returns the timestamp and relayer of a bridge proof
function bridgeProofs(bytes32 transactionId) external view returns (uint96 timestamp, address relayer);
Parameters
Name | Type | Description |
---|---|---|
transactionId | bytes32 | The ID of the bridge transaction |
Returns
Name | Type | Description |
---|---|---|
timestamp | uint96 | The timestamp of the bridge proof |
relayer | address | The relayer address of the bridge proof |
getBridgeTransactionV2
Decodes bridge request into a bridge transaction V2 struct used by FastBridgeV2
function getBridgeTransactionV2(bytes memory request) external view returns (BridgeTransactionV2 memory);
Parameters
Name | Type | Description |
---|---|---|
request | bytes | The bridge request to decode |
Events
BridgeQuoteDetails
event BridgeQuoteDetails(bytes32 indexed transactionId, bytes quoteId);
Structs
BridgeTxDetails
struct BridgeTxDetails {
BridgeStatus status;
uint32 destChainId;
uint16 proverID;
uint40 proofBlockTimestamp;
address proofRelayer;
}
BridgeRelay
struct BridgeRelay {
uint48 blockNumber;
uint48 blockTimestamp;
address relayer;
}
BridgeParamsV2
New params introduced in the FastBridgeV2. We are passing fields from the older BridgeParams struct outside of this struct for backwards compatibility. Note: quoteRelayer and quoteExclusivitySeconds are either both zero (indicating no exclusivity) or both non-zero (indicating exclusivity for the given period). Note: zapNative > 0 can NOT be used with destToken = 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE (native token)
struct BridgeParamsV2 {
address quoteRelayer;
int256 quoteExclusivitySeconds;
bytes quoteId;
uint256 zapNative;
bytes zapData;
}
BridgeTransactionV2
Updated bridge transaction struct to include parameters introduced in FastBridgeV2.
Note: only exclusivityRelayer
can fill such a transaction until exclusivityEndTime
.
struct BridgeTransactionV2 {
uint32 originChainId;
uint32 destChainId;
address originSender;
address destRecipient;
address originToken;
address destToken;
uint256 originAmount;
uint256 destAmount;
uint256 originFeeAmount;
uint256 deadline;
uint256 nonce;
address exclusivityRelayer;
uint256 exclusivityEndTime;
uint256 zapNative;
bytes zapData;
}
Enums
BridgeStatus
enum BridgeStatus {
NULL,
REQUESTED,
RELAYER_PROVED,
RELAYER_CLAIMED,
REFUNDED
}