Skip to content

Commit

Permalink
fix: L2NativeSuperchainERC20 token addr
Browse files Browse the repository at this point in the history
 Please enter the commit message for your changes. Lines starting
  • Loading branch information
jakim929 committed Sep 18, 2024
1 parent daa397a commit 89d4215
Show file tree
Hide file tree
Showing 35 changed files with 92,073 additions and 81 deletions.
32 changes: 27 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ supersim --interop.autorelay
Run the following command to mint 1000 `L2NativeSuperchainERC20` tokens to the recipient address:

```sh
cast send 0x61a6eF395d217eD7C79e1B84880167a417796172 "mint(address _to, uint256 _amount)" 0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266 1000 --rpc-url http://127.0.0.1:9545 --private-key 0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80
cast send 0x0bEa8920a4FfB1888Ec3Ac1BC0D23f414B0a28cA "mint(address _to, uint256 _amount)" 0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266 1000 --rpc-url http://127.0.0.1:9545 --private-key 0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80

```

Expand All @@ -120,7 +120,7 @@ cast send 0x61a6eF395d217eD7C79e1B84880167a417796172 "mint(address _to, uint256
Send the tokens from Chain 901 to Chain 902 using the following command:

```sh
cast send 0x61a6eF395d217eD7C79e1B84880167a417796172 "sendERC20(address _to, uint256 _amount, uint256 _chainId)" 0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266 1000 902 --rpc-url http://127.0.0.1:9545 --private-key 0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80
cast send 0x0bEa8920a4FfB1888Ec3Ac1BC0D23f414B0a28cA "sendERC20(address _to, uint256 _amount, uint256 _chainId)" 0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266 1000 902 --rpc-url http://127.0.0.1:9545 --private-key 0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80
```

**4. Wait for the relayed message to appear on chain 902**
Expand All @@ -129,16 +129,16 @@ In a few seconds, you should see the RelayedMessage on chain 902:

```sh
# example
INFO [08-30|14:30:14.698] L2ToL2CrossChainMessenger#RelayedMessage sourceChainID=901 destinationChainID=902 nonce=0 sender=0x61a6eF395d217eD7C79e1B84880167a417796172 target=0x61a6eF395d217eD7C79e1B84880167a417796172
INFO [08-30|14:30:14.698] L2ToL2CrossChainMessenger#RelayedMessage sourceChainID=901 destinationChainID=902 nonce=0 sender=0x0bEa8920a4FfB1888Ec3Ac1BC0D23f414B0a28cA target=0x0bEa8920a4FfB1888Ec3Ac1BC0D23f414B0a28cA
```
**5. Check the balance on chain 902**

Verify that the balance of the L2NativeSuperchainERC20 on chain 902 has increased:

```sh
cast balance --erc20 0x61a6eF395d217eD7C79e1B84880167a417796172 0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266 --rpc-url http://127.0.0.1:9546
cast balance --erc20 0x0bEa8920a4FfB1888Ec3Ac1BC0D23f414B0a28cA 0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266 --rpc-url http://127.0.0.1:9546
```

For more **detailed instructions** and **usage guides**, refer to the [**📚 Supersim docs**](https://supersim.pages.dev).

## 🌐 Fork mode

Expand Down Expand Up @@ -178,6 +178,28 @@ L2s: Predeploy Contracts Spec ( https://specs.optimism.io/protocol/predeploys.ht
- L1StandardBridge: 0x3e2Ea9B92B7E48A52296fD261dc26fd995284631
```

### Development

#### Running locally

```sh
go run cmd/main.go
```

#### Building locally

1. build the binary by running:

```sh
go build cmd/main.go
```

2. start supersim in vanilla mode by running:

```sh
./main
```

### Note

By default, interop contracts are not deployed on forked networks. To include them, run supersim with the `--interop.enabled` flag
Expand Down
4 changes: 2 additions & 2 deletions docs/src/chain-environment/contracts/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,10 @@ A simple ERC20 that adheres to the SuperchainERC20 standard. It includes permiss

Source: [L2NativeSuperchainERC20.sol](/contracts/src/L2NativeSuperchainERC20.sol)

Deployed address: `0x61a6eF395d217eD7C79e1B84880167a417796172`
Deployed address: `0x0bEa8920a4FfB1888Ec3Ac1BC0D23f414B0a28cA`

#### Minting new tokens

```bash
cast send 0x61a6eF395d217eD7C79e1B84880167a417796172 "mint(address _to, uint256 _amount)" $RECIPIENT_ADDRESS 1ether --rpc-url $L2_RPC_URL
cast send 0x0bEa8920a4FfB1888Ec3Ac1BC0D23f414B0a28cA "mint(address _to, uint256 _amount)" $RECIPIENT_ADDRESS 1ether --rpc-url $L2_RPC_URL
```
2 changes: 1 addition & 1 deletion docs/src/chain-environment/network-details/op-chain-a.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,6 @@
"L2ToL2CrossDomainMessenger": "0x4200000000000000000000000000000000000023",

// Periphery
"L2NativeSuperchainERC20": "0x61a6eF395d217eD7C79e1B84880167a417796172"
"L2NativeSuperchainERC20": "0x0bEa8920a4FfB1888Ec3Ac1BC0D23f414B0a28cA"
}
```
2 changes: 1 addition & 1 deletion docs/src/chain-environment/network-details/op-chain-b.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,6 @@
"L2ToL2CrossDomainMessenger": "0x4200000000000000000000000000000000000023",

// Periphery
"L2NativeSuperchainERC20": "0x61a6eF395d217eD7C79e1B84880167a417796172"
"L2NativeSuperchainERC20": "0x0bEa8920a4FfB1888Ec3Ac1BC0D23f414B0a28cA"
}
```
8 changes: 4 additions & 4 deletions docs/src/getting-started/first-steps.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ supersim --interop.autorelay
Run the following command to mint 1000 `L2NativeSuperchainERC20` tokens to the recipient address:

```sh
cast send 0x61a6eF395d217eD7C79e1B84880167a417796172 "mint(address _to, uint256 _amount)" 0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266 1000 --rpc-url http://127.0.0.1:9545 --private-key 0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80
cast send 0x0bEa8920a4FfB1888Ec3Ac1BC0D23f414B0a28cA "mint(address _to, uint256 _amount)" 0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266 1000 --rpc-url http://127.0.0.1:9545 --private-key 0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80

```

Expand All @@ -53,7 +53,7 @@ cast send 0x61a6eF395d217eD7C79e1B84880167a417796172 "mint(address _to, uint256
Send the tokens from Chain 901 to Chain 902 using the following command:

```sh
cast send 0x61a6eF395d217eD7C79e1B84880167a417796172 "sendERC20(address _to, uint256 _amount, uint256 _chainId)" 0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266 1000 902 --rpc-url http://127.0.0.1:9545 --private-key 0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80
cast send 0x0bEa8920a4FfB1888Ec3Ac1BC0D23f414B0a28cA "sendERC20(address _to, uint256 _amount, uint256 _chainId)" 0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266 1000 902 --rpc-url http://127.0.0.1:9545 --private-key 0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80
```

### 4. Wait for the relayed message to appear on chain 902
Expand All @@ -62,15 +62,15 @@ In a few seconds, you should see the RelayedMessage on chain 902:

```sh
# example
INFO [08-30|14:30:14.698] L2ToL2CrossChainMessenger#RelayedMessage sourceChainID=901 destinationChainID=902 nonce=0 sender=0x61a6eF395d217eD7C79e1B84880167a417796172 target=0x61a6eF395d217eD7C79e1B84880167a417796172
INFO [08-30|14:30:14.698] L2ToL2CrossChainMessenger#RelayedMessage sourceChainID=901 destinationChainID=902 nonce=0 sender=0x0bEa8920a4FfB1888Ec3Ac1BC0D23f414B0a28cA target=0x0bEa8920a4FfB1888Ec3Ac1BC0D23f414B0a28cA
```

### 5. Check the balance on chain 902

Verify that the balance of the L2NativeSuperchainERC20 on chain 902 has increased:

```sh
cast balance --erc20 0x61a6eF395d217eD7C79e1B84880167a417796172 0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266 --rpc-url http://127.0.0.1:9546
cast balance --erc20 0x0bEa8920a4FfB1888Ec3Ac1BC0D23f414B0a28cA 0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266 --rpc-url http://127.0.0.1:9546
```

With the steps above, you've now successfully completed both an L1 to L2 ETH bridge and an L2 to L2 interoperable SuperchainERC20 token transfer, all done locally using `supersim`. This approach simplifies multichain testing, allowing you to focus on development without the need for complex setups or relying on external testnets.
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ We'll perform the SuperchainERC20 interop transfer in [First steps](../../gettin

### Contracts used
- [L2NativeSuperchainERC20](https://github.com/ethereum-optimism/supersim/blob/main/contracts/src/L2NativeSuperchainERC20.sol)
- `0x61a6eF395d217eD7C79e1B84880167a417796172`
- `0x0bEa8920a4FfB1888Ec3Ac1BC0D23f414B0a28cA`
- [CrossL2Inbox](https://github.com/ethereum-optimism/optimism/blob/92ed64e171c6eb9c6a080c626640e8836f0653cc/packages/contracts-bedrock/src/L2/CrossL2Inbox.sol)
- `0x4200000000000000000000000000000000000022`
- [L2ToL2CrossDomainMessenger](https://github.com/ethereum-optimism/optimism/blob/92ed64e171c6eb9c6a080c626640e8836f0653cc/packages/contracts-bedrock/src/L2/L2ToL2CrossDomainMessenger.sol)
Expand Down Expand Up @@ -77,15 +77,15 @@ supersim
Run the following command to mint 1000 `L2NativeSuperchainERC20` tokens to the recipient address:

```sh
cast send 0x61a6eF395d217eD7C79e1B84880167a417796172 "mint(address _to, uint256 _amount)" 0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266 1000 --rpc-url http://127.0.0.1:9545 --private-key 0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80
cast send 0x0bEa8920a4FfB1888Ec3Ac1BC0D23f414B0a28cA "mint(address _to, uint256 _amount)" 0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266 1000 --rpc-url http://127.0.0.1:9545 --private-key 0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80
```

### 3. Initiate the send transaction on chain 901

Send the tokens from Chain 901 to Chain 902 using the following command:

```sh
cast send 0x61a6eF395d217eD7C79e1B84880167a417796172 "sendERC20(address _to, uint256 _amount, uint256 _chainId)" 0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266 1000 902 --rpc-url http://127.0.0.1:9545 --private-key 0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80
cast send 0x0bEa8920a4FfB1888Ec3Ac1BC0D23f414B0a28cA "sendERC20(address _to, uint256 _amount, uint256 _chainId)" 0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266 1000 902 --rpc-url http://127.0.0.1:9545 --private-key 0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80
```

### 4. Get the log emitted by the `L2ToL2CrossDomainMessenger`
Expand Down Expand Up @@ -215,7 +215,7 @@ cast send 0x4200000000000000000000000000000000000022 \
Verify that the balance of the L2NativeSuperchainERC20 on chain 902 has increased:

```sh
cast balance --erc20 0x61a6eF395d217eD7C79e1B84880167a417796172 0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266 --rpc-url http://127.0.0.1:9546
cast balance --erc20 0x0bEa8920a4FfB1888Ec3Ac1BC0D23f414B0a28cA 0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266 --rpc-url http://127.0.0.1:9546
```

## Alternatives
Expand Down
4 changes: 2 additions & 2 deletions docs/src/guides/interop/relay-using-viem.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ import { anvil } from "viem/chains";

// Define constants - L2NativeSuperchainERC20 contract address is the same on every chain
const L2_NATIVE_SUPERCHAINERC20_ADDRESS =
"0x61a6eF395d217eD7C79e1B84880167a417796172";
"0x0bEa8920a4FfB1888Ec3Ac1BC0D23f414B0a28cA";

const L2_TO_L2_CROSS_DOMAIN_MESSENGER_ADDRESS =
"0x4200000000000000000000000000000000000023";
Expand Down Expand Up @@ -206,7 +206,7 @@ import { anvil } from "viem/chains";

// Define constants - L2NativeSuperchainERC20 contract address is the same on every chain
const L2_NATIVE_SUPERCHAINERC20_ADDRESS =
"0x61a6eF395d217eD7C79e1B84880167a417796172";
"0x0bEa8920a4FfB1888Ec3Ac1BC0D23f414B0a28cA";

const L2_TO_L2_CROSS_DOMAIN_MESSENGER_ADDRESS =
"0x4200000000000000000000000000000000000023";
Expand Down
2 changes: 1 addition & 1 deletion genesis/generated/l1-allocs/901-l1-allocs.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion genesis/generated/l1-allocs/902-l1-allocs.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion genesis/generated/l1-allocs/903-l1-allocs.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion genesis/generated/l1-allocs/904-l1-allocs.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion genesis/generated/l1-allocs/905-l1-allocs.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion genesis/generated/l1-combined-allocs.json

Large diffs are not rendered by default.

20 changes: 10 additions & 10 deletions genesis/generated/l1-genesis.json

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

18,396 changes: 18,395 additions & 1 deletion genesis/generated/l2-allocs/901-l2-allocs.json

Large diffs are not rendered by default.

18,396 changes: 18,395 additions & 1 deletion genesis/generated/l2-allocs/902-l2-allocs.json

Large diffs are not rendered by default.

18,396 changes: 18,395 additions & 1 deletion genesis/generated/l2-allocs/903-l2-allocs.json

Large diffs are not rendered by default.

18,396 changes: 18,395 additions & 1 deletion genesis/generated/l2-allocs/904-l2-allocs.json

Large diffs are not rendered by default.

18,396 changes: 18,395 additions & 1 deletion genesis/generated/l2-allocs/905-l2-allocs.json

Large diffs are not rendered by default.

Loading

0 comments on commit 89d4215

Please sign in to comment.