| 12345678910111213141516171819202122232425262728293031323334 |
- require('dotenv').config({ path: "../.env" });
- const bs58 = require("bs58");
- const PythUpgradable = artifacts.require("PythUpgradable");
- const WormholeReceiver = artifacts.require("WormholeReceiver");
- const pyth2WormholeChainId = process.env.PYTH_TO_WORMHOLE_CHAIN_ID;
- const pyth2WormholeEmitter = process.env.PYTH_TO_WORMHOLE_EMITTER;
- const { deployProxy } = require("@openzeppelin/truffle-upgrades");
- const tdr = require('truffle-deploy-registry');
- console.log("pyth2WormholeEmitter: " + pyth2WormholeEmitter)
- console.log("pyth2WormholeChainId: " + pyth2WormholeChainId)
- module.exports = async function (deployer, network) {
- // Deploy the proxy. This will return an instance of PythUpgradable,
- // with the address field corresponding to the fronting ERC1967Proxy.
- let proxyInstance = await deployProxy(PythUpgradable,
- [
- (await WormholeReceiver.deployed()).address,
- pyth2WormholeChainId,
- pyth2WormholeEmitter
- ],
- { deployer });
- // Add the ERC1967Proxy address to the PythUpgradable contract's
- // entry in the registry. This allows us to call upgradeProxy
- // functions with the value of PythUpgradable.deployed().address:
- // e.g. upgradeProxy(PythUpgradable.deployed().address, NewImplementation)
- if (!tdr.isDryRunNetworkName(network)) {
- await tdr.appendInstance(proxyInstance);
- }
- };
|