Skip to content

Commit

Permalink
test: add check that pulls remaining balance from mento reserve
Browse files Browse the repository at this point in the history
  • Loading branch information
nvtaveras committed Nov 14, 2024
1 parent 1ea3f97 commit 549d4f4
Showing 1 changed file with 22 additions and 3 deletions.
25 changes: 22 additions & 3 deletions script/upgrades/MU08/MU08Checks.sol
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ contract MU08Checks is GovernanceScript, Test {
verifyCustodyReserveSetup();
verifyReturnOfCelo();

verifyOtherReservesAddresses();
verifyMentoReserveFinalSetup();
verifyTokenOwnership();
verifyMentoV2Ownership();
verifyMentoV1Ownership();
Expand Down Expand Up @@ -219,14 +219,33 @@ contract MU08Checks is GovernanceScript, Test {
console.log("🟢 Celo Governance can pull remaining CELO from custody reserve");
}

function verifyOtherReservesAddresses() public {
console.log("\n== Verifying other reserves addresses of onchain Reserve: ==");
function verifyMentoReserveFinalSetup() public {
console.log("\n== Verifying Mento Reserve final setup: ==");
// 1. There should only be one other reserve address, which is the Reserve Multisig
// console.log("\n== Verifying other reserves addresses of onchain Reserve: ==");
address[] memory otherReserves = IReserve(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.");

// 2. Mento Reserve multisig can pull the remaining CELO from the Reserve
uint256 multisigBalanceBefore = IERC20(CELOProxy).balanceOf(reserveMultisig);
uint256 reserveBalanceBefore = IERC20(CELOProxy).balanceOf(reserveProxy);

vm.prank(reserveMultisig);
IReserve(reserveProxy).transferCollateralAsset(CELOProxy, address(uint160(reserveMultisig)), reserveBalanceBefore);

require(
IERC20(CELOProxy).balanceOf(reserveMultisig) == multisigBalanceBefore + reserveBalanceBefore,
"❗️❌ Mento Governance can't pull remaining CELO from Reserve"
);
require(
IERC20(CELOProxy).balanceOf(reserveProxy) == 0,
"❗️❌ Reserve balance is not 0 after pulling remaining CELO"
);
console.log("🟢 Mento Governance can pull remaining CELO from Mento reserve");
}

function verifyTokenOwnership() public {
Expand Down

0 comments on commit 549d4f4

Please sign in to comment.