Skip to content

Commit

Permalink
chore(add-defender-config): merge from release/v0.3.5 (#234)
Browse files Browse the repository at this point in the history
  • Loading branch information
TuDo1403 authored Jun 25, 2024
2 parents 70a12c1 + f09bf3f commit 55c0680
Show file tree
Hide file tree
Showing 36 changed files with 144 additions and 66 deletions.
10 changes: 9 additions & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,18 @@ jobs:
with:
version: nightly

- name: Update package with soldeer
run: forge soldeer update

- name: Recursively update dependencies
run: |
chmod +x ./update-deps.sh
./update-deps.sh
- name: Run Forge build
run: |
forge --version
forge build --sizes
forge build
id: build

- name: Run Forge tests
Expand Down
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,6 @@ node_modules/
yarn-error.log
.yarn
.yarnrc.yml
script/data/*
script/data/*
dependencies
deployments/**/exported_address
18 changes: 0 additions & 18 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,9 +1,3 @@
[submodule "lib/forge-std"]
path = lib/forge-std
url = https://github.com/foundry-rs/forge-std
[submodule "lib/openzeppelin-contracts"]
path = lib/openzeppelin-contracts
url = https://github.com/openzeppelin/openzeppelin-contracts
[submodule "lib/contract-template"]
path = lib/contract-template
url = https://github.com/axieinfinity/contract-template
Expand All @@ -13,15 +7,3 @@
[submodule "lib/buffer"]
path = lib/buffer
url = https://github.com/ensdomains/buffer
[submodule "lib/pyth-sdk-solidity"]
path = lib/pyth-sdk-solidity
url = https://github.com/pyth-network/pyth-sdk-solidity
[submodule "lib/solady"]
path = lib/solady
url = https://github.com/vectorized/solady
[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
2 changes: 1 addition & 1 deletion debug.sh
Original file line number Diff line number Diff line change
@@ -1 +1 @@
source lib/foundry-deployment-kit/debug.sh
source dependencies/@fdk-0.3.0-beta/debug.sh
7 changes: 6 additions & 1 deletion foundry.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,9 @@ localhost = "http://localhost:8545"
runs = 256

[invariant]
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" }
30 changes: 30 additions & 0 deletions install.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#!/bin/bash

# Check if foundry is installed
if ! command -v $HOME/.foundry/bin/forge &>/dev/null; then
# Install foundryup
curl -L https://foundry.paradigm.xyz | bash
# Install foundry
$HOME/.foundry/bin/foundryup -v nightly-de33b6af53005037b463318d2628b5cfcaf39916 # Stable version
fi

# Check if rustup is installed
if ! command -v rustup &>/dev/null; then
# Install rustup
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
fi

# Update rustup
$HOME/.cargo/bin/rustup update stable
# Install soldeer
$HOME/.cargo/bin/cargo install soldeer
# Update dependencies with soldeer
$HOME/.cargo/bin/soldeer update
# Run forge build
$HOME/.foundry/bin/forge build

# Check if rustup is installed
if ! command -v jq &>/dev/null; then
# Install jq
brew install jq
fi
1 change: 0 additions & 1 deletion lib/contract-libs
Submodule contract-libs deleted from f177e3
1 change: 0 additions & 1 deletion lib/forge-std
Submodule forge-std deleted from 77876f
1 change: 0 additions & 1 deletion lib/foundry-deployment-kit
Submodule foundry-deployment-kit deleted from d36312
1 change: 0 additions & 1 deletion lib/openzeppelin-contracts
Submodule openzeppelin-contracts deleted from fd81a9
1 change: 0 additions & 1 deletion lib/pyth-sdk-solidity
Submodule pyth-sdk-solidity deleted from 11d6bc
1 change: 0 additions & 1 deletion lib/solady
Submodule solady deleted from 2ba1cc
10 changes: 5 additions & 5 deletions remappings.txt
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
@rns-contracts/=src/
ds-test/=lib/forge-std/lib/ds-test/src/
forge-std/=lib/forge-std/src/
@openzeppelin/=lib/openzeppelin-contracts/
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/=lib/solady/src/
@solady/=dependencies/@fdk-0.3.0-beta/dependencies/solady-0.0.206/src/
@ensdomains/ens-contracts/=lib/ens-contracts/contracts/
@ensdomains/buffer/=lib/buffer/
@pythnetwork/=lib/pyth-sdk-solidity/
foundry-deployment-kit/=lib/foundry-deployment-kit/script/
@pythnetwork/=dependencies/@pythnetwork-pyth-sdk-solidity-2.2.0/
@fdk/=dependencies/@fdk-0.3.0-beta/script
2 changes: 1 addition & 1 deletion run.sh
Original file line number Diff line number Diff line change
@@ -1 +1 @@
source lib/foundry-deployment-kit/run.sh
source dependencies/@fdk-0.3.0-beta/run.sh
8 changes: 4 additions & 4 deletions script/20231015-deploy/20231015_Deploy.s.sol
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.19;

import { console2 as console } from "forge-std/console2.sol";
import { console } from "forge-std/console.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";
Expand Down Expand Up @@ -109,7 +109,7 @@ contract Migration__20231015_Deploy is Migration {
console.log(unicode"✅ Controller checks are passed");
}

function _validateRNSUnified(uint256 ronId, uint256 addrReverseId) internal logFn("validateRNSUnified") {
function _validateRNSUnified(uint256 ronId, uint256 addrReverseId) internal view logFn("validateRNSUnified") {
assertEq(ronId, LibRNSDomain.RON_ID);
assertEq(addrReverseId, LibRNSDomain.ADDR_REVERSE_ID);
assertTrue(_rns.hasRole(_rns.CONTROLLER_ROLE(), address(_auction)), "grant controller role failed");
Expand All @@ -119,7 +119,7 @@ contract Migration__20231015_Deploy is Migration {
console.log(unicode"✅ RNSUnified checks are passed");
}

function _validateReverseRegistrar() internal logFn("validateReverseRegistrar") {
function _validateReverseRegistrar() internal view logFn("validateReverseRegistrar") {
assertEq(_rns.getApproved(LibRNSDomain.ADDR_REVERSE_ID), address(_reverseRegistrar));
}

Expand Down Expand Up @@ -202,7 +202,7 @@ contract Migration__20231015_Deploy is Migration {
console.log(unicode"✅ Domain price checks are passed");
}

function _validateNameChecker() internal logFn("validateNameChecker") {
function _validateNameChecker() internal view logFn("validateNameChecker") {
string[] memory blacklistedWords = _blacklistedWords;
(uint8 min, uint8 max) = _nameChecker.getWordRange();
bool valid;
Expand Down
2 changes: 1 addition & 1 deletion script/20231024-upgrade-domain-price/20231024_Config.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ abstract contract Config__20231024 is Migration {

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

if (network() == DefaultNetwork.RoninTestnet.key()) {
if (network() == DefaultNetwork.RoninTestnet.key() || network() == DefaultNetwork.LocalHost.key()) {
param.rnsDomainPrice.overrider = param.rnsDomainPrice.domainPriceOperators[0];
} else if (network() == DefaultNetwork.RoninMainnet.key()) {
revert("Missing param");
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.19;

import { console2 as console } from "forge-std/console2.sol";
import { console } from "forge-std/console.sol";
import { Contract } from "script/utils/Contract.sol";
import { RNSDomainPrice } from "@rns-contracts/RNSDomainPrice.sol";
import { ISharedArgument, Config__20231024 } from "./20231024_Config.s.sol";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.19;

import { console2 as console } from "forge-std/console2.sol";
import { console } from "forge-std/console.sol";
import { Contract } from "script/utils/Contract.sol";
import { JSONParserLib } from "solady/utils/JSONParserLib.sol";
import { JSONParserLib } from "@solady/utils/JSONParserLib.sol";
import { Migration } from "script/Migration.s.sol";
import { LibRNSDomain, RNSUnified } from "@rns-contracts/RNSUnified.sol";
import { OwnedMulticaller, OwnedMulticallerDeploy } from "script/contracts/OwnedMulticallerDeploy.s.sol";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
pragma solidity ^0.8.19;

import { Contract } from "script/utils/Contract.sol";
import { console2 as console } from "forge-std/console2.sol";
import { console } from "forge-std/console.sol";
import { Migration } from "script/Migration.s.sol";
import { RNSUnified } from "@rns-contracts/RNSUnified.sol";
import { OwnedMulticallerDeploy } from "script/contracts/OwnedMulticallerDeploy.s.sol";
Expand Down
2 changes: 1 addition & 1 deletion script/20231106-deploy-mainnet/20231106_Deploy.s.sol
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.19;

import { console2 as console } from "forge-std/console2.sol";
import { console } from "forge-std/console.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";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import {
ITransparentUpgradeableProxy,
TransparentUpgradeableProxy
} from "@openzeppelin/contracts/proxy/transparent/TransparentUpgradeableProxy.sol";
import { LibProxy } from "foundry-deployment-kit/libraries/LibProxy.sol";
import { LibProxy } from "@fdk/libraries/LibProxy.sol";
import { NameChecker } from "@rns-contracts/NameChecker.sol";
import { Contract } from "script/utils/Contract.sol";
import { Migration } from "script/Migration.s.sol";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.19;

import { console2 as console } from "forge-std/console2.sol";
import { console } from "forge-std/console.sol";
import { INSAuction, EventRange, RNSAuction } from "@rns-contracts/RNSAuction.sol";
import { Contract } from "script/utils/Contract.sol";
import { Migration } from "script/Migration.s.sol";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.19;

import { console2 as console } from "forge-std/console2.sol";
import { console } from "forge-std/console.sol";
import { Contract } from "script/utils/Contract.sol";
import { Migration } from "script/Migration.s.sol";
import { RNSUnified } from "@rns-contracts/RNSUnified.sol";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
pragma solidity ^0.8.19;

import { Math } from "@openzeppelin/contracts/utils/math/Math.sol";
import { console2 as console } from "forge-std/console2.sol";
import { console } from "forge-std/console.sol";
import { Contract } from "script/utils/Contract.sol";
import { Migration } from "script/Migration.s.sol";
import { RNSUnified } from "@rns-contracts/RNSUnified.sol";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.19;

import { console2 as console } from "forge-std/console2.sol";
import { console } from "forge-std/console.sol";
import { ITransparentUpgradeableProxy } from "@openzeppelin/contracts/proxy/transparent/TransparentUpgradeableProxy.sol";
import { ProxyAdmin } from "@openzeppelin/contracts/proxy/transparent/ProxyAdmin.sol";
import { Contract } from "script/utils/Contract.sol";
import { DefaultContract } from "foundry-deployment-kit/utils/DefaultContract.sol";
import { DefaultContract } from "@fdk/utils/DefaultContract.sol";
import { ISharedArgument } from "script/interfaces/ISharedArgument.sol";
import {
DefaultNetwork,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ pragma solidity ^0.8.19;

import { StdStyle } from "forge-std/StdStyle.sol";
import { IMulticall3 } from "forge-std/interfaces/IMulticall3.sol";
import { LibString } from "solady/utils/LibString.sol";
import { DefaultNetwork } from "foundry-deployment-kit/utils/DefaultNetwork.sol";
import { DefaultContract } from "foundry-deployment-kit/utils/DefaultContract.sol";
import { LibString } from "@solady/utils/LibString.sol";
import { DefaultNetwork } from "@fdk/utils/DefaultNetwork.sol";
import { DefaultContract } from "@fdk/utils/DefaultContract.sol";
import { Contract } from "../utils/Contract.sol";
import { INSDomainPrice, RNSDomainPrice } from "@rns-contracts/RNSDomainPrice.sol";
import "./20240215_Migration.s.sol";
Expand Down Expand Up @@ -58,7 +58,7 @@ contract Migration__01_UpgradeRNSDomainPriceAndOverrideTierForCommunityNames_RNS
_validateOtherDomainTiers();
}

function _validateOtherDomainTiers() internal logFn("_validating other domain tiers ...") {
function _validateOtherDomainTiers() internal view logFn("_validating other domain tiers ...") {
if (network() == DefaultNetwork.RoninMainnet.key()) {
assertEq(uint8(_domainPrice.getTier("tudo")), uint8(INSDomainPrice.Tier.Tier2), "invalid tier for tudo");
assertEq(uint8(_domainPrice.getTier("duke")), uint8(INSDomainPrice.Tier.Tier2), "invalid tier for duke");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ pragma solidity ^0.8.19;

import { StdStyle } from "forge-std/StdStyle.sol";
import { Math } from "@openzeppelin/contracts/utils/math/Math.sol";
import { console2 as console } from "forge-std/console2.sol";
import { console } from "forge-std/console.sol";
import { Contract } from "script/utils/Contract.sol";
import { Migration } from "script/Migration.s.sol";
import { RNSUnified } from "@rns-contracts/RNSUnified.sol";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.19;

import { console2 as console } from "forge-std/console2.sol";
import { JSONParserLib } from "solady/utils/JSONParserLib.sol";
import { console } from "forge-std/console.sol";
import { JSONParserLib } from "@solady/utils/JSONParserLib.sol";
import { Migration, ISharedArgument } from "../Migration.s.sol";
import { LibRNSDomain } from "@rns-contracts/libraries/LibRNSDomain.sol";
import { INSDomainPrice } from "@rns-contracts/interfaces/INSDomainPrice.sol";
Expand Down
2 changes: 1 addition & 1 deletion script/GeneralConfig.sol
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.19;

import { BaseGeneralConfig } from "foundry-deployment-kit/BaseGeneralConfig.sol";
import { BaseGeneralConfig } from "@fdk/BaseGeneralConfig.sol";
import { Contract } from "./utils/Contract.sol";

contract GeneralConfig is BaseGeneralConfig {
Expand Down
6 changes: 3 additions & 3 deletions script/Migration.s.sol
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.19;

import { BaseMigration } from "foundry-deployment-kit/BaseMigration.s.sol";
import { DefaultNetwork } from "foundry-deployment-kit/utils/DefaultNetwork.sol";
import { BaseMigration } from "@fdk/BaseMigration.s.sol";
import { DefaultNetwork } from "@fdk/utils/DefaultNetwork.sol";
import { GeneralConfig } from "./GeneralConfig.sol";
import "./interfaces/ISharedArgument.sol";

Expand All @@ -16,7 +16,7 @@ abstract contract Migration is BaseMigration {
function _sharedArguments() internal view virtual override returns (bytes memory rawArgs) {
ISharedArgument.SharedParameter memory param;

if (network() == DefaultNetwork.RoninTestnet.key()) {
if (network() == DefaultNetwork.RoninTestnet.key() || network() == DefaultNetwork.LocalHost.key()) {
address defaultAdmin = 0x968D0Cd7343f711216817E617d3f92a23dC91c07;
address defaultPauser = defaultAdmin;
address defaultOperator = defaultAdmin;
Expand Down
2 changes: 1 addition & 1 deletion script/interfaces/ISharedArgument.sol
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.19;

import { IGeneralConfig } from "foundry-deployment-kit/interfaces/IGeneralConfig.sol";
import { IGeneralConfig } from "@fdk/interfaces/IGeneralConfig.sol";
import { IPyth, INSDomainPrice, PeriodScaler } from "@rns-contracts/RNSDomainPrice.sol";
import { NameChecker } from "@rns-contracts/NameChecker.sol";
import { PublicResolver } from "@rns-contracts/resolvers/PublicResolver.sol";
Expand Down
4 changes: 2 additions & 2 deletions script/utils/Contract.sol
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.19;

import { LibString } from "lib/solady/src/utils/LibString.sol";
import { TContract } from "foundry-deployment-kit/types/Types.sol";
import { LibString } from "@solady/utils/LibString.sol";
import { TContract } from "@fdk/types/Types.sol";

enum Contract {
RNSUnified,
Expand Down
17 changes: 17 additions & 0 deletions soldeer.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
[[dependencies]]
name = "@fdk"
version = "0.3.0-beta"
source = "https://github.com/axieinfinity/foundry-deployment-kit/archive/refs/tags/v0.3.0-beta.zip"
checksum = "aabeda6cc1fe02227d26f3edd86d4af6c91e2167e8b9f1971cc1ea7ce33d34f9"

[[dependencies]]
name = "@pythnetwork-pyth-sdk-solidity"
version = "2.2.0"
source = "https://soldeer-revisions.s3.amazonaws.com/@pythnetwork-pyth-sdk-solidity/2_2_0_15-04-2024_18:50:54_pyth-sdk-solidity.zip"
checksum = "54e3bda3b27467f84c1605722f58e1d2b5a19d6ca3c24840550f1d6cf3bc2231"

[[dependencies]]
name = "@openzeppelin-contracts"
version = "4.9.3"
source = "https://soldeer-revisions.s3.amazonaws.com/@openzeppelin-contracts/4_9_3_22-01-2024_13:13:53_contracts.zip"
checksum = "95886307069cf73310b41396c49df51801a73f31f18f62e7d05adfc2031e7725"
2 changes: 1 addition & 1 deletion test/RNSUnified/RNSUnified.namehash.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
pragma solidity ^0.8.19;

import "./RNSUnified.t.sol";
import { LibString as SoladyLibString } from "solady/utils/LibString.sol";
import { LibString as SoladyLibString } from "@solady/utils/LibString.sol";

contract RNSUnified_NameHash_Test is RNSUnifiedTest {
using SoladyLibString for *;
Expand Down
Loading

0 comments on commit 55c0680

Please sign in to comment.