diff --git a/script/upgrades/MU08/MU08.md b/script/upgrades/MU08/MU08.md index ecbdc16..d4095e9 100644 --- a/script/upgrades/MU08/MU08.md +++ b/script/upgrades/MU08/MU08.md @@ -3,7 +3,7 @@ Transfer ownership of the MentoProtocol contracts to Mento Governance. Proposal Summary: -This proposal transfers ownership of the MentoProtocol contracts to Mento Governance. This will allow Mento token holders to own and manage the protocol. +This proposal transfers ownership of the MentoProtocol contracts to Mento Governance. This will allow Mento token holders to own and manage the protocol. Additionally it adds Reserve Multisig as an "Other Reserve Address" of onchain Reserve contract and removes old other reserve addresses. Contracts to Transfer Ownership: diff --git a/script/upgrades/MU08/MU08.sol b/script/upgrades/MU08/MU08.sol index 9875ecc..44967a5 100644 --- a/script/upgrades/MU08/MU08.sol +++ b/script/upgrades/MU08/MU08.sol @@ -26,6 +26,14 @@ interface IProxyLite { function _transferOwnership(address) external; } +interface IReserveLite { + function getOtherReserveAddresses() external returns (address[] memory); + + function removeOtherReserveAddress(address, uint256) external returns (bool); + + function addOtherReserveAddress(address) external returns (bool); +} + contract MU08 is IMentoUpgrade, GovernanceScript { using Contracts for Contracts.Cache; @@ -64,6 +72,9 @@ contract MU08 is IMentoUpgrade, GovernanceScript { address private governanceFactory; address private timelockProxy; + // Mento Reserve Multisig address: + address private reserveMultisig; + function prepare() public { loadDeployedContracts(); setAddresses(); @@ -116,6 +127,9 @@ contract MU08 is IMentoUpgrade, GovernanceScript { // MentoGovernance contracts: governanceFactory = contracts.deployed("GovernanceFactory"); timelockProxy = IGovernanceFactory(governanceFactory).governanceTimelock(); + + // Mento Reserve Multisig address: + reserveMultisig = contracts.dependency("PartialReserveMultisig"); } function run() public { @@ -133,6 +147,7 @@ contract MU08 is IMentoUpgrade, GovernanceScript { function buildProposal() public returns (ICeloGovernance.Transaction[] memory) { require(transactions.length == 0, "buildProposal() should only be called once"); + proposal_updateOtherReserveAddresses(); proposal_transferTokenOwnership(); proposal_transferMentoV2Ownership(); proposal_transferMentoV1Ownership(); @@ -141,6 +156,29 @@ contract MU08 is IMentoUpgrade, GovernanceScript { return transactions; } + function proposal_updateOtherReserveAddresses() public { + // remove anchorage addressess + address[] memory otherReserves = IReserveLite(reserveProxy).getOtherReserveAddresses(); + for (uint256 i = 0; i < otherReserves.length; i++) { + transactions.push( + ICeloGovernance.Transaction({ + value: 0, + destination: reserveProxy, + // we remove the first index(0) in the list for each iteration because the index changes after each removal + data: abi.encodeWithSelector(IReserveLite(0).removeOtherReserveAddress.selector, otherReserves[i], 0) + }) + ); + } + // add reserve multisig + transactions.push( + ICeloGovernance.Transaction({ + value: 0, + destination: reserveProxy, + data: abi.encodeWithSelector(IReserveLite(0).addOtherReserveAddress.selector, reserveMultisig) + }) + ); + } + function proposal_transferTokenOwnership() public { address[] memory tokenProxies = Arrays.addresses( cUSDProxy, diff --git a/script/upgrades/MU08/MU08Checks.sol b/script/upgrades/MU08/MU08Checks.sol index b7b0503..42eb408 100644 --- a/script/upgrades/MU08/MU08Checks.sol +++ b/script/upgrades/MU08/MU08Checks.sol @@ -22,6 +22,10 @@ interface IProxyLite { function _getOwner() external view returns (address); } +interface IReserveLite { + function getOtherReserveAddresses() external returns (address[] memory); +} + contract MU08Checks is GovernanceScript, Test { using Contracts for Contracts.Cache; @@ -55,6 +59,9 @@ contract MU08Checks is GovernanceScript, Test { address private governanceFactory; address private timelockProxy; + // Mento Reserve Multisig address: + address private reserveMultisig; + function prepare() public { // Load addresses from deployments contracts.loadSilent("MU01-00-Create-Proxies", "latest"); @@ -95,18 +102,32 @@ contract MU08Checks is GovernanceScript, Test { // MentoGovernance contracts: governanceFactory = contracts.deployed("GovernanceFactory"); timelockProxy = IGovernanceFactory(governanceFactory).governanceTimelock(); + + // Mento Reserve Multisig address: + reserveMultisig = contracts.dependency("PartialReserveMultisig"); } function run() public { console.log("\nStarting MU08 checks:"); prepare(); + verifyOtherReservesAddresses(); verifyTokenOwnership(); verifyMentoV2Ownership(); verifyMentoV1Ownership(); verifyGovernanceFactoryOwnership(); } + function verifyOtherReservesAddresses() public { + console.log("\n== Verifying other reserves addresses of onchain Reserve: =="); + address[] memory otherReserves = IReserveLite(reserveProxy).getOtherReserveAddresses(); + + require(otherReserves.length == 1, "❗️❌ Wrong number of other reserves addresses"); + require(otherReserves[0] == reserveMultisig, "❗️❌ Other reserve address is not the Reserve Multisig"); + console.log("🟢Other reserves address was added successfully: ", reserveMultisig); + console.log("🤘🏼Other reserves addresses of onchain Reserve are updated correctly."); + } + function verifyTokenOwnership() public { console.log("\n== Verifying token proxy and implementation ownership: =="); address[] memory tokenProxies = Arrays.addresses(