Skip to content

Commit 15052bc

Browse files
authored
created unified interface for crosschain transactions (#169)
* created unified interface for crosschain transactions * added interface functionality for setter and getter of bridge * Update implementation - implemented `sendCrossChainPayloadWithToken` - implemented `sendCrossChainPayload` - implemented `setRouter` - implemented `getRouter` - implemented `onMessageSent` - implemented `onMessageReceived` * updated to unify to just one * FIX: PR updates
1 parent a2663bf commit 15052bc

File tree

2 files changed

+52
-3
lines changed

2 files changed

+52
-3
lines changed

.vscode/settings.json

Lines changed: 0 additions & 3 deletions
This file was deleted.

src/interface/ICrosschain.sol

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
// SPDX-License-Identifier: Apache-2.0
2+
pragma solidity ^0.8.20;
3+
4+
interface ICrosschain {
5+
6+
/**
7+
* @notice Sends a cross-chain transaction.
8+
* @param _destinationChain The destination chain ID.
9+
* @param _callAddress The address of the contract on the destination chain.
10+
* @param _payload The payload to send to the destination chain.
11+
* @param _extraArgs The extra arguments to pass
12+
* @dev extraArgs may contain items such as token, amount, feeTokenAddress, receipient, gasLimit, etc
13+
*/
14+
function sendCrossChainTransaction(
15+
uint64 _destinationChain,
16+
address _callAddress,
17+
bytes calldata _payload,
18+
bytes calldata _extraArgs
19+
) external payable;
20+
21+
/**
22+
* @notice callback function for when a cross-chain transaction is sent.
23+
* @param _destinationChain The destination chain ID.
24+
* @param _callAddress The address of the contract on the destination chain.
25+
* @param _payload The payload sent to the destination chain.
26+
* @param _extraArgs The extra arguments sent to the callAddress on the destination chain.
27+
*/
28+
function onCrossChainTransactionSent(
29+
uint64 _destinationChain,
30+
address _callAddress,
31+
bytes calldata _payload,
32+
bytes calldata _extraArgs
33+
) internal;
34+
35+
/**
36+
* @notice callback function for when a cross-chain transaction is received.
37+
* @param _sourceChain The source chain ID.
38+
* @param _sourceAddress The address of the contract on the source chain.
39+
* @param _payload The payload sent to the destination chain.
40+
* @param _extraArgs The extra arguments sent to the callAddress on the destination chain.
41+
*/
42+
function onCrossChainTransactionReceived(
43+
uint64 _sourceChain,
44+
address _sourceAddress,
45+
bytes calldata _payload,
46+
bytes calldata _extraArgs
47+
) internal;
48+
49+
function setRouter(address _router) external;
50+
function getRouter() external view returns (address);
51+
52+
}

0 commit comments

Comments
 (0)