Skip to content

Commit

Permalink
deploy: b9be2fd
Browse files Browse the repository at this point in the history
  • Loading branch information
tremarkley committed Oct 17, 2024
1 parent 4125a67 commit ff8d82f
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 18 deletions.
4 changes: 2 additions & 2 deletions guides/interop/manually-relaying-interop-messages-cast.html
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,7 @@ <h3 id="2-mint-tokens-to-transfer-on-chain-901"><a class="header" href="#2-mint-
</code></pre>
<h3 id="3-initiate-the-send-transaction-on-chain-901"><a class="header" href="#3-initiate-the-send-transaction-on-chain-901">3. Initiate the send transaction on chain 901</a></h3>
<p>Send the tokens from Chain 901 to Chain 902 using the following command:</p>
<pre><code class="language-sh">cast send 0x420beeF000000000000000000000000000000001 "sendERC20(address _to, uint256 _amount, uint256 _chainId)" 0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266 1000 902 --rpc-url http://127.0.0.1:9545 --private-key 0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80
<pre><code class="language-sh">cast send 0x4200000000000000000000000000000000000028 "sendERC20(address _token, address _to, uint256 _amount, uint256 _chainId)" 0x420beeF000000000000000000000000000000001 0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266 1000 902 --rpc-url http://127.0.0.1:9545 --private-key 0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80
</code></pre>
<h3 id="4-get-the-log-emitted-by-the-l2tol2crossdomainmessenger"><a class="header" href="#4-get-the-log-emitted-by-the-l2tol2crossdomainmessenger">4. Get the log emitted by the <code>L2ToL2CrossDomainMessenger</code></a></h3>
<p>The token contract calls the <a href="https://github.com/ethereum-optimism/optimism/blob/92ed64e171c6eb9c6a080c626640e8836f0653cc/packages/contracts-bedrock/src/L2/L2ToL2CrossDomainMessenger.sol">L2ToL2CrossDomainMessenger</a>, which emits a message (log) that can be relayed on the destination chain.</p>
Expand Down Expand Up @@ -322,7 +322,7 @@ <h3 id="7-send-the-relaymessage-transaction"><a class="header" href="#7-send-the
<li><code>bytes memory _sentMessage</code>: encoding of the log topics &amp; data</li>
</ul>
<p>Below is an example call, but make sure to replace them with the correct values you received in previous steps.</p>
<pre><code class="language-sh">$ cast send 0x4200000000000000000000000000000000000023 \
<pre><code class="language-sh">$ cast send 0x4200000000000000000000000000000000000023 --gas-limit 200000 \
"relayMessage((address, uint256, uint256, uint256, uint256), bytes)" \
"(0x4200000000000000000000000000000000000023, 4, 1, 1728507703, 901)" \
0x382409ac69001e11931a28435afef442cbfd20d9891907e8fa373ba7d351f3200000000000000000000000000000000000000000000000000000000000000386000000000000000000000000420beef0000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000420beef00000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000064d9f50046000000000000000000000000f39fd6e51aad88f6f4ce6ab8827279cfffb92266000000000000000000000000f39fd6e51aad88f6f4ce6ab8827279cfffb9226600000000000000000000000000000000000000000000000000000000000003e800000000000000000000000000000000000000000000000000000000 \
Expand Down
13 changes: 7 additions & 6 deletions guides/interop/relay-using-viem.html
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,7 @@ <h3 id="3-imports--setup"><a class="header" href="#3-imports--setup">3. Imports

// SuperERC20 is in development so we manually define the address here
const L2_NATIVE_SUPERCHAINERC20_ADDRESS = "0x420beeF000000000000000000000000000000001";
const SUPERCHAIN_TOKEN_BRIDGE_ADDRESS = "0x4200000000000000000000000000000000000028";

// Account for 0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266
const account = privateKeyToAccount("0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80");
Expand Down Expand Up @@ -266,12 +267,12 @@ <h3 id="4-mint-and-bridge-l2nativesuperchainerc20-from-source-chain"><a class="h

console.log("Initiating sendERC20 on OPChainA to OPChainB...");
const sendERC20TxHash = await opChainAClient.writeContract({
address: L2_NATIVE_SUPERCHAINERC20_ADDRESS,
address: SUPERCHAIN_TOKEN_BRIDGE_ADDRESS,
abi: parseAbi([
"function sendERC20(address _to, uint256 _amount, uint256 _chainId)",
"function sendERC20(address _token, address _to, uint256 _amount, uint256 _chainId)",
]),
functionName: "sendERC20",
args: [account.address, 1000n, BigInt(supersimL2B.id)],
args: [L2_NATIVE_SUPERCHAINERC20_ADDRESS, account.address, 1000n, BigInt(supersimL2B.id)],
});

const sendERC20Receipt = await opChainAClient.waitForTransactionReceipt({ hash: sendERC20TxHash });
Expand Down Expand Up @@ -384,12 +385,12 @@ <h2 id="full-code-snippet"><a class="header" href="#full-code-snippet">Full code

console.log("Initiating sendERC20 on OPChainA...");
const sendERC20TxHash = await opChainAClient.writeContract({
address: L2_NATIVE_SUPERCHAINERC20_ADDRESS,
address: SUPERCHAIN_TOKEN_BRIDGE_ADDRESS,
abi: parseAbi([
"function sendERC20(address _to, uint256 _amount, uint256 _chainId)",
"function sendERC20(address _token, address _to, uint256 _amount, uint256 _chainId)",
]),
functionName: "sendERC20",
args: [account.address, 1000n, BigInt(supersimL2B.id)],
args: [L2_NATIVE_SUPERCHAINERC20_ADDRESS, account.address, 1000n, BigInt(supersimL2B.id)],
});

const sendERC20Receipt = await opChainAClient.waitForTransactionReceipt({ hash: sendERC20TxHash });
Expand Down
17 changes: 9 additions & 8 deletions print.html
Original file line number Diff line number Diff line change
Expand Up @@ -728,6 +728,7 @@ <h3 id="3-imports--setup"><a class="header" href="#3-imports--setup">3. Imports

// SuperERC20 is in development so we manually define the address here
const L2_NATIVE_SUPERCHAINERC20_ADDRESS = "0x420beeF000000000000000000000000000000001";
const SUPERCHAIN_TOKEN_BRIDGE_ADDRESS = "0x4200000000000000000000000000000000000028";

// Account for 0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266
const account = privateKeyToAccount("0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80");
Expand Down Expand Up @@ -772,12 +773,12 @@ <h3 id="4-mint-and-bridge-l2nativesuperchainerc20-from-source-chain"><a class="h

console.log("Initiating sendERC20 on OPChainA to OPChainB...");
const sendERC20TxHash = await opChainAClient.writeContract({
address: L2_NATIVE_SUPERCHAINERC20_ADDRESS,
address: SUPERCHAIN_TOKEN_BRIDGE_ADDRESS,
abi: parseAbi([
"function sendERC20(address _to, uint256 _amount, uint256 _chainId)",
"function sendERC20(address _token, address _to, uint256 _amount, uint256 _chainId)",
]),
functionName: "sendERC20",
args: [account.address, 1000n, BigInt(supersimL2B.id)],
args: [L2_NATIVE_SUPERCHAINERC20_ADDRESS, account.address, 1000n, BigInt(supersimL2B.id)],
});

const sendERC20Receipt = await opChainAClient.waitForTransactionReceipt({ hash: sendERC20TxHash });
Expand Down Expand Up @@ -890,12 +891,12 @@ <h2 id="full-code-snippet"><a class="header" href="#full-code-snippet">Full code

console.log("Initiating sendERC20 on OPChainA...");
const sendERC20TxHash = await opChainAClient.writeContract({
address: L2_NATIVE_SUPERCHAINERC20_ADDRESS,
address: SUPERCHAIN_TOKEN_BRIDGE_ADDRESS,
abi: parseAbi([
"function sendERC20(address _to, uint256 _amount, uint256 _chainId)",
"function sendERC20(address _token, address _to, uint256 _amount, uint256 _chainId)",
]),
functionName: "sendERC20",
args: [account.address, 1000n, BigInt(supersimL2B.id)],
args: [L2_NATIVE_SUPERCHAINERC20_ADDRESS, account.address, 1000n, BigInt(supersimL2B.id)],
});

const sendERC20Receipt = await opChainAClient.waitForTransactionReceipt({ hash: sendERC20TxHash });
Expand Down Expand Up @@ -1016,7 +1017,7 @@ <h3 id="2-mint-tokens-to-transfer-on-chain-901-1"><a class="header" href="#2-min
</code></pre>
<h3 id="3-initiate-the-send-transaction-on-chain-901-1"><a class="header" href="#3-initiate-the-send-transaction-on-chain-901-1">3. Initiate the send transaction on chain 901</a></h3>
<p>Send the tokens from Chain 901 to Chain 902 using the following command:</p>
<pre><code class="language-sh">cast send 0x420beeF000000000000000000000000000000001 "sendERC20(address _to, uint256 _amount, uint256 _chainId)" 0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266 1000 902 --rpc-url http://127.0.0.1:9545 --private-key 0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80
<pre><code class="language-sh">cast send 0x4200000000000000000000000000000000000028 "sendERC20(address _token, address _to, uint256 _amount, uint256 _chainId)" 0x420beeF000000000000000000000000000000001 0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266 1000 902 --rpc-url http://127.0.0.1:9545 --private-key 0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80
</code></pre>
<h3 id="4-get-the-log-emitted-by-the-l2tol2crossdomainmessenger"><a class="header" href="#4-get-the-log-emitted-by-the-l2tol2crossdomainmessenger">4. Get the log emitted by the <code>L2ToL2CrossDomainMessenger</code></a></h3>
<p>The token contract calls the <a href="https://github.com/ethereum-optimism/optimism/blob/92ed64e171c6eb9c6a080c626640e8836f0653cc/packages/contracts-bedrock/src/L2/L2ToL2CrossDomainMessenger.sol">L2ToL2CrossDomainMessenger</a>, which emits a message (log) that can be relayed on the destination chain.</p>
Expand Down Expand Up @@ -1082,7 +1083,7 @@ <h3 id="7-send-the-relaymessage-transaction"><a class="header" href="#7-send-the
<li><code>bytes memory _sentMessage</code>: encoding of the log topics &amp; data</li>
</ul>
<p>Below is an example call, but make sure to replace them with the correct values you received in previous steps.</p>
<pre><code class="language-sh">$ cast send 0x4200000000000000000000000000000000000023 \
<pre><code class="language-sh">$ cast send 0x4200000000000000000000000000000000000023 --gas-limit 200000 \
"relayMessage((address, uint256, uint256, uint256, uint256), bytes)" \
"(0x4200000000000000000000000000000000000023, 4, 1, 1728507703, 901)" \
0x382409ac69001e11931a28435afef442cbfd20d9891907e8fa373ba7d351f3200000000000000000000000000000000000000000000000000000000000000386000000000000000000000000420beef0000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000420beef00000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000064d9f50046000000000000000000000000f39fd6e51aad88f6f4ce6ab8827279cfffb92266000000000000000000000000f39fd6e51aad88f6f4ce6ab8827279cfffb9226600000000000000000000000000000000000000000000000000000000000003e800000000000000000000000000000000000000000000000000000000 \
Expand Down
2 changes: 1 addition & 1 deletion searchindex.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion searchindex.json

Large diffs are not rendered by default.

0 comments on commit ff8d82f

Please sign in to comment.