5_deploy_pyth.js 819 B

1234567891011121314151617181920212223
  1. require('dotenv').config({ path: "../.env" });
  2. const bs58 = require("bs58");
  3. const PythUpgradable = artifacts.require("PythUpgradable");
  4. const Wormhole = artifacts.require("Wormhole");
  5. const pyth2WormholeChainId = process.env.PYTH_TO_WORMHOLE_CHAIN_ID;
  6. const pyth2WormholeEmitter = bs58.decode(process.env.PYTH_TO_WORMHOLE_EMITTER); // base58, must fit into bytes32
  7. const { deployProxy } = require("@openzeppelin/truffle-upgrades");
  8. console.log("Deploying Pyth with emitter", pyth2WormholeEmitter.toString("hex"))
  9. module.exports = async function (deployer) {
  10. // Deploy the proxy script
  11. await deployProxy(PythUpgradable,
  12. [
  13. (await Wormhole.deployed()).address,
  14. pyth2WormholeChainId,
  15. "0x" + pyth2WormholeEmitter.toString("hex")
  16. ],
  17. { deployer });
  18. };