Skip to content

Commit

Permalink
chore: small changes
Browse files Browse the repository at this point in the history
  • Loading branch information
nvtaveras committed Aug 29, 2024
1 parent 3b0dbae commit c7821b7
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 6 deletions.
17 changes: 12 additions & 5 deletions script/upgrades/MU08/MU08.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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,
Expand All @@ -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);
}
}

Expand Down
13 changes: 12 additions & 1 deletion script/upgrades/MU08/MU08Checks.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down

0 comments on commit c7821b7

Please sign in to comment.