Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(script): implement revoke-role #209

Open
wants to merge 15 commits into
base: feature/script
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 14 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,4 @@ yarn-error.log
.yarnrc.yml
script/data/*
dependencies
deployments/**/exported_address
deployments/**/exported_address
27 changes: 24 additions & 3 deletions foundry.toml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,27 @@ runs = 256
runs = 256

[dependencies]
"@fdk" = { version = "0.3.0-beta", url = "https://github.com/axieinfinity/foundry-deployment-kit/archive/refs/tags/v0.3.0-beta.zip" }
"@pythnetwork-pyth-sdk-solidity" = { version = "2.2.0" }
"@openzeppelin-contracts" = { version = "4.9.3" }
fdk = { version = "0.3.1-beta", url = "https://github.com/axieinfinity/foundry-deployment-kit/archive/refs/tags/v0.3.1-beta.zip" }
openzeppelin = { version = "4.9.3", url = "https://github.com/OpenZeppelin/openzeppelin-contracts/archive/refs/tags/v4.9.3.zip" }
pyth-sdk-solidity = { version = "2.2.0", url = "https://github.com/pyth-network/pyth-sdk-solidity/archive/refs/tags/v2.2.0.zip" }


[soldeer]
# whether soldeer manages remappings
remappings_generate = false

# whether soldeer re-generates all remappings when installing, updating or uninstalling deps
remappings_regenerate = false

# whether to suffix the remapping with the version: `name-a.b.c`
remappings_version = true

# a prefix to add to the remappings ("@" would give `@name`)
remappings_prefix = "@"

# where to store the remappings ("txt" for `remappings.txt` or "config" for `foundry.toml`)
# ignored when `soldeer.toml` is used as config (uses `remappings.txt`)
remappings_location = "txt"

# whether to install sub-dependencies or not. If true this wil install the dependencies of dependencies 1 level down.
recursive_deps = true
12 changes: 5 additions & 7 deletions remappings.txt
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
@rns-contracts/=src/
ds-test/=lib/forge-std/lib/ds-test/src/
forge-std/=dependencies/@fdk-0.3.0-beta/dependencies/forge-std-1.8.2/src/
@openzeppelin/contracts/=dependencies/@openzeppelin-contracts-4.9.3/
contract-template/=lib/contract-template/src/
@solady/=dependencies/@fdk-0.3.0-beta/dependencies/solady-0.0.206/src/
forge-std/=dependencies/fdk-0.3.1-beta/dependencies/@forge-std-1.9.1/src/
@openzeppelin/=dependencies/openzeppelin-4.9.3/
@solady/=dependencies/fdk-0.3.1-beta/dependencies/@solady-0.0.228/src/
@ensdomains/ens-contracts/=lib/ens-contracts/contracts/
@ensdomains/buffer/=lib/buffer/
@pythnetwork/=dependencies/@pythnetwork-pyth-sdk-solidity-2.2.0/
@fdk/=dependencies/@fdk-0.3.0-beta/script
@pythnetwork/=dependencies/pyth-sdk-solidity-2.2.0/
@fdk/=dependencies/fdk-0.3.1-beta/script
2 changes: 1 addition & 1 deletion run.sh
Original file line number Diff line number Diff line change
@@ -1 +1 @@
source dependencies/@fdk-0.3.0-beta/run.sh
source dependencies/fdk-0.3.1-beta/run.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.19;

import { console } from "forge-std/console.sol";
import { Contract } from "script/utils/Contract.sol";
import { Migration } from "script/Migration.s.sol";
import { DefaultNetwork } from "@fdk/utils/DefaultNetwork.sol";
import { ERC721 } from "@openzeppelin/contracts/token/ERC721/ERC721.sol";
import { OwnedMulticaller, OwnedMulticallerDeploy } from "script/contracts/OwnedMulticallerDeploy.s.sol";
import { INSDomainPrice } from "src/interfaces/INSDomainPrice.sol";
import { Math } from "@openzeppelin/contracts/utils/math/Math.sol";

contract Migration__01_DeployNew_OwnedMulticaller is Migration {
address internal constant TUDO = 0x0Ebf93387093D7b7cDa9a4dE5d558507810af5eD; // TuDo's trezor

OwnedMulticaller _multicaller;
address internal _rns;
address internal _auction;
address internal _nameChecker;
address internal _domainPrice;
address internal _publicResolver;
address internal _reverseRegistrar;
address internal _ronController;

function run() external onlyOn(DefaultNetwork.RoninMainnet.key()) {
_rns = loadContract(Contract.RNSUnified.key());
_auction = loadContract(Contract.RNSAuction.key());
_nameChecker = loadContract(Contract.NameChecker.key());
_domainPrice = loadContract(Contract.RNSDomainPrice.key());
_publicResolver = loadContract(Contract.PublicResolver.key());
_reverseRegistrar = loadContract(Contract.RNSReverseRegistrar.key());
_ronController = loadContract(Contract.RONRegistrarController.key());
_multicaller = OwnedMulticaller(new OwnedMulticallerDeploy().overrideArgs(abi.encode(TUDO)).run());

vm.startBroadcast(TUDO);

address[] memory tos = new address[](4);
bytes[] memory callDatas = new bytes[](4);
uint256[] memory values = new uint256[](4);

tos[0] = address(_rns);
tos[1] = address(_rns);
tos[2] = address(_rns);
tos[3] = address(_rns);

callDatas[0] = abi.encodeCall(ERC721.setApprovalForAll, (address(_auction), true));
callDatas[1] = abi.encodeCall(ERC721.setApprovalForAll, (address(_ronController), true));
callDatas[2] = abi.encodeCall(ERC721.setApprovalForAll, (address(_reverseRegistrar), true));
// Grant approval for RNSOperation contract.
// Verify: https://app.roninchain.com/address/0xCD245263eDdEE593a5A66f93f74C58c544957339
callDatas[3] = abi.encodeCall(ERC721.setApprovalForAll, (0xCD245263eDdEE593a5A66f93f74C58c544957339, true));

_multicaller.multicall(tos, callDatas, values);

vm.stopBroadcast();
}

function _postCheck() internal virtual override {
assertEq(_multicaller.owner(), TUDO);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.19;

import { console } from "forge-std/console.sol";
import { Contract } from "script/utils/Contract.sol";
import { Migration } from "script/Migration.s.sol";
import { DefaultNetwork } from "@fdk/utils/DefaultNetwork.sol";
import { OwnedMulticaller, OwnedMulticallerDeploy } from "script/contracts/OwnedMulticallerDeploy.s.sol";

contract Migration__01_DeployNew_OwnedMulticaller_Testnet is Migration {
address internal constant DUKE = 0x968D0Cd7343f711216817E617d3f92a23dC91c07;
OwnedMulticaller multicall;

function run() external onlyOn(DefaultNetwork.RoninTestnet.key()) {
multicall = OwnedMulticaller(new OwnedMulticallerDeploy().overrideArgs(abi.encode(DUKE)).run());
}

function _postCheck() internal virtual override {
assertEq(multicall.owner(), DUKE);
}
}
Loading
Loading