|
|
@@ -0,0 +1,35 @@
|
|
|
+require('dotenv').config({ path: "../.env" });
|
|
|
+const bs58 = require("bs58");
|
|
|
+
|
|
|
+const PythUpgradable = artifacts.require("PythUpgradable");
|
|
|
+
|
|
|
+const wormholeBridgeAddress = process.env.WORMHOME_BRIDGE_ADDRESS;
|
|
|
+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("Wormhole bridge address: " + wormholeBridgeAddress)
|
|
|
+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(PythUpgra§dable,
|
|
|
+ [
|
|
|
+ wormholeBridgeAddress,
|
|
|
+ pyth2WormholeChainId,
|
|
|
+ pyth2WormholeEmitter.toString()
|
|
|
+ ],
|
|
|
+ { 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);
|
|
|
+ }
|
|
|
+};
|