diff --git a/tasks/misc/transfer-protocol-ownership.ts b/tasks/misc/transfer-protocol-ownership.ts index 91c35fb..441fa90 100644 --- a/tasks/misc/transfer-protocol-ownership.ts +++ b/tasks/misc/transfer-protocol-ownership.ts @@ -1,9 +1,5 @@ import { POOL_ADMIN } from "./../../helpers/constants"; import { FORK } from "./../../helpers/hardhat-config-helpers"; -import { - EMISSION_MANAGER_ID, - POOL_ADDRESSES_PROVIDER_ID, -} from "./../../helpers/deploy-ids"; import { getACLManager, getEmissionManager, @@ -13,12 +9,8 @@ import { getWrappedTokenGateway, } from "./../../helpers/contract-getters"; import { task } from "hardhat/config"; -import { getAddressFromJson, waitForTx } from "../../helpers/utilities/tx"; +import { waitForTx } from "../../helpers/utilities/tx"; import { exit } from "process"; -import { - GOVERNANCE_BRIDGE_EXECUTOR, - MULTISIG_ADDRESS, -} from "../../helpers/constants"; task( `transfer-protocol-ownership`, @@ -68,27 +60,12 @@ task( const emissionManager = await getEmissionManager(); const currentOwner = await poolAddressesProvider.owner(); - const paraswapSwapAdapter = await getOwnableContract( - await ( - await hre.deployments.get("ParaSwapLiquiditySwapAdapter") - ).address - ); - const paraswapRepayAdapter = await getOwnableContract( - await ( - await hre.deployments.get("ParaSwapRepayAdapter") - ).address - ); - const paraswapWithdrawSwapAdapter = await getOwnableContract( - await ( - await hre.deployments.get("ParaSwapWithdrawSwapAdapter") - ).address - ); if (currentOwner === desiredAdmin) { console.log( "- This market already transferred the ownership to desired multisig" ); - exit(0); + return; } if (currentOwner !== poolAdmin) { console.log( @@ -101,28 +78,54 @@ task( } /** Start of Paraswap Helpers Ownership */ - const isDeployerAdminParaswapRepayAdapter = - (await paraswapRepayAdapter.owner()) == deployer; - if (isDeployerAdminParaswapRepayAdapter) { - await paraswapRepayAdapter.transferOwnership(desiredAdmin); - console.log("- Transferred ParaswapRepayAdapter ownership"); + const ParaswapRepayAdapterArtifact = await hre.deployments.getOrNull( + "ParaSwapRepayAdapter" + ); + if (ParaswapRepayAdapterArtifact) { + const paraswapRepayAdapter = await getOwnableContract( + ParaswapRepayAdapterArtifact.address + ); + const isDeployerAdminParaswapRepayAdapter = + (await paraswapRepayAdapter.owner()) == deployer; + + if (isDeployerAdminParaswapRepayAdapter) { + await paraswapRepayAdapter.transferOwnership(desiredAdmin); + console.log("- Transferred ParaswapRepayAdapter ownership"); + } } - const isDeployerAdminParaswapSwapAdapter = - (await paraswapSwapAdapter.owner()) == deployer; + const paraswapSwapAdapterArtifact = await hre.deployments.getOrNull( + "ParaSwapLiquiditySwapAdapter" + ); + if (paraswapSwapAdapterArtifact) { + const paraswapSwapAdapter = await getOwnableContract( + paraswapSwapAdapterArtifact.address + ); + const isDeployerAdminParaswapSwapAdapter = + (await paraswapSwapAdapter.owner()) == deployer; - if (isDeployerAdminParaswapSwapAdapter) { - await paraswapSwapAdapter.transferOwnership(desiredAdmin); - console.log("- Transferred ParaswapSwapAdapter ownership"); + if (isDeployerAdminParaswapSwapAdapter) { + await paraswapSwapAdapter.transferOwnership(desiredAdmin); + console.log("- Transferred ParaswapSwapAdapter ownership"); + } } - const isDeployerAdminParaswapWithdrawSwapAdapter = - (await paraswapWithdrawSwapAdapter.owner()) == deployer; + const paraSwapWithdrawSwapAdapterArtifact = await hre.deployments.getOrNull( + "ParaSwapWithdrawSwapAdapter" + ); + if (paraSwapWithdrawSwapAdapterArtifact) { + const paraswapWithdrawSwapAdapter = await getOwnableContract( + paraSwapWithdrawSwapAdapterArtifact.address + ); + + const isDeployerAdminParaswapWithdrawSwapAdapter = + (await paraswapWithdrawSwapAdapter.owner()) == deployer; - if (isDeployerAdminParaswapWithdrawSwapAdapter) { - await paraswapWithdrawSwapAdapter.transferOwnership(desiredAdmin); - console.log("- Transferred ParaswapWithdrawSwapAdapter ownership"); + if (isDeployerAdminParaswapWithdrawSwapAdapter) { + await paraswapWithdrawSwapAdapter.transferOwnership(desiredAdmin); + console.log("- Transferred ParaswapWithdrawSwapAdapter ownership"); + } } /** End of Paraswap Helpers Ownership */ diff --git a/tasks/misc/view-protocol-roles.ts b/tasks/misc/view-protocol-roles.ts index 13c2695..6eac267 100644 --- a/tasks/misc/view-protocol-roles.ts +++ b/tasks/misc/view-protocol-roles.ts @@ -8,7 +8,6 @@ import { } from "./../../helpers/constants"; import { AaveEcosystemReserveController, - EmissionManager, WrappedTokenGatewayV3, } from "./../../typechain"; import { @@ -16,7 +15,6 @@ import { getIncentivesV2, getOwnableContract, } from "./../../helpers/contract-getters"; -import { EMISSION_MANAGER_ID } from "./../../helpers/deploy-ids"; import { FORK } from "../../helpers/hardhat-config-helpers"; import { TREASURY_PROXY_ID, @@ -64,9 +62,7 @@ task( const emissionManager = await getEmissionManager(); console.log("--- Current deployer addresses ---"); - console.table({ - poolAdmin, - }); + console.table({ poolAdmin }); console.log("--- Multisig and expected contract addresses ---"); console.table({ multisig: desiredAdmin, @@ -121,22 +117,6 @@ task( ); } - const paraswapSwapAdapter = await getOwnableContract( - await ( - await hre.deployments.get("ParaSwapLiquiditySwapAdapter") - ).address - ); - const paraswapRepayAdapter = await getOwnableContract( - await ( - await hre.deployments.get("ParaSwapRepayAdapter") - ).address - ); - const paraswapWithdrawSwapAdapter = await getOwnableContract( - await ( - await hre.deployments.get("ParaSwapWithdrawSwapAdapter") - ).address - ); - /** Output of results*/ const result = [ { @@ -242,22 +222,48 @@ task( (await poolAddressesProvider.getAddress(incentivesControllerId)) === rewardsController.address, }, - { + ]; + + const ParaswapRepayAdapterArtifact = await hre.deployments.getOrNull( + "ParaSwapRepayAdapter" + ); + if (ParaswapRepayAdapterArtifact) { + const paraswapRepayAdapter = await getOwnableContract( + ParaswapRepayAdapterArtifact.address + ); + + result.push({ role: "ParaSwapRepayAdapter owner", address: await paraswapRepayAdapter.owner(), assert: (await paraswapRepayAdapter.owner()) == desiredAdmin, - }, - { + }); + } + const paraswapSwapAdapterArtifact = await hre.deployments.getOrNull( + "ParaSwapLiquiditySwapAdapter" + ); + if (paraswapSwapAdapterArtifact) { + const paraswapSwapAdapter = await getOwnableContract( + paraswapSwapAdapterArtifact.address + ); + result.push({ role: "ParaSwapSwapAdapter owner", address: await paraswapSwapAdapter.owner(), assert: (await paraswapSwapAdapter.owner()) == desiredAdmin, - }, - { + }); + } + const paraswapWithdrawSwapAdapterArtifact = await hre.deployments.getOrNull( + "ParaSwapWithdrawSwapAdapter" + ); + if (paraswapWithdrawSwapAdapterArtifact) { + const paraswapWithdrawSwapAdapter = await getOwnableContract( + paraswapWithdrawSwapAdapterArtifact.address + ); + result.push({ role: "ParaSwapWithdrawSwapAdapter owner", address: await paraswapWithdrawSwapAdapter.owner(), assert: (await paraswapWithdrawSwapAdapter.owner()) == desiredAdmin, - }, - ]; + }); + } // Add emission manager check if 3.0.1v try {