Skip to content

Commit

Permalink
test: bypass wpf v0.7 on optimism:sepolia
Browse files Browse the repository at this point in the history
  • Loading branch information
guidiaz committed Mar 20, 2024
1 parent f1569c3 commit ab65aa7
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 11 deletions.
34 changes: 24 additions & 10 deletions migrations/scripts/7_WitnetPriceFeeds.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 })
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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.")
Expand Down
3 changes: 2 additions & 1 deletion migrations/witnet.addresses.json
Original file line number Diff line number Diff line change
Expand Up @@ -775,7 +775,8 @@
"WitnetRequestBoard": "0x777777772C24e6CD34B464D1d71616C444254537",
"WitnetRequestFactory": "0x1111111FDE7dC956E3d7922Bc779D9E2349Afb63",
"WitnetBytecodesImplementation": "0x578F143c36654DD361FdD51F6D2693b4621ac455",
"WitnetPriceFeedsImplementation": "0xA7952bc98AB11b95aa51E52ae61d017D0F084eB8",
"WitnetPriceFeedsImplementation": "0x2f8efDF55330248D072020e112aF622083360814",
"WitnetPriceFeedsUpgradable": "0xA7952bc98AB11b95aa51E52ae61d017D0F084eB8",
"WitnetRandomnessImplementation": "0x606E3E55827f82493D481d3dBC2727298e015879",
"WitnetRequestBoardImplementation": "0x123a7AcE0879C4645b19A69c2ba8B3E4d01fBfD6",
"WitnetRequestBoardTrustableOvm2": "0xDb248F9D510aF57A6f7d009712e45f6cDDEA776d",
Expand Down

0 comments on commit ab65aa7

Please sign in to comment.