2024-10-21 11:07:01 +00:00
|
|
|
# Nitro Token Ops
|
|
|
|
|
2024-10-30 10:16:28 +00:00
|
|
|
## Deploy and transfer custom tokens
|
|
|
|
|
|
|
|
### Setup
|
2024-10-21 11:07:01 +00:00
|
|
|
|
|
|
|
* Go to the directory where `nitro-contracts-deployment` is present:
|
|
|
|
|
|
|
|
```bash
|
|
|
|
cd /srv/bridge
|
|
|
|
```
|
|
|
|
|
2024-10-30 10:16:28 +00:00
|
|
|
### Deploy new token
|
2024-10-21 11:07:01 +00:00
|
|
|
|
|
|
|
* To deploy another token:
|
|
|
|
|
|
|
|
```bash
|
|
|
|
# These values can be changed to deploy another token with different name and symbol
|
|
|
|
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="129600"
|
|
|
|
|
|
|
|
laconic-so deployment --dir nitro-contracts-deployment exec nitro-contracts "TOKEN_NAME=$TOKEN_NAME TOKEN_SYMBOL=$TOKEN_SYMBOL INITIAL_TOKEN_SUPPLY=$INITIAL_TOKEN_SUPPLY /app/deploy-l1-tokens.sh"
|
|
|
|
```
|
|
|
|
|
|
|
|
* Recreate `assets.json` to include newly deployed token address:
|
|
|
|
|
|
|
|
```bash
|
|
|
|
export GETH_CHAIN_ID="1212"
|
|
|
|
|
|
|
|
laconic-so deployment --dir nitro-contracts-deployment exec nitro-contracts "jq --arg chainId \"$GETH_CHAIN_ID\" '{
|
|
|
|
(\$chainId): [
|
|
|
|
{
|
|
|
|
\"name\": .[\$chainId][0].name,
|
|
|
|
\"chainId\": .[\$chainId][0].chainId,
|
|
|
|
\"contracts\": (
|
|
|
|
.[\$chainId][0].contracts
|
|
|
|
| to_entries
|
|
|
|
| map(select(.key | in({\"ConsensusApp\":1, \"NitroAdjudicator\":1, \"VirtualPaymentApp\":1}) | not))
|
|
|
|
| from_entries
|
|
|
|
)
|
|
|
|
}
|
|
|
|
]
|
|
|
|
}' /app/deployment/nitro-addresses.json" > assets.json
|
|
|
|
```
|
|
|
|
|
|
|
|
* The required config file should be generated at `/srv/bridge/assets.json`
|
|
|
|
|
|
|
|
* Check in the generated file at location `ops/stage2/assets.json` within this repository
|
|
|
|
|
2024-10-30 10:16:28 +00:00
|
|
|
### Transfer deployed tokens to given address
|
2024-10-21 11:07:01 +00:00
|
|
|
|
|
|
|
* To transfer a token to an account:
|
|
|
|
|
|
|
|
```bash
|
|
|
|
export GETH_CHAIN_ID=1212
|
|
|
|
export TOKEN_NAME="<name-of-token-to-be-transferred>"
|
|
|
|
export ASSET_ADDRESS=$(laconic-so deployment --dir nitro-contracts-deployment exec nitro-contracts "jq -r '.\"$GETH_CHAIN_ID\"[0].contracts.$TOKEN_NAME.address' /app/deployment/nitro-addresses.json")
|
|
|
|
export ACCOUNT="<target-account-address>"
|
|
|
|
|
2024-10-30 10:16:28 +00:00
|
|
|
laconic-so deployment --dir nitro-contracts-deployment exec nitro-contracts "cd packages/nitro-protocol && yarn hardhat transfer --contract $ASSET_ADDRESS --to $ACCOUNT --amount 100 --network geth"
|
|
|
|
```
|
|
|
|
|
|
|
|
## Transfer ETH
|
|
|
|
|
|
|
|
* Go to the directory where `fixturenet-eth-deployment` is present:
|
|
|
|
|
|
|
|
```bash
|
|
|
|
cd /srv/fixturenet-eth
|
|
|
|
```
|
|
|
|
|
|
|
|
* To transfer ETH to an account:
|
|
|
|
|
|
|
|
```bash
|
|
|
|
export FUNDED_ADDRESS="0xe6CE22afe802CAf5fF7d3845cec8c736ecc8d61F"
|
|
|
|
export FUNDED_PK="888814df89c4358d7ddb3fa4b0213e7331239a80e1f013eaa7b2deca2a41a218"
|
|
|
|
|
|
|
|
export TO_ADDRESS="<target-account-address>"
|
|
|
|
|
|
|
|
laconic-so deployment --dir fixturenet-eth-deployment exec foundry "cast send $TO_ADDRESS --value 1ether --from $FUNDED_ADDRESS --private-key $FUNDED_PK"
|
2024-10-21 11:07:01 +00:00
|
|
|
```
|