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

Commit

Permalink
Add comment to updateEndowmentMultiSigFactory
Browse files Browse the repository at this point in the history
  • Loading branch information
0xNeshi committed Sep 15, 2023
1 parent 8074904 commit 09673a5
Showing 1 changed file with 13 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,14 @@ import {submitMultiSigTx} from "tasks/helpers";
import {IEndowmentMultiSigFactory__factory} from "typechain-types";
import {getAPTeamOwner, getAddresses, logger} from "utils";

/**
* @param newProxyAdmin Address of the new proxy admin.
* @param apTeamSignerPkey Private key of one of the APTeamMultiSig owners
* @param hre @see HardhatRuntimeEnvironment
* @returns boolean value indicating whether proxy admin was updated to `newProxyAdmin` or not
*/
export default async function updateEndowmentMultiSigFactory(
targetAddress: string,
newProxyAdmin: string,
apTeamSignerPkey: string | undefined,
hre: HardhatRuntimeEnvironment
): Promise<boolean> {
Expand All @@ -15,16 +21,16 @@ export default async function updateEndowmentMultiSigFactory(
hre.ethers.provider
);
const oldProxyAdmin = await endowmentMultiSigFactory.getProxyAdmin();
if (oldProxyAdmin === targetAddress) {
logger.out(`"${targetAddress}" is already the proxy admin.`);
if (oldProxyAdmin === newProxyAdmin) {
logger.out(`"${newProxyAdmin}" is already the proxy admin.`);
return true;
}

const apTeamOwner = await getAPTeamOwner(hre, apTeamSignerPkey);

// submitting the Tx
const data = endowmentMultiSigFactory.interface.encodeFunctionData("updateProxyAdmin", [
targetAddress,
newProxyAdmin,
]);
const isExecuted = await submitMultiSigTx(
addresses.multiSig.apTeam.proxy,
Expand All @@ -35,10 +41,10 @@ export default async function updateEndowmentMultiSigFactory(
if (!isExecuted) {
return false;
}
const newProxyAdmin = await endowmentMultiSigFactory.getProxyAdmin();
if (newProxyAdmin !== targetAddress) {
const updatedProxyAdmin = await endowmentMultiSigFactory.getProxyAdmin();
if (updatedProxyAdmin !== newProxyAdmin) {
throw new Error(
`Unexpected: expected new proxy admin "${targetAddress}", but got "${newProxyAdmin}"`
`Unexpected: expected new proxy admin "${newProxyAdmin}", but got "${updatedProxyAdmin}"`
);
}

Expand Down

0 comments on commit 09673a5

Please sign in to comment.