Skip to content

Matic prod deployment

Aalavandhan edited this page Jul 1, 2021 · 4 revisions
  1. Setup deployer key
# create keyfile
export KEYFILE=[Path to key file]
export PASSPHRASE=
  1. Deploy AMPL contracts
# deploy vault
yarn hardhat --network prodEthereumBaseChain deploy:token_vault \
  --bridge "matic" \
  --keyfile $KEYFILE --passphrase $PASSPHRASE 

# deploy on matic mainnet
yarn hardhat \
  --network prodMaticSatChain \
  deploy:ampleforth_xc \
  --keyfile $KEYFILE --passphrase $PASSPHRASE \
  --token-name "Ampleforth secured by Matic" \
  --token-symbol "AMPL" \
  --base-chain-network prodEthereumBaseChain

  1. Use deployed chain bridge contract and deploy handlers
yarn hardhat --network prodEthereumBaseChain deploy:matic_base_chain \
  --keyfile $KEYFILE --passphrase $PASSPHRASE \
  --checkpoint-manager "0x2890bA17EfE978480615e330ecB65333b880928e" \
  --fx-root "0x3d1d3E34f7fB6D26245E6640E1c50710eFFf15bA"

yarn hardhat --network prodMaticSatChain deploy:matic_satellite_chain \
  --keyfile $KEYFILE --passphrase $PASSPHRASE \
  --fx-child "0xCf73231F28B7331BBe3124B907840A94851f9f11"

yarn hardhat deploy:matic_connection \
  --keyfile $KEYFILE --passphrase $PASSPHRASE \
  --base-chain-network "prodEthereumBaseChain" \
  --sat-chain-network "prodMaticSatChain"
  1. Deploy and setup rebase report batcher utility if not already deployed
yarn hardhat --network prodEthereumBaseChain deploy:rebase_reporter \
  --keyfile $KEYFILE --passphrase $PASSPHRASE 

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

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

  1. Cross-chain transactions

# report rebase from base-chain to satellite-chains
yarn hardhat --network prodEthereumBaseChain matic:report_rebase:base_chain \
  --keyfile $KEYFILE --passphrase $PASSPHRASE

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


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

# cross-chain transfer from satellite to base
yarn hardhat --network prodMaticSatChain matic:xc_transfer \
  --keyfile $KEYFILE --passphrase $PASSPHRASE \
  --recipient-address "0x3b2b9EfdaE5291F3Bb9C7e6508C7e67534511585" \
  --amount 50
Clone this wiki locally