2_deploy_wormhole.js 988 B

1234567891011121314151617181920212223242526272829303132
  1. require('dotenv').config({ path: "../.env" });
  2. const Setup = artifacts.require("Setup");
  3. const Implementation = artifacts.require("Implementation");
  4. const Wormhole = artifacts.require("Wormhole");
  5. // CONFIG
  6. const initialSigners = JSON.parse(process.env.INIT_SIGNERS);
  7. const chainId = process.env.INIT_CHAIN_ID;
  8. const governanceChainId = process.env.INIT_GOV_CHAIN_ID;
  9. const governanceContract = process.env.INIT_GOV_CONTRACT; // bytes32
  10. module.exports = async function (deployer) {
  11. // deploy setup
  12. await deployer.deploy(Setup);
  13. // deploy implementation
  14. await deployer.deploy(Implementation);
  15. // encode initialisation data
  16. const setup = new web3.eth.Contract(Setup.abi, Setup.address);
  17. const initData = setup.methods.setup(
  18. Implementation.address,
  19. initialSigners,
  20. chainId,
  21. governanceChainId,
  22. governanceContract
  23. ).encodeABI();
  24. // deploy proxy
  25. await deployer.deploy(Wormhole, Setup.address, initData);
  26. };