Skip to content

Commit

Permalink
Merge branch 'feat/config' of github.com:NeokingdomDAO/whitelabel int…
Browse files Browse the repository at this point in the history
…o feat/config
  • Loading branch information
sirnicolaz committed Dec 5, 2023
2 parents 821b33d + ebd56cd commit 1676a78
Show file tree
Hide file tree
Showing 22 changed files with 143 additions and 324 deletions.
12 changes: 12 additions & 0 deletions contracts/extensions/IProxyAdmin.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (proxy/transparent/ProxyAdmin.sol)

pragma solidity ^0.8.16;

interface IProxyAdmin {
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Can only be called by the current owner.
*/
function transferOwnership(address newOwner) external;
}
95 changes: 0 additions & 95 deletions contracts/extensions/ProxyAdmin.sol

This file was deleted.

1 change: 0 additions & 1 deletion deployments/9000.DAORoles.arguments.json

This file was deleted.

1 change: 0 additions & 1 deletion deployments/9000.DIAOracleV2.arguments.json

This file was deleted.

1 change: 0 additions & 1 deletion deployments/9000.GovernanceToken.arguments.json

This file was deleted.

1 change: 0 additions & 1 deletion deployments/9000.InternalMarket.arguments.json

This file was deleted.

1 change: 0 additions & 1 deletion deployments/9000.NeokingdomToken.arguments.json

This file was deleted.

1 change: 0 additions & 1 deletion deployments/9000.RedemptionController.arguments.json

This file was deleted.

1 change: 0 additions & 1 deletion deployments/9000.ResolutionManager.arguments.json

This file was deleted.

1 change: 0 additions & 1 deletion deployments/9000.ShareholderRegistry.arguments.json

This file was deleted.

1 change: 0 additions & 1 deletion deployments/9000.USDC.arguments.json

This file was deleted.

1 change: 0 additions & 1 deletion deployments/9000.Voting.arguments.json

This file was deleted.

1 change: 0 additions & 1 deletion deployments/9000.deploy.nextstep

This file was deleted.

52 changes: 0 additions & 52 deletions deployments/9000.network.json

This file was deleted.

1 change: 0 additions & 1 deletion deployments/9000.setup-test-sequence.nextstep

This file was deleted.

11 changes: 10 additions & 1 deletion lib/internal/core.ts
Original file line number Diff line number Diff line change
Expand Up @@ -132,9 +132,18 @@ export abstract class NeokingdomDAO {
for (let i = nextStep; i < s.length; i++) {
const context = await c(this);
const step = s[i];

if (this.config.verbose) {
console.log(`${i + 1}/${s.length}: ${step.toString()}`);
console.log(
`${i + 1}/${s.length}: ${step ? step.toString() : "step is empty"}`
);
}

// If a step is null, it's skipped
if (step === null) {
continue;
}

let tx: TransactionResponse | null = null;
try {
tx = await step(context);
Expand Down
39 changes: 9 additions & 30 deletions lib/internal/types.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
import { TransactionResponse } from "@ethersproject/providers";
import { SignerWithAddress } from "@nomiclabs/hardhat-ethers/signers";
import { Wallet } from "ethers";
import { HardhatRuntimeEnvironment } from "hardhat/types";

import {
DAORoles,
Expand Down Expand Up @@ -46,7 +43,9 @@ export type Contributor = {
name?: string;
address: string;
status: "contributor" | "board" | "investor";
tokens: string;
shareBalance: string;
balance?: string;
vestingBalance?: string;
};

export type Address = `0x${string}`;
Expand All @@ -63,6 +62,7 @@ export type DAOConfig = {
reserveAddress: Address;
usdcAddress: Address;
diaOracleAddress: Address;
shareCapital: string;
contributors: Contributor[];
};

Expand All @@ -87,19 +87,21 @@ export type Context = {};

export type ContractContext = Context & NeokingdomContracts;

export type Step<T extends Context> = (c: T) => Promise<TransactionResponse>;
export type Step<T extends Context> = (
c: T
) => Promise<TransactionResponse> | null;

export type StepWithExpandable<T extends Context> =
| ExpandableStep<T>
| ((c: T) => Promise<TransactionResponse>);
| ((c: T) => Promise<TransactionResponse> | null);

export type ExpandableStep<T extends Context> = {
expandableFunction: (c: T) => ProcessedSequence<T>;
};

export type Sequence<T extends Context> = StepWithExpandable<T>[];

export type ProcessedSequence<T extends Context> = Step<T>[];
export type ProcessedSequence<T extends Context> = (Step<T> | null)[];

// FIXME: There Must Be A Better Way™ to do this in TypeScript
export const CONTRACT_NAMES = [
Expand All @@ -126,26 +128,3 @@ export function isNeokingdomContracts(
}
return true;
}

export type SetupContext = ContractContext & {
deployer: Wallet | SignerWithAddress;
contributors: Contributor[];
hre: HardhatRuntimeEnvironment;
};

export function generateSetupContext(
contributors: Contributor[],
hre: HardhatRuntimeEnvironment
) {
async function _generateSetupContext(n: NeokingdomDAO) {
const contracts = (await n.loadContractsPartial()) as NeokingdomContracts;
const context: SetupContext = {
...contracts,
contributors: contributors,
deployer: n.config.deployer,
hre: hre,
};
return context;
}
return _generateSetupContext;
}
18 changes: 3 additions & 15 deletions lib/sequence/deploy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,29 +4,17 @@ import { Wallet } from "ethers";

import { NeokingdomDAO } from "../internal/core";
import type {
ContextGenerator,
ContractContext,
ContractNames,
DAOConfig,
NeokingdomContracts,
Sequence,
} from "../internal/types";
import { ROLES } from "../utils";

export type DeployConfig = {
tokenName: string;
tokenSymbol: string;
governanceTokenName: string;
governanceTokenSymbol: string;
shareTokenName: string;
shareTokenSymbol: string;
reserveAddress: string;
usdcAddress: string;
diaOracleAddress: string;
};

export type DeployContext = ContractContext & {
deployer: Wallet | SignerWithAddress;
config: DeployConfig;
config: DAOConfig;
deploy: (
contractName: ContractNames,
args?: any[]
Expand All @@ -37,7 +25,7 @@ export type DeployContext = ContractContext & {
) => Promise<TransactionResponse>;
};

export function generateDeployContext(config: DeployConfig) {
export function generateDeployContext(config: DAOConfig) {
async function _generateDeployContext(neokingdomDAO: NeokingdomDAO) {
const contracts =
(await neokingdomDAO.loadContractsPartial()) as NeokingdomContracts;
Expand Down
Loading

0 comments on commit 1676a78

Please sign in to comment.