@gooddollar/goodprotocol 1.0.29-beta.2 → 1.0.29-beta.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gooddollar/goodprotocol",
3
- "version": "1.0.29-beta.2",
3
+ "version": "1.0.29-beta.3",
4
4
  "description": "GoodDollar Protocol",
5
5
  "scripts": {
6
6
  "prepack": "npm run minimize",
@@ -6,13 +6,11 @@ import { network, ethers, upgrades } from "hardhat";
6
6
  import { Contract } from "ethers";
7
7
  import { range } from "lodash";
8
8
  import DAOCreatorABI from "@gooddollar/goodcontracts/build/contracts/DaoCreatorGoodDollar.json";
9
- import IdentityABI from "@gooddollar/goodcontracts/build/contracts/Identity.json";
10
9
  import FeeFormulaABI from "@gooddollar/goodcontracts/build/contracts/FeeFormula.json";
11
10
  import AddFoundersABI from "@gooddollar/goodcontracts/build/contracts/AddFoundersGoodDollar.json";
12
11
  import ContributionCalculation from "@gooddollar/goodcontracts/stakingModel/build/contracts/ContributionCalculation.json";
13
12
  import FirstClaimPool from "@gooddollar/goodcontracts/stakingModel/build/contracts/FirstClaimPool.json";
14
13
  import BridgeMock from "@gooddollar/goodcontracts/stakingModel/build/contracts/BridgeMock.json";
15
- import AdminWalletABI from "@gooddollar/goodcontracts/build/contracts/AdminWallet.json";
16
14
  import OTPABI from "@gooddollar/goodcontracts/build/contracts/OneTimePayments.json";
17
15
  import HomeBridgeABI from "@gooddollar/goodcontracts/build/contracts/DeployHomeBridge.json";
18
16
  import ForeignBridgeABI from "@gooddollar/goodcontracts/build/contracts/DeployForeignBridge.json";
@@ -65,11 +63,14 @@ export const createDAO = async () => {
65
63
  root
66
64
  );
67
65
 
68
- const IdentityFactory = new ethers.ContractFactory(
69
- IdentityABI.abi,
70
- IdentityABI.bytecode,
71
- root
72
- );
66
+ // const IdentityFactory = new ethers.ContractFactory(
67
+ // IdentityABI.abi,
68
+ // IdentityABI.bytecode,
69
+ // root
70
+ // );
71
+
72
+ const IdentityFactory = await ethers.getContractFactory("IdentityV2");
73
+
73
74
  const FeeFormulaFactory = new ethers.ContractFactory(
74
75
  FeeFormulaABI.abi,
75
76
  FeeFormulaABI.bytecode,
@@ -95,9 +96,15 @@ export const createDAO = async () => {
95
96
  // "0x6F1BAbfF5E119d61F0c6d8653d84E8B284B87091"
96
97
  // );
97
98
 
98
- const Identity = (await IdentityFactory.deploy().then(
99
- printDeploy
100
- )) as Contract;
99
+ // const Identity = (await IdentityFactory.deploy().then(
100
+ // printDeploy
101
+ // )) as Contract;
102
+
103
+ const Identity = await upgrades.deployProxy(
104
+ IdentityFactory,
105
+ [root.address, ethers.constants.AddressZero],
106
+ { kind: "uups" }
107
+ );
101
108
  // const Identity = await ethers.getContractAt(
102
109
  // IdentityABI.abi,
103
110
  // release.Identity
@@ -111,8 +118,8 @@ export const createDAO = async () => {
111
118
  printDeploy
112
119
  )) as Contract;
113
120
 
114
- await Identity.setAuthenticationPeriod(365).then(printDeploy);
115
- console.log("setAuthPeriod");
121
+ // await Identity.setAuthenticationPeriod(365).then(printDeploy);
122
+ // console.log("setAuthPeriod");
116
123
  await daoCreator
117
124
  .forgeOrg(
118
125
  "GoodDollar",
@@ -144,7 +151,7 @@ export const createDAO = async () => {
144
151
  // root
145
152
  // );
146
153
 
147
- await Identity.setAvatar(Avatar.address).then(printDeploy);
154
+ // await Identity.setAvatar(Avatar.address).then(printDeploy);
148
155
 
149
156
  console.log("Done deploying DAO, setting schemes permissions");
150
157
 
@@ -201,9 +208,7 @@ export const createDAO = async () => {
201
208
  gd
202
209
  );
203
210
  schemes.push(sidechain.OneTimePayments.address);
204
- const adminWallet = await deployAdminWallet(Identity.address);
205
211
  Object.entries(sidechain).forEach(([k, v]) => (release[k] = v.address));
206
- release["AdminWallet"] = adminWallet.address;
207
212
  }
208
213
 
209
214
  await releaser(release, network.name);
@@ -242,7 +247,17 @@ export const createDAO = async () => {
242
247
  UpgradeScheme: ethers.constants.AddressZero
243
248
  };
244
249
 
250
+ console.log("deploying v2...");
245
251
  const v2 = await deployV2(network.name, false, olddao);
252
+ console.log("deploying adminWallet...");
253
+ const adminWallet = await deployAdminWallet(Identity.address, v2.NameService);
254
+ console.log("setting up identity:", {
255
+ ns: v2.NameService,
256
+ identity: Identity.address
257
+ });
258
+ await Identity.initDAO(v2.NameService);
259
+ release["AdminWallet"] = adminWallet.address;
260
+
246
261
  release = { ...v2, ...release };
247
262
  await releaser(release, network.name);
248
263
  // await pressAnyKey();
@@ -329,6 +344,7 @@ const deployBridge = async (Avatar, gd, setSchemes, isMainnet) => {
329
344
  };
330
345
 
331
346
  const deployMainnet = async (Avatar, Identity) => {
347
+ console.log("deploying mainnet...");
332
348
  const [root] = await ethers.getSigners();
333
349
 
334
350
  const cdaiFactory = await ethers.getContractFactory("cDAIMock");
@@ -415,6 +431,7 @@ export const deploySidechain = async (
415
431
  identity,
416
432
  gd
417
433
  ) => {
434
+ console.log("deploying sidechain...");
418
435
  const root = (await ethers.getSigners())[0];
419
436
  const fcFactory = new ethers.ContractFactory(
420
437
  FirstClaimPool.abi,
@@ -502,7 +519,7 @@ export const deploySidechain = async (
502
519
  };
503
520
  };
504
521
 
505
- const deployAdminWallet = async identity => {
522
+ const deployAdminWallet = async (identity, ns) => {
506
523
  const root = (await ethers.getSigners())[0];
507
524
  const hdNode = ethers.utils.HDNode.fromMnemonic(process.env.ADMIN_MNEMONIC);
508
525
  const admins = range(0, 50).map(i =>
@@ -512,8 +529,9 @@ const deployAdminWallet = async identity => {
512
529
  const adminWallet = (await upgrades
513
530
  .deployProxy(await ethers.getContractFactory("AdminWallet"), [
514
531
  admins.slice(0, 20).map(_ => _.address),
532
+ ns,
515
533
  root.address,
516
- identity
534
+ 1e9
517
535
  ])
518
536
  .then(printDeploy)) as Contract;
519
537
 
@@ -530,8 +548,10 @@ const deployAdminWallet = async identity => {
530
548
  // )
531
549
  // .then(printDeploy)) as Contract;
532
550
 
533
- const id = await ethers.getContractAt("IIdentity", identity);
534
- await id.addIdentityAdmin(adminWallet.address).then(printDeploy);
551
+ const id = await ethers.getContractAt("IdentityV2", identity);
552
+ await id
553
+ .grantRole(await id.IDENTITY_ADMIN_ROLE(), adminWallet.address)
554
+ .then(printDeploy);
535
555
  await root
536
556
  .sendTransaction({
537
557
  to: adminWallet.address,