From 3a318a5574b0ba8d9917faa02203ed576b32bd9a Mon Sep 17 00:00:00 2001 From: Nenad Misic Date: Fri, 22 Sep 2023 21:11:07 +0200 Subject: [PATCH] Closes AP-802, AP-803: Verify proxies (#389) * Verify proxies instead of implementations * Add GiftCards contract to verifyAll * Comments --- .../{getImplementations.ts => getProxies.ts} | 60 +++++++++---------- tasks/manage/verifyAll/verifyAll.ts | 6 +- 2 files changed, 31 insertions(+), 35 deletions(-) rename tasks/manage/verifyAll/{getImplementations.ts => getProxies.ts} (50%) diff --git a/tasks/manage/verifyAll/getImplementations.ts b/tasks/manage/verifyAll/getProxies.ts similarity index 50% rename from tasks/manage/verifyAll/getImplementations.ts rename to tasks/manage/verifyAll/getProxies.ts index 88f88c07e..82fe63b0b 100644 --- a/tasks/manage/verifyAll/getImplementations.ts +++ b/tasks/manage/verifyAll/getProxies.ts @@ -5,6 +5,7 @@ import { CharityApplications__factory, EndowmentMultiSigEmitter__factory, EndowmentMultiSigFactory__factory, + GiftCards__factory, IndexFund__factory, Registrar__factory, Router__factory, @@ -13,66 +14,61 @@ import { import {Deployment} from "types"; import {AddressObj, getContractName} from "utils"; -// no need to pass constructor arguments, they're initiated by their proxies using -// their respective initializer functions -export default function getImplementations( +// No need to pass constructor arguments, they're initiated by their proxies using +// their respective initializer functions. +// Proxy verification implicitly includes implementation verification, so there's no +// need to explicitly set implementation contracts to be verified. +export default function getProxies( addresses: AddressObj, hre: HardhatRuntimeEnvironment ): Deployment[] { - const result: Deployment[] = []; + const deployments: Deployment[] = []; - result.push({ - contract: IndexFund__factory.connect(addresses.indexFund.implementation, hre.ethers.provider), + deployments.push({ + contract: IndexFund__factory.connect(addresses.indexFund.proxy, hre.ethers.provider), contractName: getContractName(IndexFund__factory), }); - result.push({ + deployments.push({ contract: CharityApplications__factory.connect( - addresses.multiSig.charityApplications.implementation, + addresses.multiSig.charityApplications.proxy, hre.ethers.provider ), contractName: getContractName(CharityApplications__factory), }); - result.push({ - contract: APTeamMultiSig__factory.connect( - addresses.multiSig.apTeam.implementation, - hre.ethers.provider - ), + deployments.push({ + contract: APTeamMultiSig__factory.connect(addresses.multiSig.apTeam.proxy, hre.ethers.provider), contractName: getContractName(APTeamMultiSig__factory), }); - result.push({ + deployments.push({ contract: EndowmentMultiSigEmitter__factory.connect( - addresses.multiSig.endowment.emitter.implementation, + addresses.multiSig.endowment.emitter.proxy, hre.ethers.provider ), contractName: getContractName(EndowmentMultiSigEmitter__factory), }); - result.push({ + deployments.push({ contract: EndowmentMultiSigFactory__factory.connect( - addresses.multiSig.endowment.factory.implementation, + addresses.multiSig.endowment.factory.proxy, hre.ethers.provider ), contractName: getContractName(EndowmentMultiSigFactory__factory), - constructorArguments: [ - addresses.multiSig.endowment.implementation, - addresses.multiSig.proxyAdmin, - addresses.registrar.proxy, - ], }); - result.push({ - contract: Registrar__factory.connect(addresses.registrar.implementation, hre.ethers.provider), + deployments.push({ + contract: GiftCards__factory.connect(addresses.giftcards.proxy, hre.ethers.provider), + contractName: getContractName(GiftCards__factory), + }); + deployments.push({ + contract: Registrar__factory.connect(addresses.registrar.proxy, hre.ethers.provider), contractName: getContractName(Registrar__factory), }); - result.push({ - contract: Router__factory.connect(addresses.router.implementation, hre.ethers.provider), + deployments.push({ + contract: Router__factory.connect(addresses.router.proxy, hre.ethers.provider), contractName: getContractName(Router__factory), }); - result.push({ - contract: VaultEmitter__factory.connect( - addresses.vaultEmitter.implementation, - hre.ethers.provider - ), + deployments.push({ + contract: VaultEmitter__factory.connect(addresses.vaultEmitter.proxy, hre.ethers.provider), contractName: getContractName(VaultEmitter__factory), }); - return result; + return deployments; } diff --git a/tasks/manage/verifyAll/verifyAll.ts b/tasks/manage/verifyAll/verifyAll.ts index 89ee6089e..bb0363055 100644 --- a/tasks/manage/verifyAll/verifyAll.ts +++ b/tasks/manage/verifyAll/verifyAll.ts @@ -10,7 +10,7 @@ import { import {Deployment} from "types"; import {getAddresses, getChainId, getContractName, getSigners, logger, verify} from "utils"; import getDiamondAddresses from "./getDiamondAddresses"; -import getImplementations from "./getImplementations"; +import getProxies from "./getProxies"; task("manage:verifyAll", "Will verify all the contracts").setAction(async (_, hre) => { try { @@ -65,8 +65,8 @@ task("manage:verifyAll", "Will verify all the contracts").setAction(async (_, hr CONFIG.PROXY_ADMIN_MULTISIG_DATA.transactionExpiry, ], }); - // all contracts hidden behind proxies - deployments.push(...getImplementations(addresses, hre)); + // all contracts' proxies and their implementations + deployments.push(...getProxies(addresses, hre)); for (const deployment of deployments) { await verify(hre, deployment);