diff --git a/.env.sample b/.env.sample index 085892c8..cf4d5a69 100644 --- a/.env.sample +++ b/.env.sample @@ -32,9 +32,9 @@ SILENT_LOGGER="false" | "true" # Boolean value for if we deploy the mock # true = we deploy the mock # false = we use a hard coded address and pull data from chain -MOCK_MEOW_TOKEN= -# Address of the MEOW Token deployed to the network PRIOR to running Campaign or any other EXISTING token -# This is only used if MOCK_MEOW_TOKEN is set to false (`test` and `prod` environments) +MOCK_Z_TOKEN= +# Address of the Z Token deployed to the network PRIOR to running Campaign or any other EXISTING token +# This is only used if MOCK_Z_TOKEN is set to false (`test` and `prod` environments) STAKING_TOKEN_ADDRESS= # Environment variables to create an entirely custom config when `env_level` above is not dev diff --git a/.gitignore b/.gitignore index a9de5f05..f55a0d81 100644 --- a/.gitignore +++ b/.gitignore @@ -20,3 +20,4 @@ docker*.tgz # We don't ever use the generated manifests .openzeppelin +/.vscode diff --git a/README.md b/README.md index e2b290de..8695d5d4 100644 --- a/README.md +++ b/README.md @@ -34,7 +34,7 @@ Create `.env` file in the root directory and add the following variables: ENV_LEVEL: "dev" # local dev environment MONGO_DB_URI: "mongodb://localhost:27018" # local instance of MongoDB in the Docker MONGO_DB_NAME: "zns-campaign" # name of the database -MOCK_MEOW_TOKEN: "true" # use mock MeowToken contract for local testing +MOCK_Z_TOKEN: "true" # use mock ZToken contract for local testing SILENT_LOGGER: "true" # disable logging for tests ``` diff --git a/contracts/token/mocks/MeowTokenMock.sol b/contracts/token/mocks/MeowTokenMock.sol deleted file mode 100644 index dcbfce98..00000000 --- a/contracts/token/mocks/MeowTokenMock.sol +++ /dev/null @@ -1,16 +0,0 @@ -// SPDX-License-Identifier: MIT -/* solhint-disable */ -pragma solidity 0.8.26; - -import { ERC20Upgradeable } from "@openzeppelin/contracts-upgradeable/token/ERC20/ERC20Upgradeable.sol"; - - -contract MeowTokenMock is ERC20Upgradeable { - function initialize(string memory name_, string memory symbol_) external initializer { - __ERC20_init(name_, symbol_); - } - - function mint(address account, uint256 amount) public { - _mint(account, amount); - } -} diff --git a/contracts/token/mocks/ZTokenMock.sol b/contracts/token/mocks/ZTokenMock.sol new file mode 100644 index 00000000..7474e398 --- /dev/null +++ b/contracts/token/mocks/ZTokenMock.sol @@ -0,0 +1,34 @@ +// SPDX-License-Identifier: MIT +pragma solidity 0.8.26; + +import { ZToken } from "@zero-tech/z-token/contracts/ZToken.sol"; + + +contract ZTokenMock is ZToken { + constructor( + string memory _name, + string memory _symbol, + address _defaultAdmin, + uint48 _initialAdminDelay, + address _minter, + address _mintBeneficiary, + uint256 _initialSupplyBase, + uint16[] memory _inflationRates, + uint16 _finalInflationRate + ) ZToken( + _name, + _symbol, + _defaultAdmin, + _initialAdminDelay, + _minter, + _mintBeneficiary, + _initialSupplyBase, + _inflationRates, + _finalInflationRate + ) {} + + // for tests, to identify mock contract + function identifyMock() external pure returns (string memory) { + return "This is a mock token"; + } +} \ No newline at end of file diff --git a/package.json b/package.json index a2ead6d9..e2df8b49 100644 --- a/package.json +++ b/package.json @@ -62,7 +62,7 @@ "@types/mocha": "^9.1.0", "@types/node": "^18.15.11", "@zero-tech/eslint-config-cpt": "0.2.7", - "@zero-tech/ztoken": "2.1.0", + "@zero-tech/z-token": "1.0.0", "chai": "^4.3.10", "eslint": "^8.37.0", "ethers": "^6.9.0", @@ -83,4 +83,4 @@ "mongodb": "^6.1.0", "winston": "^3.11.0" } -} \ No newline at end of file +} diff --git a/src/deploy/campaign/environments.ts b/src/deploy/campaign/environments.ts index 7c7fdc64..e2785bef 100644 --- a/src/deploy/campaign/environments.ts +++ b/src/deploy/campaign/environments.ts @@ -14,10 +14,17 @@ import { INVALID_CURVE_ERR, MONGO_URI_ERR, INVALID_ENV_ERR, NO_ZERO_VAULT_ERR, + INITIAL_ADMIN_DELAY_DEFAULT, + INITIAL_SUPPLY_DEFAULT, + INFLATION_RATES_DEFAULT, + FINAL_INFLATION_RATE_DEFAULT, + Z_NAME_DEFAULT, + Z_SYMBOL_DEFAULT, } from "../../../test/helpers"; import { ethers } from "ethers"; -import { ICurvePriceConfig } from "../missions/types"; -import { MeowMainnet } from "../missions/contracts/meow-token/mainnet-data"; +import { ICurvePriceConfig, IZTokenConfig } from "../missions/types"; +import process from "process"; +import { ZSepolia } from "../missions/contracts/z-token/mainnet-data"; const getCustomAddresses = ( @@ -59,12 +66,14 @@ export const getConfig = async ({ admins, zeroVaultAddress, env, // this is ONLY used for tests! + zTokenConfig, } : { deployer : SignerWithAddress; governors ?: Array; admins ?: Array; zeroVaultAddress ?: string; env ?: string; + zTokenConfig ?: IZTokenConfig; }) : Promise> => { // Will throw an error based on any invalid setup, given the `ENV_LEVEL` set const priceConfig = validateEnv(env); @@ -78,31 +87,55 @@ export const getConfig = async ({ let zeroVaultAddressConf; - if (process.env.ENV_LEVEL === "dev") { + const zeroVaultAddressEnv = process.env.ZERO_VAULT_ADDRESS; + const mockZTokenEnv = process.env.MOCK_Z_TOKEN; + const envLevel = process.env.ENV_LEVEL; + + + // Get governor addresses set through env, if any + const governorAddresses = getCustomAddresses("GOVERNOR_ADDRESSES", deployerAddress, governors); + // Get admin addresses set through env, if any + const adminAddresses = getCustomAddresses("ADMIN_ADDRESSES", deployerAddress, admins); + + let zConfig : IZTokenConfig | undefined; + + if (envLevel === "dev") { requires( - !!zeroVaultAddress || !!process.env.ZERO_VAULT_ADDRESS, + !!zeroVaultAddress || !!zeroVaultAddressEnv, "Must pass `zeroVaultAddress` to `getConfig()` for `dev` environment" ); - zeroVaultAddressConf = zeroVaultAddress || process.env.ZERO_VAULT_ADDRESS; + zeroVaultAddressConf = zeroVaultAddress || zeroVaultAddressEnv; + + if (!zTokenConfig) { + // in case, we didn't provide addresses, it will choose the governon as `admin` argument, + // deployAdmin as `minter` and first passed admin as `mintBeneficiary`. + zConfig = { + name: Z_NAME_DEFAULT, + symbol: Z_SYMBOL_DEFAULT, + defaultAdmin: governorAddresses[0], + initialAdminDelay: INITIAL_ADMIN_DELAY_DEFAULT, + minter: deployer.address, + mintBeneficiary: adminAddresses[0], + initialSupplyBase: INITIAL_SUPPLY_DEFAULT, + inflationRates: INFLATION_RATES_DEFAULT, + finalInflationRate: FINAL_INFLATION_RATE_DEFAULT, + }; + } else { + zConfig = zTokenConfig; + } } else { - zeroVaultAddressConf = process.env.ZERO_VAULT_ADDRESS; + zeroVaultAddressConf = zeroVaultAddressEnv; } // Domain Token Values - const royaltyReceiver = process.env.ENV_LEVEL !== "dev" ? process.env.ROYALTY_RECEIVER! : zeroVaultAddressConf; + const royaltyReceiver = envLevel !== "dev" ? process.env.ROYALTY_RECEIVER! : zeroVaultAddressConf; const royaltyFraction = process.env.ROYALTY_FRACTION ? BigInt(process.env.ROYALTY_FRACTION) : DEFAULT_ROYALTY_FRACTION; - // Get governor addresses set through env, if any - const governorAddresses = getCustomAddresses("GOVERNOR_ADDRESSES", deployerAddress, governors); - - // Get admin addresses set through env, if any - const adminAddresses = getCustomAddresses("ADMIN_ADDRESSES", deployerAddress, admins); - const config : IZNSCampaignConfig = { - env: process.env.ENV_LEVEL!, + env: envLevel!, deployAdmin: deployer, governorAddresses, adminAddresses, @@ -113,8 +146,9 @@ export const getConfig = async ({ defaultRoyaltyFraction: royaltyFraction, }, rootPriceConfig: priceConfig, + zTokenConfig: zConfig, zeroVaultAddress: zeroVaultAddressConf as string, - mockMeowToken: process.env.MOCK_MEOW_TOKEN === "true", + mockZToken: mockZTokenEnv === "true", stakingTokenAddress: process.env.STAKING_TOKEN_ADDRESS!, postDeploy: { tenderlyProjectSlug: process.env.TENDERLY_PROJECT_SLUG!, @@ -143,11 +177,13 @@ export const validateEnv = ( // Validate price config first since we have to return it const priceConfig = getValidateRootPriceConfig(); + const mockZTokenEnv = process.env.MOCK_Z_TOKEN; + if (envLevel === "dev") return priceConfig; if (envLevel === "test" || envLevel === "dev") { - if (process.env.MOCK_MEOW_TOKEN === "false" && !process.env.STAKING_TOKEN_ADDRESS) { - throw new Error("Must provide a staking token address if not mocking MEOW token in `dev` environment"); + if (mockZTokenEnv === "false" && !process.env.STAKING_TOKEN_ADDRESS) { + throw new Error("Must provide a staking token address if not mocking Z token in `dev` environment"); } } @@ -172,19 +208,19 @@ export const validateEnv = ( // Mainnet if (envLevel === "prod") { - requires(process.env.MOCK_MEOW_TOKEN === "false", NO_MOCK_PROD_ERR); - requires(process.env.STAKING_TOKEN_ADDRESS === MeowMainnet.address, STAKING_TOKEN_ERR); requires(!process.env.MONGO_DB_URI.includes("localhost"), MONGO_URI_ERR); + requires(mockZTokenEnv === "false", NO_MOCK_PROD_ERR); + requires(process.env.STAKING_TOKEN_ADDRESS === ZSepolia.address, STAKING_TOKEN_ERR); } if (process.env.VERIFY_CONTRACTS === "true") { - requires(!!process.env.ETHERSCAN_API_KEY, "Must provide an Etherscan API Key to verify contracts"); + requires(process.env.ETHERSCAN_API_KEY === "true", "Must provide an Etherscan API Key to verify contracts"); } if (process.env.MONITOR_CONTRACTS === "true") { - requires(!!process.env.TENDERLY_PROJECT_SLUG, "Must provide a Tenderly Project Slug to monitor contracts"); - requires(!!process.env.TENDERLY_ACCOUNT_ID, "Must provide a Tenderly Account ID to monitor contracts"); - requires(!!process.env.TENDERLY_ACCESS_KEY, "Must provide a Tenderly Access Key to monitor contracts"); + requires(process.env.TENDERLY_PROJECT_SLUG === "true", "Must provide a Tenderly Project Slug to monitor contracts"); + requires(process.env.TENDERLY_ACCOUNT_ID === "true", "Must provide a Tenderly Account ID to monitor contracts"); + requires(process.env.TENDERLY_ACCESS_KEY === "true", "Must provide a Tenderly Access Key to monitor contracts"); } return priceConfig; diff --git a/src/deploy/campaign/types.ts b/src/deploy/campaign/types.ts index e3721cf0..b733056b 100644 --- a/src/deploy/campaign/types.ts +++ b/src/deploy/campaign/types.ts @@ -1,9 +1,8 @@ import { HardhatEthersSigner, SignerWithAddress } from "@nomicfoundation/hardhat-ethers/signers"; import { DefenderRelaySigner } from "@openzeppelin/defender-sdk-relay-signer-client/lib/ethers"; -import { ICurvePriceConfig } from "../missions/types"; +import { ICurvePriceConfig, IZTokenConfig } from "../missions/types"; import { IContractState, IDeployCampaignConfig } from "@zero-tech/zdc"; import { - MeowTokenMock, ZNSAccessController, ZNSAddressResolver, ZNSCurvePricer, @@ -13,8 +12,9 @@ import { ZNSRootRegistrar, ZNSSubRegistrar, ZNSTreasury, + ZToken, + ZTokenMock, } from "../../../typechain"; -import { MeowToken } from "@zero-tech/ztoken/typechain-js"; export type IZNSSigner = HardhatEthersSigner | DefenderRelaySigner | SignerWithAddress; @@ -30,8 +30,9 @@ export interface IZNSCampaignConfig extends IDeployCampaignConfig { accessController : ZNSAccessController; registry : ZNSRegistry; domainToken : ZNSDomainToken; - meowToken : MeowTokenMock; + zToken : ZTokenMock; addressResolver : ZNSAddressResolver; curvePricer : ZNSCurvePricer; treasury : ZNSTreasury; diff --git a/src/deploy/missions/contracts/index.ts b/src/deploy/missions/contracts/index.ts index 9d86beae..24dee5cf 100644 --- a/src/deploy/missions/contracts/index.ts +++ b/src/deploy/missions/contracts/index.ts @@ -5,6 +5,6 @@ export * from "./domain-token"; export * from "./treasury"; export * from "./curve-pricer"; export * from "./access-controller"; -export * from "./meow-token/meow-token"; +export * from "./z-token/z-token"; export * from "./fixed-pricer"; export * from "./sub-registrar"; diff --git a/src/deploy/missions/contracts/meow-token/mainnet-data.ts b/src/deploy/missions/contracts/meow-token/mainnet-data.ts deleted file mode 100644 index 9e8569ed..00000000 --- a/src/deploy/missions/contracts/meow-token/mainnet-data.ts +++ /dev/null @@ -1,513 +0,0 @@ - -export const MeowMainnet = { - address: "0x0eC78ED49C2D27b315D462d43B5BAB94d2C79bf8", - implementation: "0xcDb3C5e9b4760f93437aBaD33dBEC9a2cE3704f6", - abi: [ - { - "inputs": [], - "stateMutability": "nonpayable", - "type": "constructor", - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "owner", - "type": "address", - }, - { - "indexed": true, - "internalType": "address", - "name": "spender", - "type": "address", - }, - { - "indexed": false, - "internalType": "uint256", - "name": "value", - "type": "uint256", - }, - ], - "name": "Approval", - "type": "event", - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "uint8", - "name": "version", - "type": "uint8", - }, - ], - "name": "Initialized", - "type": "event", - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "previousOwner", - "type": "address", - }, - { - "indexed": true, - "internalType": "address", - "name": "newOwner", - "type": "address", - }, - ], - "name": "OwnershipTransferred", - "type": "event", - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "address", - "name": "account", - "type": "address", - }, - ], - "name": "Paused", - "type": "event", - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "uint256", - "name": "id", - "type": "uint256", - }, - ], - "name": "Snapshot", - "type": "event", - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "from", - "type": "address", - }, - { - "indexed": true, - "internalType": "address", - "name": "to", - "type": "address", - }, - { - "indexed": false, - "internalType": "uint256", - "name": "value", - "type": "uint256", - }, - ], - "name": "Transfer", - "type": "event", - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "address", - "name": "account", - "type": "address", - }, - ], - "name": "Unpaused", - "type": "event", - }, - { - "inputs": [ - { - "internalType": "address", - "name": "owner", - "type": "address", - }, - { - "internalType": "address", - "name": "spender", - "type": "address", - }, - ], - "name": "allowance", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256", - }, - ], - "stateMutability": "view", - "type": "function", - }, - { - "inputs": [ - { - "internalType": "address", - "name": "spender", - "type": "address", - }, - { - "internalType": "uint256", - "name": "amount", - "type": "uint256", - }, - ], - "name": "approve", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool", - }, - ], - "stateMutability": "nonpayable", - "type": "function", - }, - { - "inputs": [ - { - "internalType": "address", - "name": "account", - "type": "address", - }, - ], - "name": "balanceOf", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256", - }, - ], - "stateMutability": "view", - "type": "function", - }, - { - "inputs": [ - { - "internalType": "address", - "name": "", - "type": "address", - }, - { - "internalType": "uint256", - "name": "", - "type": "uint256", - }, - ], - "name": "balanceOfAt", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256", - }, - ], - "stateMutability": "view", - "type": "function", - }, - { - "inputs": [], - "name": "decimals", - "outputs": [ - { - "internalType": "uint8", - "name": "", - "type": "uint8", - }, - ], - "stateMutability": "view", - "type": "function", - }, - { - "inputs": [ - { - "internalType": "address", - "name": "spender", - "type": "address", - }, - { - "internalType": "uint256", - "name": "subtractedValue", - "type": "uint256", - }, - ], - "name": "decreaseAllowance", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool", - }, - ], - "stateMutability": "nonpayable", - "type": "function", - }, - { - "inputs": [ - { - "internalType": "address", - "name": "spender", - "type": "address", - }, - { - "internalType": "uint256", - "name": "addedValue", - "type": "uint256", - }, - ], - "name": "increaseAllowance", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool", - }, - ], - "stateMutability": "nonpayable", - "type": "function", - }, - { - "inputs": [ - { - "internalType": "string", - "name": "name_", - "type": "string", - }, - { - "internalType": "string", - "name": "symbol_", - "type": "string", - }, - ], - "name": "initialize", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function", - }, - { - "inputs": [], - "name": "name", - "outputs": [ - { - "internalType": "string", - "name": "", - "type": "string", - }, - ], - "stateMutability": "view", - "type": "function", - }, - { - "inputs": [], - "name": "owner", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address", - }, - ], - "stateMutability": "view", - "type": "function", - }, - { - "inputs": [], - "name": "paused", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool", - }, - ], - "stateMutability": "view", - "type": "function", - }, - { - "inputs": [], - "name": "renounceOwnership", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function", - }, - { - "inputs": [], - "name": "symbol", - "outputs": [ - { - "internalType": "string", - "name": "", - "type": "string", - }, - ], - "stateMutability": "view", - "type": "function", - }, - { - "inputs": [], - "name": "totalSupply", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256", - }, - ], - "stateMutability": "view", - "type": "function", - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256", - }, - ], - "name": "totalSupplyAt", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256", - }, - ], - "stateMutability": "view", - "type": "function", - }, - { - "inputs": [ - { - "internalType": "address", - "name": "to", - "type": "address", - }, - { - "internalType": "uint256", - "name": "amount", - "type": "uint256", - }, - ], - "name": "transfer", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool", - }, - ], - "stateMutability": "nonpayable", - "type": "function", - }, - { - "inputs": [ - { - "internalType": "address[]", - "name": "recipients", - "type": "address[]", - }, - { - "internalType": "uint256", - "name": "amount", - "type": "uint256", - }, - ], - "name": "transferBulk", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool", - }, - ], - "stateMutability": "nonpayable", - "type": "function", - }, - { - "inputs": [ - { - "internalType": "address", - "name": "from", - "type": "address", - }, - { - "internalType": "address", - "name": "to", - "type": "address", - }, - { - "internalType": "uint256", - "name": "amount", - "type": "uint256", - }, - ], - "name": "transferFrom", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool", - }, - ], - "stateMutability": "nonpayable", - "type": "function", - }, - { - "inputs": [ - { - "internalType": "address", - "name": "sender", - "type": "address", - }, - { - "internalType": "address[]", - "name": "recipients", - "type": "address[]", - }, - { - "internalType": "uint256", - "name": "amount", - "type": "uint256", - }, - ], - "name": "transferFromBulk", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool", - }, - ], - "stateMutability": "nonpayable", - "type": "function", - }, - { - "inputs": [ - { - "internalType": "address", - "name": "newOwner", - "type": "address", - }, - ], - "name": "transferOwnership", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function", - }, - ], -}; diff --git a/src/deploy/missions/contracts/names.ts b/src/deploy/missions/contracts/names.ts index d9272765..42e61d8f 100644 --- a/src/deploy/missions/contracts/names.ts +++ b/src/deploy/missions/contracts/names.ts @@ -14,10 +14,10 @@ export const znsNames = { contract: "ZNSDomainToken", instance: "domainToken", }, - meowToken: { - contract: "MeowToken", - contractMock: "MeowTokenMock", - instance: "meowToken", + zToken: { + contract: "ZToken", + contractMock: "ZTokenMock", + instance: "zToken", }, addressResolver: { contract: "ZNSAddressResolver", diff --git a/src/deploy/missions/contracts/treasury.ts b/src/deploy/missions/contracts/treasury.ts index 86d7a612..5a356ee3 100644 --- a/src/deploy/missions/contracts/treasury.ts +++ b/src/deploy/missions/contracts/treasury.ts @@ -27,7 +27,7 @@ IZNSContracts const { accessController, registry, - meowToken, + zToken, config: { zeroVaultAddress, }, @@ -36,7 +36,7 @@ IZNSContracts return [ await accessController.getAddress(), await registry.getAddress(), - await meowToken.getAddress(), + await zToken.getAddress(), zeroVaultAddress, ]; } diff --git a/src/deploy/missions/contracts/z-token/mainnet-data.ts b/src/deploy/missions/contracts/z-token/mainnet-data.ts new file mode 100644 index 00000000..bc2879a8 --- /dev/null +++ b/src/deploy/missions/contracts/z-token/mainnet-data.ts @@ -0,0 +1,4 @@ + +export const ZSepolia = { + address: "0x7148Db73c78Ded8e4f81784A121Bbe7E163f4834", +}; diff --git a/src/deploy/missions/contracts/meow-token/meow-token.ts b/src/deploy/missions/contracts/z-token/z-token.ts similarity index 52% rename from src/deploy/missions/contracts/meow-token/meow-token.ts rename to src/deploy/missions/contracts/z-token/z-token.ts index c75001bd..adabaa12 100644 --- a/src/deploy/missions/contracts/meow-token/meow-token.ts +++ b/src/deploy/missions/contracts/z-token/z-token.ts @@ -1,35 +1,29 @@ +/* eslint-disable prefer-const */ import { BaseDeployMission, IDeployMissionArgs, TDeployArgs, } from "@zero-tech/zdc"; -import { ProxyKinds } from "../../../constants"; -import { ethers } from "ethers"; import { znsNames } from "../names"; import { HardhatRuntimeEnvironment } from "hardhat/types"; import { SignerWithAddress } from "@nomicfoundation/hardhat-ethers/signers"; import { IZNSCampaignConfig, IZNSContracts } from "../../../campaign/types"; -import { MeowToken__factory } from "@zero-tech/ztoken/typechain-js"; -import meowArtifact from "@zero-tech/ztoken/artifacts/contracts/MeowToken.sol/MeowToken.json"; +import { IZTokenConfig } from "../../types"; +import { ZToken__factory } from "../../../../../typechain"; -export const meowTokenName = "MEOW"; -export const meowTokenSymbol = "MEOW"; - - -export class MeowTokenDM extends BaseDeployMission< +export class ZTokenDM extends BaseDeployMission< HardhatRuntimeEnvironment, SignerWithAddress, IZNSCampaignConfig, IZNSContracts > { proxyData = { - isProxy: true, - kind: ProxyKinds.transparent, + isProxy: false, }; - contractName = znsNames.meowToken.contract; - instanceName = znsNames.meowToken.instance; + contractName = znsNames.zToken.contract; + instanceName = znsNames.zToken.instance; constructor (args : IDeployMissionArgs< HardhatRuntimeEnvironment, @@ -39,16 +33,16 @@ IZNSContracts >) { super(args); - if (this.config.mockMeowToken) { - this.contractName = znsNames.meowToken.contractMock; + if (this.config.mockZToken) { + this.contractName = znsNames.zToken.contractMock; } else { - this.contractName = znsNames.meowToken.contract; + this.contractName = znsNames.zToken.contract; } } async deploy () { - if (!this.config.mockMeowToken) { - this.logger.info("Using MEOW token from Mainnet"); + if (!this.config.mockZToken) { + this.logger.info("Using Z token from Mainnet"); // TODO dep: add proper bytecode comparison here and throw if different! // const bytecodeFromChain = await this.campaign.deployer.getBytecodeFromChain(this.config.stakingTokenAddress); @@ -58,15 +52,15 @@ IZNSContracts // } = this.getArtifact(); // if (!compareBytecodeStrict(bytecode, bytecodeFromChain)) { - // this.logger.error("MEOW token bytecode compiled in this module differs from Mainnet"); + // this.logger.error("Z token bytecode compiled in this module differs from Mainnet"); // throw new Error( - // "MEOW token bytecode compiled in this module differs from Mainnet" + // "Z token bytecode compiled in this module differs from Mainnet" // ); // } this.logger.debug(`Writing ${this.contractName} to DB...`); - const factory = new MeowToken__factory(this.config.deployAdmin); + const factory = new ZToken__factory(this.config.deployAdmin); const baseContract = factory.attach(this.config.stakingTokenAddress); // TODO remove! // const baseContract = await this.campaign.deployer.getContractObject( @@ -85,36 +79,29 @@ IZNSContracts } } - getArtifact () { - return meowArtifact; - } - async deployArgs () : Promise { - return [meowTokenName, meowTokenSymbol]; - } - - async needsPostDeploy () { - const msg = this.config.mockMeowToken ? "needs" : "doesn't need"; - - this.logger.debug(`${this.contractName} ${msg} post deploy sequence`); - - return this.config.mockMeowToken ; - } - - async postDeploy () { - const { - meowToken, - config: { - deployAdmin, - }, - } = this.campaign; - - // Mint 100,000 MEOW to the deployer - await meowToken.connect(deployAdmin).mint( - await deployAdmin.getAddress?.(), - ethers.parseEther("100000") - ); - - this.logger.debug(`${this.contractName} post deploy sequence completed`); + let { + name, + symbol, + defaultAdmin, + initialAdminDelay, + minter, + mintBeneficiary, + initialSupplyBase, + inflationRates, + finalInflationRate, + } = this.config.zTokenConfig as IZTokenConfig; + + return [ + name, + symbol, + defaultAdmin, + initialAdminDelay, + minter, + mintBeneficiary, + initialSupplyBase, + inflationRates, + finalInflationRate, + ]; } } diff --git a/src/deploy/missions/types.ts b/src/deploy/missions/types.ts index 70470545..74334a0a 100644 --- a/src/deploy/missions/types.ts +++ b/src/deploy/missions/types.ts @@ -8,3 +8,15 @@ export interface ICurvePriceConfig { feePercentage : bigint; isSet : boolean; } + +export interface IZTokenConfig { + name : string; + symbol : string; + defaultAdmin : string; + initialAdminDelay : bigint; + minter : string; + mintBeneficiary : string; + initialSupplyBase : bigint; + inflationRates : Array; + finalInflationRate : bigint; +} \ No newline at end of file diff --git a/src/deploy/zns-campaign.ts b/src/deploy/zns-campaign.ts index 0d3a1f5c..61293059 100644 --- a/src/deploy/zns-campaign.ts +++ b/src/deploy/zns-campaign.ts @@ -6,7 +6,7 @@ import { getLogger, } from "@zero-tech/zdc"; import { - MeowTokenDM, + ZTokenDM, ZNSAccessControllerDM, ZNSAddressResolverDM, ZNSDomainTokenDM, ZNSCurvePricerDM, ZNSRootRegistrarDM, @@ -50,7 +50,7 @@ export const runZnsCampaign = async ({ ZNSAccessControllerDM, ZNSRegistryDM, ZNSDomainTokenDM, - MeowTokenDM, + ZTokenDM, ZNSAddressResolverDM, ZNSCurvePricerDM, ZNSTreasuryDM, diff --git a/src/tenderly/devnet/run-all-flows.ts b/src/tenderly/devnet/run-all-flows.ts index 15ba04d8..bb8f4dfa 100644 --- a/src/tenderly/devnet/run-all-flows.ts +++ b/src/tenderly/devnet/run-all-flows.ts @@ -37,7 +37,7 @@ export const runAllFlows = async () => { accessType: AccessType.OPEN, }, paymentConfig: { - token: await zns.meowToken.getAddress(), + token: await zns.zToken.getAddress(), beneficiary: governor.address, }, priceConfig: { @@ -47,7 +47,7 @@ export const runAllFlows = async () => { }; // get some funds and approve funds for treasury - await zns.meowToken.connect(governor).approve(await zns.treasury.getAddress(), ethers.MaxUint256); + await zns.zToken.connect(governor).approve(await zns.treasury.getAddress(), ethers.MaxUint256); const rootHash = await registrationWithSetup({ zns, @@ -64,14 +64,14 @@ export const runAllFlows = async () => { accessType: AccessType.OPEN, }, paymentConfig: { - token: await zns.meowToken.getAddress(), + token: await zns.zToken.getAddress(), beneficiary: user.address, }, priceConfig: DEFAULT_PRICE_CONFIG, }; - await zns.meowToken.transfer(user.address, ethers.parseEther("10000")); - await zns.meowToken.connect(user).approve(await zns.treasury.getAddress(), ethers.MaxUint256); + await zns.zToken.transfer(user.address, ethers.parseEther("10000")); + await zns.zToken.connect(user).approve(await zns.treasury.getAddress(), ethers.MaxUint256); await registrationWithSetup({ zns, diff --git a/src/utils/compare-bytecode.ts b/src/utils/compare-bytecode.ts index 4eddba82..4ce3a0b8 100644 --- a/src/utils/compare-bytecode.ts +++ b/src/utils/compare-bytecode.ts @@ -1,5 +1,4 @@ -// TODO dep: this does not work. find a better way and uncomment the call in meow-token.ts const replacePattern = /a165627a7a72305820.{64}0029.*/g; export const compareBytecodeStrict = (bytecodeA : string, bytecodeB : string) => { diff --git a/test/DeployCampaign.integration.test.ts b/test/DeployCampaign.integration.test.ts index abe78255..c7aee5c4 100644 --- a/test/DeployCampaign.integration.test.ts +++ b/test/DeployCampaign.integration.test.ts @@ -5,14 +5,13 @@ import * as hre from "hardhat"; import { SignerWithAddress } from "@nomicfoundation/hardhat-ethers/signers"; import { getConfig } from "../src/deploy/campaign/environments"; import { runZnsCampaign } from "../src/deploy/zns-campaign"; -import { ethers } from "ethers"; import { IDistributionConfig } from "./helpers/types"; import { expect } from "chai"; import { hashDomainLabel, PaymentType, AccessType } from "./helpers"; import { approveBulk, getPriceBulk, - mintBulk, + transferBulk, registerRootDomainBulk, registerSubdomainBulk, } from "./helpers/deploy-helpers"; @@ -64,8 +63,6 @@ describe("zNS + zDC Single Integration Test", () => { let paidMediumSubHash : string; let paidLongSubHash : string; - const mintAmount = ethers.parseEther("10000000"); - const domains = [shortDomain, mediumDomain, longDomain]; before(async () => { @@ -78,7 +75,7 @@ describe("zNS + zDC Single Integration Test", () => { zeroVaultAddress: zeroVault.address, }); - config.mockMeowToken = hre.network.name === "hardhat"; + config.mockZToken = hre.network.name === "hardhat"; // First run the `run-campaign` script, then modify the `MONGO_DB_VERSION` environment variable // Then run this test. The campaign won't be run, but those addresses will be picked up from the DB @@ -119,10 +116,12 @@ describe("zNS + zDC Single Integration Test", () => { await approveBulk(users, zns); // Give the user funds - if (hre.network.name === "hardhat" && config.mockMeowToken) { - await mintBulk( + if (hre.network.name === "hardhat" && config.mockZToken) { + const userBalanceInitial = await zns.zToken.balanceOf(deployAdmin.address) / BigInt(users.length); + await transferBulk( users, - mintAmount, + deployAdmin, + userBalanceInitial, zns ); } @@ -198,9 +197,9 @@ describe("zNS + zDC Single Integration Test", () => { const subdomains = [paidShortSubdomain, paidMediumSubdomain, paidLongSubdomain]; const balancePromises = [ - zns.meowToken.balanceOf(userD.address), - zns.meowToken.balanceOf(userE.address), - zns.meowToken.balanceOf(userF.address), + zns.zToken.balanceOf(userD.address), + zns.zToken.balanceOf(userE.address), + zns.zToken.balanceOf(userF.address), ]; const [ @@ -239,9 +238,9 @@ describe("zNS + zDC Single Integration Test", () => { ); const balanceAfterPromises = [ - zns.meowToken.balanceOf(userD.address), - zns.meowToken.balanceOf(userE.address), - zns.meowToken.balanceOf(userF.address), + zns.zToken.balanceOf(userD.address), + zns.zToken.balanceOf(userE.address), + zns.zToken.balanceOf(userF.address), ]; const [ diff --git a/test/DeployCampaignInt.test.ts b/test/DeployCampaignInt.test.ts index 98bf69e0..11064c04 100644 --- a/test/DeployCampaignInt.test.ts +++ b/test/DeployCampaignInt.test.ts @@ -23,11 +23,15 @@ import { STAKING_TOKEN_ERR, INVALID_CURVE_ERR, MONGO_URI_ERR, + INFLATION_RATES_DEFAULT, + FINAL_INFLATION_RATE_DEFAULT, + INITIAL_SUPPLY_DEFAULT, + INITIAL_ADMIN_DELAY_DEFAULT, + Z_NAME_DEFAULT, + Z_SYMBOL_DEFAULT, } from "./helpers"; import { - MeowTokenDM, - meowTokenName, - meowTokenSymbol, + ZTokenDM, ZNSAccessControllerDM, ZNSAddressResolverDM, ZNSCurvePricerDM, @@ -36,7 +40,7 @@ import { } from "../src/deploy/missions/contracts"; import { znsNames } from "../src/deploy/missions/contracts/names"; import { runZnsCampaign } from "../src/deploy/zns-campaign"; -import { MeowMainnet } from "../src/deploy/missions/contracts/meow-token/mainnet-data"; +import { ZSepolia } from "../src/deploy/missions/contracts/z-token/mainnet-data"; import { ResolverTypes } from "../src/deploy/constants"; import { getConfig } from "../src/deploy/campaign/environments"; import { ethers } from "ethers"; @@ -46,6 +50,7 @@ import { saveTag } from "../src/utils/git-tag/save-tag"; import { IZNSCampaignConfig, IZNSContracts } from "../src/deploy/campaign/types"; import { HardhatRuntimeEnvironment } from "hardhat/types"; import { getZnsMongoAdapter } from "../src/deploy/mongo"; +import { IZTokenConfig } from "../src/deploy/missions/types"; const execAsync = promisify(exec); @@ -69,100 +74,100 @@ describe("Deploy Campaign Test", () => { [deployAdmin, admin, governor, zeroVault, userA, userB] = await hre.ethers.getSigners(); }); - describe("MEOW Token Ops", () => { + describe("Z Token Ops", () => { before(async () => { - campaignConfig = { - env, - deployAdmin, - governorAddresses: [deployAdmin.address], - adminAddresses: [deployAdmin.address, admin.address], - domainToken: { - name: ZNS_DOMAIN_TOKEN_NAME, - symbol: ZNS_DOMAIN_TOKEN_SYMBOL, - defaultRoyaltyReceiver: deployAdmin.address, - defaultRoyaltyFraction: DEFAULT_ROYALTY_FRACTION, - }, - rootPriceConfig: DEFAULT_PRICE_CONFIG, - zeroVaultAddress: zeroVault.address, - stakingTokenAddress: MeowMainnet.address, - mockMeowToken: true, - postDeploy: { - tenderlyProjectSlug: "", - monitorContracts: false, - verifyContracts: false, - }, - }; + campaignConfig = await getConfig( + { + deployer: deployAdmin, + governors: [deployAdmin.address], + admins: [deployAdmin.address, admin.address], + zeroVaultAddress: zeroVault.address, + env, + } + ); + campaignConfig.domainToken.defaultRoyaltyReceiver = deployAdmin.address; + campaignConfig.postDeploy.tenderlyProjectSlug = ""; }); - it("should deploy new MeowTokenMock when `mockMeowToken` is true", async () => { + it("should deploy new ZTokenMock when `mockZToken` is true", async () => { const campaign = await runZnsCampaign({ config: campaignConfig, }); - const { meowToken, dbAdapter } = campaign; + const { zToken, dbAdapter } = campaign; - const toMint = hre.ethers.parseEther("972315"); + expect( + campaignConfig.mockZToken + ).to.equal(true); - const balanceBefore = await meowToken.balanceOf(userA.address); - // `mint()` only exists on the Mocked contract - await meowToken.connect(deployAdmin).mint( - userA.address, - toMint + expect( + await zToken.getAddress() + ).to.properAddress; + + expect( + await zToken.name() + ).to.equal("ZERO Token"); + + expect( + await zToken.symbol() + ).to.equal("Z"); + + // one of deploy args + expect( + await zToken.INITIAL_SUPPLY_BASE() + ).to.equal( + (campaignConfig.zTokenConfig as IZTokenConfig).initialSupplyBase ); - const balanceAfter = await meowToken.balanceOf(userA.address); - expect(balanceAfter - balanceBefore).to.equal(toMint); + // function, which exist only on mock contract + expect( + await zToken.identifyMock() + ).to.equal("This is a mock token"); await dbAdapter.dropDB(); }); - it("should use existing deployed non-mocked MeowToken contract when `mockMeowToken` is false", async () => { - campaignConfig.mockMeowToken = false; - - // deploy MeowToken contract - const factory = await hre.ethers.getContractFactory("MeowTokenMock"); - const meow = await hre.upgrades.deployProxy( - factory, - [meowTokenName, meowTokenSymbol], - { - kind: "transparent", - }); + it("should use existing deployed non-mocked ZToken contract when `mockZToken` is false", async () => { + campaignConfig.mockZToken = false; + + // deploy ZToken contract + const Factory = await hre.ethers.getContractFactory("ZTokenMock"); + const z = await Factory.deploy( + Z_NAME_DEFAULT, + Z_SYMBOL_DEFAULT, + admin.address, + INITIAL_ADMIN_DELAY_DEFAULT, + admin.address, + userA.address, + INITIAL_SUPPLY_DEFAULT, + INFLATION_RATES_DEFAULT, + FINAL_INFLATION_RATE_DEFAULT, + ); - await meow.waitForDeployment(); + await z.waitForDeployment(); - campaignConfig.stakingTokenAddress = await meow.getAddress(); + campaignConfig.stakingTokenAddress = await z.getAddress(); const campaign = await runZnsCampaign({ config: campaignConfig, }); const { - meowToken, + zToken, dbAdapter, state: { instances: { - meowToken: meowDMInstance, + zToken: zDMInstance, }, }, } = campaign; - expect(meowToken.address).to.equal(meow.address); - expect(meowDMInstance.contractName).to.equal(znsNames.meowToken.contract); - - const toMint = hre.ethers.parseEther("972315"); - // `mint()` only exists on the Mocked contract - try { - await meowToken.connect(deployAdmin).mint( - userA.address, - toMint - ); - } catch (e) { - // eslint-disable-next-line @typescript-eslint/ban-ts-comment - // @ts-ignore - expect(e.message).to.include( - ".mint is not a function" - ); - } + expect( + await zToken.getAddress() + ).to.equal( + await z.getAddress() + ); + expect(zDMInstance.contractName).to.equal(znsNames.zToken.contract); // Cannot call to real db to await dbAdapter.dropDB(); @@ -357,28 +362,19 @@ describe("Deploy Campaign Test", () => { beforeEach(async () => { [deployAdmin, admin, zeroVault] = await hre.ethers.getSigners(); - campaignConfig = { - env, - deployAdmin, - governorAddresses: [deployAdmin.address], - adminAddresses: [deployAdmin.address, admin.address], - domainToken: { - name: ZNS_DOMAIN_TOKEN_NAME, - symbol: ZNS_DOMAIN_TOKEN_SYMBOL, - defaultRoyaltyReceiver: deployAdmin.address, - defaultRoyaltyFraction: DEFAULT_ROYALTY_FRACTION, - }, - rootPriceConfig: DEFAULT_PRICE_CONFIG, - zeroVaultAddress: zeroVault.address, - // TODO dep: what do we pass here for test flow? we don't have a deployed MeowToken contract - stakingTokenAddress: "", - mockMeowToken: true, // 1700083028872 - postDeploy: { - tenderlyProjectSlug: "", - monitorContracts: false, - verifyContracts: false, - }, - }; + campaignConfig = await getConfig( + { + deployer: deployAdmin, + governors: [deployAdmin.address], + admins: [deployAdmin.address, admin.address], + zeroVaultAddress: zeroVault.address, + env, + } + ); + campaignConfig.domainToken.defaultRoyaltyReceiver = deployAdmin.address; + // TODO dep: what do we pass here for test flow? we don't have a deployed ZToken contract + campaignConfig.stakingTokenAddress = ""; + campaignConfig.postDeploy.tenderlyProjectSlug = ""; mongoAdapter = await getZnsMongoAdapter({ logger: loggerMock as TLogger, @@ -404,8 +400,8 @@ describe("Deploy Campaign Test", () => { znsNames.registry, znsNames.domainToken, { - contract: znsNames.meowToken.contractMock, - instance: znsNames.meowToken.instance, + contract: znsNames.zToken.contractMock, + instance: znsNames.zToken.instance, }, ]; @@ -424,7 +420,7 @@ describe("Deploy Campaign Test", () => { ZNSAccessControllerDM, ZNSRegistryDM, ZNSDomainTokenDM, - MeowTokenDM, + ZTokenDM, FailingZNSAddressResolverDM, // failing DM ZNSCurvePricerDM, ZNSTreasuryDM, @@ -452,8 +448,8 @@ describe("Deploy Campaign Test", () => { znsNames.registry, znsNames.domainToken, { - contract: znsNames.meowToken.contractMock, - instance: znsNames.meowToken.instance, + contract: znsNames.zToken.contractMock, + instance: znsNames.zToken.instance, }, znsNames.addressResolver, ]; @@ -489,7 +485,7 @@ describe("Deploy Campaign Test", () => { ZNSAccessControllerDM, ZNSRegistryDM, ZNSDomainTokenDM, - MeowTokenDM, + ZTokenDM, FailingZNSAddressResolverDM, // failing DM ZNSCurvePricerDM, ZNSTreasuryDM, @@ -525,8 +521,8 @@ describe("Deploy Campaign Test", () => { znsNames.registry, znsNames.domainToken, { - contract: znsNames.meowToken.contractMock, - instance: znsNames.meowToken.instance, + contract: znsNames.zToken.contractMock, + instance: znsNames.zToken.instance, }, znsNames.addressResolver, znsNames.curvePricer, @@ -545,7 +541,7 @@ describe("Deploy Campaign Test", () => { ZNSAccessControllerDM, ZNSRegistryDM, ZNSDomainTokenDM, - MeowTokenDM, + ZTokenDM, ZNSAddressResolverDM, ZNSCurvePricerDM, ZNSTreasuryDM, @@ -573,8 +569,8 @@ describe("Deploy Campaign Test", () => { znsNames.registry, znsNames.domainToken, { - contract: znsNames.meowToken.contractMock, - instance: znsNames.meowToken.instance, + contract: znsNames.zToken.contractMock, + instance: znsNames.zToken.instance, }, znsNames.addressResolver, znsNames.curvePricer, @@ -612,7 +608,7 @@ describe("Deploy Campaign Test", () => { ZNSAccessControllerDM, ZNSRegistryDM, ZNSDomainTokenDM, - MeowTokenDM, + ZTokenDM, ZNSAddressResolverDM, ZNSCurvePricerDM, ZNSTreasuryDM, @@ -708,7 +704,7 @@ describe("Deploy Campaign Test", () => { expect(await zns.accessController.isAdmin(userB.address)).to.be.true; expect(await zns.accessController.isAdmin(governor.address)).to.be.true; expect(await zns.accessController.isGovernor(admin.address)).to.be.true; - expect(rootPaymentConfig.token).to.eq(await zns.meowToken.getAddress()); + expect(rootPaymentConfig.token).to.eq(await zns.zToken.getAddress()); expect(rootPaymentConfig.beneficiary).to.eq(userA.address); await dbAdapter.dropDB(); @@ -762,8 +758,8 @@ describe("Deploy Campaign Test", () => { } }); - it("Fails to validate when mocking MEOW on prod", async () => { - process.env.MOCK_MEOW_TOKEN = "true"; + it("Fails to validate when mocking Z on prod", async () => { + process.env.MOCK_Z_TOKEN = "true"; try { await getConfig({ @@ -779,8 +775,8 @@ describe("Deploy Campaign Test", () => { } }); - it("Fails to validate if not using the MEOW token on prod", async () => { - process.env.MOCK_MEOW_TOKEN = "false"; + it("Fails to validate if not using the Z token on prod", async () => { + process.env.MOCK_Z_TOKEN = "false"; process.env.STAKING_TOKEN_ADDRESS = "0x123"; try { @@ -797,8 +793,8 @@ describe("Deploy Campaign Test", () => { }); it("Fails to validate if invalid curve for pricing", async () => { - process.env.MOCK_MEOW_TOKEN = "false"; - process.env.STAKING_TOKEN_ADDRESS = MeowMainnet.address; + process.env.MOCK_Z_TOKEN = "false"; + process.env.STAKING_TOKEN_ADDRESS = ZSepolia.address; process.env.BASE_LENGTH = "3"; process.env.MAX_LENGTH = "5"; process.env.MAX_PRICE = "0"; @@ -819,8 +815,8 @@ describe("Deploy Campaign Test", () => { }); it("Fails to validate if no mongo uri or local URI in prod", async () => { - process.env.MOCK_MEOW_TOKEN = "false"; - process.env.STAKING_TOKEN_ADDRESS = MeowMainnet.address; + process.env.MOCK_Z_TOKEN = "false"; + process.env.STAKING_TOKEN_ADDRESS = ZSepolia.address; // Falls back onto the default URI which is for localhost and fails in prod process.env.MONGO_DB_URI = ""; process.env.ROYALTY_RECEIVER = "0x123"; @@ -839,8 +835,8 @@ describe("Deploy Campaign Test", () => { expect(e.message).includes("Must provide a Mongo URI used for prod environment!"); } - process.env.MOCK_MEOW_TOKEN = "false"; - process.env.STAKING_TOKEN_ADDRESS = MeowMainnet.address; + process.env.MOCK_Z_TOKEN = "false"; + process.env.STAKING_TOKEN_ADDRESS = ZSepolia.address; process.env.MONGO_DB_URI = "mongodb://localhost:27018"; process.env.ZERO_VAULT_ADDRESS = "0x123"; @@ -870,27 +866,20 @@ describe("Deploy Campaign Test", () => { before(async () => { await saveTag(); - campaignConfig = { - env, - deployAdmin, - governorAddresses: [deployAdmin.address, governor.address], - adminAddresses: [deployAdmin.address, admin.address], - domainToken: { - name: ZNS_DOMAIN_TOKEN_NAME, - symbol: ZNS_DOMAIN_TOKEN_SYMBOL, - defaultRoyaltyReceiver: deployAdmin.address, - defaultRoyaltyFraction: DEFAULT_ROYALTY_FRACTION, - }, - rootPriceConfig: DEFAULT_PRICE_CONFIG, - zeroVaultAddress: zeroVault.address, - stakingTokenAddress: MeowMainnet.address, - mockMeowToken: true, - postDeploy: { - tenderlyProjectSlug: "", - monitorContracts: false, - verifyContracts: false, - }, - }; + campaignConfig = await getConfig( + { + deployer: deployAdmin, + governors: [deployAdmin.address, governor.address], + admins: [deployAdmin.address, admin.address], + zeroVaultAddress: zeroVault.address, + env, + } + ); + + campaignConfig.domainToken.defaultRoyaltyReceiver = deployAdmin.address; + // TODO dep: what do we pass here for test flow? we don't have a deployed ZToken contract + campaignConfig.stakingTokenAddress = ZSepolia.address; + campaignConfig.postDeploy.tenderlyProjectSlug = ""; campaign = await runZnsCampaign({ config: campaignConfig, @@ -1051,27 +1040,19 @@ describe("Deploy Campaign Test", () => { before (async () => { [deployAdmin, admin, governor, zeroVault] = await hre.ethers.getSigners(); - config = { - env: "dev", - deployAdmin, - governorAddresses: [deployAdmin.address, governor.address], - adminAddresses: [deployAdmin.address, admin.address], - domainToken: { - name: ZNS_DOMAIN_TOKEN_NAME, - symbol: ZNS_DOMAIN_TOKEN_SYMBOL, - defaultRoyaltyReceiver: deployAdmin.address, - defaultRoyaltyFraction: DEFAULT_ROYALTY_FRACTION, - }, - rootPriceConfig: DEFAULT_PRICE_CONFIG, - zeroVaultAddress: zeroVault.address, - stakingTokenAddress: MeowMainnet.address, - mockMeowToken: true, - postDeploy: { - tenderlyProjectSlug: "", - monitorContracts: false, - verifyContracts: true, - }, - }; + config = await getConfig( + { + deployer: deployAdmin, + governors: [deployAdmin.address, governor.address], + admins: [deployAdmin.address, admin.address], + zeroVaultAddress: zeroVault.address, + env, + } + ); + config.domainToken.defaultRoyaltyReceiver = deployAdmin.address; + config.stakingTokenAddress = ZSepolia.address; + config.postDeploy.tenderlyProjectSlug = ""; + config.postDeploy.verifyContracts = true; }); afterEach(async () => { diff --git a/test/ZNSCurvePricer.test.ts b/test/ZNSCurvePricer.test.ts index 8c272288..a9460e09 100644 --- a/test/ZNSCurvePricer.test.ts +++ b/test/ZNSCurvePricer.test.ts @@ -54,10 +54,13 @@ describe("ZNSCurvePricer", () => { deployer, governorAddresses: [deployer.address], adminAddresses: [admin.address], + priceConfig: DEFAULT_PRICE_CONFIG, }); - await zns.meowToken.connect(user).approve(await zns.treasury.getAddress(), ethers.MaxUint256); - await zns.meowToken.mint(user.address, DEFAULT_PRICE_CONFIG.maxPrice); + // transfer funds from admin to user + const userBalanceInitial = await zns.zToken.balanceOf(admin.address); + await zns.zToken.connect(user).approve(await zns.treasury.getAddress(), userBalanceInitial); + await zns.zToken.connect(admin).transfer(user.address, userBalanceInitial); const fullConfig = { distrConfig: { @@ -66,7 +69,7 @@ describe("ZNSCurvePricer", () => { accessType: AccessType.OPEN, }, paymentConfig: { - token: await zns.meowToken.getAddress(), + token: await zns.zToken.getAddress(), beneficiary: user.address, }, priceConfig: DEFAULT_PRICE_CONFIG, diff --git a/test/ZNSFixedPricer.test.ts b/test/ZNSFixedPricer.test.ts index 9f956fb1..d79551c7 100644 --- a/test/ZNSFixedPricer.test.ts +++ b/test/ZNSFixedPricer.test.ts @@ -8,14 +8,21 @@ import { PaymentType, DEFAULT_PERCENTAGE_BASIS, DEFAULT_PRICE_CONFIG, - validateUpgrade, AccessType, AC_UNAUTHORIZED_ERR, FEE_TOO_LARGE_ERR, + validateUpgrade, + AccessType, + AC_UNAUTHORIZED_ERR, + FEE_TOO_LARGE_ERR, } from "./helpers"; import * as hre from "hardhat"; import { SignerWithAddress } from "@nomicfoundation/hardhat-ethers/signers"; import * as ethers from "ethers"; import { registrationWithSetup } from "./helpers/register-setup"; import { expect } from "chai"; -import { ZNSFixedPricer__factory, ZNSFixedPricer, ZNSFixedPricerUpgradeMock__factory } from "../typechain"; +import { + ZNSFixedPricer__factory, + ZNSFixedPricer, + ZNSFixedPricerUpgradeMock__factory, +} from "../typechain"; import { getProxyImplAddress } from "./helpers/utils"; import { IZNSContractsLocal } from "./helpers/types"; @@ -45,8 +52,9 @@ describe("ZNSFixedPricer", () => { zeroVaultAddress: zeroVault.address, }); - await zns.meowToken.connect(user).approve(await zns.treasury.getAddress(), ethers.MaxUint256); - await zns.meowToken.mint(user.address, ethers.parseEther("10000000000000")); + const userBalanceInitial = await zns.zToken.balanceOf(admin.address) / 2n; + await zns.zToken.connect(user).approve(await zns.treasury.getAddress(), userBalanceInitial); + await zns.zToken.connect(admin).transfer(user.address, userBalanceInitial); const fullConfig = { distrConfig: { @@ -55,7 +63,7 @@ describe("ZNSFixedPricer", () => { accessType: AccessType.OPEN, }, paymentConfig: { - token: await zns.meowToken.getAddress(), + token: await zns.zToken.getAddress(), beneficiary: user.address, }, priceConfig: { @@ -300,8 +308,9 @@ describe("ZNSFixedPricer", () => { zeroVaultAddress: zeroVault.address, }); - await zns.meowToken.connect(user).approve(await zns.treasury.getAddress(), ethers.MaxUint256); - await zns.meowToken.mint(user.address, ethers.parseEther("10000000000000")); + const userBalanceInitial = await zns.zToken.balanceOf(admin.address) / 2n; + await zns.zToken.connect(user).approve(await zns.treasury.getAddress(), userBalanceInitial); + await zns.zToken.connect(admin).transfer(user.address, userBalanceInitial); const fullConfig = { distrConfig: { @@ -310,7 +319,7 @@ describe("ZNSFixedPricer", () => { accessType: AccessType.OPEN, }, paymentConfig: { - token: await zns.meowToken.getAddress(), + token: await zns.zToken.getAddress(), beneficiary: user.address, }, priceConfig: { diff --git a/test/ZNSRootRegistrar.test.ts b/test/ZNSRootRegistrar.test.ts index f4018b04..fa0dc45f 100644 --- a/test/ZNSRootRegistrar.test.ts +++ b/test/ZNSRootRegistrar.test.ts @@ -86,15 +86,15 @@ describe("ZNSRootRegistrar", () => { mongoAdapter = campaign.dbAdapter; - await zns.meowToken.connect(deployer).approve( + await zns.zToken.connect(deployer).approve( await zns.treasury.getAddress(), ethers.MaxUint256 ); - userBalanceInitial = ethers.parseEther("1000000000000000000"); - // Give funds to user - await zns.meowToken.connect(user).approve(await zns.treasury.getAddress(), ethers.MaxUint256); - await zns.meowToken.mint(user.address, userBalanceInitial); + // Give funds to user. leave half of the amount in the deployer wallet + userBalanceInitial = await zns.zToken.balanceOf(deployer.address) / 2n; + await zns.zToken.connect(user).approve(await zns.treasury.getAddress(), userBalanceInitial); + await zns.zToken.connect(deployer).transfer(user.address, userBalanceInitial); }); afterEach(async () => { @@ -115,14 +115,14 @@ describe("ZNSRootRegistrar", () => { tokenURI, distrConfig, { - token: await zns.meowToken.getAddress(), + token: await zns.zToken.getAddress(), beneficiary: user.address, } ); const domainHash = hashDomainLabel(defaultDomain); const config = await zns.treasury.paymentConfigs(domainHash); - expect(config.token).to.eq(await zns.meowToken.getAddress()); + expect(config.token).to.eq(await zns.zToken.getAddress()); expect(config.beneficiary).to.eq(user.address); }); @@ -281,11 +281,11 @@ describe("ZNSRootRegistrar", () => { }); it("Confirms a user has funds and allowance for the Registrar", async () => { - const balance = await zns.meowToken.balanceOf(user.address); + const balance = await zns.zToken.balanceOf(user.address); expect(balance).to.eq(userBalanceInitial); - const allowance = await zns.meowToken.allowance(user.address, await zns.treasury.getAddress()); - expect(allowance).to.eq(ethers.MaxUint256); + const allowance = await zns.zToken.allowance(user.address, await zns.treasury.getAddress()); + expect(allowance).to.eq(userBalanceInitial); }); it("Should revert when initialize() without ADMIN_ROLE", async () => { @@ -637,8 +637,8 @@ describe("ZNSRootRegistrar", () => { }); it("Stakes and saves the correct amount and token, takes the correct fee and sends fee to Zero Vault", async () => { - const balanceBeforeUser = await zns.meowToken.balanceOf(user.address); - const balanceBeforeVault = await zns.meowToken.balanceOf(zeroVault.address); + const balanceBeforeUser = await zns.zToken.balanceOf(user.address); + const balanceBeforeVault = await zns.zToken.balanceOf(zeroVault.address); // Deploy "wilder" with default configuration await defaultRootRegistration({ @@ -658,14 +658,14 @@ describe("ZNSRootRegistrar", () => { } = getPriceObject(defaultDomain, DEFAULT_PRICE_CONFIG); await checkBalance({ - token: zns.meowToken as IERC20, + token: zns.zToken as IERC20, balanceBefore: balanceBeforeUser, userAddress: user.address, target: totalPrice, }); await checkBalance({ - token: zns.meowToken as IERC20, + token: zns.zToken as IERC20, balanceBefore: balanceBeforeVault, userAddress: zeroVault.address, target: stakeFee, @@ -675,7 +675,7 @@ describe("ZNSRootRegistrar", () => { const { amount: staked, token } = await zns.treasury.stakedForDomain(domainHash); expect(staked).to.eq(expectedPrice); - expect(token).to.eq(await zns.meowToken.getAddress()); + expect(token).to.eq(await zns.zToken.getAddress()); }); it("Sets the correct data in Registry", async () => { @@ -703,8 +703,8 @@ describe("ZNSRootRegistrar", () => { }); it("Fails when the user does not have enough funds", async () => { - const balance = await zns.meowToken.balanceOf(user.address); - await zns.meowToken.connect(user).transfer(randomUser.address, balance); + const balance = await zns.zToken.balanceOf(user.address); + await zns.zToken.connect(user).transfer(randomUser.address, balance); const tx = defaultRootRegistration({ user, @@ -714,7 +714,7 @@ describe("ZNSRootRegistrar", () => { const { price, stakeFee } = await zns.curvePricer.getPriceAndFee(ZeroHash, defaultDomain, true); await expect(tx).to.be.revertedWithCustomError( - zns.meowToken, + zns.zToken, INSUFFICIENT_BALANCE_ERC_ERR ) .withArgs(user.address, 0n, price + stakeFee); @@ -805,8 +805,8 @@ describe("ZNSRootRegistrar", () => { await zns.curvePricer.connect(deployer).setMaxPrice(ethers.ZeroHash, "0"); await zns.curvePricer.connect(deployer).setMinPrice(ethers.ZeroHash, "0"); - const userBalanceBefore = await zns.meowToken.balanceOf(user.address); - const vaultBalanceBefore = await zns.meowToken.balanceOf(zeroVault.address); + const userBalanceBefore = await zns.zToken.balanceOf(user.address); + const vaultBalanceBefore = await zns.zToken.balanceOf(zeroVault.address); // register a domain await zns.rootRegistrar.connect(user).registerRootDomain( @@ -820,8 +820,8 @@ describe("ZNSRootRegistrar", () => { } ); - const userBalanceAfter = await zns.meowToken.balanceOf(user.address); - const vaultBalanceAfter = await zns.meowToken.balanceOf(zeroVault.address); + const userBalanceAfter = await zns.zToken.balanceOf(user.address); + const vaultBalanceAfter = await zns.zToken.balanceOf(zeroVault.address); expect(userBalanceBefore).to.eq(userBalanceAfter); expect(vaultBalanceBefore).to.eq(vaultBalanceAfter); @@ -832,10 +832,10 @@ describe("ZNSRootRegistrar", () => { expect(exists).to.be.true; // make sure no transfers happened - const transferEventFilter = zns.meowToken.filters.Transfer( + const transferEventFilter = zns.zToken.filters.Transfer( user.address, ); - const events = await zns.meowToken.queryFilter(transferEventFilter); + const events = await zns.zToken.queryFilter(transferEventFilter); expect(events.length).to.eq(0); }); }); @@ -872,7 +872,7 @@ describe("ZNSRootRegistrar", () => { // Verify same amount is staked const { amount: stakedAfterReclaim, token: tokenAfterReclaim } = await zns.treasury.stakedForDomain(domainHash); expect(staked).to.equal(stakedAfterReclaim); - expect(tokenAfterReclaim).to.equal(await zns.meowToken.getAddress()); + expect(tokenAfterReclaim).to.equal(await zns.zToken.getAddress()); expect(token).to.equal(tokenAfterReclaim); }); @@ -960,13 +960,13 @@ describe("ZNSRootRegistrar", () => { // Verify same amount is staked const { amount: stakedAfterReclaim, token: tokenAfterReclaim } = await zns.treasury.stakedForDomain(domainHash); expect(staked).to.equal(stakedAfterReclaim); - expect(tokenAfterReclaim).to.equal(await zns.meowToken.getAddress()); + expect(tokenAfterReclaim).to.equal(await zns.zToken.getAddress()); expect(token).to.equal(tokenAfterReclaim); }); it("Can revoke and unstake after reclaiming", async () => { // Verify Balance - const balance = await zns.meowToken.balanceOf(user.address); + const balance = await zns.zToken.balanceOf(user.address); expect(balance).to.eq(userBalanceInitial); // Register Top level @@ -983,7 +983,7 @@ describe("ZNSRootRegistrar", () => { } = getPriceObject(defaultDomain, DEFAULT_PRICE_CONFIG); const { amount: staked, token } = await zns.treasury.stakedForDomain(domainHash); expect(staked).to.eq(expectedStaked); - expect(token).to.eq(await zns.meowToken.getAddress()); + expect(token).to.eq(await zns.zToken.getAddress()); // Transfer the domain token await zns.domainToken.connect(deployer).transferFrom(deployer.address, user.address, tokenId); @@ -1003,7 +1003,7 @@ describe("ZNSRootRegistrar", () => { // Verify final balances const computedFinalBalance = balance + staked - protocolFee; - const finalBalance = await zns.meowToken.balanceOf(user.address); + const finalBalance = await zns.zToken.balanceOf(user.address); expect(computedFinalBalance).to.equal(finalBalance); }); }); @@ -1029,12 +1029,12 @@ describe("ZNSRootRegistrar", () => { const price = await zns.curvePricer.getPrice(ethers.ZeroHash, defaultDomain, false); const protocolFee = await zns.curvePricer.getFeeForPrice(ethers.ZeroHash, price); - const balanceBefore = await zns.meowToken.balanceOf(user.address); + const balanceBefore = await zns.zToken.balanceOf(user.address); // is revoke meant to be free if owner of parent? register subdomain is await zns.rootRegistrar.connect(user).revokeDomain(domainHash); - const balanceAfter = await zns.meowToken.balanceOf(user.address); + const balanceAfter = await zns.zToken.balanceOf(user.address); expect(balanceAfter).to.eq(balanceBefore + price - protocolFee); }); @@ -1121,7 +1121,7 @@ describe("ZNSRootRegistrar", () => { it("Revoking domain unstakes", async () => { // Verify Balance - const balance = await zns.meowToken.balanceOf(user.address); + const balance = await zns.zToken.balanceOf(user.address); expect(balance).to.eq(userBalanceInitial); // Register Top level @@ -1138,10 +1138,10 @@ describe("ZNSRootRegistrar", () => { } = getPriceObject(defaultDomain, DEFAULT_PRICE_CONFIG); const { amount: staked, token } = await zns.treasury.stakedForDomain(domainHash); expect(staked).to.eq(expectedStaked); - expect(token).to.eq(await zns.meowToken.getAddress()); + expect(token).to.eq(await zns.zToken.getAddress()); // Get balance after staking - const balanceAfterStaking = await zns.meowToken.balanceOf(user.address); + const balanceAfterStaking = await zns.zToken.balanceOf(user.address); // Revoke the domain await zns.rootRegistrar.connect(user).revokeDomain(domainHash); @@ -1158,7 +1158,7 @@ describe("ZNSRootRegistrar", () => { const computedBalanceAfterStaking = balanceAfterStaking + staked; const balanceMinusFee = balance - expectedStakeFee; expect(computedBalanceAfterStaking).to.equal(balanceMinusFee); - const finalBalance = await zns.meowToken.balanceOf(user.address); + const finalBalance = await zns.zToken.balanceOf(user.address); expect(computedBalanceAfterStaking - protocolFee).to.equal(finalBalance); }); @@ -1422,8 +1422,8 @@ describe("ZNSRootRegistrar", () => { const domainName = "world"; const domainHash = hashDomainLabel(domainName); - await zns.meowToken.connect(randomUser).approve(await zns.treasury.getAddress(), ethers.MaxUint256); - await zns.meowToken.mint(randomUser.address, DEFAULT_PRICE_CONFIG.maxPrice); + await zns.zToken.connect(randomUser).approve(await zns.treasury.getAddress(), ethers.MaxUint256); + await zns.zToken.connect(deployer).transfer(randomUser.address, DEFAULT_PRICE_CONFIG.maxPrice); await zns.rootRegistrar.connect(randomUser).registerRootDomain( domainName, diff --git a/test/ZNSSubRegistrar.test.ts b/test/ZNSSubRegistrar.test.ts index ac20e980..6da6cd8b 100644 --- a/test/ZNSSubRegistrar.test.ts +++ b/test/ZNSSubRegistrar.test.ts @@ -88,14 +88,20 @@ describe("ZNSSubRegistrar", () => { zeroVaultAddress: zeroVault.address, }); // Give funds to users + const users = [ + rootOwner, + lvl2SubOwner, + ]; + const totalAdminBalance = await zns.zToken.balanceOf(admin.address); + const userBalanceInitial = totalAdminBalance / BigInt(users.length); + await Promise.all( - [ - rootOwner, - lvl2SubOwner, - ].map(async ({ address }) => - zns.meowToken.mint(address, ethers.parseEther("100000000000"))) + users.map(async ({ address }) => + zns.zToken.connect(admin).transfer(address, userBalanceInitial) + ) ); - await zns.meowToken.connect(rootOwner).approve(await zns.treasury.getAddress(), ethers.MaxUint256); + + await zns.zToken.connect(rootOwner).approve(await zns.treasury.getAddress(), ethers.MaxUint256); rootPriceConfig = { price: ethers.parseEther("1375.612"), @@ -114,7 +120,7 @@ describe("ZNSSubRegistrar", () => { paymentType: PaymentType.DIRECT, }, paymentConfig: { - token: await zns.meowToken.getAddress(), + token: await zns.zToken.getAddress(), beneficiary: rootOwner.address, }, priceConfig: rootPriceConfig, @@ -125,7 +131,7 @@ describe("ZNSSubRegistrar", () => { it("Sets the payment config when given", async () => { const subdomain = "world-subdomain"; - await zns.meowToken.connect(lvl2SubOwner).approve(await zns.treasury.getAddress(), ethers.MaxUint256); + await zns.zToken.connect(lvl2SubOwner).approve(await zns.treasury.getAddress(), ethers.MaxUint256); await zns.subRegistrar.connect(lvl2SubOwner).registerSubdomain( rootHash, @@ -134,14 +140,14 @@ describe("ZNSSubRegistrar", () => { subTokenURI, distrConfigEmpty, { - token: await zns.meowToken.getAddress(), + token: await zns.zToken.getAddress(), beneficiary: lvl2SubOwner.address, }, ); const subHash = await zns.subRegistrar.hashWithParent(rootHash, subdomain); const config = await zns.treasury.paymentConfigs(subHash); - expect(config.token).to.eq(await zns.meowToken.getAddress()); + expect(config.token).to.eq(await zns.zToken.getAddress()); expect(config.beneficiary).to.eq(lvl2SubOwner.address); }); @@ -179,7 +185,7 @@ describe("ZNSSubRegistrar", () => { paymentType: PaymentType.DIRECT, }, paymentConfig: { - token: await zns.meowToken.getAddress(), + token: await zns.zToken.getAddress(), beneficiary: rootOwner.address, }, priceConfig: { @@ -197,7 +203,7 @@ describe("ZNSSubRegistrar", () => { subTokenURI, distrConfigEmpty, { - token: await zns.meowToken.getAddress(), + token: await zns.zToken.getAddress(), beneficiary: rootOwner.address, }) ).to.be.revertedWithCustomError( @@ -221,7 +227,7 @@ describe("ZNSSubRegistrar", () => { paymentType: PaymentType.DIRECT, }, paymentConfig: { - token: await zns.meowToken.getAddress(), + token: await zns.zToken.getAddress(), beneficiary: rootOwner.address, }, priceConfig: DEFAULT_PRICE_CONFIG, @@ -257,7 +263,7 @@ describe("ZNSSubRegistrar", () => { paymentType: PaymentType.DIRECT, }, paymentConfig: { - token: await zns.meowToken.getAddress(), + token: await zns.zToken.getAddress(), beneficiary: lvl2SubOwner.address, }, priceConfig: { @@ -276,7 +282,7 @@ describe("ZNSSubRegistrar", () => { const alphaNumeric = "0x0dwidler0x0"; // Add allowance - await zns.meowToken.connect(lvl2SubOwner).approve(await zns.treasury.getAddress(), ethers.MaxUint256); + await zns.zToken.connect(lvl2SubOwner).approve(await zns.treasury.getAddress(), ethers.MaxUint256); // While "to.not.be.reverted" isn't really a full "test" // we don't emit a custom event here, only in the `rootRegistrar.coreRegister` @@ -400,7 +406,7 @@ describe("ZNSSubRegistrar", () => { paymentType: PaymentType.DIRECT, }, paymentConfig: { - token: await zns.meowToken.getAddress(), + token: await zns.zToken.getAddress(), beneficiary: lvl2SubOwner.address, }, priceConfig: { @@ -444,12 +450,12 @@ describe("ZNSSubRegistrar", () => { it("should revert when user has insufficient funds", async () => { const label = "subinsufficientfunds"; const { expectedPrice } = getPriceObject(label, rootPriceConfig); - const userBalanceBefore = await zns.meowToken.balanceOf(lvl2SubOwner.address); + const userBalanceBefore = await zns.zToken.balanceOf(lvl2SubOwner.address); const userBalanceAfter = userBalanceBefore - expectedPrice; - await zns.meowToken.connect(lvl2SubOwner).transfer(deployer.address, userBalanceAfter); + await zns.zToken.connect(lvl2SubOwner).transfer(deployer.address, userBalanceAfter); // add allowance - await zns.meowToken.connect(lvl2SubOwner).approve(await zns.treasury.getAddress(), ethers.MaxUint256); + await zns.zToken.connect(lvl2SubOwner).approve(await zns.treasury.getAddress(), ethers.MaxUint256); await expect( zns.subRegistrar.connect(lvl2SubOwner).registerSubdomain( @@ -461,12 +467,12 @@ describe("ZNSSubRegistrar", () => { paymentConfigEmpty, ) ).to.be.revertedWithCustomError( - zns.meowToken, + zns.zToken, INSUFFICIENT_BALANCE_ERC_ERR ); // transfer back for other tests - await zns.meowToken.connect(deployer).transfer(lvl2SubOwner.address, userBalanceAfter); + await zns.zToken.connect(deployer).transfer(lvl2SubOwner.address, userBalanceAfter); }); it("should revert when user has insufficient allowance", async () => { @@ -474,7 +480,7 @@ describe("ZNSSubRegistrar", () => { const { expectedPrice } = getPriceObject(label, rootPriceConfig); // add allowance - await zns.meowToken.connect(lvl2SubOwner).approve(await zns.treasury.getAddress(), expectedPrice - 1n); + await zns.zToken.connect(lvl2SubOwner).approve(await zns.treasury.getAddress(), expectedPrice - 1n); await expect( zns.subRegistrar.connect(lvl2SubOwner).registerSubdomain( @@ -486,7 +492,7 @@ describe("ZNSSubRegistrar", () => { paymentConfigEmpty, ) ).to.be.revertedWithCustomError( - zns.meowToken, + zns.zToken, INSUFFICIENT_ALLOWANCE_ERC_ERR ); }); @@ -509,7 +515,7 @@ describe("ZNSSubRegistrar", () => { }); // set the token address - await zns.treasury.connect(rootOwner).setPaymentToken(parentHash1, await zns.meowToken.getAddress()); + await zns.treasury.connect(rootOwner).setPaymentToken(parentHash1, await zns.zToken.getAddress()); // register a new parent with stake payment and no payment config const parentHash2 = await registrationWithSetup({ @@ -528,7 +534,7 @@ describe("ZNSSubRegistrar", () => { }); // set the token address - await zns.treasury.connect(rootOwner).setPaymentToken(parentHash2, await zns.meowToken.getAddress()); + await zns.treasury.connect(rootOwner).setPaymentToken(parentHash2, await zns.zToken.getAddress()); // register subdomains under new parents await expect( @@ -600,21 +606,29 @@ describe("ZNSSubRegistrar", () => { }); // Give funds to users + const users = [ + rootOwner, + lvl2SubOwner, + lvl3SubOwner, + lvl4SubOwner, + lvl5SubOwner, + lvl6SubOwner, + branchLvl1Owner, + branchLvl2Owner, + multiOwner, + ]; + + const totalAdminBalance = await zns.zToken.balanceOf(admin.address); + const userBalanceInitial = totalAdminBalance / BigInt(users.length); + await zns.zToken.connect(admin).approve(await zns.treasury.getAddress(), totalAdminBalance); + await Promise.all( - [ - rootOwner, - lvl2SubOwner, - lvl3SubOwner, - lvl4SubOwner, - lvl5SubOwner, - lvl6SubOwner, - branchLvl1Owner, - branchLvl2Owner, - multiOwner, - ].map(async ({ address }) => - zns.meowToken.mint(address, ethers.parseEther("1000000"))) - ); - await zns.meowToken.connect(rootOwner).approve(await zns.treasury.getAddress(), ethers.MaxUint256); + users.map(async ({ address }) => + zns.zToken.connect(admin).transfer(address, userBalanceInitial) + ) + ); + + await zns.zToken.connect(rootOwner).approve(await zns.treasury.getAddress(), ethers.MaxUint256); domainConfigs = [ { @@ -627,7 +641,7 @@ describe("ZNSSubRegistrar", () => { accessType: AccessType.OPEN, }, paymentConfig: { - token: await zns.meowToken.getAddress(), + token: await zns.zToken.getAddress(), beneficiary: rootOwner.address, }, priceConfig: { price: fixedPrice, feePercentage: BigInt(0) }, @@ -643,7 +657,7 @@ describe("ZNSSubRegistrar", () => { accessType: AccessType.OPEN, }, paymentConfig: { - token: await zns.meowToken.getAddress(), + token: await zns.zToken.getAddress(), beneficiary: lvl2SubOwner.address, }, priceConfig: DEFAULT_PRICE_CONFIG, @@ -659,7 +673,7 @@ describe("ZNSSubRegistrar", () => { accessType: AccessType.OPEN, }, paymentConfig: { - token: await zns.meowToken.getAddress(), + token: await zns.zToken.getAddress(), beneficiary: lvl3SubOwner.address, }, priceConfig: DEFAULT_PRICE_CONFIG, @@ -675,7 +689,7 @@ describe("ZNSSubRegistrar", () => { accessType: AccessType.OPEN, }, paymentConfig: { - token: await zns.meowToken.getAddress(), + token: await zns.zToken.getAddress(), beneficiary: lvl4SubOwner.address, }, priceConfig: DEFAULT_PRICE_CONFIG, @@ -692,7 +706,7 @@ describe("ZNSSubRegistrar", () => { accessType: AccessType.OPEN, }, paymentConfig: { - token: await zns.meowToken.getAddress(), + token: await zns.zToken.getAddress(), beneficiary: lvl5SubOwner.address, }, priceConfig: { price: fixedPrice, feePercentage: fixedFeePercentage }, @@ -709,7 +723,7 @@ describe("ZNSSubRegistrar", () => { accessType: AccessType.OPEN, }, paymentConfig: { - token: await zns.meowToken.getAddress(), + token: await zns.zToken.getAddress(), beneficiary: lvl6SubOwner.address, }, priceConfig: DEFAULT_PRICE_CONFIG, @@ -745,7 +759,7 @@ describe("ZNSSubRegistrar", () => { paymentType: PaymentType.DIRECT, }, paymentConfig: { - token: await zns.meowToken.getAddress(), + token: await zns.zToken.getAddress(), beneficiary: multiOwner.address, }, priceConfig: { price: fixedPrice, feePercentage: BigInt(0) }, @@ -762,7 +776,7 @@ describe("ZNSSubRegistrar", () => { paymentType: PaymentType.STAKE, }, paymentConfig: { - token: await zns.meowToken.getAddress(), + token: await zns.zToken.getAddress(), beneficiary: zeroVault.address, }, priceConfig: DEFAULT_PRICE_CONFIG, @@ -779,7 +793,7 @@ describe("ZNSSubRegistrar", () => { paymentType: PaymentType.DIRECT, }, paymentConfig: { - token: await zns.meowToken.getAddress(), + token: await zns.zToken.getAddress(), beneficiary: multiOwner.address, }, priceConfig: DEFAULT_PRICE_CONFIG, @@ -796,7 +810,7 @@ describe("ZNSSubRegistrar", () => { paymentType: PaymentType.STAKE, }, paymentConfig: { - token: await zns.meowToken.getAddress(), + token: await zns.zToken.getAddress(), beneficiary: zeroVault.address, }, priceConfig: { price: fixedPrice, feePercentage: BigInt(0) }, @@ -813,7 +827,7 @@ describe("ZNSSubRegistrar", () => { paymentType: PaymentType.DIRECT, }, paymentConfig: { - token: await zns.meowToken.getAddress(), + token: await zns.zToken.getAddress(), beneficiary: multiOwner.address, }, priceConfig: DEFAULT_PRICE_CONFIG, @@ -830,7 +844,7 @@ describe("ZNSSubRegistrar", () => { paymentType: PaymentType.STAKE, }, paymentConfig: { - token: await zns.meowToken.getAddress(), + token: await zns.zToken.getAddress(), beneficiary: zeroVault.address, }, priceConfig: DEFAULT_PRICE_CONFIG, @@ -847,7 +861,7 @@ describe("ZNSSubRegistrar", () => { paymentType: PaymentType.DIRECT, }, paymentConfig: { - token: await zns.meowToken.getAddress(), + token: await zns.zToken.getAddress(), beneficiary: multiOwner.address, }, priceConfig: { price: fixedPrice, feePercentage: fixedFeePercentage }, @@ -856,7 +870,7 @@ describe("ZNSSubRegistrar", () => { ]; // prep - await zns.meowToken.connect(multiOwner).approve(await zns.treasury.getAddress(), ethers.MaxUint256); + await zns.zToken.connect(multiOwner).approve(await zns.treasury.getAddress(), ethers.MaxUint256); // register const domainHashes = await configs.reduce( @@ -926,13 +940,13 @@ describe("ZNSSubRegistrar", () => { [true, true] ); - const userBalBefore = await zns.meowToken.balanceOf(lvl6SubOwner.address); + const userBalBefore = await zns.zToken.balanceOf(lvl6SubOwner.address); await zns.rootRegistrar.connect(lvl6SubOwner).revokeDomain( domainHash, ); - const userBalAfter = await zns.meowToken.balanceOf(lvl6SubOwner.address); + const userBalAfter = await zns.zToken.balanceOf(lvl6SubOwner.address); expect(userBalAfter - userBalBefore).to.eq(0); @@ -982,20 +996,20 @@ describe("ZNSSubRegistrar", () => { it("should revoke lvl 5 domain with refund", async () => { const domainHash = regResults[4].domainHash; - const userBalanceBefore = await zns.meowToken.balanceOf(lvl5SubOwner.address); - const parentBalBefore = await zns.meowToken.balanceOf(lvl4SubOwner.address); - const paymentContractBalBefore = await zns.meowToken.balanceOf(await zns.treasury.getAddress()); + const userBalanceBefore = await zns.zToken.balanceOf(lvl5SubOwner.address); + const parentBalBefore = await zns.zToken.balanceOf(lvl4SubOwner.address); + const paymentContractBalBefore = await zns.zToken.balanceOf(await zns.treasury.getAddress()); const stake = await zns.treasury.stakedForDomain(domainHash); const protocolFee = getStakingOrProtocolFee(stake.amount); - await zns.meowToken.connect(lvl5SubOwner).approve(await zns.treasury.getAddress(), protocolFee); + await zns.zToken.connect(lvl5SubOwner).approve(await zns.treasury.getAddress(), protocolFee); await zns.rootRegistrar.connect(lvl5SubOwner).revokeDomain(domainHash); - const userBalAfter = await zns.meowToken.balanceOf(lvl5SubOwner.address); - const parentBalAfter = await zns.meowToken.balanceOf(lvl4SubOwner.address); - const paymentContractBalAfter = await zns.meowToken.balanceOf(await zns.treasury.getAddress()); + const userBalAfter = await zns.zToken.balanceOf(lvl5SubOwner.address); + const parentBalAfter = await zns.zToken.balanceOf(lvl4SubOwner.address); + const paymentContractBalAfter = await zns.zToken.balanceOf(await zns.treasury.getAddress()); const { expectedPrice } = getPriceObject(domainConfigs[4].domainLabel); @@ -1067,7 +1081,7 @@ describe("ZNSSubRegistrar", () => { accessType: AccessType.OPEN, }, paymentConfig: { - token: await zns.meowToken.getAddress(), + token: await zns.zToken.getAddress(), beneficiary: branchLvl1Owner.address, }, priceConfig: { price: fixedPrice, feePercentage: fixedFeePercentage }, @@ -1083,7 +1097,7 @@ describe("ZNSSubRegistrar", () => { accessType: AccessType.OPEN, }, paymentConfig: { - token: await zns.meowToken.getAddress(), + token: await zns.zToken.getAddress(), beneficiary: branchLvl2Owner.address, }, priceConfig: DEFAULT_PRICE_CONFIG, @@ -1113,7 +1127,7 @@ describe("ZNSSubRegistrar", () => { const stake = await zns.treasury.stakedForDomain(lvl2Hash); const protocolFee = getStakingOrProtocolFee(stake.amount); - await zns.meowToken.connect(lvl2SubOwner).approve(await zns.treasury.getAddress(), protocolFee); + await zns.zToken.connect(lvl2SubOwner).approve(await zns.treasury.getAddress(), protocolFee); // revoke parent await zns.rootRegistrar.connect(lvl2SubOwner).revokeDomain( @@ -1159,19 +1173,19 @@ describe("ZNSSubRegistrar", () => { expect(childStakedAmt).to.eq(expectedPrice); - const userBalBefore = await zns.meowToken.balanceOf(lvl3SubOwner.address); + const userBalBefore = await zns.zToken.balanceOf(lvl3SubOwner.address); const subStake = await zns.treasury.stakedForDomain(lvl3Hash); const subProtocolFee = getStakingOrProtocolFee(subStake.amount); - await zns.meowToken.connect(lvl3SubOwner).approve(await zns.treasury.getAddress(), subProtocolFee); + await zns.zToken.connect(lvl3SubOwner).approve(await zns.treasury.getAddress(), subProtocolFee); // revoke child await zns.rootRegistrar.connect(lvl3SubOwner).revokeDomain( lvl3Hash, ); - const userBalAfter = await zns.meowToken.balanceOf(lvl3SubOwner.address); + const userBalAfter = await zns.zToken.balanceOf(lvl3SubOwner.address); expect(userBalAfter - userBalBefore).to.eq(expectedPrice - subProtocolFee); @@ -1236,7 +1250,7 @@ describe("ZNSSubRegistrar", () => { accessType: AccessType.OPEN, }, paymentConfig: { - token: await zns.meowToken.getAddress(), + token: await zns.zToken.getAddress(), beneficiary: branchLvl1Owner.address, }, priceConfig: { price: fixedPrice, feePercentage: fixedFeePercentage }, @@ -1347,7 +1361,7 @@ describe("ZNSSubRegistrar", () => { accessType: AccessType.MINTLIST, }, paymentConfig: { - token: await zns.meowToken.getAddress(), + token: await zns.zToken.getAddress(), beneficiary: branchLvl1Owner.address, }, priceConfig: { price: fixedPrice, feePercentage: BigInt(0) }, @@ -1366,7 +1380,7 @@ describe("ZNSSubRegistrar", () => { const parentOwnerFromReg = await zns.registry.getDomainOwner(newHash); expect(parentOwnerFromReg).to.eq(branchLvl1Owner.address); - const childBalBefore = await zns.meowToken.balanceOf(branchLvl2Owner.address); + const childBalBefore = await zns.zToken.balanceOf(branchLvl2Owner.address); // try register a new child under the new parent const newChildHash = await registrationWithSetup({ @@ -1377,7 +1391,7 @@ describe("ZNSSubRegistrar", () => { fullConfig: fullDistrConfigEmpty, }); - const childBalAfter = await zns.meowToken.balanceOf(branchLvl2Owner.address); + const childBalAfter = await zns.zToken.balanceOf(branchLvl2Owner.address); // check that the new child has been registered const childOwnerFromReg = await zns.registry.getDomainOwner(newChildHash); @@ -1449,20 +1463,27 @@ describe("ZNSSubRegistrar", () => { )); // Give funds to users + const users = [ + rootOwner, + lvl2SubOwner, + lvl3SubOwner, + lvl4SubOwner, + lvl5SubOwner, + lvl6SubOwner, + branchLvl1Owner, + branchLvl2Owner, + ]; + const totalAdminBalance = await zns.zToken.balanceOf(admin.address); + const userBalanceInitial = totalAdminBalance / BigInt(users.length); + await zns.zToken.connect(admin).approve(await zns.treasury.getAddress(), totalAdminBalance); + await Promise.all( - [ - rootOwner, - lvl2SubOwner, - lvl3SubOwner, - lvl4SubOwner, - lvl5SubOwner, - lvl6SubOwner, - branchLvl1Owner, - branchLvl2Owner, - ].map(async ({ address }) => - zns.meowToken.mint(address, ethers.parseEther("1000000"))) - ); - await zns.meowToken.connect(rootOwner).approve(await zns.treasury.getAddress(), ethers.MaxUint256); + users.map(async ({ address }) => + zns.zToken.connect(admin).transfer(address, userBalanceInitial) + ) + ); + + await zns.zToken.connect(rootOwner).approve(await zns.treasury.getAddress(), ethers.MaxUint256); // register root domain rootHash = await registrationWithSetup({ @@ -1476,7 +1497,7 @@ describe("ZNSSubRegistrar", () => { paymentType: PaymentType.DIRECT, }, paymentConfig: { - token: await zns.meowToken.getAddress(), + token: await zns.zToken.getAddress(), beneficiary: rootOwner.address, }, priceConfig: { @@ -1584,11 +1605,11 @@ describe("ZNSSubRegistrar", () => { domainLabel: "subdomain", }); - const balanceBefore = await zns.meowToken.balanceOf(rootOwner.address); + const balanceBefore = await zns.zToken.balanceOf(rootOwner.address); await zns.rootRegistrar.connect(rootOwner).revokeDomain(subdomainHash); - const balanceAfter = await zns.meowToken.balanceOf(rootOwner.address); + const balanceAfter = await zns.zToken.balanceOf(rootOwner.address); expect(balanceBefore).to.eq(balanceAfter); }); @@ -1936,7 +1957,7 @@ describe("ZNSSubRegistrar", () => { }, paymentConfig: { // zero has 18 decimals - token: await zns.meowToken.getAddress(), + token: await zns.zToken.getAddress(), beneficiary: lvl2SubOwner.address, }, priceConfig, @@ -1945,10 +1966,10 @@ describe("ZNSSubRegistrar", () => { const label = "asdirectnofeechild"; - const contractBalBefore = await zns.meowToken.balanceOf(await zns.treasury.getAddress()); - const parentBalBefore = await zns.meowToken.balanceOf(lvl2SubOwner.address); - const childBalBefore = await zns.meowToken.balanceOf(lvl3SubOwner.address); - const zeroVaultBalanceBefore = await zns.meowToken.balanceOf(zeroVault.address); + const contractBalBefore = await zns.zToken.balanceOf(await zns.treasury.getAddress()); + const parentBalBefore = await zns.zToken.balanceOf(lvl2SubOwner.address); + const childBalBefore = await zns.zToken.balanceOf(lvl3SubOwner.address); + const zeroVaultBalanceBefore = await zns.zToken.balanceOf(zeroVault.address); const childHash = await registrationWithSetup({ zns, @@ -1957,10 +1978,10 @@ describe("ZNSSubRegistrar", () => { domainLabel: label, }); - const parentBalAfter = await zns.meowToken.balanceOf(lvl2SubOwner.address); - const childBalAfter = await zns.meowToken.balanceOf(lvl3SubOwner.address); - const contractBalAfter = await zns.meowToken.balanceOf(await zns.treasury.getAddress()); - const zeroVaultBalanceAfter = await zns.meowToken.balanceOf(zeroVault.address); + const parentBalAfter = await zns.zToken.balanceOf(lvl2SubOwner.address); + const childBalAfter = await zns.zToken.balanceOf(lvl3SubOwner.address); + const contractBalAfter = await zns.zToken.balanceOf(await zns.treasury.getAddress()); + const zeroVaultBalanceAfter = await zns.zToken.balanceOf(zeroVault.address); const { expectedPrice } = getPriceObject(label, priceConfig); const protocolFee = getStakingOrProtocolFee(expectedPrice); @@ -1976,10 +1997,10 @@ describe("ZNSSubRegistrar", () => { ); // should NOT offer refund ! - const parentBalAfterRevoke = await zns.meowToken.balanceOf(lvl2SubOwner.address); - const childBalAfterRevoke = await zns.meowToken.balanceOf(lvl3SubOwner.address); - const contractBalAfterRevoke = await zns.meowToken.balanceOf(await zns.treasury.getAddress()); - const zeroVaultBalanceAfterRevoke = await zns.meowToken.balanceOf(zeroVault.address); + const parentBalAfterRevoke = await zns.zToken.balanceOf(lvl2SubOwner.address); + const childBalAfterRevoke = await zns.zToken.balanceOf(lvl3SubOwner.address); + const contractBalAfterRevoke = await zns.zToken.balanceOf(await zns.treasury.getAddress()); + const zeroVaultBalanceAfterRevoke = await zns.zToken.balanceOf(zeroVault.address); expect(parentBalAfterRevoke - parentBalAfter).to.eq(0); expect(childBalAfterRevoke - childBalAfter).to.eq(0); @@ -2005,17 +2026,17 @@ describe("ZNSSubRegistrar", () => { paymentType: PaymentType.DIRECT, }, paymentConfig: { - token: await zns.meowToken.getAddress(), + token: await zns.zToken.getAddress(), beneficiary: lvl2SubOwner.address, }, priceConfig, }, }); - const contractBalBefore = await zns.meowToken.balanceOf(await zns.treasury.getAddress()); - const parentBalBefore = await zns.meowToken.balanceOf(lvl2SubOwner.address); - const childBalBefore = await zns.meowToken.balanceOf(lvl3SubOwner.address); - const zeroVaultBalanceBefore = await zns.meowToken.balanceOf(zeroVault.address); + const contractBalBefore = await zns.zToken.balanceOf(await zns.treasury.getAddress()); + const parentBalBefore = await zns.zToken.balanceOf(lvl2SubOwner.address); + const childBalBefore = await zns.zToken.balanceOf(lvl3SubOwner.address); + const zeroVaultBalanceBefore = await zns.zToken.balanceOf(zeroVault.address); const label = "zeropricechild"; const childHash = await registrationWithSetup({ @@ -2025,10 +2046,10 @@ describe("ZNSSubRegistrar", () => { domainLabel: label, }); - const parentBalAfter = await zns.meowToken.balanceOf(lvl2SubOwner.address); - const childBalAfter = await zns.meowToken.balanceOf(lvl3SubOwner.address); - const contractBalAfter = await zns.meowToken.balanceOf(await zns.treasury.getAddress()); - const zeroVaultBalanceAfter = await zns.meowToken.balanceOf(zeroVault.address); + const parentBalAfter = await zns.zToken.balanceOf(lvl2SubOwner.address); + const childBalAfter = await zns.zToken.balanceOf(lvl3SubOwner.address); + const contractBalAfter = await zns.zToken.balanceOf(await zns.treasury.getAddress()); + const zeroVaultBalanceAfter = await zns.zToken.balanceOf(zeroVault.address); expect(parentBalAfter - parentBalBefore).to.eq(0); expect(childBalBefore - childBalAfter).to.eq(0); @@ -2037,17 +2058,17 @@ describe("ZNSSubRegistrar", () => { // validate transfer events are not happenning const latestBlock = await time.latestBlock(); - const transferFilterToParent = zns.meowToken.filters.Transfer(lvl3SubOwner.address, lvl2SubOwner.address); - const transferFilterToTreasury = zns.meowToken.filters.Transfer( + const transferFilterToParent = zns.zToken.filters.Transfer(lvl3SubOwner.address, lvl2SubOwner.address); + const transferFilterToTreasury = zns.zToken.filters.Transfer( lvl3SubOwner.address, await zns.treasury.getAddress() ); - const transfersToParent = await zns.meowToken.queryFilter( + const transfersToParent = await zns.zToken.queryFilter( transferFilterToParent, latestBlock - 3, latestBlock ); - const transfersToTreasury = await zns.meowToken.queryFilter( + const transfersToTreasury = await zns.zToken.queryFilter( transferFilterToTreasury, latestBlock - 3, latestBlock @@ -2061,10 +2082,10 @@ describe("ZNSSubRegistrar", () => { ); // should NOT offer refund ! - const parentBalAfterRevoke = await zns.meowToken.balanceOf(lvl2SubOwner.address); - const childBalAfterRevoke = await zns.meowToken.balanceOf(lvl3SubOwner.address); - const contractBalAfterRevoke = await zns.meowToken.balanceOf(await zns.treasury.getAddress()); - const zeroVaultBalanceAfterRevoke = await zns.meowToken.balanceOf(zeroVault.address); + const parentBalAfterRevoke = await zns.zToken.balanceOf(lvl2SubOwner.address); + const childBalAfterRevoke = await zns.zToken.balanceOf(lvl3SubOwner.address); + const contractBalAfterRevoke = await zns.zToken.balanceOf(await zns.treasury.getAddress()); + const zeroVaultBalanceAfterRevoke = await zns.zToken.balanceOf(zeroVault.address); expect(parentBalAfterRevoke - parentBalAfter).to.eq(0); expect(childBalAfterRevoke - childBalAfter).to.eq(0); @@ -2091,17 +2112,17 @@ describe("ZNSSubRegistrar", () => { paymentType: PaymentType.DIRECT, }, paymentConfig: { - token: await zns.meowToken.getAddress(), + token: await zns.zToken.getAddress(), beneficiary: lvl2SubOwner.address, }, priceConfig, }, }); - const contractBalBefore = await zns.meowToken.balanceOf(await zns.treasury.getAddress()); - const parentBalBefore = await zns.meowToken.balanceOf(lvl2SubOwner.address); - const childBalBefore = await zns.meowToken.balanceOf(lvl3SubOwner.address); - const zeroVaultBalanceBefore = await zns.meowToken.balanceOf(zeroVault.address); + const contractBalBefore = await zns.zToken.balanceOf(await zns.treasury.getAddress()); + const parentBalBefore = await zns.zToken.balanceOf(lvl2SubOwner.address); + const childBalBefore = await zns.zToken.balanceOf(lvl3SubOwner.address); + const zeroVaultBalanceBefore = await zns.zToken.balanceOf(zeroVault.address); const label = "zeropricechildad"; const childHash = await registrationWithSetup({ @@ -2111,10 +2132,10 @@ describe("ZNSSubRegistrar", () => { domainLabel: label, }); - const parentBalAfter = await zns.meowToken.balanceOf(lvl2SubOwner.address); - const childBalAfter = await zns.meowToken.balanceOf(lvl3SubOwner.address); - const contractBalAfter = await zns.meowToken.balanceOf(await zns.treasury.getAddress()); - const zeroVaultBalanceAfter = await zns.meowToken.balanceOf(zeroVault.address); + const parentBalAfter = await zns.zToken.balanceOf(lvl2SubOwner.address); + const childBalAfter = await zns.zToken.balanceOf(lvl3SubOwner.address); + const contractBalAfter = await zns.zToken.balanceOf(await zns.treasury.getAddress()); + const zeroVaultBalanceAfter = await zns.zToken.balanceOf(zeroVault.address); expect(parentBalAfter - parentBalBefore).to.eq(0); expect(childBalBefore - childBalAfter).to.eq(0); @@ -2123,20 +2144,20 @@ describe("ZNSSubRegistrar", () => { // validate transfer events are not happenning const latestBlock = await time.latestBlock(); - const transferFilterToParent = zns.meowToken.filters.Transfer( + const transferFilterToParent = zns.zToken.filters.Transfer( lvl3SubOwner.address, lvl2SubOwner.address ); - const transferFilterToTreasury = zns.meowToken.filters.Transfer( + const transferFilterToTreasury = zns.zToken.filters.Transfer( lvl3SubOwner.address, await zns.treasury.getAddress() ); - const transfersToParent = await zns.meowToken.queryFilter( + const transfersToParent = await zns.zToken.queryFilter( transferFilterToParent, latestBlock - 3, latestBlock ); - const transfersToTreasury = await zns.meowToken.queryFilter( + const transfersToTreasury = await zns.zToken.queryFilter( transferFilterToTreasury, latestBlock - 3, latestBlock @@ -2150,10 +2171,10 @@ describe("ZNSSubRegistrar", () => { ); // should NOT offer refund ! - const parentBalAfterRevoke = await zns.meowToken.balanceOf(lvl2SubOwner.address); - const childBalAfterRevoke = await zns.meowToken.balanceOf(lvl3SubOwner.address); - const contractBalAfterRevoke = await zns.meowToken.balanceOf(await zns.treasury.getAddress()); - const zeroVaultBalanceAfterRevoke = await zns.meowToken.balanceOf(zeroVault.address); + const parentBalAfterRevoke = await zns.zToken.balanceOf(lvl2SubOwner.address); + const childBalAfterRevoke = await zns.zToken.balanceOf(lvl3SubOwner.address); + const contractBalAfterRevoke = await zns.zToken.balanceOf(await zns.treasury.getAddress()); + const zeroVaultBalanceAfterRevoke = await zns.zToken.balanceOf(zeroVault.address); expect(parentBalAfterRevoke - parentBalAfter).to.eq(0); expect(childBalAfterRevoke - childBalAfter).to.eq(0); @@ -2180,17 +2201,17 @@ describe("ZNSSubRegistrar", () => { paymentType: PaymentType.STAKE, }, paymentConfig: { - token: await zns.meowToken.getAddress(), + token: await zns.zToken.getAddress(), beneficiary: lvl2SubOwner.address, }, priceConfig, }, }); - const contractBalBefore = await zns.meowToken.balanceOf(await zns.treasury.getAddress()); - const parentBalBefore = await zns.meowToken.balanceOf(lvl2SubOwner.address); - const childBalBefore = await zns.meowToken.balanceOf(lvl3SubOwner.address); - const zeroVaultBalanceBefore = await zns.meowToken.balanceOf(zeroVault.address); + const contractBalBefore = await zns.zToken.balanceOf(await zns.treasury.getAddress()); + const parentBalBefore = await zns.zToken.balanceOf(lvl2SubOwner.address); + const childBalBefore = await zns.zToken.balanceOf(lvl3SubOwner.address); + const zeroVaultBalanceBefore = await zns.zToken.balanceOf(zeroVault.address); const label = "zeropricechildas"; const childHash = await registrationWithSetup({ @@ -2200,10 +2221,10 @@ describe("ZNSSubRegistrar", () => { domainLabel: label, }); - const parentBalAfter = await zns.meowToken.balanceOf(lvl2SubOwner.address); - const childBalAfter = await zns.meowToken.balanceOf(lvl3SubOwner.address); - const contractBalAfter = await zns.meowToken.balanceOf(await zns.treasury.getAddress()); - const zeroVaultBalanceAfter = await zns.meowToken.balanceOf(zeroVault.address); + const parentBalAfter = await zns.zToken.balanceOf(lvl2SubOwner.address); + const childBalAfter = await zns.zToken.balanceOf(lvl3SubOwner.address); + const contractBalAfter = await zns.zToken.balanceOf(await zns.treasury.getAddress()); + const zeroVaultBalanceAfter = await zns.zToken.balanceOf(zeroVault.address); expect(parentBalAfter - parentBalBefore).to.eq(0); expect(childBalBefore - childBalAfter).to.eq(0); @@ -2212,17 +2233,17 @@ describe("ZNSSubRegistrar", () => { // validate transfer events are not happenning const latestBlock = await time.latestBlock(); - const transferFilterToParent = zns.meowToken.filters.Transfer(lvl3SubOwner.address, lvl2SubOwner.address); - const transferFilterToTreasury = zns.meowToken.filters.Transfer( + const transferFilterToParent = zns.zToken.filters.Transfer(lvl3SubOwner.address, lvl2SubOwner.address); + const transferFilterToTreasury = zns.zToken.filters.Transfer( lvl3SubOwner.address, await zns.treasury.getAddress() ); - const transfersToParent = await zns.meowToken.queryFilter( + const transfersToParent = await zns.zToken.queryFilter( transferFilterToParent, latestBlock - 3, latestBlock ); - const transfersToTreasury = await zns.meowToken.queryFilter( + const transfersToTreasury = await zns.zToken.queryFilter( transferFilterToTreasury, latestBlock - 3, latestBlock @@ -2236,10 +2257,10 @@ describe("ZNSSubRegistrar", () => { ); // should NOT offer refund ! - const parentBalAfterRevoke = await zns.meowToken.balanceOf(lvl2SubOwner.address); - const childBalAfterRevoke = await zns.meowToken.balanceOf(lvl3SubOwner.address); - const contractBalAfterRevoke = await zns.meowToken.balanceOf(await zns.treasury.getAddress()); - const zeroVaultBalanceAfterRevoke = await zns.meowToken.balanceOf(zeroVault.address); + const parentBalAfterRevoke = await zns.zToken.balanceOf(lvl2SubOwner.address); + const childBalAfterRevoke = await zns.zToken.balanceOf(lvl3SubOwner.address); + const contractBalAfterRevoke = await zns.zToken.balanceOf(await zns.treasury.getAddress()); + const zeroVaultBalanceAfterRevoke = await zns.zToken.balanceOf(zeroVault.address); expect(parentBalAfterRevoke - parentBalAfter).to.eq(0); expect(childBalAfterRevoke - childBalAfter).to.eq(0); @@ -2267,17 +2288,17 @@ describe("ZNSSubRegistrar", () => { paymentType: PaymentType.STAKE, }, paymentConfig: { - token: await zns.meowToken.getAddress(), + token: await zns.zToken.getAddress(), beneficiary: lvl2SubOwner.address, }, priceConfig, }, }); - const contractBalBefore = await zns.meowToken.balanceOf(await zns.treasury.getAddress()); - const parentBalBefore = await zns.meowToken.balanceOf(lvl2SubOwner.address); - const childBalBefore = await zns.meowToken.balanceOf(lvl3SubOwner.address); - const zeroVaultBalanceBefore = await zns.meowToken.balanceOf(zeroVault.address); + const contractBalBefore = await zns.zToken.balanceOf(await zns.treasury.getAddress()); + const parentBalBefore = await zns.zToken.balanceOf(lvl2SubOwner.address); + const childBalBefore = await zns.zToken.balanceOf(lvl3SubOwner.address); + const zeroVaultBalanceBefore = await zns.zToken.balanceOf(zeroVault.address); const label = "zeropricechildfs"; const childHash = await registrationWithSetup({ @@ -2287,10 +2308,10 @@ describe("ZNSSubRegistrar", () => { domainLabel: label, }); - const parentBalAfter = await zns.meowToken.balanceOf(lvl2SubOwner.address); - const childBalAfter = await zns.meowToken.balanceOf(lvl3SubOwner.address); - const contractBalAfter = await zns.meowToken.balanceOf(await zns.treasury.getAddress()); - const zeroVaultBalanceAfter = await zns.meowToken.balanceOf(zeroVault.address); + const parentBalAfter = await zns.zToken.balanceOf(lvl2SubOwner.address); + const childBalAfter = await zns.zToken.balanceOf(lvl3SubOwner.address); + const contractBalAfter = await zns.zToken.balanceOf(await zns.treasury.getAddress()); + const zeroVaultBalanceAfter = await zns.zToken.balanceOf(zeroVault.address); expect(parentBalAfter - parentBalBefore).to.eq(0); expect(childBalBefore - childBalAfter).to.eq(0); @@ -2299,17 +2320,17 @@ describe("ZNSSubRegistrar", () => { // validate transfer events are not happenning const latestBlock = await time.latestBlock(); - const transferFilterToParent = zns.meowToken.filters.Transfer(lvl3SubOwner.address, lvl2SubOwner.address); - const transferFilterToTreasury = zns.meowToken.filters.Transfer( + const transferFilterToParent = zns.zToken.filters.Transfer(lvl3SubOwner.address, lvl2SubOwner.address); + const transferFilterToTreasury = zns.zToken.filters.Transfer( lvl3SubOwner.address, await zns.treasury.getAddress() ); - const transfersToParent = await zns.meowToken.queryFilter( + const transfersToParent = await zns.zToken.queryFilter( transferFilterToParent, latestBlock - 3, latestBlock ); - const transfersToTreasury = await zns.meowToken.queryFilter( + const transfersToTreasury = await zns.zToken.queryFilter( transferFilterToTreasury, latestBlock - 3, latestBlock @@ -2323,10 +2344,10 @@ describe("ZNSSubRegistrar", () => { ); // should NOT offer refund ! - const parentBalAfterRevoke = await zns.meowToken.balanceOf(lvl2SubOwner.address); - const childBalAfterRevoke = await zns.meowToken.balanceOf(lvl3SubOwner.address); - const contractBalAfterRevoke = await zns.meowToken.balanceOf(await zns.treasury.getAddress()); - const zeroVaultBalanceAfterRevoke = await zns.meowToken.balanceOf(zeroVault.address); + const parentBalAfterRevoke = await zns.zToken.balanceOf(lvl2SubOwner.address); + const childBalAfterRevoke = await zns.zToken.balanceOf(lvl3SubOwner.address); + const contractBalAfterRevoke = await zns.zToken.balanceOf(await zns.treasury.getAddress()); + const zeroVaultBalanceAfterRevoke = await zns.zToken.balanceOf(zeroVault.address); expect(parentBalAfterRevoke - parentBalAfter).to.eq(0); expect(childBalAfterRevoke - childBalAfter).to.eq(0); @@ -2439,7 +2460,7 @@ describe("ZNSSubRegistrar", () => { paymentConfigEmpty, ) ).to.be.revertedWithCustomError( - zns.meowToken, + zns.zToken, INSUFFICIENT_ALLOWANCE_ERC_ERR ); @@ -2494,18 +2515,25 @@ describe("ZNSSubRegistrar", () => { fixedPrice = ethers.parseEther("397"); fixedFeePercentage = BigInt(200); + const users = [ + rootOwner, + lvl2SubOwner, + lvl3SubOwner, + lvl4SubOwner, + lvl5SubOwner, + lvl6SubOwner, + ]; + const totalAdminBalance = await zns.zToken.balanceOf(admin.address); + const userBalanceInitial = totalAdminBalance / BigInt(users.length); + await zns.zToken.connect(admin).approve(await zns.treasury.getAddress(), totalAdminBalance); + await Promise.all( - [ - rootOwner, - lvl2SubOwner, - lvl3SubOwner, - lvl4SubOwner, - lvl5SubOwner, - lvl6SubOwner, - ].map(async ({ address }) => - zns.meowToken.mint(address, ethers.parseEther("1000000"))) - ); - await zns.meowToken.connect(rootOwner).approve(await zns.treasury.getAddress(), ethers.MaxUint256); + users.map(async ({ address }) => + zns.zToken.connect(admin).transfer(address, userBalanceInitial) + ) + ); + + await zns.zToken.connect(rootOwner).approve(await zns.treasury.getAddress(), ethers.MaxUint256); // register root domain and 1 subdomain domainConfigs = [ @@ -2519,7 +2547,7 @@ describe("ZNSSubRegistrar", () => { accessType: AccessType.OPEN, }, paymentConfig: { - token: await zns.meowToken.getAddress(), + token: await zns.zToken.getAddress(), beneficiary: rootOwner.address, }, priceConfig: { price: fixedPrice, feePercentage: fixedFeePercentage }, @@ -2535,7 +2563,7 @@ describe("ZNSSubRegistrar", () => { accessType: AccessType.OPEN, }, paymentConfig: { - token: await zns.meowToken.getAddress(), + token: await zns.zToken.getAddress(), beneficiary: lvl2SubOwner.address, }, priceConfig: { price: fixedPrice, feePercentage: fixedFeePercentage }, @@ -2555,7 +2583,7 @@ describe("ZNSSubRegistrar", () => { AccessType.LOCKED, ); - const balBefore = await zns.meowToken.balanceOf(lvl2SubOwner.address); + const balBefore = await zns.zToken.balanceOf(lvl2SubOwner.address); const hash = await registrationWithSetup({ zns, @@ -2566,8 +2594,8 @@ describe("ZNSSubRegistrar", () => { const latestBlock = await time.latestBlock(); // look for an event where user pays himself - const filter = zns.meowToken.filters.Transfer(lvl2SubOwner.address, lvl2SubOwner.address); - const events = await zns.meowToken.queryFilter( + const filter = zns.zToken.filters.Transfer(lvl2SubOwner.address, lvl2SubOwner.address); + const events = await zns.zToken.queryFilter( filter, latestBlock - 50, latestBlock @@ -2575,7 +2603,7 @@ describe("ZNSSubRegistrar", () => { // this means NO transfers have been executed, which is what we need expect(events.length).to.eq(0); - const balAfter = await zns.meowToken.balanceOf(lvl2SubOwner.address); + const balAfter = await zns.zToken.balanceOf(lvl2SubOwner.address); // the diff is 0 because user should not pay himself expect(balAfter - balBefore).to.eq(0); @@ -2641,7 +2669,7 @@ describe("ZNSSubRegistrar", () => { const protocolFee = getStakingOrProtocolFee(expectedPrice); // approve direct payment - await zns.meowToken.connect(lvl5SubOwner).approve( + await zns.zToken.connect(lvl5SubOwner).approve( await zns.treasury.getAddress(), expectedPrice + protocolFee ); @@ -2674,7 +2702,7 @@ describe("ZNSSubRegistrar", () => { // eslint-disable-next-line max-len it("should ONLY allow mintlisted addresses and NOT allow other ones to register a domain when parent's accessType is MINTLIST", async () => { // approve direct payment - await zns.meowToken.connect(lvl3SubOwner).approve(await zns.treasury.getAddress(), fixedPrice); + await zns.zToken.connect(lvl3SubOwner).approve(await zns.treasury.getAddress(), fixedPrice); // register parent with mintlisted access const parentHash = await registrationWithSetup({ zns, @@ -2688,7 +2716,7 @@ describe("ZNSSubRegistrar", () => { accessType: AccessType.MINTLIST, }, paymentConfig: { - token: await zns.meowToken.getAddress(), + token: await zns.zToken.getAddress(), beneficiary: lvl3SubOwner.address, }, priceConfig: { price: fixedPrice, feePercentage: fixedFeePercentage }, @@ -2879,7 +2907,7 @@ describe("ZNSSubRegistrar", () => { : expectedPrice; const protocolFee = getStakingOrProtocolFee(paymentToParent); - await zns.meowToken.connect(lvl5SubOwner).approve( + await zns.zToken.connect(lvl5SubOwner).approve( await zns.treasury.getAddress(), paymentToParent + protocolFee ); @@ -2968,18 +2996,24 @@ describe("ZNSSubRegistrar", () => { fixedPrice = ethers.parseEther("397"); fixedFeePercentage = BigInt(200); + const users = [ + rootOwner, + lvl2SubOwner, + lvl3SubOwner, + lvl4SubOwner, + lvl5SubOwner, + lvl6SubOwner, + ]; + const totalAdminBalance = await zns.zToken.balanceOf(admin.address); + const userBalanceInitial = totalAdminBalance / BigInt(users.length); + await Promise.all( - [ - rootOwner, - lvl2SubOwner, - lvl3SubOwner, - lvl4SubOwner, - lvl5SubOwner, - lvl6SubOwner, - ].map(async ({ address }) => - zns.meowToken.mint(address, ethers.parseEther("1000000"))) - ); - await zns.meowToken.connect(rootOwner).approve(await zns.treasury.getAddress(), ethers.MaxUint256); + users.map(async ({ address }) => + zns.zToken.connect(admin).transfer(address, userBalanceInitial) + ) + ); + + await zns.zToken.connect(rootOwner).approve(await zns.treasury.getAddress(), ethers.MaxUint256); // register root domain and 1 subdomain domainConfigs = [ @@ -2993,7 +3027,7 @@ describe("ZNSSubRegistrar", () => { accessType: AccessType.OPEN, }, paymentConfig: { - token: await zns.meowToken.getAddress(), + token: await zns.zToken.getAddress(), beneficiary: rootOwner.address, }, priceConfig: { price: fixedPrice, feePercentage: fixedFeePercentage }, @@ -3010,7 +3044,7 @@ describe("ZNSSubRegistrar", () => { accessType: AccessType.OPEN, }, paymentConfig: { - token: await zns.meowToken.getAddress(), + token: await zns.zToken.getAddress(), beneficiary: lvl2SubOwner.address, }, priceConfig: { price: fixedPrice, feePercentage: fixedFeePercentage }, @@ -3027,7 +3061,7 @@ describe("ZNSSubRegistrar", () => { accessType: AccessType.OPEN, }, paymentConfig: { - token: await zns.meowToken.getAddress(), + token: await zns.zToken.getAddress(), beneficiary: lvl3SubOwner.address, }, priceConfig: DEFAULT_PRICE_CONFIG, @@ -3354,18 +3388,18 @@ describe("ZNSSubRegistrar", () => { const { amount: stakedAfter } = await zns.treasury.stakedForDomain(regResults[1].domainHash); expect(stakedAfter).to.eq(stakedBefore); - const userBalbefore = await zns.meowToken.balanceOf(lvl3SubOwner.address); + const userBalbefore = await zns.zToken.balanceOf(lvl3SubOwner.address); const protocolFee = getStakingOrProtocolFee(stakedAfter); - await zns.meowToken.connect(lvl3SubOwner).approve(await zns.treasury.getAddress(), protocolFee); + await zns.zToken.connect(lvl3SubOwner).approve(await zns.treasury.getAddress(), protocolFee); // try revoking await zns.rootRegistrar.connect(lvl3SubOwner).revokeDomain( regResults[1].domainHash, ); // verify that refund has been acquired by the new owner - const userBalAfter = await zns.meowToken.balanceOf(lvl3SubOwner.address); + const userBalAfter = await zns.zToken.balanceOf(lvl3SubOwner.address); expect(userBalAfter - userBalbefore).to.eq(fixedPrice - protocolFee); }); }); @@ -3481,14 +3515,20 @@ describe("ZNSSubRegistrar", () => { }); // Give funds to users + const users = [ + rootOwner, + lvl2SubOwner, + ]; + const totalAdminBalance = await zns.zToken.balanceOf(admin.address); + const userBalanceInitial = totalAdminBalance / BigInt(users.length); + await Promise.all( - [ - rootOwner, - lvl2SubOwner, - ].map(async ({ address }) => - zns.meowToken.mint(address, ethers.parseEther("1000000"))) + users.map(async ({ address }) => + zns.zToken.connect(admin).transfer(address, userBalanceInitial) + ) ); - await zns.meowToken.connect(rootOwner).approve(await zns.treasury.getAddress(), ethers.MaxUint256); + + await zns.zToken.connect(rootOwner).approve(await zns.treasury.getAddress(), ethers.MaxUint256); fixedPrice = ethers.parseEther("397.13"); // register root domain @@ -3503,7 +3543,7 @@ describe("ZNSSubRegistrar", () => { paymentType: PaymentType.DIRECT, }, paymentConfig: { - token: await zns.meowToken.getAddress(), + token: await zns.zToken.getAddress(), beneficiary: rootOwner.address, }, priceConfig: { @@ -3566,9 +3606,6 @@ describe("ZNSSubRegistrar", () => { const domainLabel = "world"; - await zns.meowToken.connect(lvl2SubOwner).approve(await zns.treasury.getAddress(), ethers.MaxUint256); - await zns.meowToken.mint(lvl2SubOwner.address, ethers.parseEther("1000000")); - const domainHash = await registrationWithSetup({ zns, user: lvl2SubOwner, @@ -3585,7 +3622,7 @@ describe("ZNSSubRegistrar", () => { feePercentage: BigInt(0), }, paymentConfig: { - token: await zns.meowToken.getAddress(), + token: await zns.zToken.getAddress(), beneficiary: lvl2SubOwner.address, }, }, @@ -3628,8 +3665,7 @@ describe("ZNSSubRegistrar", () => { expect(rootConfigBefore.pricerContract).to.eq(await zns.fixedPricer.getAddress()); expect(rootConfigBefore.paymentType).to.eq(PaymentType.DIRECT); - await zns.meowToken.mint(lvl2SubOwner.address, ethers.parseEther("1000000")); - await zns.meowToken.connect(lvl2SubOwner).approve(await zns.treasury.getAddress(), ethers.parseEther("1000000")); + await zns.zToken.connect(lvl2SubOwner).approve(await zns.treasury.getAddress(), ethers.parseEther("1000000")); const subConfigToSet = { accessType: AccessType.MINTLIST, diff --git a/test/ZNSTreasury.test.ts b/test/ZNSTreasury.test.ts index fcb58999..b8368420 100644 --- a/test/ZNSTreasury.test.ts +++ b/test/ZNSTreasury.test.ts @@ -61,16 +61,18 @@ describe("ZNSTreasury", () => { zns = await deployZNS(params); paymentConfig = { - token: await zns.meowToken.getAddress(), + token: await zns.zToken.getAddress(), beneficiary: user.address, }; // give REGISTRAR_ROLE to a wallet address to be calling guarded functions await zns.accessController.connect(admin).grantRole(REGISTRAR_ROLE, mockRegistrar.address); - // Give funds to user - await zns.meowToken.connect(user).approve(await zns.treasury.getAddress(), ethers.MaxUint256); - await zns.meowToken.mint(user.address, ethers.parseEther("50000")); + // Give funds to user and deployer. Divide equally to give them the same amount + const userBalanceInitial = await zns.zToken.balanceOf(admin.address) / 3n; + await zns.zToken.connect(user).approve(await zns.treasury.getAddress(), userBalanceInitial); + await zns.zToken.connect(admin).transfer(user, userBalanceInitial); + await zns.zToken.connect(admin).transfer(deployer, userBalanceInitial); // register random domain await zns.rootRegistrar.connect(user).registerRootDomain( @@ -91,7 +93,7 @@ describe("ZNSTreasury", () => { const accessController = await zns.treasury.getAccessController(); expect(registry).to.eq(await zns.registry.getAddress()); - expect(token).to.eq(await zns.meowToken.getAddress()); + expect(token).to.eq(await zns.zToken.getAddress()); expect(beneficiary).to.eq(zns.zeroVaultAddress); expect(accessController).to.eq(await zns.accessController.getAddress()); }); @@ -99,7 +101,7 @@ describe("ZNSTreasury", () => { it("should NOT initialize twice", async () => { const tx = zns.treasury.initialize( await zns.registry.getAddress(), - await zns.meowToken.getAddress(), + await zns.zToken.getAddress(), zns.zeroVaultAddress, await zns.accessController.getAddress() ); @@ -117,7 +119,7 @@ describe("ZNSTreasury", () => { await expect( implContract.initialize( await zns.registry.getAddress(), - await zns.meowToken.getAddress(), + await zns.zToken.getAddress(), zns.zeroVaultAddress, await zns.accessController.getAddress() ) @@ -129,7 +131,7 @@ describe("ZNSTreasury", () => { deployer, accessControllerAddress: await zns.accessController.getAddress(), registryAddress: await zns.registry.getAddress(), - zTokenMockAddress: await zns.meowToken.getAddress(), + zTokenMockAddress: await zns.zToken.getAddress(), zeroVaultAddress: zns.zeroVaultAddress, isTenderlyRun: false, }; @@ -152,8 +154,8 @@ describe("ZNSTreasury", () => { describe("#stakeForDomain()", () => { it("Stakes the correct amount", async () => { - const balanceBeforeStake = await zns.meowToken.balanceOf(user.address); - const zeroVaultBalanceBeforeStake = await zns.meowToken.balanceOf(zeroVault.address); + const balanceBeforeStake = await zns.zToken.balanceOf(user.address); + const zeroVaultBalanceBeforeStake = await zns.zToken.balanceOf(zeroVault.address); const expectedStake = await zns.curvePricer.getPrice( ethers.ZeroHash, @@ -175,14 +177,14 @@ describe("ZNSTreasury", () => { expect(stake).to.eq(expectedStake); await checkBalance({ - token: zns.meowToken, + token: zns.zToken, balanceBefore: balanceBeforeStake, userAddress: user.address, target: stake + fee, shouldDecrease: true, }); - const zeroVaultBalanceAfterStake = await zns.meowToken.balanceOf(zeroVault.address); + const zeroVaultBalanceAfterStake = await zns.zToken.balanceOf(zeroVault.address); expect(zeroVaultBalanceAfterStake).to.eq(zeroVaultBalanceBeforeStake + fee); }); @@ -222,7 +224,7 @@ describe("ZNSTreasury", () => { ethers.ZeroHash, domainHash, user.address, - await zns.meowToken.getAddress(), + await zns.zToken.getAddress(), expectedPrice, BigInt(0), protocolFee @@ -244,19 +246,19 @@ describe("ZNSTreasury", () => { protocolFee ); - const balanceBeforeUnstake = await zns.meowToken.balanceOf(user.address); + const balanceBeforeUnstake = await zns.zToken.balanceOf(user.address); const { token, amount: stake } = await zns.treasury.stakedForDomain(domainHash); await zns.treasury.connect(mockRegistrar).unstakeForDomain(domainHash, user.address, protocolFee); await checkBalance({ - token: zns.meowToken, + token: zns.zToken, balanceBefore: balanceBeforeUnstake, userAddress: user.address, target: stake - protocolFee, shouldDecrease: false, }); - expect(token).to.eq(await zns.meowToken.getAddress()); + expect(token).to.eq(await zns.zToken.getAddress()); }); it("Should revert if called from an address without REGISTRAR_ROLE", async () => { @@ -275,7 +277,7 @@ describe("ZNSTreasury", () => { it("should process payment correctly with paymentConfig set", async () => { const randomHash = hashDomainLabel("randommmmmmmm2342342"); const config = { - token: await zns.meowToken.getAddress(), + token: await zns.zToken.getAddress(), beneficiary: user.address, }; @@ -293,12 +295,12 @@ describe("ZNSTreasury", () => { const paymentAmt = ethers.parseEther("1000"); const protocolFee = ethers.parseEther("10"); // give tokens to mock registrar - await zns.meowToken.connect(user).transfer(mockRegistrar.address, paymentAmt + protocolFee); - await zns.meowToken.connect(mockRegistrar).approve(await zns.treasury.getAddress(), paymentAmt + protocolFee); + await zns.zToken.connect(user).transfer(mockRegistrar.address, paymentAmt + protocolFee); + await zns.zToken.connect(mockRegistrar).approve(await zns.treasury.getAddress(), paymentAmt + protocolFee); - const userBalanceBefore = await zns.meowToken.balanceOf(user.address); - const payerBalanceBefore = await zns.meowToken.balanceOf(mockRegistrar.address); - const zeroVaultBalanceBefore = await zns.meowToken.balanceOf(zeroVault.address); + const userBalanceBefore = await zns.zToken.balanceOf(user.address); + const payerBalanceBefore = await zns.zToken.balanceOf(mockRegistrar.address); + const zeroVaultBalanceBefore = await zns.zToken.balanceOf(zeroVault.address); await zns.treasury.connect(mockRegistrar).processDirectPayment( randomHash, @@ -308,9 +310,9 @@ describe("ZNSTreasury", () => { protocolFee ); - const userBalanceAfter = await zns.meowToken.balanceOf(user.address); - const payerBalanceAfter = await zns.meowToken.balanceOf(mockRegistrar.address); - const zeroVaultBalanceAfter = await zns.meowToken.balanceOf(zeroVault.address); + const userBalanceAfter = await zns.zToken.balanceOf(user.address); + const payerBalanceAfter = await zns.zToken.balanceOf(mockRegistrar.address); + const zeroVaultBalanceAfter = await zns.zToken.balanceOf(zeroVault.address); expect(userBalanceAfter - userBalanceBefore).to.eq(paymentAmt); expect(payerBalanceBefore - payerBalanceAfter).to.eq(paymentAmt + protocolFee); @@ -359,8 +361,8 @@ describe("ZNSTreasury", () => { const paymentAmt = ethers.parseEther("100"); const protocolFee = ethers.parseEther("7"); // give tokens to mock registrar - await zns.meowToken.connect(user).transfer(mockRegistrar.address, paymentAmt + protocolFee); - await zns.meowToken.connect(mockRegistrar).approve(await zns.treasury.getAddress(), paymentAmt + protocolFee); + await zns.zToken.connect(user).transfer(mockRegistrar.address, paymentAmt + protocolFee); + await zns.zToken.connect(mockRegistrar).approve(await zns.treasury.getAddress(), paymentAmt + protocolFee); await expect( zns.treasury.connect(mockRegistrar).processDirectPayment( @@ -444,13 +446,13 @@ describe("ZNSTreasury", () => { ZERO_ADDRESS_ERR ); - const meowTokenConf = { + const zTokenConf = { token: ethers.ZeroAddress, beneficiary: randomAcc.address, }; await expect( - zns.treasury.connect(user).setPaymentConfig(domainHash, meowTokenConf) + zns.treasury.connect(user).setPaymentConfig(domainHash, zTokenConf) ).to.be.revertedWithCustomError( zns.treasury, ZERO_ADDRESS_ERR @@ -628,6 +630,8 @@ describe("ZNSTreasury", () => { const newHash = hashSubdomainName(newLabel); const { expectedPrice, stakeFee } = getPriceObject(newLabel, DEFAULT_PRICE_CONFIG); + await zns.zToken.connect(deployer).approve(await zns.treasury.getAddress(), ethers.MaxInt256); + await zns.treasury.connect(mockRegistrar).stakeForDomain( ethers.ZeroHash, newHash, diff --git a/test/gas/TransactionGasCosts.test.ts b/test/gas/TransactionGasCosts.test.ts index d27dd320..f19ad4c2 100644 --- a/test/gas/TransactionGasCosts.test.ts +++ b/test/gas/TransactionGasCosts.test.ts @@ -51,14 +51,19 @@ describe("Transaction Gas Costs Test", () => { }; // Give funds to users + const users = [ + rootOwner, + lvl2SubOwner, + ]; + const totalAdminBalance = await zns.zToken.balanceOf(admin.address); + const userBalanceInitial = totalAdminBalance / BigInt(users.length); + await Promise.all( - [ - rootOwner, - lvl2SubOwner, - ].map(async ({ address }) => - zns.meowToken.mint(address, ethers.parseEther("1000000"))) + users.map(async ({ address }) => + zns.zToken.connect(admin).transfer(address, userBalanceInitial) + ) ); - await zns.meowToken.connect(rootOwner).approve(await zns.treasury.getAddress(), ethers.MaxUint256); + await zns.zToken.connect(rootOwner).approve(await zns.treasury.getAddress(), ethers.MaxUint256); rootHashDirect = await registrationWithSetup({ zns, @@ -71,7 +76,7 @@ describe("Transaction Gas Costs Test", () => { paymentType: PaymentType.DIRECT, }, paymentConfig: { - token: await zns.meowToken.getAddress(), + token: await zns.zToken.getAddress(), beneficiary: rootOwner.address, }, priceConfig: DEFAULT_PRICE_CONFIG, @@ -83,10 +88,10 @@ describe("Transaction Gas Costs Test", () => { it("Root Domain Price", async function () { // approve - await zns.meowToken.connect(rootOwner).approve(await zns.treasury.getAddress(), ethers.MaxUint256); + await zns.zToken.connect(rootOwner).approve(await zns.treasury.getAddress(), ethers.MaxUint256); // register root domain const paymentConfig = { - token: await zns.meowToken.getAddress(), + token: await zns.zToken.getAddress(), beneficiary: rootOwner.address, }; @@ -133,10 +138,10 @@ describe("Transaction Gas Costs Test", () => { it("Subdomain Price", async function () { // approve - await zns.meowToken.connect(lvl2SubOwner).approve(await zns.treasury.getAddress(), ethers.MaxUint256); + await zns.zToken.connect(lvl2SubOwner).approve(await zns.treasury.getAddress(), ethers.MaxUint256); // register subdomain const paymentConfig = { - token: await zns.meowToken.getAddress(), + token: await zns.zToken.getAddress(), beneficiary: rootOwner.address, }; diff --git a/test/gas/gas-costs.json b/test/gas/gas-costs.json index c533f917..e0c20210 100644 --- a/test/gas/gas-costs.json +++ b/test/gas/gas-costs.json @@ -1,4 +1,4 @@ { - "Root Domain Price": "470041", - "Subdomain Price": "463156" + "Root Domain Price": "464901", + "Subdomain Price": "457940" } \ No newline at end of file diff --git a/test/helpers/constants.ts b/test/helpers/constants.ts index a3adc1bc..226b9a4f 100644 --- a/test/helpers/constants.ts +++ b/test/helpers/constants.ts @@ -77,7 +77,7 @@ export const implSlotErc1967 = "0x360894a13ba1a3210667c828492db98dca3e2076cc3735 export const accessControllerName = "ZNSAccessController"; export const registryName = "ZNSRegistry"; export const domainTokenName = "ZNSDomainToken"; -export const meowTokenMockName = "MeowTokenMock"; +export const zTokenMockName = "ZTokenMock"; export const addressResolverName = "ZNSAddressResolver"; export const curvePricerName = "ZNSCurvePricer"; export const fixedPricerName = "ZNSFixedPricer"; @@ -85,3 +85,11 @@ export const treasuryName = "ZNSTreasury"; export const registrarName = "ZNSRootRegistrar"; export const erc1967ProxyName = "ERC1967Proxy"; export const subRegistrarName = "ZNSSubRegistrar"; + +// zToken mock deploy default params +export const Z_NAME_DEFAULT = "ZERO Token"; +export const Z_SYMBOL_DEFAULT = "Z"; +export const INITIAL_ADMIN_DELAY_DEFAULT = 5n; +export const INITIAL_SUPPLY_DEFAULT = 369000000n; +export const INFLATION_RATES_DEFAULT = [0n, 900n, 765n, 650n, 552n, 469n, 398n, 338n, 287n, 243n, 206n, 175n]; +export const FINAL_INFLATION_RATE_DEFAULT = 150n; diff --git a/test/helpers/deploy-helpers.ts b/test/helpers/deploy-helpers.ts index 01d1d721..dd2cee8f 100644 --- a/test/helpers/deploy-helpers.ts +++ b/test/helpers/deploy-helpers.ts @@ -16,11 +16,11 @@ export const approveBulk = async ( ) => { for (const signer of signers) { // if (hre.network.name === "hardhat") { - const hasApproval = await zns.meowToken.allowance(signer.address, await zns.treasury.getAddress()); + const hasApproval = await zns.zToken.allowance(signer.address, await zns.treasury.getAddress()); // To avoid resending the approval repeatedly we first check the allowance if (hasApproval === BigInt(0)) { - const tx = await zns.meowToken.connect(signer).approve( + const tx = await zns.zToken.connect(signer).approve( await zns.treasury.getAddress(), ethers.MaxUint256, ); @@ -30,16 +30,14 @@ export const approveBulk = async ( } }; -export const mintBulk = async ( - signers : Array, +export const transferBulk = async ( + users : Array, + admin : SignerWithAddress, amount : bigint, zns : IZNSContractsLocal | IZNSContracts, ) => { - for (const signer of signers) { - await zns.meowToken.connect(signer).mint( - signer.address, - amount - ); + for (const user of users) { + await zns.zToken.connect(admin).transfer(user.address, amount); } }; @@ -94,14 +92,14 @@ export const registerRootDomainBulk = async ( let index = 0; for(const domain of domains) { - const balanceBefore = await zns.meowToken.balanceOf(signers[index].address); + const balanceBefore = await zns.zToken.balanceOf(signers[index].address); const tx = await zns.rootRegistrar.connect(signers[index]).registerRootDomain( domain, config.zeroVaultAddress, `${tokenUri}${index}`, distConfig, { - token: await zns.meowToken.getAddress(), + token: await zns.zToken.getAddress(), beneficiary: config.zeroVaultAddress, } ); @@ -111,7 +109,7 @@ export const registerRootDomainBulk = async ( logger.info(`Registered '${domain}' for ${signers[index].address} at tx: ${tx.hash}`); } - const balanceAfter = await zns.meowToken.balanceOf(signers[index].address); + const balanceAfter = await zns.zToken.balanceOf(signers[index].address); const [price, protocolFee] = await zns.curvePricer.getPriceAndFee(ethers.ZeroHash, domain, true); expect(balanceAfter).to.be.eq(balanceBefore - price - protocolFee); @@ -140,7 +138,7 @@ export const registerSubdomainBulk = async ( let index = 0; for (const subdomain of subdomains) { - const balanceBefore = await zns.meowToken.balanceOf(signers[index].address); + const balanceBefore = await zns.zToken.balanceOf(signers[index].address); const tx = await zns.subRegistrar.connect(signers[index]).registerSubdomain( parents[index], subdomain, @@ -157,7 +155,7 @@ export const registerSubdomainBulk = async ( logger.info(`registered '${subdomain}' for ${signers[index].address} at tx: ${tx.hash}`); } - const balanceAfter = await zns.meowToken.balanceOf(signers[index].address); + const balanceAfter = await zns.zToken.balanceOf(signers[index].address); const owner = await zns.registry.getDomainOwner(parents[index]); if (signers[index].address === owner) { diff --git a/test/helpers/deploy/deploy-zns.ts b/test/helpers/deploy/deploy-zns.ts index c2006a9d..d944bcd3 100644 --- a/test/helpers/deploy/deploy-zns.ts +++ b/test/helpers/deploy/deploy-zns.ts @@ -1,5 +1,5 @@ import { - MeowTokenMock__factory, + ZTokenMock__factory, ZNSAccessController, ZNSAccessController__factory, ZNSAddressResolver, @@ -18,11 +18,11 @@ import { ZNSTreasury__factory, ZNSFixedPricer, ZNSSubRegistrar, - MeowTokenMock, + ZTokenMock, } from "../../../typechain"; import { DeployZNSParams, RegistrarConfig, IZNSContractsLocal } from "../types"; import * as hre from "hardhat"; -import { ethers, upgrades } from "hardhat"; +import { upgrades } from "hardhat"; import { SignerWithAddress } from "@nomicfoundation/hardhat-ethers/signers"; import { accessControllerName, @@ -36,16 +36,21 @@ import { registryName, subRegistrarName, treasuryName, - meowTokenMockName, + zTokenMockName, ZNS_DOMAIN_TOKEN_NAME, ZNS_DOMAIN_TOKEN_SYMBOL, DEFAULT_ROYALTY_FRACTION, DEFAULT_RESOLVER_TYPE, + INITIAL_ADMIN_DELAY_DEFAULT, + INITIAL_SUPPLY_DEFAULT, + INFLATION_RATES_DEFAULT, + FINAL_INFLATION_RATE_DEFAULT, + Z_NAME_DEFAULT, + Z_SYMBOL_DEFAULT, } from "../constants"; import { REGISTRAR_ROLE } from "../../../src/deploy/constants"; import { getProxyImplAddress } from "../utils"; import { ICurvePriceConfig } from "../../../src/deploy/missions/types"; -import { meowTokenName, meowTokenSymbol } from "../../../src/deploy/missions/contracts"; import { transparentProxyName } from "../../../src/deploy/missions/contracts/names"; @@ -164,25 +169,27 @@ export const deployDomainToken = async ( return domainToken as unknown as ZNSDomainToken; }; -export const deployMeowToken = async ( +export const deployZToken = async ( deployer : SignerWithAddress, + governorAddresses : Array, + adminAddresses : Array, isTenderlyRun : boolean -) : Promise => { - const factory = new MeowTokenMock__factory(deployer); - - const meowToken = await hre.upgrades.deployProxy( - factory, - [ - meowTokenName, - meowTokenSymbol, - ], - { - kind: "transparent", - } - ) as unknown as MeowTokenMock; - - await meowToken.waitForDeployment(); - const proxyAddress = await meowToken.getAddress(); +) : Promise => { + const Factory = new ZTokenMock__factory(deployer); + const zToken = await Factory.deploy( + Z_NAME_DEFAULT, + Z_SYMBOL_DEFAULT, + governorAddresses[0], + INITIAL_ADMIN_DELAY_DEFAULT, + deployer.address, + adminAddresses[0], + INITIAL_SUPPLY_DEFAULT, + INFLATION_RATES_DEFAULT, + FINAL_INFLATION_RATE_DEFAULT + ) as ZTokenMock; + + await zToken.waitForDeployment(); + const proxyAddress = await zToken.getAddress(); if (isTenderlyRun) { await hre.tenderly.verify({ @@ -193,19 +200,16 @@ export const deployMeowToken = async ( const impl = await getProxyImplAddress(proxyAddress); await hre.tenderly.verify({ - name: meowTokenMockName, + name: zTokenMockName, address: impl, }); - console.log(`${meowTokenMockName} deployed at: + console.log(`${zTokenMockName} deployed at: proxy: ${proxyAddress} implementation: ${impl}`); } - // Mint 10,000 ZERO for self - await meowToken.mint(proxyAddress, ethers.parseEther("10000")); - - return meowToken as unknown as MeowTokenMock; + return zToken as unknown as ZTokenMock; }; export const deployAddressResolver = async ( @@ -558,7 +562,12 @@ export const deployZNS = async ({ // While we do use the real ZeroToken contract, it is only deployed as a mock here // for testing purposes that verify expected behavior of other contracts. // This should not be used in any other context than deploying to a local hardhat testnet. - const meowTokenMock = await deployMeowToken(deployer, isTenderlyRun); + const zTokenMock = await deployZToken( + deployer, + governorAddresses, + adminAddresses, + isTenderlyRun, + ); const addressResolver = await deployAddressResolver( deployer, @@ -579,7 +588,7 @@ export const deployZNS = async ({ deployer, accessControllerAddress: await accessController.getAddress(), registryAddress: await registry.getAddress(), - zTokenMockAddress: await meowTokenMock.getAddress(), + zTokenMockAddress: await zTokenMock.getAddress(), zeroVaultAddress, isTenderlyRun, }); @@ -618,7 +627,7 @@ export const deployZNS = async ({ accessController, registry, domainToken, - meowToken: meowTokenMock, + zToken: zTokenMock, addressResolver, curvePricer, treasury, @@ -628,10 +637,6 @@ export const deployZNS = async ({ zeroVaultAddress, }; - // Give 15 ZERO to the deployer and allowance to the treasury - await meowTokenMock.connect(deployer).approve(await treasury.getAddress(), ethers.MaxUint256); - await meowTokenMock.mint(await deployer.getAddress(), ethers.parseEther("5000000")); - await registry.connect(deployer).addResolverType(DEFAULT_RESOLVER_TYPE, await addressResolver.getAddress()); return znsContracts; diff --git a/test/helpers/errors.ts b/test/helpers/errors.ts index cbb42de1..304010c3 100644 --- a/test/helpers/errors.ts +++ b/test/helpers/errors.ts @@ -46,8 +46,8 @@ export const INITIALIZED_ERR = "InvalidInitialization"; // Environment validation export const INVALID_ENV_ERR = "Invalid environment value. Must set env to one of `dev`, `test`, or `prod`"; -export const NO_MOCK_PROD_ERR = "Cannot mock MEOW token in production"; -export const STAKING_TOKEN_ERR = "Must use MEOW token in production"; +export const NO_MOCK_PROD_ERR = "Cannot mock Z token in production"; +export const STAKING_TOKEN_ERR = "Must use Z token in production"; export const INVALID_CURVE_ERR = "Must use a valid price configuration"; export const MONGO_URI_ERR = "Cannot use local mongo URI in production"; export const NO_ZERO_VAULT_ERR = "Must provide ZERO_VAULT_ADDRESS for 'prod' or 'test' environments"; diff --git a/test/helpers/flows/registration.ts b/test/helpers/flows/registration.ts index 7cef8dfa..5bd069fb 100644 --- a/test/helpers/flows/registration.ts +++ b/test/helpers/flows/registration.ts @@ -36,7 +36,7 @@ export const registerDomainPath = async ({ let beneficiary; if (isRootDomain) { - paymentTokenContract = zns.meowToken; + paymentTokenContract = zns.zToken; // no beneficiary for root domain beneficiary = ethers.ZeroAddress; } else { @@ -45,8 +45,8 @@ export const registerDomainPath = async ({ const { token: paymentTokenAddress } = paymentConfig; ({ beneficiary } = paymentConfig); - if (paymentTokenAddress === await zns.meowToken.getAddress()) { - paymentTokenContract = zns.meowToken; + if (paymentTokenAddress === await zns.zToken.getAddress()) { + paymentTokenContract = zns.zToken; } else { paymentTokenContract = getTokenContract(paymentTokenAddress, config.user); } diff --git a/test/helpers/types.ts b/test/helpers/types.ts index 49b03016..5193f035 100644 --- a/test/helpers/types.ts +++ b/test/helpers/types.ts @@ -1,5 +1,4 @@ import { - MeowTokenMock, ZNSAccessController, ZNSAddressResolver, ZNSAddressResolverUpgradeMock, @@ -25,6 +24,7 @@ import { ZNSTreasury, ZNSTreasuryUpgradeMock, ZNSTreasuryUpgradeMock__factory, + ZTokenMock, } from "../../typechain"; import { SignerWithAddress } from "@nomicfoundation/hardhat-ethers/signers"; import { ICurvePriceConfig } from "../../src/deploy/missions/types"; @@ -81,7 +81,7 @@ export interface IZNSContractsLocal { accessController : ZNSAccessController; registry : ZNSRegistry; domainToken : ZNSDomainToken; - meowToken : MeowTokenMock; + zToken : ZTokenMock; addressResolver : ZNSAddressResolver; curvePricer : ZNSCurvePricer; treasury : ZNSTreasury; diff --git a/test/helpers/validate-upgrade.ts b/test/helpers/validate-upgrade.ts index 1cace957..d0cf9e15 100644 --- a/test/helpers/validate-upgrade.ts +++ b/test/helpers/validate-upgrade.ts @@ -2,13 +2,14 @@ import { expect } from "chai"; import { SignerWithAddress } from "@nomicfoundation/hardhat-ethers/signers"; import { ZNSContractMock, ZNSContractMockFactory, GeneralContractGetter } from "./types"; import { ZNSContract } from "../../src/deploy/campaign/types"; -import { ZNSAccessController } from "../../typechain"; -import { MeowToken } from "@zero-tech/ztoken/typechain-js"; - +import { + ZNSAccessController, + ZToken, +} from "../../typechain"; export const validateUpgrade = async ( deployer : SignerWithAddress, - contract : Exclude, MeowToken>, + contract : Exclude, ZToken>, upgradeContract : ZNSContractMock, upgradeContractFactory : ZNSContractMockFactory, getters : Array diff --git a/yarn.lock b/yarn.lock index a4ddc31b..2027590e 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1129,21 +1129,11 @@ resolved "https://registry.yarnpkg.com/@openzeppelin/contracts-upgradeable/-/contracts-upgradeable-4.0.0.tgz#11edb64933c43ab3eab2a84abe5e3ccf2981c4c7" integrity sha512-T5tO/KD++m+Ph74ppPPmNuhyrvNcsMDgQWt+pGshNJMsTf9UvmhBNyyOqVAL91UeuqDI0FHAbBV1+NnMg7ffFA== -"@openzeppelin/contracts-upgradeable@4.9.3": - version "4.9.3" - resolved "https://registry.yarnpkg.com/@openzeppelin/contracts-upgradeable/-/contracts-upgradeable-4.9.3.tgz#ff17a80fb945f5102571f8efecb5ce5915cc4811" - integrity sha512-jjaHAVRMrE4UuZNfDwjlLGDxTHWIOwTJS2ldnc278a0gevfXfPr8hxKEVBGFBE96kl2G3VHDZhUimw/+G3TG2A== - "@openzeppelin/contracts-upgradeable@^5.0.2": version "5.0.2" resolved "https://registry.yarnpkg.com/@openzeppelin/contracts-upgradeable/-/contracts-upgradeable-5.0.2.tgz#3e5321a2ecdd0b206064356798c21225b6ec7105" integrity sha512-0MmkHSHiW2NRFiT9/r5Lu4eJq5UJ4/tzlOgYXNAIj/ONkQTVnz22pLxDvp4C4uZ9he7ZFvGn3Driptn1/iU7tQ== -"@openzeppelin/contracts@4.9.3": - version "4.9.3" - resolved "https://registry.yarnpkg.com/@openzeppelin/contracts/-/contracts-4.9.3.tgz#00d7a8cf35a475b160b3f0293a6403c511099364" - integrity sha512-He3LieZ1pP2TNt5JbkPA4PNT9WC3gOTOlDcFGJW4Le4QKqwmiNJCRt44APfxMxvq7OugU/cqYuPcSBzOw38DAg== - "@openzeppelin/contracts@^5.0.2": version "5.0.2" resolved "https://registry.yarnpkg.com/@openzeppelin/contracts/-/contracts-5.0.2.tgz#b1d03075e49290d06570b2fd42154d76c2a5d210" @@ -1926,6 +1916,11 @@ eslint-plugin-prefer-arrow "^1.2.3" typescript "^5.0.2" +"@zero-tech/z-token@1.0.0": + version "1.0.0" + resolved "https://registry.yarnpkg.com/@zero-tech/z-token/-/z-token-1.0.0.tgz#ba56c7e269e399e029cca69d1d54357220a2d08f" + integrity sha512-hbUmgKZ6G4Z4dLzvI0SR5n/O6OaWpWh2utG5DHDZZd6P6G5HBdeELUKVVQxecTsPQY0GnVvevxaEoLBMcyW9Xw== + "@zero-tech/zdc@0.1.6": version "0.1.6" resolved "https://registry.yarnpkg.com/@zero-tech/zdc/-/zdc-0.1.6.tgz#131d13a128c494b7b5d32c208f3afdb775bf3ba2" @@ -1935,14 +1930,6 @@ mongodb "^6.3.0" winston "^3.11.0" -"@zero-tech/ztoken@2.1.0": - version "2.1.0" - resolved "https://registry.yarnpkg.com/@zero-tech/ztoken/-/ztoken-2.1.0.tgz#71f50b532c258588ade488644fd75d1b8028a256" - integrity sha512-5S392GkiE+mH+ZNWs1XKL/ia4YiQ9tf+i8p1qeoHBFqatwB1wP3XTl+GkosqSxaJPnw/nNq7bn2W+XBnGATxJg== - dependencies: - "@openzeppelin/contracts" "4.9.3" - "@openzeppelin/contracts-upgradeable" "4.9.3" - JSONStream@^1.3.5: version "1.3.5" resolved "https://registry.yarnpkg.com/JSONStream/-/JSONStream-1.3.5.tgz#3208c1f08d3a4d99261ab64f92302bc15e111ca0"