From 44c089d509406ea3f068498993efc1fffc49f373 Mon Sep 17 00:00:00 2001 From: invocamanman Date: Tue, 5 Nov 2024 14:51:57 +0100 Subject: [PATCH] fix pp info upgrade --- .../upgradePessimistic/upgradePessimistic.ts | 35 ++++++++----------- 1 file changed, 15 insertions(+), 20 deletions(-) diff --git a/upgrade/upgradePessimistic/upgradePessimistic.ts b/upgrade/upgradePessimistic/upgradePessimistic.ts index c9bf51f1..c0bff2eb 100644 --- a/upgrade/upgradePessimistic/upgradePessimistic.ts +++ b/upgrade/upgradePessimistic/upgradePessimistic.ts @@ -9,6 +9,7 @@ import * as dotenv from "dotenv"; dotenv.config({path: path.resolve(__dirname, "../../.env")}); import {ethers, upgrades} from "hardhat"; import {PolygonRollupManager, PolygonZkEVM} from "../../typechain-types"; +import {proxy} from "../../typechain-types/@openzeppelin/contracts"; const pathOutputJson = path.join(__dirname, "./upgrade_output.json"); @@ -165,34 +166,28 @@ async function main() { // Decode the scheduleData for better readability const timelockTx = timelockContractFactory.interface.parseTransaction({data: scheduleData}); - const paramsArray = timelockTx?.fragment.inputs; - const objectDecoded = {}; + const paramsArray = timelockTx?.fragment.inputs as any; + const objectDecoded = {} as any; for (let i = 0; i < paramsArray?.length; i++) { const currentParam = paramsArray[i]; objectDecoded[currentParam.name] = timelockTx?.args[i]; - if (currentParam.name == "payloads") { - // for each payload - const payloads = timelockTx?.args[i]; - for (let j = 0; j < payloads.length; j++) { - const data = payloads[j]; - const decodedProxyAdmin = proxyAdmin.interface.parseTransaction({ - data, - }); + if (currentParam.name == "data") { + const decodedProxyAdmin = proxyAdmin.interface.parseTransaction({ + data: timelockTx?.args[i], + }); + const objectDecodedData = {} as any; + const paramsArrayData = decodedProxyAdmin?.fragment.inputs as any; - const resultDecodeProxyAdmin = {}; - resultDecodeProxyAdmin.signature = decodedProxyAdmin?.signature; - resultDecodeProxyAdmin.selector = decodedProxyAdmin?.selector; + objectDecodedData.signature = decodedProxyAdmin?.signature; + objectDecodedData.selector = decodedProxyAdmin?.selector; - const paramsArrayData = decodedProxyAdmin?.fragment.inputs; - - for (let n = 0; n < paramsArrayData?.length; n++) { - const currentParam = paramsArrayData[n]; - resultDecodeProxyAdmin[currentParam.name] = decodedProxyAdmin?.args[n]; - } - objectDecoded[`decodePayload_${j}`] = resultDecodeProxyAdmin; + for (let j = 0; j < paramsArrayData?.length; j++) { + const currentParam = paramsArrayData[j]; + objectDecodedData[currentParam.name] = decodedProxyAdmin?.args[j]; } + objectDecoded["decodedData"] = objectDecodedData; } }