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

Consistent openzeppelin imports #80

Merged
merged 2 commits into from
Feb 4, 2025
Merged
Show file tree
Hide file tree
Changes from all 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
6 changes: 5 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
node_modules/
local/
clk-gateway/dist/
.DS_Store
.env-*
*.env

# Compiler files
cache/
Expand All @@ -9,7 +14,6 @@ zkout/
/broadcast
/broadcast/*/31337/
/broadcast/**/dry-run/

# Docs
docs/

Expand Down
1 change: 1 addition & 0 deletions remappings.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
@openzeppelin=lib/openzeppelin-contracts/
2 changes: 1 addition & 1 deletion script/DeployMigrationNFT.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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";

Expand Down
4 changes: 2 additions & 2 deletions src/Grants.sol
Original file line number Diff line number Diff line change
@@ -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
Expand Down
6 changes: 3 additions & 3 deletions src/NODL.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down
4 changes: 2 additions & 2 deletions src/Payment.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions src/QuotaControl.sol
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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();
}
Expand Down
6 changes: 3 additions & 3 deletions src/Rewards.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/bridge/MigrationNFT.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
4 changes: 2 additions & 2 deletions src/contentsign/BaseContentSign.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion src/contentsign/EnterpriseContentSign.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
8 changes: 4 additions & 4 deletions src/contentsign/PaymentMiddleware.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
8 changes: 4 additions & 4 deletions src/nameservice/ClickNameService.sol
Original file line number Diff line number Diff line change
@@ -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";

/**
Expand Down
2 changes: 1 addition & 1 deletion src/nameservice/ClickResolver.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/paymasters/BasePaymaster.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand Down
6 changes: 3 additions & 3 deletions test/NODL.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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);
}

Expand Down
4 changes: 2 additions & 2 deletions test/Rewards.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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"));
Expand Down
2 changes: 1 addition & 1 deletion test/__helpers__/AccessControlUtils.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion test/bridge/GrantsMigration.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
2 changes: 1 addition & 1 deletion test/bridge/MigrationNFT.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand Down
4 changes: 2 additions & 2 deletions test/bridge/NODLMigration.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,15 @@ 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);
}
assertEq(migration.threshold(), 2);
assertEq(migration.delay(), delay);
}

function test_configuredProperToken() public {
function test_configuredProperToken() public view {
assertEq(address(migration.nodl()), address(nodl));
}

Expand Down