Skip to content
This repository has been archived by the owner on Oct 6, 2023. It is now read-only.

Commit

Permalink
Closes AP-802, AP-803: Verify proxies (#389)
Browse files Browse the repository at this point in the history
* Verify proxies instead of implementations

* Add GiftCards contract to verifyAll

* Comments
  • Loading branch information
Nenad Misic authored Sep 22, 2023
1 parent 99030bd commit 3a318a5
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 35 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import {
CharityApplications__factory,
EndowmentMultiSigEmitter__factory,
EndowmentMultiSigFactory__factory,
GiftCards__factory,
IndexFund__factory,
Registrar__factory,
Router__factory,
Expand All @@ -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<ContractFactory>[] {
const result: Deployment<ContractFactory>[] = [];
const deployments: Deployment<ContractFactory>[] = [];

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;
}
6 changes: 3 additions & 3 deletions tasks/manage/verifyAll/verifyAll.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit 3a318a5

Please sign in to comment.