Skip to content

Dev1 deployment

Aalavandhan edited this page Sep 12, 2022 · 1 revision
  1. Setup deployer key
# create keyfile
export KEYFILE=[Path to key file]
export PASSPHRASE=
  1. Deploy AMPL contracts
# use existing deployment
yarn hardhat --network dev1RopstenBaseChain deploy:use_deployed \
  --ampleforth-deployment-yaml "https://raw.githubusercontent.com/ampleforth/uFragments-eth-integration/master/migrations/deployments/rinkeby-staging.yaml?token=ABPZMDWFRG2VQF4Y47CTA2DAMHWGW"

# create new deployment
yarn hardhat --network dev1RopstenBaseChain testnet:deploy:ampleforth \
  --keyfile $KEYFILE --passphrase $PASSPHRASE 

# deploy token vault for bridge
yarn hardhat --network dev1RopstenBaseChain deploy:token_vault \
  --bridge "chainBridge" \
  --keyfile $KEYFILE --passphrase $PASSPHRASE 

# deploy on bsc testnet
yarn hardhat \
  --network dev1BscTestnetSatChain \
  deploy:ampleforth_xc \
  --keyfile $KEYFILE --passphrase $PASSPHRASE \
  --token-name "BSC ChainBridge Ample" \
  --token-symbol "BSC-CB-AMPL" \
  --base-chain-network dev1RopstenBaseChain

# deploy on meter testnet
yarn hardhat \
  --network dev1MeterTestnetSatChain \
  deploy:ampleforth_xc \
  --keyfile $KEYFILE --passphrase $PASSPHRASE \
  --token-name "Meter ChainBridge Ample" \
  --token-symbol "Meter-CB-AMPL" \
  --base-chain-network dev1RopstenBaseChain
  1. Use deployed chain bridge contract and deploy handlers
yarn hardhat --network dev1RopstenBaseChain deploy:chain_bridge_use_deployed \
  --bridge-address "0x6fC272eD9B6B947a7858DF30D7DD2D8173306EA8" \
  --generic-handler-address "0xBAb8402E278F45d51BB342525716611fE1090027"

yarn hardhat --network dev1RopstenBaseChain deploy:chain_bridge_base_chain \
  --keyfile $KEYFILE --passphrase $PASSPHRASE \
  --use-deployed true

yarn hardhat --network dev1BscTestnetSatChain deploy:chain_bridge_use_deployed \
  --bridge-address "0xcCeA086cbb7DA6bA5eb004fAd435F9b7712bA80e" \
  --generic-handler-address "0xb264Cf6be02f17BF638Cd59F63C68Ec3036b32b5"

yarn hardhat --network dev1BscTestnetSatChain deploy:chain_bridge_satellite_chain \
  --keyfile $KEYFILE --passphrase $PASSPHRASE \
  --use-deployed true

yarn hardhat --network dev1MeterTestnetSatChain deploy:chain_bridge_use_deployed \
  --bridge-address "0x4E68f5f704878e69AF9d58D5616168d69f1D03e4" \
  --generic-handler-address "0x56f03E0B73fa6Ff6704CA399CE88282EDcF9FeEA"

yarn hardhat --network dev1MeterTestnetSatChain deploy:chain_bridge_satellite_chain \
  --keyfile $KEYFILE --passphrase $PASSPHRASE \
  --use-deployed true
  1. Deploy and setup rebase report batcher utility if not already deployed
yarn hardhat --network dev1RopstenBaseChain deploy:rebase_reporter \
  --keyfile $KEYFILE --passphrase $PASSPHRASE 

yarn hardhat --network dev1RopstenBaseChain deploy:rebase_reporter:prep_tx \
  --keyfile $KEYFILE --passphrase $PASSPHRASE \
  --bridge "chainBridge" \
  --satellite-chain-networks "[\"dev1BscTestnetSatChain\", \"dev1MeterTestnetSatChain\" ]"
  1. Inspect state
# prints ampl state
yarn hardhat info:ampl \
  --networks "[\"dev1RopstenBaseChain\", \"dev1BscTestnetSatChain\", \"dev1MeterTestnetSatChain\" ]"

# prints ampl balances across chains
yarn hardhat info:ampl:balance \
  --networks "[\"dev1RopstenBaseChain\", \"dev1BscTestnetSatChain\", \"dev1MeterTestnetSatChain\" ]" \
  --wallet "0x3b2b9EfdaE5291F3Bb9C7e6508C7e67534511585"

# prints bridge state
yarn hardhat info:chain_bridge \
  --networks "[\"dev1RopstenBaseChain\", \"dev1BscTestnetSatChain\", \"dev1MeterTestnetSatChain\" ]"

# get transaction history
yarn hardhat info:cb_ampl_tx --networks "[\"dev1RopstenBaseChain\", \"dev1BscTestnetSatChain\", \"dev1MeterTestnetSatChain\"]" --output-csv-path dev1-tx.csv
  1. Cross-chain transactions
yarn hardhat --network dev1RopstenBaseChain testnet:rebase:base_chain \
  --keyfile $KEYFILE --passphrase $PASSPHRASE \
  --rebase-perc 10

# report rebase from base-chain to satellite-chains
yarn hardhat --network dev1RopstenBaseChain report_rebase:base_chain \
  --satellite-chain-networks "[\"dev1BscTestnetSatChain\", \"dev1MeterTestnetSatChain\" ]" \
  --keyfile $KEYFILE --passphrase $PASSPHRASE

# wait for relayer to report rebase execute rebase on satellite chains
yarn hardhat rebase:satellite_chain \
  --networks "[\"dev1BscTestnetSatChain\", \"dev1MeterTestnetSatChain\" ]" \
  --keyfile $KEYFILE --passphrase $PASSPHRASE


# cross-chain transfer from base to satellite
yarn hardhat --network dev1RopstenBaseChain xc_transfer \
  --target-chain-network dev1BscTestnetSatChain \
  --keyfile $KEYFILE --passphrase $PASSPHRASE \
  --recipient-address "0x3b2b9EfdaE5291F3Bb9C7e6508C7e67534511585" \
  --amount 100

# cross-chain transfer from satellite to base
yarn hardhat --network dev1BscTestnetSatChain xc_transfer \
  --target-chain-network dev1RopstenBaseChain \
  --keyfile $KEYFILE --passphrase $PASSPHRASE \
  --recipient-address "0x3b2b9EfdaE5291F3Bb9C7e6508C7e67534511585" \
  --amount 50

# cross-chain transfer from satellite to satellite
yarn hardhat --network dev1BscTestnetSatChain xc_transfer \
  --target-chain-network dev1MeterTestnetSatChain \
  --keyfile $KEYFILE --passphrase $PASSPHRASE \
  --recipient-address "0x3b2b9EfdaE5291F3Bb9C7e6508C7e67534511585" \
  --amount 25