Send custom tokens to Alice and Charlie using bridge stack

This commit is contained in:
Adw8 2024-07-19 17:17:43 +05:30
parent b08cc87e05
commit 52cb1315e8

View File

@ -530,48 +530,36 @@
# 100000000000000000
```
- Deploy go-nitro contracts on L1 and L2 (run steps in go-nitro repo)
- Deploy contracts on L1 and L2
- In `bridge-nitro-deployment/config.env` file, set the following env variable:
```bash
# Deploy contracts on geth
yarn contracts:deploy-geth
# URL endpoint of the L2 and L2 chains
CERC_NITRO_L1_CHAIN_URL=ws://host.docker.internal:8546
CERC_NITRO_L2_CHAIN_URL=ws://host.docker.internal:9546
# Deploy contracts on Optimism
yarn contracts:deploy-optimism
# Private key of the account on chain that is used for funding channels in Nitro node
CERC_NITRO_CHAIN_PK=888814df89c4358d7ddb3fa4b0213e7331239a80e1f013eaa7b2deca2a41a218
CERC_NITRO_SC_PK=0279651921cd800ac560c21ceea27aab0107b67daf436cdd25ce84cad30159b4
CERC_GETH_URL=http://host.docker.internal:8545
CERC_OPTIMISM_URL=http://host.docker.internal:9545
CERC_GETH_DEPLOYER_PK=888814df89c4358d7ddb3fa4b0213e7331239a80e1f013eaa7b2deca2a41a218
CERC_OPTIMISM_DEPLOYER_PK=888814df89c4358d7ddb3fa4b0213e7331239a80e1f013eaa7b2deca2a41a218
CERC_TOKEN_NAME=LaconicNetworkToken
CERC_TOKEN_SYMBOL=LNT
CERC_INITIAL_TOKEN_SUPPLY=10000000
```
- Deploy custom token on L1
- Start the nitro bridge
```bash
# Deploy token on geth
yarn contracts:deploy-token-geth
```bash
laconic-so deployment --dir bridge-deployment start
# Check the logs, ensure that the node is running
laconic-so deployment --dir bridge-deployment logs nitro-bridge -f
```
- Note address of the deployed token on L1 and update `~/go-nitro/cmd/test-configs/bridge-assets-map.toml` config file
```bash
[[assets]]
l1AssetAddress = "<Token address on L1>"
...
```
- Deploy custom token on L2
```bash
# Deploy token on Optimism
yarn contracts:deploy-token-optimism
```
- Note address of the deployed token on L2 and update `~/go-nitro/cmd/test-configs/bridge-assets-map.toml` config file
```bash
[[assets]]
l1AssetAddress = "<Token address on L1>"
l2AssetAddress = "<Token address on L2>"
```
- Send custom tokens to Alice and Charlie on L1
- Export variables for L1 token address
@ -587,33 +575,10 @@
```bash
# Send tokens to Alice
yarn hardhat transfer --contract $L1_ASSET_ADDRESS --to $A_CHAIN_ADDRESS --amount 1000 --network geth
laconic-so deployment --dir bridge-deployment exec nitro-bridge yarn hardhat transfer --contract $L1_ASSET_ADDRESS --to $A_CHAIN_ADDRESS --amount 1000 --network geth
#Send tokens to Charlie
yarn hardhat transfer --contract $L1_ASSET_ADDRESS --to $C_CHAIN_ADDRESS --amount 1000 --network geth
```
- Create a deployment for the bridge:
- Create spec files for the deployment, map container ports to host ports and set env variables:
```bash
laconic-so --stack ~/cerc/nitro-stack/stack-orchestrator/stacks/bridge deploy init --map-ports-to-host any-same --output bridge-nitro-spec.yml --config CERC_NITRO_L1_CHAIN_URL=ws://host.docker.internal:8546, \
CERC_NITRO_L2_CHAIN_URL=ws://host.docker.internal:9546, \
CERC_NITRO_CHAIN_PK=888814df89c4358d7ddb3fa4b0213e7331239a80e1f013eaa7b2deca2a41a218, \
CERC_NITRO_SC_PK=0279651921cd800ac560c21ceea27aab0107b67daf436cdd25ce84cad30159b4, \
CERC_GETH_URL=http://host.docker.internal:8545, \
CERC_OPTIMISM_URL=http://host.docker.internal:9545, \
CERC_GETH_DEPLOYER_PK=888814df89c4358d7ddb3fa4b0213e7331239a80e1f013eaa7b2deca2a41a218, \
CERC_OPTIMISM_DEPLOYER_PK=888814df89c4358d7ddb3fa4b0213e7331239a80e1f013eaa7b2deca2a41a218, \
CERC_TOKEN_NAME=LaconicNetworkToken, \
CERC_TOKEN_SYMBOL=LNT, \
CERC_INITIAL_TOKEN_SUPPLY=10000000, \
```
- Create a deployment from the spec file:
```bash
laconic-so --stack ~/cerc/nitro-stack/stack-orchestrator/stacks/bridge deploy create --spec-file bridge-nitro-spec.yml --deployment-dir bridge-nitro-deployment
laconic-so deployment --dir bridge-deployment exec nitro-bridge yarn hardhat transfer --contract $L1_ASSET_ADDRESS --to $C_CHAIN_ADDRESS --amount 1000 --network geth
```
- Start testnet-onboarding-app (run command in testnet-onboarding-app repo)
@ -697,15 +662,6 @@
- In the wallet, add 2 accounts (Alice and Charlie) for both the networks (ethereum and laconicd) by selecting the network and clicking on `Add account`
- Start the nitro bridge
```bash
laconic-so deployment --dir bridge-nitro-deployment start
# Check the logs, ensure that the node is running
laconic-so deployment --dir bridge-nitro-deployment logs laconicd -f
```
- Get the deployed nitro contract addresses (Run in the directory where the deployments were created):
```bash