Skip to content

Commit 9ac96f2

Browse files
committed
verify new array test
1 parent eb173d8 commit 9ac96f2

2 files changed

Lines changed: 21 additions & 7 deletions

File tree

protocol-units/settlement/mcr/contracts/script/MOVETokenDeployer.s.sol

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,9 +84,11 @@ contract MOVETokenDeployer is Helper {
8484
assert(deployment.movementLabsSafe != address(0));
8585

8686
// bridge address
87-
address[2] memory burn = [0xf1dF43A3053cd18E477233B59a25fC483C2cBe0f, 0x3073f7aAA4DB83f95e9FFf17424F71D4751a3073];
87+
address[] memory burn = new address[](2);
88+
burn[0] = 0xf1dF43A3053cd18E477233B59a25fC483C2cBe0f;
89+
burn[1] = 0x3073f7aAA4DB83f95e9FFf17424F71D4751a3073;
8890
// Prepare the data for the upgrade
89-
bytes upgradeCalldata = abi.encodeWithSignature(
91+
bytes memory upgradeCalldata = abi.encodeWithSignature(
9092
"upgradeAndCall(address,address,bytes)",
9193
address(deployment.move),
9294
address(newMoveImplementation),

protocol-units/settlement/mcr/contracts/test/token/MOVETokenV2.t.sol

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -227,6 +227,8 @@ contract MOVETokenV2Test is Test {
227227
* @param other Random address to test role assignment
228228
*/
229229
function testAdminRoleFuzz(address other) public {
230+
vm.assume(other != oldFoundation);
231+
vm.assume(other != address(0));
230232
assertEq(move.hasRole(DEFAULT_ADMIN_ROLE, other), false);
231233

232234
vm.expectRevert(
@@ -264,8 +266,9 @@ contract MOVETokenV2Test is Test {
264266
assertEq(move.hasRole(DEFAULT_ADMIN_ROLE, labs), false);
265267

266268
// Define deprecated addresses whose balances will be burned during upgrade
267-
address[] memory deprecated = new address[](1);
269+
address[] memory deprecated = new address[](2);
268270
deprecated[0] = bridge;
271+
deprecated[1] = address(moveProxy); // Token address
269272

270273
bytes memory initializeData =
271274
abi.encodeWithSignature("initialize(address,address,address[])", labs, oldFoundation, deprecated);
@@ -277,6 +280,8 @@ contract MOVETokenV2Test is Test {
277280
initializeData
278281
);
279282

283+
console.logBytes(upgradeData);
284+
280285
vm.prank(labs);
281286
timelock.schedule(address(admin), 0, upgradeData, bytes32(0), bytes32(0), minDelay);
282287

@@ -297,8 +302,9 @@ contract MOVETokenV2Test is Test {
297302
*/
298303
function testUpgradeFromTimelock() public {
299304
// Define deprecated addresses whose balances will be burned during upgrade
300-
address[] memory deprecated = new address[](1);
305+
address[] memory deprecated = new address[](2);
301306
deprecated[0] = bridge;
307+
deprecated[1] = address(moveProxy); // Token address
302308

303309
bytes memory initializeData =
304310
abi.encodeWithSignature("initialize(address,address,address[])", labs, oldFoundation, deprecated);
@@ -320,13 +326,14 @@ contract MOVETokenV2Test is Test {
320326
vm.warp(block.timestamp + minDelay + 1);
321327

322328
uint256 bridgeBalance = move.balanceOf(bridge);
329+
uint256 proxyBalance = move.balanceOf(address(moveProxy));
323330

324331
vm.prank(foundation);
325332
timelock.execute(address(admin), 0, upgradeData, bytes32(0), bytes32(0));
326333

327334
// Verify V1 token state after upgrade with old interface
328335
assertEq(move.decimals(), MOVE_DECIMALS);
329-
assertEq(move.totalSupply(), TOTAL_SUPPLY - bridgeBalance);
336+
assertEq(move.totalSupply(), TOTAL_SUPPLY - (bridgeBalance + proxyBalance));
330337
assertEq(move.balanceOf(bridge), 0);
331338
assertEq(move.hasRole(DEFAULT_ADMIN_ROLE, oldFoundation), false);
332339
assertEq(move.hasRole(DEFAULT_ADMIN_ROLE, foundation), false);
@@ -335,7 +342,7 @@ contract MOVETokenV2Test is Test {
335342

336343
// Verify V2 token state after upgrade
337344
assertEq(move2.decimals(), 8);
338-
assertEq(move2.totalSupply(), 10000000000 * 10 ** 8 - bridgeBalance);
345+
assertEq(move2.totalSupply(), 10000000000 * 10 ** 8 - (bridgeBalance + proxyBalance));
339346
assertEq(move2.balanceOf(bridge), 0);
340347
assertEq(move2.hasRole(DEFAULT_ADMIN_ROLE, oldFoundation), false);
341348
assertEq(move2.hasRole(DEFAULT_ADMIN_ROLE, foundation), false);
@@ -364,8 +371,9 @@ contract MOVETokenV2Test is Test {
364371
* including labs, oldFoundation, foundation, and proxy admin
365372
*/
366373
function testCannotReinitialize2() public {
367-
address[] memory deprecated = new address[](1);
374+
address[] memory deprecated = new address[](2);
368375
deprecated[0] = bridge;
376+
deprecated[1] = address(moveProxy); // Token address
369377

370378
bytes memory initializeData =
371379
abi.encodeWithSignature("initialize(address,address,address[])", labs, oldFoundation, deprecated);
@@ -414,6 +422,9 @@ contract MOVETokenV2Test is Test {
414422
*/
415423
function testAdminRole2Fuzz(address other) public {
416424
testUpgradeFromTimelock();
425+
vm.assume(other != address(admin));
426+
vm.assume(other != labs);
427+
vm.assume(other != address(0));
417428
assertEq(move2.hasRole(DEFAULT_ADMIN_ROLE, other), false);
418429

419430
vm.prank(other);
@@ -463,6 +474,7 @@ contract MOVETokenV2Test is Test {
463474
function testDeprecatedBridge() public {
464475
testSend();
465476
assertEq(move2.balanceOf(bridge), 0);
477+
assertEq(move2.balanceOf(address(moveProxy)), 0);
466478

467479
uint256 amount = 1 * 10 ** MOVE_DECIMALS;
468480
vm.prank(anchorage);

0 commit comments

Comments
 (0)