Add steps to deploy new custom token

This commit is contained in:
Shreerang Kale 2024-10-18 11:31:28 +05:30
parent 8129b0eb90
commit 0e67ad7547

View File

@ -175,21 +175,23 @@
* Edit [`contract-vars.yml`](./contract-vars.yml) and fill in the following values:
```bash
# L1 RPC endpoint
geth_url: "https://sepolia.laconic.com"
# RPC endpoint
geth_url: "https://fixturenet-eth.laconic.com"
# L1 chain ID (Sepolia: 11155111)
geth_chain_id: "11155111"
# Chain ID (Fixturenet-eth: 1212)
geth_chain_id: "1212"
# Private key for a funded L1 account, to be used for contract deployment on L1
# Must also be funded on L2 for deploying contracts
# Required since this private key will be utilized by both L1 and L2 nodes of the bridge
# TODO: HARDCODE PK AND USE SAME IN BRIDGE
geth_deployer_pk: ""
# Custom L1 token to be deployed
token_name: ""
token_symbol: ""
intial_token_supply: ""
# Custom token to be deployed
token_name: "TestToken"
token_symbol: "TST"
intial_token_supply: "10000000"
```
* Update the target dir in `setup-vars.yml`:
@ -252,6 +254,29 @@
laconic-so deployment --dir nitro-contracts-deployment logs nitro-contracts -f
```
* To deploy another token
```bash
export TOKEN_NAME="TestToken2"
export TOKEN_SYMBOL="TST2"
# Note: Token supply denotes actual number of tokens and not the supply in Wei
export INITIAL_TOKEN_SUPPLY="10000000"
laconic-so deployment --dir nitro-contracts-deployment exec nitro-contracts "cd packages/nitro-protocol && yarn contracts:deploy-token-geth"
```
* To transfer a token to an account
```bash
# Note: Replace `<TokenName>` with name of the token to be tranferred (e.g. TestToken2)
export $ASSET_ADDRESS=$(laconic-so deployment --dir nitro-contracts-deployment exec nitro-contracts "jq -r '.\"{{ geth_chain_id }}\"[0].contracts.<TokenName>.address' /app/deployment/nitro-addresses.json")
export $ACCOUNT="<address of target account>"
export $AMOUNT="<Amount to be transferred>"
laconic-so deployment --dir nitro-contracts-deployment exec nitro-contracts "cd packages/nitro-protocol && yarn hardhat transfer --contract $ASSET_ADDRESS --to $ACCOUNT --amount 1000 --network geth"
```
</details>
<details open>
@ -288,10 +313,10 @@
# Expected output:
# {
# "11155111": [
# "1212": [
# {
# "name": "geth",
# "chainId": "11155111",
# "chainId": "1212",
# "contracts": {
# "ConsensusApp": {
# "address": "0xC98aD0B41B9224dad0605be32A9241dB9c67E2e8"
@ -302,7 +327,7 @@
# "VirtualPaymentApp": {
# "address": "0x778e4e6297E8BF04C67a20Ec989618d72eB4a19E"
# },
# "Token": {
# "TestToken": {
# "address": "0x02ebfB2706527C7310F2a7d9098b2BC61014C5F2"
# }
# }
@ -327,7 +352,7 @@
```bash
# WS endpoint
nitro_chain_url: "wss://sepolia.laconic.com"
nitro_chain_url: "wss://fixturenet-eth.laconic.com"
# Private key for bridge Nitro address
nitro_sc_pk: ""
@ -336,7 +361,7 @@
# It also needs to hold L1 tokens to fund Nitro channels
nitro_chain_pk: ""
# Deployed L1 Nitro contract addresses
# Deployed Nitro contract addresses
na_address: ""
vpa_address: ""
ca_address: ""
@ -414,7 +439,7 @@
export CA_ADDRESS=$(laconic-so deployment --dir nitro-contracts-deployment exec nitro-contracts "jq -r '.\"$GETH_CHAIN_ID\"[0].contracts.ConsensusApp.address' /app/deployment/nitro-addresses.json")
export VPA_ADDRESS=$(laconic-so deployment --dir nitro-contracts-deployment exec nitro-contracts "jq -r '.\"$GETH_CHAIN_ID\"[0].contracts.VirtualPaymentApp.address' /app/deployment/nitro-addresses.json")
export ASSET_ADDRESS=$(laconic-so deployment --dir nitro-contracts-deployment exec nitro-contracts "jq -r '.\"$GETH_CHAIN_ID\"[0].contracts.Token.address' /app/deployment/nitro-addresses.json")
export ASSET_ADDRESS=$(laconic-so deployment --dir nitro-contracts-deployment exec nitro-contracts "jq -r '.\"$GETH_CHAIN_ID\"[0].contracts.TestToken.address' /app/deployment/nitro-addresses.json")
export BRIDGE_NITRO_ADDRESS=$(laconic-so deployment --dir bridge-deployment exec nitro-rpc-client "nitro-rpc-client get-node-info -p 4005 -h nitro-bridge" | jq -r '.SCAddress')
@ -425,7 +450,7 @@
# Create the required config file
cat <<EOF > nitro-node-config.yml
nitro_chain_url: "wss://sepolia.laconic.com"
nitro_chain_url: "wss://fixturenet-eth.laconic.com"
na_address: "$NA_ADDRESS"
ca_address: "$CA_ADDRESS"
vpa_address: "$VPA_ADDRESS"