Skip to content

Commit 86a9e05

Browse files
committed
Merge branch 'master' into feature/erc7802bridge-v2
2 parents 31f25b9 + 70653e2 commit 86a9e05

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

docs/modules/ROOT/pages/crosschain.adoc

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@ To address the lack of composability in a simple and unopinionated way, ERC-7786
1414

1515
The ERC defines a source and a destination gateway. Both are contracts that implement a protocol to send a message and process its reception respectively. These two processes are identified explicitly by the ERC-7786 specification since they define the minimal requirements for both gateways.
1616

17-
* On the **source chain**, the contract implements a standard xref:api:crosschain.adoc#AxelarGatewaySource-sendMessage-string-string-bytes-bytes---[`sendMessage`] function and emits a xref:api:crosschain.adoc#AxelarGatewaySource-MessagePosted-bytes32-string-string-bytes-bytes---[`MessagePosted`] event to signal that the message should be relayed by the underlying protocol.
17+
* On the **source chain**, the contract implements a standard xref:api:crosschain.adoc#AxelarGatewaySource-sendMessage-bytes-bytes-bytes---[`sendMessage`] function and emits a xref:api:crosschain.adoc#AxelarGatewaySource-MessageSent-bytes32-string-string-bytes-bytes---[`MessageSent`] event to signal that the message should be relayed by the underlying protocol.
1818

19-
* On the **destination chain**, the gateway receives the message and passes it to the receiver contract by calling the xref:api:crosschain.adoc#ERC7786Receiver-executeMessage-string-string-string-bytes-bytes---[`executeMessage`] function.
19+
* On the **destination chain**, the gateway receives the message and passes it to the receiver contract by calling the xref:api:crosschain.adoc#ERC7786Receiver-receiveMessage-bytes32-bytes-bytes-[`receiveMessage`] function.
2020

2121
Smart contract developers only need to worry about implementing the xref:api:crosschain.adoc#IERC7786GatewaySource[IERC7786GatewaySource] interface to send a message on the source chain and the xref:api:crosschain.adoc#IERC7786GatewaySource[IERC7786GatewaySource] and xref:api:crosschain.adoc#IERC7786Receiver[IERC7786Receiver] interface to receive such message on the destination chain.
2222

@@ -37,7 +37,7 @@ NOTE: Developers can register supported chains and destination gateways using th
3737

3838
=== Sending a message
3939

40-
The interface for a source gateway is general enough that it allows wrapping a custom protocol to authenticate messages. Depending on the use case, developers can implement any offchain mechanism to read the standard xref:api:crosschain.adoc#IERC7786GatewaySource-MessagePosted-bytes32-string-string-bytes-bytes---[`MessagePosted`] event and deliver it to the receiver on the destination chain.
40+
The interface for a source gateway is general enough that it allows wrapping a custom protocol to authenticate messages. Depending on the use case, developers can implement any offchain mechanism to read the standard xref:api:crosschain.adoc#IERC7786GatewaySource-MessageSent-bytes32-string-string-bytes-bytes---[`MessageSent`] event and deliver it to the receiver on the destination chain.
4141

4242
[source,solidity]
4343
----
@@ -48,9 +48,9 @@ NOTE: The standard represents chains using https://github.com/ChainAgnostic/CAIP
4848

4949
=== Receiving a message
5050

51-
To successfully process a message on the destination chain, a destination gateway is required. Although ERC-7786 doesn't define a standard interface for the destination gateway, it requires that it calls the `executeMessage` upon message reception.
51+
To successfully process a message on the destination chain, a destination gateway is required. Although ERC-7786 doesn't define a standard interface for the destination gateway, it requires that it calls the `receiveMessage` upon message reception.
5252

53-
Every cross-chain message protocol already offers a way to receive the message either through a canonical bridge or an intermediate contract. Developers can easily wrap the receiving contract into a gateway that calls the `executeMessage` function as mandated by the ERC.
53+
Every cross-chain message protocol already offers a way to receive the message either through a canonical bridge or an intermediate contract. Developers can easily wrap the receiving contract into a gateway that calls the `receiveMessage` function as mandated by the ERC.
5454

5555
To receive a message on a custom smart contract, OpenZeppelin Community Contracts provide an xref:api:crosschain.adoc#ERC7786Receiver[ERC7786Receiver] implementation for developers to inherit. This way your contracts can receive a cross-chain message relayed through a known destination gateway gateway.
5656

@@ -125,10 +125,10 @@ function sendMessage(
125125
}
126126
```
127127

128-
On the receiving end, the bridge implements a threshold-based confirmation system. Messages are only executed after receiving enough confirmations from the gateways, ensuring message validity and preventing double execution. The xref:api:crosschain.adoc#ERC7786OpenBridge-executeMessage-string-string-string-bytes-bytes---[`executeMessage`] function handles this process:
128+
On the receiving end, the bridge implements a threshold-based confirmation system. Messages are only executed after receiving enough confirmations from the gateways, ensuring message validity and preventing double execution. The xref:api:crosschain.adoc#ERC7786OpenBridge-receiveMessage-string-string-string-bytes-bytes---[`receiveMessage`] function handles this process:
129129

130130
```solidity
131-
function executeMessage(
131+
function receiveMessage(
132132
string calldata /*messageId*/, // gateway specific, empty or unique
133133
string calldata sourceChain, // CAIP-2 chain identifier
134134
string calldata sender, // CAIP-10 account address (does not include the chain identifier)
@@ -146,7 +146,7 @@ function executeMessage(
146146
emit Received(id, msg.sender);
147147

148148
// if already executed, leave gracefully
149-
if (tracker.executed) return IERC7786Receiver.executeMessage.selector;
149+
if (tracker.executed) return IERC7786Receiver.receiveMessage.selector;
150150
} else if (tracker.executed) {
151151
revert ERC7786OpenBridgeAlreadyExecuted();
152152
}
@@ -160,7 +160,7 @@ function executeMessage(
160160

161161
// ... Prepare execution context and validate state ...
162162
bytes memory call = abi.encodeCall(
163-
IERC7786Receiver.executeMessage,
163+
IERC7786Receiver.receiveMessage,
164164
(uint256(id).toHexString(32), sourceChain, originalSender, unwrappedPayload, attributes)
165165
);
166166

@@ -169,7 +169,7 @@ function executeMessage(
169169
// ... Handle the result ...
170170
}
171171

172-
return IERC7786Receiver.executeMessage.selector;
172+
return IERC7786Receiver.receiveMessage.selector;
173173
}
174174
```
175175

0 commit comments

Comments
 (0)