Skip to content

Commit

Permalink
Revert "Types upgrade after PROVIDER removal"
Browse files Browse the repository at this point in the history
This reverts commit ae74c06.
  • Loading branch information
MichaelKorchagin committed Jul 17, 2024
1 parent ae74c06 commit 2a958a1
Show file tree
Hide file tree
Showing 19 changed files with 141 additions and 88 deletions.
42 changes: 18 additions & 24 deletions contracts/registrar/IZNSSubRegistrar.sol
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
// SPDX-License-Identifier: MIT
pragma solidity 0.8.26;

import {IDistributionConfig} from "../types/IDistributionConfig.sol";
import {PaymentConfig} from "../treasury/IZNSTreasury.sol";
import {IZNSPricer} from "../types/IZNSPricer.sol";
import { IDistributionConfig } from "../types/IDistributionConfig.sol";
import { PaymentConfig } from "../treasury/IZNSTreasury.sol";
import { IZNSPricer } from "../types/IZNSPricer.sol";


/**
* @title IZNSSubRegistrar.sol - Interface for the ZNSSubRegistrar contract responsible for registering subdomains.
*/
*/
interface IZNSSubRegistrar is IDistributionConfig {
/**
* @notice Reverted when someone other than parent owner is trying to buy
a subdomain under the parent that is locked\
* @notice Reverted when someone other than parent owner is trying to buy a subdomain under the parent that is locked\
* or when the parent provided does not exist.
*/
error ParentLockedOrDoesntExist(bytes32 parentHash);
Expand All @@ -23,25 +23,22 @@ interface IZNSSubRegistrar is IDistributionConfig {

/**
* @notice Emitted when a new `DistributionConfig.pricerContract` is set for a domain.
*/
event PricerContractSet(
bytes32 indexed domainHash,
address indexed pricerContract
);
*/
event PricerContractSet(bytes32 indexed domainHash, address indexed pricerContract);

/**
* @notice Emitted when a new `DistributionConfig.paymentType` is set for a domain.
*/
*/
event PaymentTypeSet(bytes32 indexed domainHash, PaymentType paymentType);

/**
* @notice Emitted when a new `DistributionConfig.accessType` is set for a domain.
*/
*/
event AccessTypeSet(bytes32 indexed domainHash, AccessType accessType);

/**
* @notice Emitted when a new full `DistributionConfig` is set for a domain at once.
*/
*/
event DistributionConfigSet(
bytes32 indexed domainHash,
IZNSPricer pricerContract,
Expand All @@ -51,7 +48,7 @@ interface IZNSSubRegistrar is IDistributionConfig {

/**
* @notice Emitted when a `mintlist` is updated for a domain.
*/
*/
event MintlistUpdated(
bytes32 indexed domainHash,
uint256 indexed ownerIndex,
Expand All @@ -67,19 +64,16 @@ interface IZNSSubRegistrar is IDistributionConfig {

/**
* @notice Emitted when the ZNSRootRegistrar address is set in state.
*/
*/
event RootRegistrarSet(address registrar);

function distrConfigs(
bytes32 domainHash
)
external
view
returns (
IZNSPricer pricerContract,
PaymentType paymentType,
AccessType accessType
);
) external view returns (
IZNSPricer pricerContract,
PaymentType paymentType,
AccessType accessType
);

function isMintlistedForDomain(
bytes32 domainHash,
Expand Down
6 changes: 3 additions & 3 deletions contracts/types/IZNSPricer.sol
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// SPDX-License-Identifier: MIT
pragma solidity 0.8.26;


/**
* @title IZNSPricer.sol
* @notice Base interface required to be inherited by all Pricing contracts to work with zNS
Expand All @@ -13,8 +14,7 @@ interface IZNSPricer {
error ParentPriceConfigNotSet(bytes32 parentHash);

/**
* @notice Reverted when domain owner is trying to set it's stake fee percentage higher than 100%
(uint256 "10,000").
* @notice Reverted when domain owner is trying to set it's stake fee percentage higher than 100% (uint256 "10,000").
*/
error FeePercentageValueTooLarge(uint256 feePercentage, uint256 maximum);

Expand Down Expand Up @@ -49,7 +49,7 @@ interface IZNSPricer {
/**
* @notice Returns the fee for a given price.
* @dev Fees are only supported for PaymentType.STAKE !
*/
*/
function getFeeForPrice(
bytes32 parentHash,
uint256 price
Expand Down
14 changes: 0 additions & 14 deletions hardhat.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -150,20 +150,6 @@ const config : HardhatUserConfig = {
"oz-proxies/",
],
},
// meowtestnet: {
// url: `${process.env.MEOWTESTNET_RPC_URL}`,
// chainId: 883424730,
// accounts: [ // Comment out for CI, uncomment this when using Sepolia
// `${process.env.DEPLOYER_PRIVATE_KEY}`,
// `${process.env.ZERO_VAULT_PRIVATE_KEY}`,
// `${process.env.TESTNET_PRIVATE_KEY_A}`,
// `${process.env.TESTNET_PRIVATE_KEY_B}`,
// `${process.env.TESTNET_PRIVATE_KEY_C}`,
// `${process.env.TESTNET_PRIVATE_KEY_D}`,
// `${process.env.TESTNET_PRIVATE_KEY_E}`,
// `${process.env.TESTNET_PRIVATE_KEY_F}`,
// ],
// },
};

export default config;
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -75,10 +75,10 @@
"typescript": "^5.0.2"
},
"dependencies": {
"@zero-tech/zdc": "0.1.6",
"@zero-tech/zdc": "0.1.3",
"axios": "^1.4.0",
"dotenv": "16.0.3",
"mongodb": "^6.1.0",
"winston": "^3.11.0"
}
}
}
7 changes: 4 additions & 3 deletions src/deploy/missions/contracts/access-controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,14 @@ import {
import { znsNames } from "./names";
import { HardhatRuntimeEnvironment } from "hardhat/types";
import { SignerWithAddress } from "@nomicfoundation/hardhat-ethers/signers";
import { IZNSCampaignConfig, IZNSContracts } from "../../campaign/types";
import { DefenderRelayProvider } from "@openzeppelin/defender-sdk-relay-signer-client/lib/ethers";
import { IZNSContracts } from "../../campaign/types";


export class ZNSAccessControllerDM extends BaseDeployMission<
HardhatRuntimeEnvironment,
SignerWithAddress,
IZNSCampaignConfig<SignerWithAddress>,
DefenderRelayProvider,
IZNSContracts
> {
proxyData = {
Expand All @@ -26,6 +27,6 @@ IZNSContracts
adminAddresses,
} = this.config;

return [governorAddresses, adminAddresses];
return [ governorAddresses, adminAddresses ];
}
}
5 changes: 3 additions & 2 deletions src/deploy/missions/contracts/address-resolver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,15 @@ import {
import { ProxyKinds, ResolverTypes } from "../../constants";
import { znsNames } from "./names";
import { HardhatRuntimeEnvironment } from "hardhat/types";
import { IZNSCampaignConfig, IZNSContracts } from "../../campaign/types";
import { DefenderRelayProvider } from "@openzeppelin/defender-sdk-relay-signer-client/lib/ethers";
import { IZNSContracts } from "../../campaign/types";
import { SignerWithAddress } from "@nomicfoundation/hardhat-ethers/signers";


export class ZNSAddressResolverDM extends BaseDeployMission<
HardhatRuntimeEnvironment,
SignerWithAddress,
IZNSCampaignConfig<SignerWithAddress>,
DefenderRelayProvider,
IZNSContracts
> {
proxyData = {
Expand Down
5 changes: 3 additions & 2 deletions src/deploy/missions/contracts/curve-pricer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,14 @@ import { ProxyKinds } from "../../constants";
import { znsNames } from "./names";
import { HardhatRuntimeEnvironment } from "hardhat/types";
import { SignerWithAddress } from "@nomicfoundation/hardhat-ethers/signers";
import { IZNSCampaignConfig, IZNSContracts } from "../../campaign/types";
import { DefenderRelayProvider } from "@openzeppelin/defender-sdk-relay-signer-client/lib/ethers";
import { IZNSContracts } from "../../campaign/types";


export class ZNSCurvePricerDM extends BaseDeployMission<
HardhatRuntimeEnvironment,
SignerWithAddress,
IZNSCampaignConfig<SignerWithAddress>,
DefenderRelayProvider,
IZNSContracts
> {
proxyData = {
Expand Down
5 changes: 3 additions & 2 deletions src/deploy/missions/contracts/domain-token.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,14 @@ import { ProxyKinds } from "../../constants";
import { znsNames } from "./names";
import { HardhatRuntimeEnvironment } from "hardhat/types";
import { SignerWithAddress } from "@nomicfoundation/hardhat-ethers/signers";
import { DefenderRelayProvider } from "@openzeppelin/defender-sdk-relay-signer-client/lib/ethers";
import { IZNSCampaignConfig, IZNSContracts } from "../../campaign/types";


export class ZNSDomainTokenDM extends BaseDeployMission<
HardhatRuntimeEnvironment,
SignerWithAddress,
IZNSCampaignConfig<SignerWithAddress>,
DefenderRelayProvider,
IZNSContracts
> {
proxyData = {
Expand All @@ -32,7 +33,7 @@ IZNSContracts
defaultRoyaltyReceiver,
defaultRoyaltyFraction,
},
} = this.config ;
} = this.config as IZNSCampaignConfig<SignerWithAddress>;

return [ await accessController.getAddress(), name, symbol, defaultRoyaltyReceiver, defaultRoyaltyFraction ];
}
Expand Down
5 changes: 3 additions & 2 deletions src/deploy/missions/contracts/fixed-pricer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,14 @@ import {
import { znsNames } from "./names";
import { HardhatRuntimeEnvironment } from "hardhat/types";
import { SignerWithAddress } from "@nomicfoundation/hardhat-ethers/signers";
import { IZNSCampaignConfig, IZNSContracts } from "../../campaign/types";
import { DefenderRelayProvider } from "@openzeppelin/defender-sdk-relay-signer-client/lib/ethers";
import { IZNSContracts } from "../../campaign/types";


export class ZNSFixedPricerDM extends BaseDeployMission<
HardhatRuntimeEnvironment,
SignerWithAddress,
IZNSCampaignConfig<SignerWithAddress>,
DefenderRelayProvider,
IZNSContracts
> {
proxyData = {
Expand Down
11 changes: 6 additions & 5 deletions src/deploy/missions/contracts/meow-token/meow-token.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ 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 { DefenderRelayProvider } from "@openzeppelin/defender-sdk-relay-signer-client/lib/ethers";
import { 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";

Expand All @@ -20,7 +21,7 @@ export const meowTokenSymbol = "MEOW";
export class MeowTokenDM extends BaseDeployMission<
HardhatRuntimeEnvironment,
SignerWithAddress,
IZNSCampaignConfig<SignerWithAddress>,
DefenderRelayProvider,
IZNSContracts
> {
proxyData = {
Expand All @@ -34,7 +35,7 @@ IZNSContracts
constructor (args : IDeployMissionArgs<
HardhatRuntimeEnvironment,
SignerWithAddress,
IZNSCampaignConfig<SignerWithAddress>,
DefenderRelayProvider,
IZNSContracts
>) {
super(args);
Expand Down Expand Up @@ -67,7 +68,7 @@ IZNSContracts
this.logger.debug(`Writing ${this.contractName} to DB...`);

const factory = new MeowToken__factory(this.config.deployAdmin);
const baseContract = factory.attach(this.config.stakingTokenAddress);
const baseContract = factory.attach(this.config.stakingTokenAddress as string);
// TODO remove!
// const baseContract = await this.campaign.deployer.getContractObject(
// this.contractName,
Expand Down Expand Up @@ -98,7 +99,7 @@ IZNSContracts

this.logger.debug(`${this.contractName} ${msg} post deploy sequence`);

return this.config.mockMeowToken ;
return this.config.mockMeowToken as boolean;
}

async postDeploy () {
Expand Down
5 changes: 3 additions & 2 deletions src/deploy/missions/contracts/registry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,14 @@ import { ProxyKinds } from "../../constants";
import { znsNames } from "./names";
import { HardhatRuntimeEnvironment } from "hardhat/types";
import { SignerWithAddress } from "@nomicfoundation/hardhat-ethers/signers";
import { IZNSCampaignConfig, IZNSContracts } from "../../campaign/types";
import { DefenderRelayProvider } from "@openzeppelin/defender-sdk-relay-signer-client/lib/ethers";
import { IZNSContracts } from "../../campaign/types";


export class ZNSRegistryDM extends BaseDeployMission<
HardhatRuntimeEnvironment,
SignerWithAddress,
IZNSCampaignConfig<SignerWithAddress>,
DefenderRelayProvider,
IZNSContracts
> {
proxyData = {
Expand Down
5 changes: 3 additions & 2 deletions src/deploy/missions/contracts/root-registrar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,14 @@ import { ProxyKinds, REGISTRAR_ROLE } from "../../constants";
import { znsNames } from "./names";
import { HardhatRuntimeEnvironment } from "hardhat/types";
import { SignerWithAddress } from "@nomicfoundation/hardhat-ethers/signers";
import { IZNSCampaignConfig, IZNSContracts } from "../../campaign/types";
import { DefenderRelayProvider } from "@openzeppelin/defender-sdk-relay-signer-client/lib/ethers";
import { IZNSContracts } from "../../campaign/types";


export class ZNSRootRegistrarDM extends BaseDeployMission<
HardhatRuntimeEnvironment,
SignerWithAddress,
IZNSCampaignConfig<SignerWithAddress>,
DefenderRelayProvider,
IZNSContracts
> {
proxyData = {
Expand Down
5 changes: 3 additions & 2 deletions src/deploy/missions/contracts/sub-registrar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,14 @@ import { ProxyKinds, REGISTRAR_ROLE } from "../../constants";
import { znsNames } from "./names";
import { HardhatRuntimeEnvironment } from "hardhat/types";
import { SignerWithAddress } from "@nomicfoundation/hardhat-ethers/signers";
import { IZNSCampaignConfig, IZNSContracts } from "../../campaign/types";
import { DefenderRelayProvider } from "@openzeppelin/defender-sdk-relay-signer-client/lib/ethers";
import { IZNSContracts } from "../../campaign/types";


export class ZNSSubRegistrarDM extends BaseDeployMission<
HardhatRuntimeEnvironment,
SignerWithAddress,
IZNSCampaignConfig<SignerWithAddress>,
DefenderRelayProvider,
IZNSContracts
> {
proxyData = {
Expand Down
5 changes: 3 additions & 2 deletions src/deploy/missions/contracts/treasury.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,14 @@ import { ProxyKinds } from "../../constants";
import { znsNames } from "./names";
import { HardhatRuntimeEnvironment } from "hardhat/types";
import { SignerWithAddress } from "@nomicfoundation/hardhat-ethers/signers";
import { IZNSCampaignConfig, IZNSContracts } from "../../campaign/types";
import { DefenderRelayProvider } from "@openzeppelin/defender-sdk-relay-signer-client/lib/ethers";
import { IZNSContracts } from "../../campaign/types";


export class ZNSTreasuryDM extends BaseDeployMission<
HardhatRuntimeEnvironment,
SignerWithAddress,
IZNSCampaignConfig<SignerWithAddress>,
DefenderRelayProvider,
IZNSContracts
> {
proxyData = {
Expand Down
Loading

0 comments on commit 2a958a1

Please sign in to comment.