diff --git a/migrations/scripts/7_WitnetPriceFeeds.js b/migrations/scripts/7_WitnetPriceFeeds.js index 9e891e8e..d160c50e 100644 --- a/migrations/scripts/7_WitnetPriceFeeds.js +++ b/migrations/scripts/7_WitnetPriceFeeds.js @@ -33,8 +33,12 @@ module.exports = async function (deployer, network, [, from]) { return } - const artifactNames = merge(settings.artifacts.default, settings.artifacts[ecosystem], settings.artifacts[network]) - const WitnetPriceFeedsImplementation = artifacts.require(artifactNames.WitnetPriceFeeds) + const artifactsName = merge(settings.artifacts.default, settings.artifacts[ecosystem], settings.artifacts[network]) + const artifactNames = artifactsName.WitnetPriceFeeds?.split(":") + const bypass = artifactNames.length > 1 + const implName = artifactNames[0] + + const WitnetPriceFeedsImplementation = artifacts.require(implName) if (utils.isNullAddress(addresses[ecosystem][network]?.WitnetPriceFeedsLib)) { await deployer.deploy(WitnetPriceFeedsLib, { from }) @@ -99,13 +103,21 @@ module.exports = async function (deployer, network, [, from]) { } let router if (utils.isNullAddress(addresses[ecosystem][network]?.WitnetPriceFeedsImplementation)) { - await deployer.deploy( - WitnetPriceFeedsImplementation, - WitnetRequestBoard.address, - true, - utils.fromAscii(version), - { from } - ) + if (bypass) { + await deployer.deploy( + WitnetPriceFeedsImplementation, + /* _v20 address */ addresses[ecosystem][network].WitnetPriceFeedsV20, + /* _isUpgradeable */ true, + /* _versionTag */ utils.fromAscii(version), + { from } + ) + } else { + await deployer.deploy( + WitnetPriceFeedsImplementation, + WitnetRequestBoard.address, true, utils.fromAscii(version), + { from } + ) + } router = await WitnetPriceFeedsImplementation.deployed() addresses[ecosystem][network].WitnetPriceFeedsImplementation = router.address if (!isDryRun) { @@ -134,7 +146,9 @@ module.exports = async function (deployer, network, [, from]) { ["y", "yes"].includes((await utils.prompt(" > Upgrade the proxy ? [y/N] ")).toLowerCase().trim()) ) { try { - const tx = await proxy.upgradeTo(router.address, "0x", { from }) + const tx = await proxy.upgradeTo(router.address, "0x", { + from: bypass ? '0xF121b71715E71DDeD592F1125a06D4ED06F0694D' : from + }) console.info(" => transaction hash :", tx.receipt.transactionHash) console.info(" => transaction gas :", tx.receipt.gasUsed) console.info(" > Done.") diff --git a/migrations/witnet.addresses.json b/migrations/witnet.addresses.json index 76ece538..acddf73f 100644 --- a/migrations/witnet.addresses.json +++ b/migrations/witnet.addresses.json @@ -775,7 +775,8 @@ "WitnetRequestBoard": "0x777777772C24e6CD34B464D1d71616C444254537", "WitnetRequestFactory": "0x1111111FDE7dC956E3d7922Bc779D9E2349Afb63", "WitnetBytecodesImplementation": "0x578F143c36654DD361FdD51F6D2693b4621ac455", - "WitnetPriceFeedsImplementation": "0xA7952bc98AB11b95aa51E52ae61d017D0F084eB8", + "WitnetPriceFeedsImplementation": "0x2f8efDF55330248D072020e112aF622083360814", + "WitnetPriceFeedsUpgradable": "0xA7952bc98AB11b95aa51E52ae61d017D0F084eB8", "WitnetRandomnessImplementation": "0x606E3E55827f82493D481d3dBC2727298e015879", "WitnetRequestBoardImplementation": "0x123a7AcE0879C4645b19A69c2ba8B3E4d01fBfD6", "WitnetRequestBoardTrustableOvm2": "0xDb248F9D510aF57A6f7d009712e45f6cDDEA776d",