From 7b4d342187f4f350cbe8786dcaa3719ce3e147c1 Mon Sep 17 00:00:00 2001 From: Alex Sedighi Date: Tue, 4 Feb 2025 12:17:23 +1300 Subject: [PATCH 1/2] chore: update git ignore list --- .gitignore | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 6c32b4f1..c854df4b 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,9 @@ node_modules/ +local/ +clk-gateway/dist/ +.DS_Store +.env-* +*.env # Compiler files cache/ @@ -9,7 +14,6 @@ zkout/ /broadcast /broadcast/*/31337/ /broadcast/**/dry-run/ - # Docs docs/ From a2cef8ab46d5d03b4619209da8ca1988da4bc9ea Mon Sep 17 00:00:00 2001 From: Alex Sedighi Date: Tue, 4 Feb 2025 13:00:32 +1300 Subject: [PATCH 2/2] chore: make openzeppelin imports consistent --- remappings.txt | 1 + script/DeployMigrationNFT.s.sol | 2 +- src/Grants.sol | 4 ++-- src/NODL.sol | 6 +++--- src/Payment.sol | 4 ++-- src/QuotaControl.sol | 6 +++--- src/Rewards.sol | 6 +++--- src/bridge/MigrationNFT.sol | 2 +- src/contentsign/BaseContentSign.sol | 4 ++-- src/contentsign/EnterpriseContentSign.sol | 2 +- src/contentsign/PaymentMiddleware.sol | 8 ++++---- src/nameservice/ClickNameService.sol | 8 ++++---- src/nameservice/ClickResolver.sol | 2 +- src/paymasters/BasePaymaster.sol | 2 +- test/NODL.t.sol | 6 +++--- test/Rewards.t.sol | 4 ++-- test/__helpers__/AccessControlUtils.sol | 2 +- test/bridge/GrantsMigration.t.sol | 2 +- test/bridge/MigrationNFT.t.sol | 2 +- test/bridge/NODLMigration.t.sol | 4 ++-- 20 files changed, 39 insertions(+), 38 deletions(-) create mode 100644 remappings.txt diff --git a/remappings.txt b/remappings.txt new file mode 100644 index 00000000..1e950773 --- /dev/null +++ b/remappings.txt @@ -0,0 +1 @@ +@openzeppelin=lib/openzeppelin-contracts/ \ No newline at end of file diff --git a/script/DeployMigrationNFT.s.sol b/script/DeployMigrationNFT.s.sol index d884eadf..d07e0683 100644 --- a/script/DeployMigrationNFT.s.sol +++ b/script/DeployMigrationNFT.s.sol @@ -3,7 +3,7 @@ pragma solidity 0.8.23; import {Script, console} from "forge-std/Script.sol"; -import {Strings} from "openzeppelin-contracts/contracts/utils/Strings.sol"; +import {Strings} from "@openzeppelin/contracts/utils/Strings.sol"; import {MigrationNFT} from "../src/bridge/MigrationNFT.sol"; import {NODLMigration} from "../src/bridge/NODLMigration.sol"; diff --git a/src/Grants.sol b/src/Grants.sol index cd9070f7..0fe8bd6a 100644 --- a/src/Grants.sol +++ b/src/Grants.sol @@ -1,8 +1,8 @@ // SPDX-License-Identifier: BSD-3-Clause-Clear pragma solidity ^0.8.23; -import {IERC20} from "openzeppelin-contracts/contracts/token/ERC20/IERC20.sol"; -import {SafeERC20} from "openzeppelin-contracts/contracts/token/ERC20/utils/SafeERC20.sol"; +import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol"; +import {SafeERC20} from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol"; /** * @title Grants diff --git a/src/NODL.sol b/src/NODL.sol index dd3244fe..7a30933e 100644 --- a/src/NODL.sol +++ b/src/NODL.sol @@ -2,9 +2,9 @@ pragma solidity 0.8.23; -import {ERC20} from "openzeppelin-contracts/contracts/token/ERC20/ERC20.sol"; -import {ERC20Burnable} from "openzeppelin-contracts/contracts/token/ERC20/extensions/ERC20Burnable.sol"; -import {AccessControl} from "openzeppelin-contracts/contracts/access/AccessControl.sol"; +import {ERC20} from "@openzeppelin/contracts/token/ERC20/ERC20.sol"; +import {ERC20Burnable} from "@openzeppelin/contracts/token/ERC20/extensions/ERC20Burnable.sol"; +import {AccessControl} from "@openzeppelin/contracts/access/AccessControl.sol"; contract NODL is ERC20Burnable, AccessControl { bytes32 public constant MINTER_ROLE = keccak256("MINTER_ROLE"); diff --git a/src/Payment.sol b/src/Payment.sol index d6600a57..fb205492 100644 --- a/src/Payment.sol +++ b/src/Payment.sol @@ -2,8 +2,8 @@ pragma solidity 0.8.23; import {QuotaControl} from "./QuotaControl.sol"; -import {IERC20} from "openzeppelin-contracts/contracts/token/ERC20/IERC20.sol"; -import {SafeERC20} from "openzeppelin-contracts/contracts/token/ERC20/utils/SafeERC20.sol"; +import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol"; +import {SafeERC20} from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol"; /** * @title Payment Contract diff --git a/src/QuotaControl.sol b/src/QuotaControl.sol index 90440d54..9d876dad 100644 --- a/src/QuotaControl.sol +++ b/src/QuotaControl.sol @@ -1,8 +1,8 @@ // SPDX-License-Identifier: BSD-3-Clause-Clear pragma solidity 0.8.23; -import {AccessControl} from "openzeppelin-contracts/contracts/access/AccessControl.sol"; -import {Math} from "openzeppelin-contracts/contracts/utils/math/Math.sol"; +import {AccessControl} from "@openzeppelin/contracts/access/AccessControl.sol"; +import {Math} from "@openzeppelin/contracts/utils/math/Math.sol"; /** * @title QuotaControl @@ -153,7 +153,7 @@ contract QuotaControl is AccessControl { * - The `newPeriod` must be greater than 0. * - The `newPeriod` must not exceed `MAX_PERIOD`. */ - function _mustBeWithinPeriodRange(uint256 newPeriod) internal { + function _mustBeWithinPeriodRange(uint256 newPeriod) internal pure { if (newPeriod == 0) { revert ZeroPeriod(); } diff --git a/src/Rewards.sol b/src/Rewards.sol index bcc35b7d..7eec38ef 100644 --- a/src/Rewards.sol +++ b/src/Rewards.sol @@ -3,9 +3,9 @@ pragma solidity 0.8.23; import {NODL} from "./NODL.sol"; import {QuotaControl} from "./QuotaControl.sol"; -import {EIP712} from "openzeppelin-contracts/contracts/utils/cryptography/EIP712.sol"; -import {SignatureChecker} from "openzeppelin-contracts/contracts/utils/cryptography/SignatureChecker.sol"; -import {Math} from "openzeppelin-contracts/contracts/utils/math/Math.sol"; +import {EIP712} from "@openzeppelin/contracts/utils/cryptography/EIP712.sol"; +import {SignatureChecker} from "@openzeppelin/contracts/utils/cryptography/SignatureChecker.sol"; +import {Math} from "@openzeppelin/contracts/utils/math/Math.sol"; /** * @title Nodle DePIN Rewards diff --git a/src/bridge/MigrationNFT.sol b/src/bridge/MigrationNFT.sol index b7b7f93f..655f48f2 100644 --- a/src/bridge/MigrationNFT.sol +++ b/src/bridge/MigrationNFT.sol @@ -22,7 +22,7 @@ */ pragma solidity 0.8.23; -import {ERC721} from "openzeppelin-contracts/contracts/token/ERC721/ERC721.sol"; +import {ERC721} from "@openzeppelin/contracts/token/ERC721/ERC721.sol"; import {NODLMigration} from "./NODLMigration.sol"; contract MigrationNFT is ERC721 { diff --git a/src/contentsign/BaseContentSign.sol b/src/contentsign/BaseContentSign.sol index 82d41e88..df47385b 100644 --- a/src/contentsign/BaseContentSign.sol +++ b/src/contentsign/BaseContentSign.sol @@ -2,8 +2,8 @@ pragma solidity 0.8.23; -import {ERC721} from "openzeppelin-contracts/contracts/token/ERC721/ERC721.sol"; -import {ERC721URIStorage} from "openzeppelin-contracts/contracts/token/ERC721/extensions/ERC721URIStorage.sol"; +import {ERC721} from "@openzeppelin/contracts/token/ERC721/ERC721.sol"; +import {ERC721URIStorage} from "@openzeppelin/contracts/token/ERC721/extensions/ERC721URIStorage.sol"; /// @notice a simple NFT contract for contentsign data where each nft is mapped to a one-time /// configurable URL. This is used for every variant of ContentSign with associated hooks. diff --git a/src/contentsign/EnterpriseContentSign.sol b/src/contentsign/EnterpriseContentSign.sol index 3d1efbb6..e4939a2a 100644 --- a/src/contentsign/EnterpriseContentSign.sol +++ b/src/contentsign/EnterpriseContentSign.sol @@ -4,7 +4,7 @@ pragma solidity 0.8.23; import {BaseContentSign} from "./BaseContentSign.sol"; -import {AccessControl} from "openzeppelin-contracts/contracts/access/AccessControl.sol"; +import {AccessControl} from "@openzeppelin/contracts/access/AccessControl.sol"; /// @notice the content sign contract variant for enterprises. Only users whitelisted on this contract can mint contract EnterpriseContentSign is BaseContentSign, AccessControl { diff --git a/src/contentsign/PaymentMiddleware.sol b/src/contentsign/PaymentMiddleware.sol index 262ffdee..3168c93d 100644 --- a/src/contentsign/PaymentMiddleware.sol +++ b/src/contentsign/PaymentMiddleware.sol @@ -3,10 +3,10 @@ pragma solidity ^0.8.20; import {BaseContentSign} from "./BaseContentSign.sol"; -import {IERC20} from "openzeppelin-contracts/contracts/token/ERC20/IERC20.sol"; -import {SafeERC20} from "openzeppelin-contracts/contracts/token/ERC20/utils/SafeERC20.sol"; -import {IERC721} from "openzeppelin-contracts/contracts/token/ERC721/IERC721.sol"; -import {Ownable} from "openzeppelin-contracts/contracts/access/Ownable.sol"; +import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol"; +import {SafeERC20} from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol"; +import {IERC721} from "@openzeppelin/contracts/token/ERC721/IERC721.sol"; +import {Ownable} from "@openzeppelin/contracts/access/Ownable.sol"; contract PaymentMiddleware is Ownable { using SafeERC20 for IERC20; diff --git a/src/nameservice/ClickNameService.sol b/src/nameservice/ClickNameService.sol index 02dd8e7f..ca75b7ee 100644 --- a/src/nameservice/ClickNameService.sol +++ b/src/nameservice/ClickNameService.sol @@ -1,10 +1,10 @@ // SPDX-License-Identifier: BSD-3-Clause-Clear pragma solidity ^0.8.23; -import {ERC721} from "openzeppelin-contracts/contracts/token/ERC721/ERC721.sol"; -import {ERC721Burnable} from "openzeppelin-contracts/contracts/token/ERC721/extensions/ERC721Burnable.sol"; -import {AccessControl} from "openzeppelin-contracts/contracts/access/AccessControl.sol"; -import {Strings} from "openzeppelin-contracts/contracts/utils/Strings.sol"; +import {ERC721} from "@openzeppelin/contracts/token/ERC721/ERC721.sol"; +import {ERC721Burnable} from "@openzeppelin/contracts/token/ERC721/extensions/ERC721Burnable.sol"; +import {AccessControl} from "@openzeppelin/contracts/access/AccessControl.sol"; +import {Strings} from "@openzeppelin/contracts/utils/Strings.sol"; import {IClickNameService} from "./IClickNameService.sol"; /** diff --git a/src/nameservice/ClickResolver.sol b/src/nameservice/ClickResolver.sol index bc39211f..eeb7eb70 100644 --- a/src/nameservice/ClickResolver.sol +++ b/src/nameservice/ClickResolver.sol @@ -8,7 +8,7 @@ pragma solidity ^0.8.23; import {IERC165} from "lib/forge-std/src/interfaces/IERC165.sol"; -import {Ownable} from "openzeppelin-contracts/contracts/access/Ownable.sol"; +import {Ownable} from "@openzeppelin/contracts/access/Ownable.sol"; import { StorageProof, StorageProofVerifier diff --git a/src/paymasters/BasePaymaster.sol b/src/paymasters/BasePaymaster.sol index ab84e9e5..0fe77174 100644 --- a/src/paymasters/BasePaymaster.sol +++ b/src/paymasters/BasePaymaster.sol @@ -9,7 +9,7 @@ import { } from "lib/era-contracts/l2-contracts/contracts/interfaces/IPaymaster.sol"; import {IPaymasterFlow} from "lib/era-contracts/l2-contracts/contracts/interfaces/IPaymasterFlow.sol"; import {Transaction} from "lib/era-contracts/l2-contracts/contracts/L2ContractHelper.sol"; -import {AccessControl} from "openzeppelin-contracts/contracts/access/AccessControl.sol"; +import {AccessControl} from "@openzeppelin/contracts/access/AccessControl.sol"; uint160 constant SYSTEM_CONTRACTS_OFFSET = 0x8000; address payable constant BOOTLOADER_FORMAL_ADDRESS = payable(address(SYSTEM_CONTRACTS_OFFSET + 0x01)); diff --git a/test/NODL.t.sol b/test/NODL.t.sol index ed05cec0..df1dfb34 100644 --- a/test/NODL.t.sol +++ b/test/NODL.t.sol @@ -4,7 +4,7 @@ pragma solidity ^0.8.20; import {Test, console} from "forge-std/Test.sol"; import {NODL} from "../src/NODL.sol"; -import {ERC20Capped} from "openzeppelin-contracts/contracts/token/ERC20/extensions/ERC20Capped.sol"; +import {ERC20Capped} from "@openzeppelin/contracts/token/ERC20/extensions/ERC20Capped.sol"; contract NODLTest is Test { NODL private nodl; @@ -21,11 +21,11 @@ contract NODLTest is Test { assert(nodl.hasRole(nodl.MINTER_ROLE(), alice)); } - function test_has18Decimals() public { + function test_has18Decimals() public view { assertEq(nodl.decimals(), 18); } - function test_shouldDeployWithNoSupply() public { + function test_shouldDeployWithNoSupply() public view { assertEq(nodl.totalSupply(), 0); } diff --git a/test/Rewards.t.sol b/test/Rewards.t.sol index e5117b6b..5fecfdb8 100644 --- a/test/Rewards.t.sol +++ b/test/Rewards.t.sol @@ -6,7 +6,7 @@ import "forge-std/console.sol"; import "../src/NODL.sol"; import "../src/QuotaControl.sol"; import "../src/Rewards.sol"; -import "openzeppelin-contracts/contracts/utils/cryptography/MessageHashUtils.sol"; +import "@openzeppelin/contracts/utils/cryptography/MessageHashUtils.sol"; import "./__helpers__/AccessControlUtils.sol"; contract RewardsTest is Test { @@ -256,7 +256,7 @@ contract RewardsTest is Test { rewards.mintBatchReward(rewardsBatch, signature); } - function test_digestReward() public { + function test_digestReward() public view { bytes32 hashedEIP712DomainType = keccak256("EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)"); bytes32 hashedName = keccak256(bytes("rewards.depin.nodle")); diff --git a/test/__helpers__/AccessControlUtils.sol b/test/__helpers__/AccessControlUtils.sol index 1c94cc4a..040ab6b0 100644 --- a/test/__helpers__/AccessControlUtils.sol +++ b/test/__helpers__/AccessControlUtils.sol @@ -3,7 +3,7 @@ pragma solidity ^0.8.20; import {Vm} from "forge-std/Vm.sol"; -import {IAccessControl} from "openzeppelin-contracts/contracts/access/IAccessControl.sol"; +import {IAccessControl} from "@openzeppelin/contracts/access/IAccessControl.sol"; library AccessControlUtils { function expectRevert_AccessControlUnauthorizedAccount(Vm vm, address user, bytes32 role) internal { diff --git a/test/bridge/GrantsMigration.t.sol b/test/bridge/GrantsMigration.t.sol index 5ba8097b..7d0daf36 100644 --- a/test/bridge/GrantsMigration.t.sol +++ b/test/bridge/GrantsMigration.t.sol @@ -58,7 +58,7 @@ contract GrantsMigrationTest is Test { nodl.grantRole(nodl.MINTER_ROLE(), address(migration)); } - function test_oraclesAreRegisteredProperly() public { + function test_oraclesAreRegisteredProperly() public view { for (uint256 i = 0; i < oracles.length; i++) { assertEq(migration.isOracle(oracles[i]), true); } diff --git a/test/bridge/MigrationNFT.t.sol b/test/bridge/MigrationNFT.t.sol index 1eecf9ee..99b5fefd 100644 --- a/test/bridge/MigrationNFT.t.sol +++ b/test/bridge/MigrationNFT.t.sol @@ -51,7 +51,7 @@ contract MigrationNFTTest is Test { nodl.grantRole(nodl.MINTER_ROLE(), address(migration)); } - function test_initialState() public { + function test_initialState() public view { assertEq(migrationNFT.nextTokenId(), 0); assertEq(migrationNFT.maxHolders(), maxHolders); assertEq(address(migrationNFT.migration()), address(migration)); diff --git a/test/bridge/NODLMigration.t.sol b/test/bridge/NODLMigration.t.sol index 63c907a6..09de3b6e 100644 --- a/test/bridge/NODLMigration.t.sol +++ b/test/bridge/NODLMigration.t.sol @@ -22,7 +22,7 @@ contract NODLMigrationTest is Test { nodl.grantRole(nodl.MINTER_ROLE(), address(migration)); } - function test_oraclesAreRegisteredProperly() public { + function test_oraclesAreRegisteredProperly() public view { for (uint256 i = 0; i < oracles.length; i++) { assertEq(migration.isOracle(oracles[i]), true); } @@ -30,7 +30,7 @@ contract NODLMigrationTest is Test { assertEq(migration.delay(), delay); } - function test_configuredProperToken() public { + function test_configuredProperToken() public view { assertEq(address(migration.nodl()), address(nodl)); }