You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The [`awk`](https://www.tutorialspoint.com/awk/index.htm) command looks for the line that has `Deployed to:` and writes the third word in that line, which is the address.
175
+
The [`awk`](https://www.tutorialspoint.com/awk/index.htm) command looks for the line that has `Deployed to:` and writes the third word in that line, which is the address.
176
176
177
-
```sh
178
-
awk '/Deployed to:/ {print $3}'
179
-
```
177
+
```sh
178
+
awk '/Deployed to:/ {print $3}'
179
+
```
180
180
181
-
Finally, in UNIX (including Linux and macOS) the when the command line includes backticks (\`\`\`), the shell executes the code between the backticks and puts the output, in this case the contract address, in the command.
182
-
So we get.
181
+
Finally, in UNIX (including Linux and macOS) the when the command line includes backticks (\`\`\`), the shell executes the code between the backticks and puts the output, in this case the contract address, in the command.
182
+
So we get.
183
183
184
-
```sh
185
-
GREETER_B_ADDR=<the address>
186
-
```
187
-
</details>
184
+
```sh
185
+
GREETER_B_ADDR=<the address>
186
+
```
187
+
</details>
188
188
189
-
<details>
190
-
<summary>Sanity check</summary>
189
+
<details>
190
+
<summary>Sanity check</summary>
191
191
192
-
Run these commands to verify the contract works.
193
-
The first and third commands retrieve the current greeting, while the second command updates it.
192
+
Run these commands to verify the contract works.
193
+
The first and third commands retrieve the current greeting, while the second command updates it.
This function encodes a call to `setGreeting` and sends it to a contract on another chain.
232
-
`abi.encodeCall(Greeter.setGreeting, (greeting))` constructs the [calldata](https://docs.soliditylang.org/en/latest/internals/layout_in_calldata.html) by encoding the function selector and parameters.
233
-
The encoded message is then passed to `messenger.sendMessage`, which forwards it to the destination contract (`greeterAddress`) on the specified chain (`greeterChainId`).
231
+
This function encodes a call to `setGreeting` and sends it to a contract on another chain.
232
+
`abi.encodeCall(Greeter.setGreeting, (greeting))` constructs the [calldata](https://docs.soliditylang.org/en/latest/internals/layout_in_calldata.html) by encoding the function selector and parameters.
233
+
The encoded message is then passed to `messenger.sendMessage`, which forwards it to the destination contract (`greeterAddress`) on the specified chain (`greeterChainId`).
234
234
235
-
This ensures that `setGreeting` is executed remotely with the provided `greeting` value (as long as there is an executing message to relay it).
236
-
</details>
235
+
This ensures that `setGreeting` is executed remotely with the provided `greeting` value (as long as there is an executing message to relay it).
236
+
</details>
237
237
238
238
7. Deploy `GreetingSender` to chain A.
239
239
@@ -315,19 +315,19 @@ In this section we change `Greeter.sol` to emit a separate event in it receives
315
315
}
316
316
```
317
317
318
-
<details>
319
-
<summary>Explanation</summary>
318
+
<details>
319
+
<summary>Explanation</summary>
320
320
321
-
```solidity
322
-
if (msg.sender == Predeploys.L2_TO_L2_CROSS_DOMAIN_MESSENGER) {
If we see that we got a message from `L2ToL2CrossDomainMessenger`, we call [`L2ToL2CrossDomainMessenger.crossDomainMessageContext`](https://github.com/ethereum-optimism/optimism/blob/develop/packages/contracts-bedrock/src/L2/L2ToL2CrossDomainMessenger.sol#L118-L126).
330
-
</details>
329
+
If we see that we got a message from `L2ToL2CrossDomainMessenger`, we call [`L2ToL2CrossDomainMessenger.crossDomainMessageContext`](https://github.com/ethereum-optimism/optimism/blob/develop/packages/contracts-bedrock/src/L2/L2ToL2CrossDomainMessenger.sol#L118-L126).
330
+
</details>
331
331
332
332
2. Redeploy the contracts.
333
333
Because the address of `Greeter` is immutable in `GreetingSender`, we need to redeploy both contracts.
@@ -497,36 +497,36 @@ In production we will not have this, we need to create our own executing message
In addition to extending the wallets with [Viem public actions](https://viem.sh/docs/accounts/local#5-optional-extend-with-public-actions), extend with the OP-Stack actions, both the public ones and the ones that require an account.
511
+
In addition to extending the wallets with [Viem public actions](https://viem.sh/docs/accounts/local#5-optional-extend-with-public-actions), extend with the OP-Stack actions, both the public ones and the ones that require an account.
0 commit comments