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

chore(auction): merge from release/v0.3.1 #147

Merged
merged 8 commits into from
Dec 18, 2023
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,6 @@
[submodule "lib/foundry-deployment-kit"]
path = lib/foundry-deployment-kit
url = https://github.com/axieinfinity/foundry-deployment-kit
[submodule "lib/contract-libs"]
path = lib/contract-libs
url = https://github.com/axieinfinity/contract-libs
40 changes: 1 addition & 39 deletions debug.sh
Original file line number Diff line number Diff line change
@@ -1,39 +1 @@
# Source (or "dot") the .env file to load environment variables
if [ -f .env ]; then
source .debug.env
else
echo "Error: .debug.env file not found."
fi

verify_arg=""
extra_argument=""
op_command=""

for arg in "$@"; do
case $arg in
--trezor)
op_command=""
extra_argument+=trezor@
;;
--broadcast)
op_command="op run --env-file="./.env" --"
;;
--log)
set -- "${@/#--log/}"
extra_argument+=log@
;;
*) ;;
esac
done

# Remove the @ character from the end of extra_argument
extra_argument="${extra_argument%%@}"

echo Debug Tx...
echo From: ${FROM}
echo To: ${TO}
echo Value: ${VALUE}
echo Calldata:
cast pretty-calldata ${CALLDATA}
calldata=$(cast calldata 'debug(uint256,address,address,uint256,bytes)' ${BLOCK} ${FROM} ${TO} ${VALUE} ${CALLDATA})
${op_command} forge script ${verify_arg} --legacy ${@} script/Debug.s.sol --sig 'run(bytes,string)' ${calldata} "${extra_argument}"
source lib/foundry-deployment-kit/debug.sh
1 change: 1 addition & 0 deletions lib/contract-libs
Submodule contract-libs added at f177e3
2 changes: 1 addition & 1 deletion lib/foundry-deployment-kit
Submodule foundry-deployment-kit updated 72 files
+10 −0 .debug.env.example
+2 −0 .github/template/create-pull-request.md
+50 −0 .github/workflows/create-PR-implement.yml
+84 −0 .github/workflows/create-PR-release.yml
+46 −0 .github/workflows/test.yml
+1 −1 .gitignore
+3 −0 .gitmodules
+1 −0 .husky/.gitignore
+16 −0 .husky/generate-layout.sh
+0 −0 .husky/pre-commit
+26 −0 .husky/pre-push
+46 −0 .husky/storage-logger.js
+34 −0 README.md
+39 −0 debug.sh
+0 −245 deployments/ronin-testnet/ProxyAdmin.json
+2 −2 foundry.toml
+1 −0 lib/contract-libs
+1 −1 lib/forge-std
+1 −1 lib/solady
+0 −0 logs/.gitkeep
+0 −0 logs/storage/.gitkeep
+1 −5 remappings.txt
+27 −0 run.sh
+88 −0 script/ArtifactFactory.sol
+0 −184 script/BaseDeploy.s.sol
+136 −0 script/BaseGeneralConfig.sol
+267 −0 script/BaseMigration.s.sol
+0 −99 script/BaseScript.s.sol
+0 −118 script/GeneralConfig.s.sol
+0 −82 script/LogGenerator.s.sol
+41 −0 script/OnchainDebugger.s.sol
+35 −0 script/SignUtil.s.sol
+144 −44 script/configs/ContractConfig.sol
+17 −0 script/configs/MigrationConfig.sol
+80 −98 script/configs/NetworkConfig.sol
+38 −9 script/configs/RuntimeConfig.sol
+24 −0 script/configs/WalletConfig.sol
+113 −0 script/extensions/ScriptExtended.s.sol
+13 −0 script/interfaces/IArtifactFactory.sol
+16 −0 script/interfaces/IGeneralConfig.sol
+2 −5 script/interfaces/IMigrationScript.sol
+0 −6 script/interfaces/IScript.sol
+14 −0 script/interfaces/IScriptExtended.sol
+30 −0 script/interfaces/configs/IContractConfig.sol
+8 −0 script/interfaces/configs/IMigrationConfig.sol
+48 −0 script/interfaces/configs/INetworkConfig.sol
+15 −0 script/interfaces/configs/IRuntimeConfig.sol
+6 −0 script/interfaces/configs/ISharedParameter.sol
+12 −0 script/interfaces/configs/IWalletConfig.sol
+37 −0 script/libraries/LibProxy.sol
+8 −0 script/libraries/LibSharedAddress.sol
+33 −0 script/libraries/LibSig.sol
+23 −0 script/sample/SampleGeneralConfig.sol
+34 −0 script/sample/SampleMigration.s.sol
+28 −0 script/sample/contracts/SampleCloneDeploy.s.sol
+18 −0 script/sample/contracts/SampleDeploy.s.sol
+18 −0 script/sample/contracts/SampleProxyDeploy.s.sol
+22 −0 script/sample/interfaces/ISharedArgument.sol
+27 −0 script/sample/ronin-mainnet/xxxxyyzz_DeploySample/xxxxyyzz_DeploySample.s.sol
+66 −0 script/sample/ronin-testnet/20231204-DeployMockERC20.s.sol/20231204_DeployMockERC20.s.sol
+27 −0 script/sample/ronin-testnet/xxxxyyzz-DeploySample/xxxxyyzz_DeploySample.s.sol
+34 −0 script/sample/utils/Contract.sol
+36 −0 script/types/Types.sol
+18 −0 script/utils/DefaultContract.sol
+58 −0 script/utils/DefaultNetwork.sol
+18 −0 src/Sample.sol
+26 −0 src/SampleProxy.sol
+12 −0 src/Token.sol
+32 −0 src/WNT.sol
+14 −0 src/interfaces/IWNT.sol
+0 −18 src/libraries/LibErrorHandler.sol
+86 −0 upload-sig.sh
45 changes: 22 additions & 23 deletions script/20231015-deploy/20231015_Deploy.s.sol
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.19;

import { console2 } from "forge-std/console2.sol";
import { console2 as console } from "forge-std/console2.sol";
import { StdStyle } from "forge-std/StdStyle.sol";
import { Math } from "@openzeppelin/contracts/utils/math/Math.sol";
import { Strings } from "@openzeppelin/contracts/utils/Strings.sol";
import { LibRNSDomain } from "@rns-contracts/libraries/LibRNSDomain.sol";
import { ContractKey } from "foundry-deployment-kit/configs/ContractConfig.sol";
import { Contract } from "script/utils/Contract.sol";
import {
RONRegistrarController, RONRegistrarControllerDeploy
} from "script/contracts/RONRegistrarControllerDeploy.s.sol";
Expand All @@ -16,9 +16,10 @@ import { NameChecker, NameCheckerDeploy } from "script/contracts/NameCheckerDepl
import { RNSDomainPrice, RNSDomainPriceDeploy } from "script/contracts/RNSDomainPriceDeploy.s.sol";
import { PublicResolver, PublicResolverDeploy } from "script/contracts/PublicResolverDeploy.s.sol";
import { RNSReverseRegistrar, RNSReverseRegistrarDeploy } from "script/contracts/RNSReverseRegistrarDeploy.s.sol";
import { INSDomainPrice, RNSDeploy } from "../RNSDeploy.s.sol";
import { DefaultNetwork, Migration } from "../Migration.s.sol";
import { INSDomainPrice } from "script/interfaces/ISharedArgument.sol";

contract Migration__20231015_Deploy is RNSDeploy {
contract Migration__20231015_Deploy is Migration {
using Strings for *;
using LibRNSDomain for string;

Expand All @@ -32,7 +33,7 @@ contract Migration__20231015_Deploy is RNSDeploy {

string[] internal _blacklistedWords;

function run() public trySetUp {
function run() public onlyOn(DefaultNetwork.RoninTestnet.key()) {
_rns = new RNSUnifiedDeploy().run();
_auction = new RNSAuctionDeploy().run();
_nameChecker = new NameCheckerDeploy().run();
Expand All @@ -48,7 +49,6 @@ contract Migration__20231015_Deploy is RNSDeploy {
}
uint256[] memory packedWords = _nameChecker.packBulk(_blacklistedWords);

vm.resumeGasMetering();
vm.startBroadcast(admin);

_rns.grantRole(_rns.CONTROLLER_ROLE(), address(_auction));
Expand All @@ -67,7 +67,6 @@ contract Migration__20231015_Deploy is RNSDeploy {
_nameChecker.setForbiddenWords({ packedWords: packedWords, shouldForbid: true });

vm.stopBroadcast();
vm.pauseGasMetering();

_validateAuction();
_validateController();
Expand All @@ -76,7 +75,7 @@ contract Migration__20231015_Deploy is RNSDeploy {
_validateNameChecker();
_validateRNSUnified(ronId, addrReverseId);

console2.log(StdStyle.green(unicode"✅ All checks are passed"));
console.log(StdStyle.green(unicode"✅ All checks are passed"));
}

function _validateController() internal logFn("_validateController") {
Expand All @@ -90,7 +89,7 @@ contract Migration__20231015_Deploy is RNSDeploy {
_ronController.computeCommitment(domain, user.addr, duration, secret, address(_publicResolver), data, true);

(, uint256 ronPrice) = _ronController.rentPrice(domain, duration);
console2.log("domain price:", ronPrice);
console.log("domain price:", ronPrice);
vm.deal(user.addr, ronPrice);

vm.startPrank(user.addr);
Expand All @@ -103,7 +102,7 @@ contract Migration__20231015_Deploy is RNSDeploy {

uint256 expectedId = uint256(string.concat(domain, ".ron").namehash());
assertEq(_rns.ownerOf(expectedId), user.addr);
console2.log(unicode"✅ Controller checks are passed");
console.log(unicode"✅ Controller checks are passed");
}

function _validateRNSUnified(uint256 ronId, uint256 addrReverseId) internal logFn("validateRNSUnified") {
Expand All @@ -113,7 +112,7 @@ contract Migration__20231015_Deploy is RNSDeploy {
assertTrue(_rns.hasRole(_rns.RESERVATION_ROLE(), address(_auction)), "grant reservation role failed");
assertEq(address(_ronController.getPriceOracle()), address(_domainPrice), "set price oracle failed");

console2.log(unicode"✅ RNSUnified checks are passed");
console.log(unicode"✅ RNSUnified checks are passed");
}

function _validateReverseRegistrar() internal logFn("validateReverseRegistrar") {
Expand Down Expand Up @@ -146,7 +145,7 @@ contract Migration__20231015_Deploy is RNSDeploy {
assertTrue(_auction.reserved(id), "invalid bulkRegister");
assertEq(_rns.getRecord(id).mut.expiry, _rns.MAX_EXPIRY(), "invalid expiry time");

console2.log(unicode"✅ Auction checks are passed");
console.log(unicode"✅ Auction checks are passed");
}

function _validateDomainPrice() internal logFn("validateDomainPrice") {
Expand Down Expand Up @@ -191,12 +190,12 @@ contract Migration__20231015_Deploy is RNSDeploy {

vm.stopPrank();

console2.log("Tax Raio:", _domainPrice.getTaxRatio());
console2.log("Converting 1 USD (18 decimals) to RON:", _domainPrice.convertUSDToRON(1e18));
console2.log("Converting 1 RON to USD (18 decimals):", _domainPrice.convertRONToUSD(1 ether));
console2.log("Converting 1m USD (18 decimals) to RON:", _domainPrice.convertUSDToRON(1e18 * 1e6));
console2.log("Converting 1m RON to USD (18 decimals):", _domainPrice.convertRONToUSD(1 ether * 1e6));
console2.log(unicode"✅ Domain price checks are passed");
console.log("Tax Raio:", _domainPrice.getTaxRatio());
console.log("Converting 1 USD (18 decimals) to RON:", _domainPrice.convertUSDToRON(1e18));
console.log("Converting 1 RON to USD (18 decimals):", _domainPrice.convertRONToUSD(1 ether));
console.log("Converting 1m USD (18 decimals) to RON:", _domainPrice.convertUSDToRON(1e18 * 1e6));
console.log("Converting 1m RON to USD (18 decimals):", _domainPrice.convertRONToUSD(1 ether * 1e6));
console.log(unicode"✅ Domain price checks are passed");
}

function _validateNameChecker() internal logFn("validateNameChecker") {
Expand All @@ -208,9 +207,9 @@ contract Migration__20231015_Deploy is RNSDeploy {
uint256 expectedMax;
uint256 expectedMin = type(uint256).max;

console2.log(StdStyle.blue("Blacklisted words count"), blacklistedWords.length);
console2.log(StdStyle.blue("Word"), "RONRegistrarController::valid()", "NameChecker::forbidden()");
console2.log(StdStyle.blue("Word Range"), string.concat("min: ", min.toString(), " ", "max: ", max.toString()));
console.log(StdStyle.blue("Blacklisted words count"), blacklistedWords.length);
console.log(StdStyle.blue("Word"), "RONRegistrarController::valid()", "NameChecker::forbidden()");
console.log(StdStyle.blue("Word Range"), string.concat("min: ", min.toString(), " ", "max: ", max.toString()));

for (uint256 i; i < blacklistedWords.length;) {
word = blacklistedWords[i];
Expand All @@ -220,7 +219,7 @@ contract Migration__20231015_Deploy is RNSDeploy {
forbidden = _nameChecker.forbidden(word);

if (i % 50 == 0) {
console2.log(StdStyle.blue(word), valid ? unicode"✅" : unicode"❌", forbidden ? unicode"✅" : unicode"❌");
console.log(StdStyle.blue(word), valid ? unicode"✅" : unicode"❌", forbidden ? unicode"✅" : unicode"❌");
}

assertTrue(!valid);
Expand All @@ -234,6 +233,6 @@ contract Migration__20231015_Deploy is RNSDeploy {
assertEq(min, expectedMin);
assertEq(max, expectedMax);

console2.log(unicode"✅ NameChecker checks are passed");
console.log(unicode"✅ NameChecker checks are passed");
}
}
10 changes: 5 additions & 5 deletions script/20231020-rns-upgrade/20231020_RNSUpgrade.s.sol
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.19;

import { ContractKey } from "foundry-deployment-kit/configs/ContractConfig.sol";
import { RNSDeploy } from "script/RNSDeploy.s.sol";
import { Contract } from "script/utils/Contract.sol";
import { Migration } from "script/Migration.s.sol";

contract Migration__20231020_RNSUpgrade is RNSDeploy {
function run() public trySetUp {
_upgradeProxy(ContractKey.RNSUnified, EMPTY_ARGS);
contract Migration__20231020_RNSUpgrade is Migration {
function run() public {
_upgradeProxy(Contract.RNSUnified.key());
}
}
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.19;

import { ContractKey } from "foundry-deployment-kit/configs/ContractConfig.sol";
import { RNSDeploy } from "script/RNSDeploy.s.sol";
import { Contract } from "script/utils/Contract.sol";
import { Migration } from "script/Migration.s.sol";

contract Migration__20231021_UpgradeDomainPriceAndAuction is RNSDeploy {
function run() public trySetUp {
_upgradeProxy(ContractKey.RNSAuction, EMPTY_ARGS);
_upgradeProxy(ContractKey.RNSDomainPrice, EMPTY_ARGS);
contract Migration__20231021_UpgradeDomainPriceAndAuction is Migration {
function run() public {
_upgradeProxy(Contract.RNSAuction.key());
_upgradeProxy(Contract.RNSDomainPrice.key());
}
}
10 changes: 5 additions & 5 deletions script/20231024-upgrade-auction/20231024_UpgradeAuction.s.sol
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.19;

import { ContractKey } from "foundry-deployment-kit/configs/ContractConfig.sol";
import { RNSDeploy } from "script/RNSDeploy.s.sol";
import { Contract } from "script/utils/Contract.sol";
import { Migration } from "script/Migration.s.sol";

contract Migration__20231024_UpgradeAuction is RNSDeploy {
function run() public trySetUp {
_upgradeProxy(ContractKey.RNSAuction, EMPTY_ARGS);
contract Migration__20231024_UpgradeAuction is Migration {
function run() public {
_upgradeProxy(Contract.RNSAuction.key());
}
}
23 changes: 14 additions & 9 deletions script/20231024-upgrade-domain-price/20231024_Config.s.sol
Original file line number Diff line number Diff line change
@@ -1,17 +1,22 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.19;

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

abstract contract Config__20231024 is RNSDeploy {
function _buildMigrationConfig() internal view virtual override returns (Config memory config) {
config = super._buildMigrationConfig();
if (_network == Network.RoninTestnet) {
config.overrider = config.operator;
} else if (_network == Network.RoninMainnet) {
revert("Missing config");
abstract contract Config__20231024 is Migration {
function _sharedArguments() internal view virtual override returns (bytes memory rawArgs) {
rawArgs = super._sharedArguments();

ISharedArgument.SharedParameter memory param = abi.decode(rawArgs, (ISharedArgument.SharedParameter));

if (network() == DefaultNetwork.RoninTestnet.key()) {
param.overrider = param.operator;
} else if (network() == DefaultNetwork.RoninMainnet.key()) {
revert("Missing param");
} else {
revert("Missing config");
revert("Missing param");
}

rawArgs = abi.encode(param);
}
}
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.19;

import { console2 } from "forge-std/console2.sol";
import { ContractKey } from "foundry-deployment-kit/configs/ContractConfig.sol";
import { console2 as console } from "forge-std/console2.sol";
import { Contract } from "script/utils/Contract.sol";
import { RNSDomainPrice } from "@rns-contracts/RNSDomainPrice.sol";
import { Config__20231024 } from "./20231024_Config.s.sol";
import { ISharedArgument, Config__20231024 } from "./20231024_Config.s.sol";

contract Migration__20231024_UpgradeDomainPrice is Config__20231024 {
function run() public trySetUp {
Config memory config = getConfig();
_upgradeProxy(ContractKey.RNSDomainPrice, EMPTY_ARGS);
function run() public {
ISharedArgument.SharedParameter memory param = config.sharedArguments();
_upgradeProxy(Contract.RNSDomainPrice.key());

console2.log("operator", config.operator);
console2.log("overrider", config.overrider);
console.log("operator", param.operator);
console.log("overrider", param.overrider);

RNSDomainPrice domainPrice = RNSDomainPrice(_config.getAddressFromCurrentNetwork(ContractKey.RNSDomainPrice));
RNSDomainPrice domainPrice = RNSDomainPrice(config.getAddressFromCurrentNetwork(Contract.RNSDomainPrice.key()));
address admin = domainPrice.getRoleMember(0x00, 0);
bytes32 overriderRole = domainPrice.OVERRIDER_ROLE();
vm.broadcast(admin);
domainPrice.grantRole(overriderRole, config.overrider);
domainPrice.grantRole(overriderRole, param.overrider);
}
}
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.19;

import { ContractKey } from "foundry-deployment-kit/configs/ContractConfig.sol";
import { RNSDeploy } from "script/RNSDeploy.s.sol";
import { Contract } from "script/utils/Contract.sol";
import { Migration } from "script/Migration.s.sol";

contract Migration__20231024_UpgradeRNSUnified is RNSDeploy {
function run() public trySetUp {
_upgradeProxy(ContractKey.RNSUnified, EMPTY_ARGS);
contract Migration__20231024_UpgradeRNSUnified is Migration {
function run() public {
_upgradeProxy(Contract.RNSUnified.key());
}
}
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.19;

import { ContractKey } from "foundry-deployment-kit/configs/ContractConfig.sol";
import { RNSDeploy } from "script/RNSDeploy.s.sol";
import { Contract } from "script/utils/Contract.sol";
import { Migration } from "script/Migration.s.sol";

contract Migration__20231025_UpgradeController is RNSDeploy {
function run() public trySetUp {
_upgradeProxy(ContractKey.RONRegistrarController, EMPTY_ARGS);
contract Migration__20231025_UpgradeController is Migration {
function run() public {
_upgradeProxy(Contract.RONRegistrarController.key());
}
}
Original file line number Diff line number Diff line change
@@ -1,18 +1,16 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.19;

import { ContractKey } from "foundry-deployment-kit/configs/ContractConfig.sol";
import { RNSDeploy } from "script/RNSDeploy.s.sol";
import { Contract } from "script/utils/Contract.sol";
import { ISharedArgument, Migration } from "script/Migration.s.sol";
import { RNSDomainPrice } from "@rns-contracts/RNSDomainPrice.sol";

contract Migration__20231106_RevertRenewalFees is RNSDeploy {
contract Migration__20231106_RevertRenewalFees is Migration {
function run() public {
RNSDomainPrice domainPrice = RNSDomainPrice(_config.getAddressFromCurrentNetwork(ContractKey.RNSDomainPrice));
RNSDomainPrice domainPrice = RNSDomainPrice(config.getAddressFromCurrentNetwork(Contract.RNSDomainPrice.key()));

Config memory config = getConfig();
ISharedArgument.SharedParameter memory param = config.sharedArguments();
vm.broadcast(domainPrice.getRoleMember(domainPrice.DEFAULT_ADMIN_ROLE(), 0));
vm.resumeGasMetering();
domainPrice.setRenewalFeeByLengths(config.renewalFees);
vm.pauseGasMetering();
domainPrice.setRenewalFeeByLengths(param.renewalFees);
}
}
Loading