Skip to content

Commit

Permalink
script: prepare script + param for RNSCommission deploy
Browse files Browse the repository at this point in the history
  • Loading branch information
tringuyenskymavis committed Jun 24, 2024
1 parent c39ea0f commit 3ccf07c
Show file tree
Hide file tree
Showing 4 changed files with 55 additions and 0 deletions.
1 change: 1 addition & 0 deletions script/GeneralConfig.sol
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ contract GeneralConfig is BaseGeneralConfig {
_mapContractName(Contract.OwnedMulticaller);
_mapContractName(Contract.RNSReverseRegistrar);
_mapContractName(Contract.RONRegistrarController);
_mapContractName(Contract.RNSCommission);
}

function _mapContractName(Contract contractEnum) internal {
Expand Down
16 changes: 16 additions & 0 deletions script/Migration.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,22 @@ abstract contract Migration is BaseMigration {
param.rnsUnified.protectedSettler = defaultAdmin;
param.rnsUnified.gracePeriod = 90 days;
param.rnsUnified.baseTokenURI = "https://metadata-rns.skymavis.one/saigon/";

// RNSCommission
param.rnsCommission.admin = defaultAdmin;
param.rnsCommission.commissionSetters = new address[](1);
param.rnsCommission.commissionSetters[0] = defaultAdmin;

param.rnsCommission.allowedSenders = new address[](2);

param.rnsCommission.treasuryCommission = new INSCommission.Commission[](2);
param.rnsCommission.treasuryCommission[0].recipient = payable(0x32f830633DfC64E213EAC4f80660B65CF722dD0B);
param.rnsCommission.treasuryCommission[0].ratio = 70_00;
param.rnsCommission.treasuryCommission[0].name = "Sky Mavis";

param.rnsCommission.treasuryCommission[1].recipient = payable(0x407E58588c983643a0A121eeaCB3661289235327);
param.rnsCommission.treasuryCommission[1].ratio = 30_00;
param.rnsCommission.treasuryCommission[1].name = "Ronin";
} else if (network() == DefaultNetwork.RoninMainnet.key()) {
address duke = 0x0F68eDBE14C8f68481771016d7E2871d6a35DE11;
address andy = 0xEd4A9F48a62Fb6FdcfB45Bb00C9f61D1A436E58C;
Expand Down
29 changes: 29 additions & 0 deletions script/contracts/RNSCommissionDeploy.s.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.19;

import { RNSCommission } from "@rns-contracts/RNSCommission.sol";
import { ISharedArgument, Migration } from "script/Migration.s.sol";
import { Contract } from "script/utils/Contract.sol";
import { RONRegistrarController, RONRegistrarControllerDeploy } from "./RONRegistrarControllerDeploy.s.sol";
import { Contract } from "script/utils/Contract.sol";
import { RNSAuction, RNSAuctionDeploy } from "./RNSAuctionDeploy.s.sol";

contract RNSCommissionDeploy is Migration {
function _defaultArguments() internal virtual override returns (bytes memory args) {
ISharedArgument.RNSCommissionParam memory param = config.sharedArguments().rnsCommission;
address[] memory allowedSenders;
allowedSenders = new address[](2);
allowedSenders[0] = param.allowedSenders[0] == address(0)
? address(RNSAuction(loadContract(Contract.RNSAuction.key())))
: param.allowedSenders[0];
allowedSenders[1] = param.allowedSenders[1] == address(0)
? address(RONRegistrarController(loadContract(Contract.RONRegistrarController.key())))
: param.allowedSenders[1];

args = abi.encodeCall(RNSCommission.initialize, (param.admin, param.treasuryCommission, allowedSenders));
}

function run() public virtual returns (RNSCommission) {
return RNSCommission(_deployProxy(Contract.RNSCommission.key()));
}
}
9 changes: 9 additions & 0 deletions script/interfaces/ISharedArgument.sol
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import { RNSUnified } from "@rns-contracts/RNSUnified.sol";
import { RNSDomainPrice } from "@rns-contracts/RNSDomainPrice.sol";
import { RNSOperation } from "@rns-contracts/utils/RNSOperation.sol";
import { OwnedMulticaller } from "@rns-contracts/utils/OwnedMulticaller.sol";
import { RNSCommission, INSCommission } from "@rns-contracts/RNSCommission.sol";

interface ISharedArgument is IGeneralConfig {
struct NameCheckerParam {
Expand Down Expand Up @@ -86,6 +87,13 @@ interface ISharedArgument is IGeneralConfig {
RNSReverseRegistrar rnsReverseRegistrar;
}

struct RNSCommissionParam {
address admin;
address[] commissionSetters;
INSCommission.Commission[] treasuryCommission;
address[] allowedSenders;
}

struct SharedParameter {
NameCheckerParam nameChecker;
OwnedMulticallerParam ownedMulticaller;
Expand All @@ -96,6 +104,7 @@ interface ISharedArgument is IGeneralConfig {
RNSReverseRegistrarParam rnsReverseRegistrar;
RNSUnifiedParam rnsUnified;
RONRegistrarControllerParam ronRegistrarController;
RNSCommissionParam rnsCommission;
}

function sharedArguments() external view returns (SharedParameter memory param);
Expand Down

0 comments on commit 3ccf07c

Please sign in to comment.