From c7821b7f4c0332fc924b11171437247b511da5fa Mon Sep 17 00:00:00 2001 From: Nelson Taveras <4562733+nvtaveras@users.noreply.github.com> Date: Thu, 29 Aug 2024 13:39:01 +0200 Subject: [PATCH] chore: small changes --- script/upgrades/MU08/MU08.sol | 17 ++++++++++++----- script/upgrades/MU08/MU08Checks.sol | 13 ++++++++++++- 2 files changed, 24 insertions(+), 6 deletions(-) diff --git a/script/upgrades/MU08/MU08.sol b/script/upgrades/MU08/MU08.sol index c3e1ecb..7a3cda7 100644 --- a/script/upgrades/MU08/MU08.sol +++ b/script/upgrades/MU08/MU08.sol @@ -136,10 +136,16 @@ contract MU08 is IMentoUpgrade, GovernanceScript { transferOwnership(tokenProxies[i]); } - // Transfer ownership of the cUSD implementation all the token proxies - // are pointing to the same StableTokenV2 implementation - address implementation = IProxyLite(cUSDProxy)._getImplementation(); - transferOwnership(implementation); + // All the token proxies are pointing to the same StableTokenV2 implementation (cUSD) + // so we only need to transfer ownership of that single contract. + address sharedImplementation = IProxyLite(cUSDProxy)._getImplementation(); + for (uint i = 0; i < tokenProxies.length; i++) { + require( + IProxyLite(tokenProxies[i])._getImplementation() == sharedImplementation, + "Token proxies not poiting to cUSD implementation" + ); + } + transferOwnership(sharedImplementation); } function proposal_transferMentoV2Ownership() public { @@ -161,6 +167,8 @@ contract MU08 is IMentoUpgrade, GovernanceScript { } function proposal_transferMentoV1Ownership() public { + // For some reason Mento V1 implementation contracts were not transferred to Celo Governance and are + // owned by the original deployer address. Therefore we can only transfer ownership of the proxies. address[] memory mentoV1Proxies = Arrays.addresses( exchangeProxy, exchangeEURProxy, @@ -170,7 +178,6 @@ contract MU08 is IMentoUpgrade, GovernanceScript { for (uint i = 0; i < mentoV1Proxies.length; i++) { transferOwnership(mentoV1Proxies[i]); address implementation = IProxyLite(mentoV1Proxies[i])._getImplementation(); - transferOwnership(implementation); } } diff --git a/script/upgrades/MU08/MU08Checks.sol b/script/upgrades/MU08/MU08Checks.sol index a34727b..7d24123 100644 --- a/script/upgrades/MU08/MU08Checks.sol +++ b/script/upgrades/MU08/MU08Checks.sol @@ -154,13 +154,24 @@ contract MU08Checks is GovernanceScript, Test { address implementation = IProxyLite(proxy)._getImplementation(); address implementationOwner = IOwnableLite(implementation).owner(); require(implementationOwner != address(0), "❗️❌ Implementation not owned by anybody"); - if (implementationOwner != timelockProxy) { + + // Note: Mento V1 contracts are owned by the original deployer address and not by Celo Governance, + // so we are not able to transfer them. Since they are deprecated anyways we are fine with this. + if (implementationOwner != timelockProxy && !isMentoV1Contract(proxy)) { console.log("🟡 Warning Implementation:[%s] ownership not transferred to Mento Governance 🟡 ", implementation); } else { console.log("🟢 Implementation:[%s] ownership transferred to Mento Governance", implementation); } } + function isMentoV1Contract(address contractAddr) internal view returns (bool) { + return + contractAddr == exchangeProxy || + contractAddr == exchangeEURProxy || + contractAddr == exchangeBRLProxy || + contractAddr == grandaMentoProxy; + } + function verifyNonupgradeableContractsOwnership(address nonupgradeableContract) public { address contractOwner = IOwnableLite(nonupgradeableContract).owner(); require(contractOwner == timelockProxy, "❗️❌ Contract ownership not transferred to Mento Governance");