Skip to content

Commit

Permalink
chore: add migration script for ronin-mainnet
Browse files Browse the repository at this point in the history
  • Loading branch information
TuDo1403 committed Dec 5, 2023
1 parent 0512bdf commit 223c87e
Show file tree
Hide file tree
Showing 4 changed files with 49 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -45,16 +45,18 @@ contract Migration__20231123_UpgradeAuctionClaimeUnbiddedNames is RNSDeploy {
}

vm.revertTo(snapshotId);
uint256 firstFailId;
uint256 firstFailId = type(uint256).max;
for (uint256 i; i < domainAuctions.length; ++i) {
if (domainAuctions[i].bid.bidder != address(0x0)) {
firstFailId = reservedIds[i];
break;
}
}
// !allowFailure
vm.prank(operator);
vm.expectRevert(abi.encodeWithSelector(INSAuction.AlreadyBidding.selector, firstFailId));
claimeds = auction.bulkClaimUnbiddedNames(tos, reservedIds, false);
if (firstFailId != type(uint256).max) {
// !allowFailure
vm.prank(operator);
vm.expectRevert(abi.encodeWithSelector(INSAuction.AlreadyBidding.selector, firstFailId));
claimeds = auction.bulkClaimUnbiddedNames(tos, reservedIds, false);
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.19;

import { Network, RNSDeploy } from "script/RNSDeploy.s.sol";

abstract contract Config__Mainnet20231205 is RNSDeploy {
function _buildMigrationConfig() internal view virtual override returns (Config memory config) {
config = super._buildMigrationConfig();
if (_network == Network.RoninMainnet) {
config.rnsOperationOwner = 0x1FF1edE0242317b8C4229fC59E64DD93952019ef;
} else {
revert("Missing config");
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.19;

import { ContractKey } from "foundry-deployment-kit/configs/ContractConfig.sol";
import { Network, Config__Mainnet20231205 } from "script/20231205-deploy-upgrade-auction-and-deploy-rns-operation/20231205_MainnetConfig.s.sol";
import { Migration__20231123_UpgradeAuctionClaimeUnbiddedNames as UpgradeAuctionScript } from "script/20231123-upgrade-auction-claim-unbidded-names/20231123_UpgradeAuctionClaimUnbiddedNames.s.sol";
import { RNSOperation, Migration__20231124_DeployRNSOperation as DeployRNSOperationScript } from "script/20231124-deploy-rns-operation/20231124_DeployRNSOperation.s.sol";

contract Migration__20231205_UpgradeRNSAuctionAndDeployRNSOperation is Config__Mainnet20231205 {
function run() public trySetUp onMainnet {
Config memory config = getConfig();

// upgrade rns auction contract
new UpgradeAuctionScript().run();
// deploy rns operation contract
new DeployRNSOperationScript().run();

RNSOperation rnsOperation = RNSOperation(_config.getAddressFromCurrentNetwork(ContractKey.RNSOperation));

// transfer owner ship for RNSOperation
vm.broadcast(rnsOperation.owner());
rnsOperation.transferOwnership(config.rnsOperationOwner);

assertTrue(rnsOperation.owner() == config.rnsOperationOwner);
}
}
1 change: 1 addition & 0 deletions script/RNSDeploy.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ abstract contract RNSDeploy is BaseDeploy {
address controller;
uint8 minWord;
uint8 maxWord;
address rnsOperationOwner;
address operator;
address[] controllerOperators;
address[] auctionOperators;
Expand Down

0 comments on commit 223c87e

Please sign in to comment.