diff --git a/contracts/access/AAccessControlled.sol b/contracts/access/AAccessControlled.sol index 0ee7ede25..19de2287c 100644 --- a/contracts/access/AAccessControlled.sol +++ b/contracts/access/AAccessControlled.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: MIT -pragma solidity ^0.8.18; +pragma solidity 0.8.18; import { IZNSAccessController } from "./IZNSAccessController.sol"; diff --git a/contracts/access/IZNSAccessController.sol b/contracts/access/IZNSAccessController.sol index fa41ee0e6..4008a1780 100644 --- a/contracts/access/IZNSAccessController.sol +++ b/contracts/access/IZNSAccessController.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: MIT -pragma solidity ^0.8.18; +pragma solidity 0.8.18; import { IAccessControl } from "@openzeppelin/contracts/access/IAccessControl.sol"; diff --git a/contracts/access/ZNSAccessController.sol b/contracts/access/ZNSAccessController.sol index c25e49742..6a0934115 100644 --- a/contracts/access/ZNSAccessController.sol +++ b/contracts/access/ZNSAccessController.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: MIT -pragma solidity ^0.8.18; +pragma solidity 0.8.18; import { AccessControl } from "@openzeppelin/contracts/access/AccessControl.sol"; import { IZNSAccessController } from "./IZNSAccessController.sol"; diff --git a/contracts/access/ZNSRoles.sol b/contracts/access/ZNSRoles.sol index ab8fa4c11..48a920620 100644 --- a/contracts/access/ZNSRoles.sol +++ b/contracts/access/ZNSRoles.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: MIT -pragma solidity ^0.8.18; +pragma solidity 0.8.18; /** diff --git a/contracts/oz-proxies/ERC1967ProxyAcc.sol b/contracts/oz-proxies/ERC1967ProxyAcc.sol index cd7dcf11e..67824c9c9 100644 --- a/contracts/oz-proxies/ERC1967ProxyAcc.sol +++ b/contracts/oz-proxies/ERC1967ProxyAcc.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: MIT -pragma solidity ^0.8.18; +pragma solidity 0.8.18; // solhint-disable-next-line no-global-import import "@openzeppelin/contracts/proxy/ERC1967/ERC1967Proxy.sol"; diff --git a/contracts/oz-proxies/TransparentUpgradeableProxyAcc.sol b/contracts/oz-proxies/TransparentUpgradeableProxyAcc.sol index 737cc9af7..a3d6f86a3 100644 --- a/contracts/oz-proxies/TransparentUpgradeableProxyAcc.sol +++ b/contracts/oz-proxies/TransparentUpgradeableProxyAcc.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: MIT -pragma solidity ^0.8.18; +pragma solidity 0.8.18; // solhint-disable-next-line no-global-import import "@openzeppelin/contracts/proxy/transparent/TransparentUpgradeableProxy.sol"; diff --git a/contracts/price/IZNSCurvePricer.sol b/contracts/price/IZNSCurvePricer.sol index fb8840b6e..7ef0d4830 100644 --- a/contracts/price/IZNSCurvePricer.sol +++ b/contracts/price/IZNSCurvePricer.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: MIT -pragma solidity ^0.8.18; +pragma solidity 0.8.18; import { ICurvePriceConfig } from "../types/ICurvePriceConfig.sol"; import { IZNSPricer } from "../types/IZNSPricer.sol"; diff --git a/contracts/price/IZNSFixedPricer.sol b/contracts/price/IZNSFixedPricer.sol index ccea1013b..2968ae72f 100644 --- a/contracts/price/IZNSFixedPricer.sol +++ b/contracts/price/IZNSFixedPricer.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: MIT -pragma solidity ^0.8.18; +pragma solidity 0.8.18; import { IZNSPricer } from "../types/IZNSPricer.sol"; diff --git a/contracts/price/ZNSCurvePricer.sol b/contracts/price/ZNSCurvePricer.sol index 0e28a430a..70bb32025 100644 --- a/contracts/price/ZNSCurvePricer.sol +++ b/contracts/price/ZNSCurvePricer.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: MIT -pragma solidity ^0.8.18; +pragma solidity 0.8.18; import { UUPSUpgradeable } from "@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol"; import { IZNSCurvePricer } from "./IZNSCurvePricer.sol"; @@ -299,8 +299,7 @@ contract ZNSCurvePricer is AAccessControlled, ARegistryWired, UUPSUpgradeable, I if (length <= config.baseLength) return config.maxPrice; if (length > config.maxLength) return config.minPrice; - return - (config.baseLength * config.maxPrice / length) + return (config.baseLength * config.maxPrice / length) / config.precisionMultiplier * config.precisionMultiplier; } @@ -312,7 +311,7 @@ contract ZNSCurvePricer is AAccessControlled, ARegistryWired, UUPSUpgradeable, I * which can occur if some of the config values are not properly chosen and set. */ function _validateConfig(bytes32 domainHash) internal view { - uint256 prevToMinPrice = _getPrice(domainHash, priceConfigs[domainHash].maxLength - 1); + uint256 prevToMinPrice = _getPrice(domainHash, priceConfigs[domainHash].maxLength); require( priceConfigs[domainHash].minPrice <= prevToMinPrice, "ZNSCurvePricer: incorrect value set causes the price spike at maxLength." diff --git a/contracts/price/ZNSFixedPricer.sol b/contracts/price/ZNSFixedPricer.sol index f4ef5ab00..c1fbe518c 100644 --- a/contracts/price/ZNSFixedPricer.sol +++ b/contracts/price/ZNSFixedPricer.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: MIT -pragma solidity ^0.8.18; +pragma solidity 0.8.18; import { AAccessControlled } from "../access/AAccessControlled.sol"; import { ARegistryWired } from "../registry/ARegistryWired.sol"; diff --git a/contracts/registrar/IZNSRootRegistrar.sol b/contracts/registrar/IZNSRootRegistrar.sol index a732fc5d0..02ccffb35 100644 --- a/contracts/registrar/IZNSRootRegistrar.sol +++ b/contracts/registrar/IZNSRootRegistrar.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: MIT -pragma solidity ^0.8.18; +pragma solidity 0.8.18; import { IDistributionConfig } from "../types/IDistributionConfig.sol"; import { IERC20 } from "@openzeppelin/contracts/token/ERC20/IERC20.sol"; diff --git a/contracts/registrar/IZNSSubRegistrar.sol b/contracts/registrar/IZNSSubRegistrar.sol index 5262d0869..7ca726c69 100644 --- a/contracts/registrar/IZNSSubRegistrar.sol +++ b/contracts/registrar/IZNSSubRegistrar.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: MIT -pragma solidity ^0.8.18; +pragma solidity 0.8.18; import { IDistributionConfig } from "../types/IDistributionConfig.sol"; import { PaymentConfig } from "../treasury/IZNSTreasury.sol"; diff --git a/contracts/registrar/ZNSRootRegistrar.sol b/contracts/registrar/ZNSRootRegistrar.sol index c5afde960..829fb8471 100644 --- a/contracts/registrar/ZNSRootRegistrar.sol +++ b/contracts/registrar/ZNSRootRegistrar.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: MIT -pragma solidity ^0.8.18; +pragma solidity 0.8.18; import { IZNSRootRegistrar, CoreRegisterArgs } from "./IZNSRootRegistrar.sol"; import { IZNSTreasury } from "../treasury/IZNSTreasury.sol"; diff --git a/contracts/registrar/ZNSSubRegistrar.sol b/contracts/registrar/ZNSSubRegistrar.sol index dd0dd03fe..da45034e0 100644 --- a/contracts/registrar/ZNSSubRegistrar.sol +++ b/contracts/registrar/ZNSSubRegistrar.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: MIT -pragma solidity ^0.8.18; +pragma solidity 0.8.18; import { IZNSPricer } from "../types/IZNSPricer.sol"; import { IZNSRootRegistrar, CoreRegisterArgs } from "./IZNSRootRegistrar.sol"; diff --git a/contracts/registry/ARegistryWired.sol b/contracts/registry/ARegistryWired.sol index 5b8b3fb99..c4b0de706 100644 --- a/contracts/registry/ARegistryWired.sol +++ b/contracts/registry/ARegistryWired.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: MIT -pragma solidity ^0.8.18; +pragma solidity 0.8.18; import { IZNSRegistry } from "./IZNSRegistry.sol"; diff --git a/contracts/registry/ZNSRegistry.sol b/contracts/registry/ZNSRegistry.sol index 3588d8a59..96e4868de 100644 --- a/contracts/registry/ZNSRegistry.sol +++ b/contracts/registry/ZNSRegistry.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: MIT -pragma solidity ^0.8.18; +pragma solidity 0.8.18; import { IZNSRegistry } from "./IZNSRegistry.sol"; import { AAccessControlled } from "../access/AAccessControlled.sol"; diff --git a/contracts/resolver/IZNSAddressResolver.sol b/contracts/resolver/IZNSAddressResolver.sol index c957c5269..06e690181 100644 --- a/contracts/resolver/IZNSAddressResolver.sol +++ b/contracts/resolver/IZNSAddressResolver.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: MIT -pragma solidity ^0.8.18; +pragma solidity 0.8.18; interface IZNSAddressResolver { diff --git a/contracts/resolver/ZNSAddressResolver.sol b/contracts/resolver/ZNSAddressResolver.sol index ed6987741..28b2a8470 100644 --- a/contracts/resolver/ZNSAddressResolver.sol +++ b/contracts/resolver/ZNSAddressResolver.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: MIT -pragma solidity ^0.8.18; +pragma solidity 0.8.18; import { ERC165 } from "@openzeppelin/contracts/utils/introspection/ERC165.sol"; import { UUPSUpgradeable } from "@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol"; diff --git a/contracts/token/IZNSDomainToken.sol b/contracts/token/IZNSDomainToken.sol index 0a1d45966..77604c013 100644 --- a/contracts/token/IZNSDomainToken.sol +++ b/contracts/token/IZNSDomainToken.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: MIT -pragma solidity ^0.8.18; +pragma solidity 0.8.18; import { IERC721Upgradeable } from "@openzeppelin/contracts-upgradeable/token/ERC721/IERC721Upgradeable.sol"; import { IERC2981Upgradeable } from "@openzeppelin/contracts-upgradeable/interfaces/IERC2981Upgradeable.sol"; diff --git a/contracts/token/ZNSDomainToken.sol b/contracts/token/ZNSDomainToken.sol index 1d269c67f..fc4b9568a 100644 --- a/contracts/token/ZNSDomainToken.sol +++ b/contracts/token/ZNSDomainToken.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: MIT -pragma solidity ^0.8.18; +pragma solidity 0.8.18; import { ERC721Upgradeable } from "@openzeppelin/contracts-upgradeable/token/ERC721/ERC721Upgradeable.sol"; import { UUPSUpgradeable } from "@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol"; diff --git a/contracts/token/mocks/CustomDecimalTokenMock.sol b/contracts/token/mocks/CustomDecimalTokenMock.sol index 87c92b0c8..3d5c46b0b 100644 --- a/contracts/token/mocks/CustomDecimalTokenMock.sol +++ b/contracts/token/mocks/CustomDecimalTokenMock.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: MIT -pragma solidity ^0.8.18; +pragma solidity 0.8.18; // solhint-disable import "@openzeppelin/contracts/token/ERC20/ERC20.sol"; diff --git a/contracts/token/mocks/IZeroTokenMock.sol b/contracts/token/mocks/IZeroTokenMock.sol index 0809d9cc5..7bb2d9f49 100644 --- a/contracts/token/mocks/IZeroTokenMock.sol +++ b/contracts/token/mocks/IZeroTokenMock.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: MIT -pragma solidity ^0.8.18; +pragma solidity 0.8.18; import { IERC20 } from "@openzeppelin/contracts/token/ERC20/IERC20.sol"; diff --git a/contracts/token/mocks/ZeroTokenMock.sol b/contracts/token/mocks/ZeroTokenMock.sol index 7c2c53d38..970b90099 100644 --- a/contracts/token/mocks/ZeroTokenMock.sol +++ b/contracts/token/mocks/ZeroTokenMock.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: MIT -pragma solidity ^0.8.18; +pragma solidity 0.8.18; // solhint-disable import { ZeroToken } from "@zero-tech/ztoken/contracts/ZeroToken.sol"; diff --git a/contracts/treasury/IZNSTreasury.sol b/contracts/treasury/IZNSTreasury.sol index 6879829e8..26c17f8ed 100644 --- a/contracts/treasury/IZNSTreasury.sol +++ b/contracts/treasury/IZNSTreasury.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: MIT -pragma solidity ^0.8.18; +pragma solidity 0.8.18; import { IERC20 } from "@openzeppelin/contracts/token/ERC20/IERC20.sol"; diff --git a/contracts/treasury/ZNSTreasury.sol b/contracts/treasury/ZNSTreasury.sol index 854c038b9..14bc01809 100644 --- a/contracts/treasury/ZNSTreasury.sol +++ b/contracts/treasury/ZNSTreasury.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: MIT -pragma solidity ^0.8.18; +pragma solidity 0.8.18; import { IZNSTreasury } from "./IZNSTreasury.sol"; import { AAccessControlled } from "../access/AAccessControlled.sol"; diff --git a/contracts/types/ICurvePriceConfig.sol b/contracts/types/ICurvePriceConfig.sol index 5b98cc5c8..295b44462 100644 --- a/contracts/types/ICurvePriceConfig.sol +++ b/contracts/types/ICurvePriceConfig.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: MIT -pragma solidity ^0.8.18; +pragma solidity 0.8.18; /** diff --git a/contracts/types/IDistributionConfig.sol b/contracts/types/IDistributionConfig.sol index d143827ea..73024f515 100644 --- a/contracts/types/IDistributionConfig.sol +++ b/contracts/types/IDistributionConfig.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: MIT -pragma solidity ^0.8.18; +pragma solidity 0.8.18; import { IZNSPricer } from "../types/IZNSPricer.sol"; import { IERC20 } from "@openzeppelin/contracts/token/ERC20/IERC20.sol"; diff --git a/contracts/types/IZNSPricer.sol b/contracts/types/IZNSPricer.sol index 848afcea2..32f00c6c3 100644 --- a/contracts/types/IZNSPricer.sol +++ b/contracts/types/IZNSPricer.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: MIT -pragma solidity ^0.8.18; +pragma solidity 0.8.18; /** diff --git a/contracts/upgrade-test-mocks/UpgradeMock.sol b/contracts/upgrade-test-mocks/UpgradeMock.sol index 4f46bcaab..20393f216 100644 --- a/contracts/upgrade-test-mocks/UpgradeMock.sol +++ b/contracts/upgrade-test-mocks/UpgradeMock.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: MIT -pragma solidity ^0.8.18; +pragma solidity 0.8.18; /* solhint-disable */ contract UpgradeMock { diff --git a/contracts/upgrade-test-mocks/distribution/ZNSCurvePricerMock.sol b/contracts/upgrade-test-mocks/distribution/ZNSCurvePricerMock.sol index 1727c2c18..507650178 100644 --- a/contracts/upgrade-test-mocks/distribution/ZNSCurvePricerMock.sol +++ b/contracts/upgrade-test-mocks/distribution/ZNSCurvePricerMock.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: MIT -pragma solidity ^0.8.18; +pragma solidity 0.8.18; import { ZNSCurvePricer } from "../../price/ZNSCurvePricer.sol"; import { UpgradeMock } from "../UpgradeMock.sol"; diff --git a/contracts/upgrade-test-mocks/distribution/ZNSFixedPricerMock.sol b/contracts/upgrade-test-mocks/distribution/ZNSFixedPricerMock.sol index 98b5dbb4c..85565a732 100644 --- a/contracts/upgrade-test-mocks/distribution/ZNSFixedPricerMock.sol +++ b/contracts/upgrade-test-mocks/distribution/ZNSFixedPricerMock.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: MIT -pragma solidity ^0.8.18; +pragma solidity 0.8.18; import { ZNSFixedPricer } from "../../price/ZNSFixedPricer.sol"; import { UpgradeMock } from "../UpgradeMock.sol"; diff --git a/contracts/upgrade-test-mocks/distribution/ZNSRootRegistrarMock.sol b/contracts/upgrade-test-mocks/distribution/ZNSRootRegistrarMock.sol index 703d3299e..f153db525 100644 --- a/contracts/upgrade-test-mocks/distribution/ZNSRootRegistrarMock.sol +++ b/contracts/upgrade-test-mocks/distribution/ZNSRootRegistrarMock.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: MIT -pragma solidity ^0.8.18; +pragma solidity 0.8.18; import { ZNSRootRegistrar } from "../../registrar/ZNSRootRegistrar.sol"; import { UpgradeMock } from "../UpgradeMock.sol"; diff --git a/contracts/upgrade-test-mocks/distribution/ZNSSubRegistrarMock.sol b/contracts/upgrade-test-mocks/distribution/ZNSSubRegistrarMock.sol index f51b19fe2..a3061f5a3 100644 --- a/contracts/upgrade-test-mocks/distribution/ZNSSubRegistrarMock.sol +++ b/contracts/upgrade-test-mocks/distribution/ZNSSubRegistrarMock.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: MIT -pragma solidity ^0.8.18; +pragma solidity 0.8.18; // solhint-disable import { ZNSSubRegistrar } from "../../registrar/ZNSSubRegistrar.sol"; diff --git a/contracts/upgrade-test-mocks/distribution/ZNSTreasuryMock.sol b/contracts/upgrade-test-mocks/distribution/ZNSTreasuryMock.sol index ee902b179..292bbb424 100644 --- a/contracts/upgrade-test-mocks/distribution/ZNSTreasuryMock.sol +++ b/contracts/upgrade-test-mocks/distribution/ZNSTreasuryMock.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: MIT -pragma solidity ^0.8.18; +pragma solidity 0.8.18; import { ZNSTreasury } from "../../treasury/ZNSTreasury.sol"; import { UpgradeMock } from "../UpgradeMock.sol"; diff --git a/contracts/upgrade-test-mocks/registry/ZNSRegistryMock.sol b/contracts/upgrade-test-mocks/registry/ZNSRegistryMock.sol index 752c71aa7..0193e0e3a 100644 --- a/contracts/upgrade-test-mocks/registry/ZNSRegistryMock.sol +++ b/contracts/upgrade-test-mocks/registry/ZNSRegistryMock.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: MIT -pragma solidity ^0.8.18; +pragma solidity 0.8.18; import { ZNSRegistry } from "../../registry/ZNSRegistry.sol"; import { UpgradeMock } from "../UpgradeMock.sol"; diff --git a/contracts/upgrade-test-mocks/resolver/ZNSAddressResolverMock.sol b/contracts/upgrade-test-mocks/resolver/ZNSAddressResolverMock.sol index d901ed6f3..eb8027589 100644 --- a/contracts/upgrade-test-mocks/resolver/ZNSAddressResolverMock.sol +++ b/contracts/upgrade-test-mocks/resolver/ZNSAddressResolverMock.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: MIT -pragma solidity ^0.8.18; +pragma solidity 0.8.18; import { ZNSAddressResolver } from "../../resolver/ZNSAddressResolver.sol"; import { UpgradeMock } from "../UpgradeMock.sol"; diff --git a/contracts/upgrade-test-mocks/token/ZNSDomainTokenMock.sol b/contracts/upgrade-test-mocks/token/ZNSDomainTokenMock.sol index 1bbd04d77..34facac9a 100644 --- a/contracts/upgrade-test-mocks/token/ZNSDomainTokenMock.sol +++ b/contracts/upgrade-test-mocks/token/ZNSDomainTokenMock.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: MIT -pragma solidity ^0.8.18; +pragma solidity 0.8.18; import { ZNSDomainToken } from "../../token/ZNSDomainToken.sol"; import { UpgradeMock } from "../UpgradeMock.sol"; diff --git a/contracts/utils/StringUtils.sol b/contracts/utils/StringUtils.sol index a02703d9b..c2e1bab51 100644 --- a/contracts/utils/StringUtils.sol +++ b/contracts/utils/StringUtils.sol @@ -1,7 +1,7 @@ // SPDX-License-Identifier: MIT // Source: // https://github.com/ensdomains/ens-contracts/blob/master/contracts/ethregistrar/StringUtils.sol -pragma solidity ^0.8.18; +pragma solidity 0.8.18; library StringUtils { diff --git a/docs/roles.md b/docs/roles.md new file mode 100644 index 000000000..7b3ad356e --- /dev/null +++ b/docs/roles.md @@ -0,0 +1,42 @@ +# zNS Access Roles and Their Privileges + +## `GOVERNOR_ROLE` privileges: +- The UUPS function `upgradeToAndCall()` allows governors to update the implementation used and invoke a call in upgradeable +contracts. +- The UUPS function `upgradeTo()` allows governors to update the implementation used in upgradeable contracts. +- The governors can grant `GOVERNOR_ROLE` to addresses. +- The governors can grant `ADMIN_ROLE` to addresses. +- The governors can grant any role to any address through the function `ZNSAccessController.setRoleAdmin()` . + +## `ADMIN_ROLE` privileges: +- The function `setRegistry()` allows admins to update the registry address for contracts inheriting `ARegistryWired`: + - `ZNSCurvePricer` + - `ZNSRootRegistrar` + - `ZNSSubRegistrar` + - `ZNSAddressResolver` + - `ZNSDomainToken` + - `ZNSTreasury` +- The function `ZNSRootRegister.setRootPricer()` allows admins to update the pricer contract used to determine pricing for root +domains. +- The function `ZNSRootRegister.setTreasury()` allows admins to update the `ZNSTreasury` contract used to store protocol fees +and staked funds. +- The function `ZNSRootRegister.setDomainToken()` allows admins to update the domain token contract used to validate domain +ownership. +- The function `ZNSRootRegister.setSubRegistrar()` allows admins to update the subdomain registrar contract. +- The function `ZNSRootRegister.setAddressResolver()` allows admins to update the root domain resolver. +- The admins can grant `REGISTRAR_ROLE` to addresses. + +## `REGISTRAR_ROLE` privileges: +- The function `ZNSRootRegister.coreRegister()` allows registrars to register domains. +- The function `ZNSRegistry.createDomainRecord()` allows registrars to register domain records which track ownership and address +resolver. +- The function `ZNSDomainToken.register()` allows registrars to mint tokens which are used to validate domain ownership. +- The function `ZNSDomainToken.revoke()` allows registrars to burn tokens to revoke domain ownership. +- The function `ZNSTreasury.stakeForDomain()` allows registrars to process registration fee to beneficiaries and stake domain funds +in the treasury. The staked funds are returned to the domain owner when the domain is revoked. +- The function `ZNSTreasury.unstakeForDomain()` allows registrars to unstake domain registration funds in the treasury during the +domain revocation process. +- The function `ZNSTreasury.processDirectPayment()` allows registrars to process registration fees to beneficiaries directly. +>The `REGISTRAR_ROLE` is reserved for contracts ZNSRootRegistrar and ZNSSubRegistrar only. + +>`EXECUTOR_ROLE` does not have any privileges. This role may be used for future implementations and additions. \ No newline at end of file diff --git a/hardhat.config.ts b/hardhat.config.ts index c53b3ea63..92e766842 100644 --- a/hardhat.config.ts +++ b/hardhat.config.ts @@ -1,112 +1,112 @@ -/* eslint-disable @typescript-eslint/no-var-requires, @typescript-eslint/no-unused-vars */ -require("dotenv").config(); - -import { HardhatUserConfig } from "hardhat/config"; -import * as tenderly from "@tenderly/hardhat-tenderly"; -import "@nomicfoundation/hardhat-toolbox"; -import "@nomiclabs/hardhat-ethers"; -import "@nomicfoundation/hardhat-network-helpers"; -import "@nomicfoundation/hardhat-chai-matchers"; -import "@openzeppelin/hardhat-upgrades"; -import "solidity-coverage"; -import "solidity-docgen"; -import "hardhat-gas-reporter"; - -// This call is needed to initialize Tenderly with Hardhat, -// the automatic verifications, though, don't seem to work, -// needing us to verify explicitly in code, however, -// for Tenderly to work properly with Hardhat this method -// needs to be called. The call below is commented out -// because if we leave it here, solidity-coverage -// does not work properly locally or in CI, so we -// keep it commented out and uncomment when using DevNet -// locally. -// !!! Uncomment this when using Tenderly DevNet !!! -// tenderly.setup({ automaticVerifications: false }); - -const config : HardhatUserConfig = { - solidity: { - compilers: [ - { - version: "0.8.18", - settings: { - optimizer: { - enabled: true, - runs: 200, - }, - }, - }, - ], - overrides: { - "@openzeppelin/contracts/proxy/ERC1967/ERC1967Proxy.sol": { - version: "0.8.9", - settings: { - optimizer: { - enabled: true, - runs: 200, - }, - }, - }, - "@openzeppelin/contracts/proxy/transparent/TransparentUpgradeableProxy.sol": { - version: "0.8.9", - settings: { - optimizer: { - enabled: true, - runs: 200, - }, - }, - }, - }, - }, - paths: { - sources: "./contracts", - tests: "./test", - cache: "./cache", - artifacts: "./artifacts", - }, - typechain: { - outDir: "typechain", - }, - mocha: { - timeout: 5000000, - }, - gasReporter: { - enabled: true, - }, - networks: { - mainnet: { - url: "https://mainnet.infura.io/v3/97e75e0bbc6a4419a5dd7fe4a518b917", - gasPrice: 80000000000, - }, - goerli: { - url: "https://goerli.infura.io/v3/77c3d733140f4c12a77699e24cb30c27", - timeout: 10000000, - }, - devnet: { - // Add current URL that you spawned if not using automated spawning - url: `${process.env.DEVNET_RPC_URL}`, - chainId: 1, - }, - }, - etherscan: { - apiKey: `${process.env.ETHERSCAN_API_KEY}`, - }, - tenderly: { - project: `${process.env.TENDERLY_PROJECT_SLUG}`, - username: `${process.env.TENDERLY_ACCOUNT_ID}`, - }, - docgen: { - pages: "files", - templates: "docs/docgen-templates", - outputDir: "docs/contracts", - exclude: [ - "upgrade-test-mocks/", - "upgradeMocks/", - "token/mocks/", - "utils/", - "oz-proxies/", - ], - }, -}; - -export default config; +/* eslint-disable @typescript-eslint/no-var-requires, @typescript-eslint/no-unused-vars */ +require("dotenv").config(); + +import { HardhatUserConfig } from "hardhat/config"; +import * as tenderly from "@tenderly/hardhat-tenderly"; +import "@nomicfoundation/hardhat-toolbox"; +import "@nomiclabs/hardhat-ethers"; +import "@nomicfoundation/hardhat-network-helpers"; +import "@nomicfoundation/hardhat-chai-matchers"; +import "@openzeppelin/hardhat-upgrades"; +import "solidity-coverage"; +import "solidity-docgen"; +import "hardhat-gas-reporter"; + +// This call is needed to initialize Tenderly with Hardhat, +// the automatic verifications, though, don't seem to work, +// needing us to verify explicitly in code, however, +// for Tenderly to work properly with Hardhat this method +// needs to be called. The call below is commented out +// because if we leave it here, solidity-coverage +// does not work properly locally or in CI, so we +// keep it commented out and uncomment when using DevNet +// locally. +// !!! Uncomment this when using Tenderly DevNet !!! +// tenderly.setup({ automaticVerifications: false }); + +const config : HardhatUserConfig = { + solidity: { + compilers: [ + { + version: "0.8.18", + settings: { + optimizer: { + enabled: true, + runs: 200, + }, + }, + }, + ], + overrides: { + "@openzeppelin/contracts/proxy/ERC1967/ERC1967Proxy.sol": { + version: "0.8.9", + settings: { + optimizer: { + enabled: true, + runs: 200, + }, + }, + }, + "@openzeppelin/contracts/proxy/transparent/TransparentUpgradeableProxy.sol": { + version: "0.8.9", + settings: { + optimizer: { + enabled: true, + runs: 200, + }, + }, + }, + }, + }, + paths: { + sources: "./contracts", + tests: "./test", + cache: "./cache", + artifacts: "./artifacts", + }, + typechain: { + outDir: "typechain", + }, + mocha: { + timeout: 5000000, + }, + gasReporter: { + enabled: false, + }, + networks: { + mainnet: { + url: "https://mainnet.infura.io/v3/97e75e0bbc6a4419a5dd7fe4a518b917", + gasPrice: 80000000000, + }, + goerli: { + url: "https://goerli.infura.io/v3/77c3d733140f4c12a77699e24cb30c27", + timeout: 10000000, + }, + devnet: { + // Add current URL that you spawned if not using automated spawning + url: `${process.env.DEVNET_RPC_URL}`, + chainId: 1, + }, + }, + etherscan: { + apiKey: `${process.env.ETHERSCAN_API_KEY}`, + }, + tenderly: { + project: `${process.env.TENDERLY_PROJECT_SLUG}`, + username: `${process.env.TENDERLY_ACCOUNT_ID}`, + }, + docgen: { + pages: "files", + templates: "docs/docgen-templates", + outputDir: "docs/contracts", + exclude: [ + "upgrade-test-mocks/", + "upgradeMocks/", + "token/mocks/", + "utils/", + "oz-proxies/", + ], + }, +}; + +export default config; diff --git a/test/ZNSCurvePricer.test.ts b/test/ZNSCurvePricer.test.ts index 099006a17..c14d749a6 100644 --- a/test/ZNSCurvePricer.test.ts +++ b/test/ZNSCurvePricer.test.ts @@ -309,6 +309,22 @@ describe("ZNSCurvePricer", () => { ).to.be.revertedWith(CURVE_PRICE_CONFIG_ERR); }); + it("Cannot go below the set minPrice", async () => { + // Using config numbers from audit + const newConfig = { + baseLength: BigNumber.from("5"), + maxLength: BigNumber.from("10"), + maxPrice: parseEther("10"), + minPrice: parseEther("5.5"), + precisionMultiplier: precisionMultiDefault, + feePercentage: registrationFeePercDefault, + }; + + await expect( + zns.curvePricer.connect(user).setPriceConfig(domainHash, newConfig) + ).to.be.revertedWith(CURVE_PRICE_CONFIG_ERR); + }); + it("Should revert if called by anyone other than owner or operator", async () => { const newConfig = { baseLength: BigNumber.from("6"), diff --git a/test/ZNSSubRegistrar.test.ts b/test/ZNSSubRegistrar.test.ts index 8d4c69cd9..5e332b7c5 100644 --- a/test/ZNSSubRegistrar.test.ts +++ b/test/ZNSSubRegistrar.test.ts @@ -1448,7 +1448,7 @@ describe("ZNSSubRegistrar", () => { it("CurvePricer - StakePayment - stake fee - 13 decimals", async () => { const priceConfig = { - maxPrice: parseUnits("25000.93", decimalValues.thirteen), + maxPrice: parseUnits("30000.93", decimalValues.thirteen), minPrice: parseUnits("2000.11", decimalValues.thirteen), maxLength: BigNumber.from(50), baseLength: BigNumber.from(4),