Before deploying check out the .env.test.example
file. You should create your own .env.test
file.
DEPLOYER_PRIVATE_KEY=<PRIVATE KEY OF THE DEPLOYER WALLET>
ETHERSCAN_API_KEY=<ETHERSCAN API KEY>
ROOT_CHAIN_RPC=<RPC OF THE ROOT CHAIN>
ROOT_GAS_PRICE=<GAS PRICE IN WEI>
CHILD_CHAIN_RPC=<RPC OF THE CHILD CHAIN>
CHILD_GAS_PRICE=<GAS PRICE IN WEI>
STAKE_MANAGER=<STAKE MANAGER ADDRESS (POLYGON FOUNDATION)>
MATIC_TOKEN=<ADDRESS OF THE MATIC ERC20 TOKEN>
MANAGER=<ADDRESS THAT WILL BE USED AS A MANAGER>
INSTANT_POOL_OWNER=<ADDRESS THAT WILL BE USED AS AN OWNER FOR INSTANT POOL>
TREASURY=<ADDRESS THAT WILL BE USED AS A TREASURY FOR REVENUE COLLECTION>
FX_ROOT=<FX ROOT ADDRESS ON ETHEREUM (POLYGON FOUNDATION)>
FX_CHILD=<FX CHILD ADDRESS ON POLYGON (POLYGON FOUNDATION)>
CHECKPOINT_MANAGER=<CHECKPOINT MANAGER ADDRESS ON ETHEREUM (POLYGON FOUNDATION)>
To deploy on testnet run:
npm run deploy:test
To deploy on mainnet run:
npm run deploy:main
To deploy contract directly, run:
npx hardhat deployFxStateChildTunnel --network matic
npx hardhat deployRateProvider <fxStateChildTunnelAddress> --network matic
npx hardhat deployChildPoolImpl --network matic
npx hardhat deployChildPoolProxy <fxStateChildTunnelAddress> <maticX> <manager> <instantPoolOwner> <treasury> <instantWithdrawalFeeBps> --network matic
npx hardhat deployFxStateRootTunnel <maticXAddress> --network mainnet
npx hardhat deployMaticXImpl --network mainnet
npx hardhat deployValidatorRegistryImpl --network mainnet
npx hardhat run ./scripts/upgradeMaticX.ts --network <network>
npx hardhat run ./scripts/upgradeValidatorRegistry.ts --network <network>
npx hardhat verifyMaticX --network <network>
npx hardhat verify <address> <...args> --network <network>
npx hardhat test
Smart contract integration guide is at link