Skip to content

Commit

Permalink
feat: zDC Integration (#98)
Browse files Browse the repository at this point in the history
  • Loading branch information
Whytecrowe authored Jan 29, 2024
2 parents 53df710 + 14d3e1c commit d5eb5a1
Show file tree
Hide file tree
Showing 56 changed files with 580 additions and 1,308 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ coverage.json
typechain
typechain-types
.idea
dist

# Hardhat files
cache
Expand Down
2 changes: 1 addition & 1 deletion hardhat.config.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
/* eslint-disable @typescript-eslint/no-var-requires, @typescript-eslint/no-unused-vars */
require("dotenv").config();

import { mochaGlobalSetup, mochaGlobalTeardown } from "./test/mocha-global";

require("dotenv").config();

import * as tenderly from "@tenderly/hardhat-tenderly";
import "@nomicfoundation/hardhat-toolbox";
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@
"typescript": "^5.0.2"
},
"dependencies": {
"@zero-tech/zdc": "0.1.3",
"axios": "^1.4.0",
"dotenv": "16.0.3",
"mongodb": "^6.1.0",
Expand Down
153 changes: 0 additions & 153 deletions src/deploy/campaign/deploy-campaign.ts

This file was deleted.

10 changes: 5 additions & 5 deletions src/deploy/campaign/environments.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { HardhatEthersSigner, SignerWithAddress } from "@nomicfoundation/hardhat-ethers/signers";

import { IDeployCampaignConfig } from "./types";
import { IZNSCampaignConfig } from "./types";
import {
DEFAULT_PROTOCOL_FEE_PERCENT,
DEFAULT_ROYALTY_FRACTION,
Expand Down Expand Up @@ -62,18 +62,18 @@ export const getConfig = async ({
zeroVaultAddress,
env, // this is ONLY used for tests!
} : {
deployer : SignerWithAddress | DefenderRelaySigner;
deployer : SignerWithAddress;
governors ?: Array<string>;
admins ?: Array<string>;
zeroVaultAddress ?: string;
env ?: string;
}) : Promise<IDeployCampaignConfig> => {
}) : Promise<IZNSCampaignConfig<SignerWithAddress>> => {
// Will throw an error based on any invalid setup, given the `ENV_LEVEL` set
const priceConfig = validateEnv(env);

let deployerAddress;
if (deployer && Object.keys(deployer).includes("address")) {
deployerAddress = (deployer as HardhatEthersSigner).address;
deployerAddress = deployer.address;
} else {
deployerAddress = await deployer.getAddress();
}
Expand All @@ -99,7 +99,7 @@ export const getConfig = async ({
// Get admin addresses set through env, if any
const adminAddresses = getCustomAddresses("ADMIN_ADDRESSES", deployerAddress, admins);

const config : IDeployCampaignConfig = {
const config : IZNSCampaignConfig<SignerWithAddress> = {
env: process.env.ENV_LEVEL!,
deployAdmin: deployer,
governorAddresses,
Expand Down
78 changes: 43 additions & 35 deletions src/deploy/campaign/types.ts
Original file line number Diff line number Diff line change
@@ -1,18 +1,26 @@
import { BaseDeployMission } from "../missions/base-deploy-mission";
import { BaseContract } from "ethers";
import { ICurvePriceConfig, TDeployMissionCtor } from "../missions/types";
import { HardhatDeployer } from "../deployer/hardhat-deployer";
import { HardhatEthersSigner } from "@nomicfoundation/hardhat-ethers/signers";
import { IZNSContracts } from "../../../test/helpers/types";
import { Logger as WinstonLogger } from "winston";
import { MongoDBAdapter } from "../db/mongo-adapter/mongo-adapter";
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 { IContractState, IDeployCampaignConfig } from "@zero-tech/zdc";
import {
MeowTokenMock,
ZNSAccessController,
ZNSAddressResolver,
ZNSCurvePricer,
ZNSDomainToken,
ZNSFixedPricer,
ZNSRegistry,
ZNSRootRegistrar,
ZNSSubRegistrar,
ZNSTreasury,
MeowToken,
} from "../../../typechain";

export type ContractV6 = BaseContract & Omit<BaseContract, keyof BaseContract>;
export type IZNSSigner = HardhatEthersSigner | DefenderRelaySigner | SignerWithAddress;

export interface IDeployCampaignConfig {
export interface IZNSCampaignConfig <Signer> extends IDeployCampaignConfig<Signer> {
env : string;
deployAdmin : HardhatEthersSigner | DefenderRelaySigner;
deployAdmin : Signer;
governorAddresses : Array<string>;
adminAddresses : Array<string>;
domainToken : {
Expand All @@ -32,28 +40,28 @@ export interface IDeployCampaignConfig {
};
}

export type TLogger = WinstonLogger | Console;
export type ZNSContract =
ZNSAccessController |
ZNSRegistry |
ZNSDomainToken |
MeowTokenMock |
MeowToken |
ZNSAddressResolver |
ZNSCurvePricer |
ZNSTreasury |
ZNSRootRegistrar |
ZNSFixedPricer |
ZNSSubRegistrar;

export interface IContractState {
[key : string] : ContractV6;
}

export interface IMissionInstances {
[key : string] : BaseDeployMission;
}

export interface ICampaignState {
missions : Array<TDeployMissionCtor>;
instances : IMissionInstances;
contracts : TZNSContractState;
}

export interface ICampaignArgs {
missions : Array<TDeployMissionCtor>;
deployer : HardhatDeployer;
dbAdapter : MongoDBAdapter;
logger : TLogger;
config : IDeployCampaignConfig;
}

export type TZNSContractState = IContractState & IZNSContracts;
export interface IZNSContracts extends IContractState<ZNSContract> {
accessController : ZNSAccessController;
registry : ZNSRegistry;
domainToken : ZNSDomainToken;
meowToken : MeowTokenMock;
addressResolver : ZNSAddressResolver;
curvePricer : ZNSCurvePricer;
treasury : ZNSTreasury;
rootRegistrar : ZNSRootRegistrar;
fixedPricer : ZNSFixedPricer;
subRegistrar : ZNSSubRegistrar;
}
3 changes: 2 additions & 1 deletion src/deploy/constants.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { IProxyKinds } from "@zero-tech/zdc";
import { ethers } from "ethers";
import { IProxyKinds } from "./missions/types";


export const ProxyKinds : IProxyKinds = {
uups: "uups",
Expand Down
14 changes: 0 additions & 14 deletions src/deploy/db/mongo-adapter/constants.ts

This file was deleted.

Loading

0 comments on commit d5eb5a1

Please sign in to comment.