Skip to content

Commit

Permalink
Add share capital
Browse files Browse the repository at this point in the history
  • Loading branch information
vrde committed Dec 5, 2023
1 parent 29d54af commit ebd56cd
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 6 deletions.
7 changes: 3 additions & 4 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 @@ -45,7 +42,8 @@ export type ContractNames = keyof typeof FACTORIES;
export type Contributor = {
name?: string;
address: string;
status?: "contributor" | "board" | "investor";
status: "contributor" | "board" | "investor";
shareBalance: string;
balance?: string;
vestingBalance?: string;
};
Expand All @@ -64,6 +62,7 @@ export type DAOConfig = {
reserveAddress: Address;
usdcAddress: Address;
diaOracleAddress: Address;
shareCapital: string;
contributors: Contributor[];
};

Expand Down
13 changes: 11 additions & 2 deletions lib/sequence/setup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,20 @@ export function generateSetupContext(config: DAOConfig) {
}

export const SETUP_SEQUENCE: Sequence<SetupContext> = [
// Give each address one share
(c) =>
c.shareholderRegistry.mint(
c.shareholderRegistry.address,
c.config.shareCapital
),

expandable((preprocessContext: SetupContext) =>
preprocessContext.config.contributors.map(
(contributor) => (c) =>
c.shareholderRegistry.mint(contributor.address, parseEther("1"))
c.shareholderRegistry.transferFrom(
c.shareholderRegistry.address,
contributor.address,
contributor.shareBalance
)
)
),

Expand Down
2 changes: 2 additions & 0 deletions test/utils/setup.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { SignerWithAddress } from "@nomiclabs/hardhat-ethers/signers";
import { Wallet } from "ethers";
import { parseEther } from "ethers/lib/utils";

import { DEPLOY_SEQUENCE, generateDeployContext } from "../../lib";
import { NeokingdomDAOMemory } from "../../lib/environment/memory";
Expand All @@ -13,6 +14,7 @@ const config: DAOConfig = {
tokenSymbol: "TD",
governanceTokenName: "Test DAO Governance",
governanceTokenSymbol: "TDGOV",
shareCapital: parseEther("10000").toString(),
shareTokenName: "Test DAO Share",
shareTokenSymbol: "TDSHARE",
reserveAddress: "0x0000000000000000000000000000000000000001",
Expand Down

0 comments on commit ebd56cd

Please sign in to comment.