Skip to content

Commit 3555ced

Browse files
committed
clarify CAIP-10 format
1 parent 0d214da commit 3555ced

File tree

3 files changed

+18
-18
lines changed

3 files changed

+18
-18
lines changed

contracts/crosschain/axelar/AxelarGatewayDestination.sol

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import {IERC7786GatewayDestinationPassive, IERC7786Receiver} from "../interfaces
1010
import {AxelarGatewayBase} from "./AxelarGatewayBase.sol";
1111

1212
/**
13-
* @dev Implementation of an ERC7786 gateway destination adapter for the Axelar Network in dual mode.
13+
* @dev Implementation of an ERC-7786 gateway destination adapter for the Axelar Network in dual mode.
1414
*
1515
* The contract implements implements AxelarExecutable's {_execute} function to execute the message,
1616
* converting Axelar's native workflow into the standard ERC7786 active mode.
@@ -24,8 +24,8 @@ abstract contract AxelarGatewayDestination is IERC7786GatewayDestinationPassive,
2424
/// @dev Sets a message as executed so it can't be executed again. Should be called by the receiver contract.
2525
function setMessageExecuted(
2626
bytes calldata messageKey,
27-
string calldata source, // CAIP-2
28-
string calldata sender, // CAIP-10
27+
string calldata sourceChain, // CAIP-2 chain identifier
28+
string calldata sender, // CAIP-10 account address (does not include the chain identifier)
2929
bytes calldata payload,
3030
bytes[] calldata attributes
3131
) external {
@@ -44,8 +44,8 @@ abstract contract AxelarGatewayDestination is IERC7786GatewayDestinationPassive,
4444
require(
4545
gateway.validateContractCall(
4646
commandId,
47-
getEquivalentChain(source),
48-
getRemoteGateway(source),
47+
getEquivalentChain(sourceChain),
48+
getRemoteGateway(sourceChain),
4949
keccak256(adapterPayload)
5050
),
5151
NotApprovedByGateway()

contracts/crosschain/axelar/AxelarGatewaySource.sol

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@ abstract contract AxelarGatewaySource is IERC7786GatewaySource, AxelarGatewayBas
2424

2525
/// @inheritdoc IERC7786GatewaySource
2626
function sendMessage(
27-
string calldata destination, // CAIP-2 chain ID
28-
string calldata receiver, // i.e. address
27+
string calldata destinationChain, // CAIP-2 chain identifier
28+
string calldata receiver, // CAIP-10 account address (does not include the chain identifier)
2929
bytes calldata payload,
3030
bytes[] calldata attributes
3131
) external payable returns (bytes32) {
@@ -40,14 +40,14 @@ abstract contract AxelarGatewaySource is IERC7786GatewaySource, AxelarGatewayBas
4040
emit MessagePosted(
4141
0,
4242
CAIP10.format(CAIP2.local(), sender),
43-
CAIP10.format(destination, receiver),
43+
CAIP10.format(destinationChain, receiver),
4444
payload,
4545
attributes
4646
);
4747

4848
// Send the message
49-
string memory axelarDestination = getEquivalentChain(destination);
50-
string memory remoteGateway = getRemoteGateway(destination);
49+
string memory axelarDestination = getEquivalentChain(destinationChain);
50+
string memory remoteGateway = getRemoteGateway(destinationChain);
5151
localGateway.callContract(axelarDestination, remoteGateway, adapterPayload);
5252

5353
return 0;

contracts/crosschain/interfaces/draft-IERC7786.sol

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ interface IERC7786GatewaySource {
1414
*/
1515
event MessagePosted(
1616
bytes32 indexed outboxId,
17-
string sender, // CAIP-10 account ID
18-
string receiver, // CAIP-10 account ID
17+
string sender, // CAIP-10 account identifier (chain identifier + ":" + account address)
18+
string receiver, // CAIP-10 account identifier (chain identifier + ":" + account address)
1919
bytes payload,
2020
bytes[] attributes
2121
);
@@ -37,8 +37,8 @@ interface IERC7786GatewaySource {
3737
* Other errors SHOULD revert with errors not specified in ERC-7786.
3838
*/
3939
function sendMessage(
40-
string calldata destinationChain, // CAIP-2 chain ID
41-
string calldata receiver, // CAIP-10 account ID
40+
string calldata destinationChain, // CAIP-2 chain identifier
41+
string calldata receiver, // CAIP-10 account address (does not include the chain identifier)
4242
bytes calldata payload,
4343
bytes[] calldata attributes
4444
) external payable returns (bytes32 outboxId);
@@ -62,8 +62,8 @@ interface IERC7786GatewayDestinationPassive {
6262
*/
6363
function setMessageExecuted(
6464
bytes calldata messageKey,
65-
string calldata sourceChain,
66-
string calldata sender,
65+
string calldata sourceChain, // CAIP-2 chain identifier
66+
string calldata sender, // CAIP-10 account address (does not include the chain identifier)
6767
bytes calldata payload,
6868
bytes[] calldata attributes
6969
) external;
@@ -83,8 +83,8 @@ interface IERC7786Receiver {
8383
function executeMessage(
8484
address gateway,
8585
bytes calldata gatewayMessageKey,
86-
string calldata sourceChain,
87-
string calldata sender,
86+
string calldata sourceChain, // CAIP-2 chain identifier
87+
string calldata sender, // CAIP-10 account address (does not include the chain identifier)
8888
bytes calldata payload,
8989
bytes[] calldata attributes
9090
) external payable returns (bytes4);

0 commit comments

Comments
 (0)