@daohost/host 0.10.2 → 0.10.4

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/out/host.js CHANGED
@@ -3,7 +3,7 @@
3
3
  Host prototype.
4
4
  */
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.DAOAction = exports.Host = exports.daoContractIndices = exports.ContractIndices = exports.FundingType = exports.LifecyclePhase = exports.STATIC_BASE_URL = exports.DAO_FEATURES = exports.HOST_DESCRIPTION = void 0;
6
+ exports.DAOAction = exports.Host = exports.daoContractIndices = void 0;
7
7
  exports.getUnit = getUnit;
8
8
  exports.getDAOUnit = getDAOUnit;
9
9
  exports.getDAOUnitEmitData = getDAOUnitEmitData;
@@ -12,154 +12,79 @@ exports.getBridgeTokens = getBridgeTokens;
12
12
  const chains_1 = require("./chains");
13
13
  const assets_1 = require("./assets");
14
14
  const validation_1 = require("./validation");
15
- exports.HOST_DESCRIPTION = "Home for DAOs";
16
- exports.DAO_FEATURES = [
17
- "True DAO: only holders owns, manage and earn whole value",
18
- "Inter-chain setup with bridging",
19
- "Decentralized fundraising",
20
- "Self-developing via Builder activity",
21
- "Tokenomics constructor",
22
- "Proper token launch flow to get cg/cmc and wallets listings",
23
- "Deterministic managed contract addresses",
24
- ];
25
- exports.STATIC_BASE_URL = "https://raw.githubusercontent.com/stabilitydao/.github/main";
26
- /**
27
- Lifecycle phase represents DAO tokenomics stage.
28
- */
29
- var LifecyclePhase;
30
- (function (LifecyclePhase) {
31
- /** Created */
32
- LifecyclePhase["DRAFT"] = "DRAFT";
33
- /**
34
- * DAO ready to attract initial community
35
- */
36
- LifecyclePhase["INCEPTION"] = "INCEPTION";
37
- /**
38
- Initial funding. DAO project passed requirements.
39
- Since SEED started a DAO become real DAO:
40
- - noncustodial
41
- - tokenized share holdings
42
- - collective management via voting
43
- */
44
- LifecyclePhase["SEED"] = "SEED";
45
- /** Seed was not success. Raised funds sent back to seeders. */
46
- LifecyclePhase["SEED_FAILED"] = "SEED_FAILED";
47
- /** Using SEED funds to launch MVP / Unit generating */
48
- LifecyclePhase["DEVELOPMENT"] = "DEVELOPMENT";
49
- /** TGE is funding event for token liquidity and DAO developments (optionally) */
50
- LifecyclePhase["TGE"] = "TGE";
51
- /** Delay before any vesting allocation started */
52
- LifecyclePhase["LIVE_CLIFF"] = "LIVE_CLIFF";
53
- /** Vesting period active */
54
- LifecyclePhase["LIVE_VESTING"] = "LIVE_VESTING";
55
- /** Vesting ended - token fully distributed */
56
- LifecyclePhase["LIVE"] = "LIVE";
57
- })(LifecyclePhase || (exports.LifecyclePhase = LifecyclePhase = {}));
58
- var FundingType;
59
- (function (FundingType) {
60
- FundingType["SEED"] = "SEED";
61
- FundingType["TGE"] = "TGE";
62
- })(FundingType || (exports.FundingType = FundingType = {}));
63
- /// @notice Indices of all contracts that can be deployed by a DAO. The indices are used to pre-set salts
64
- var ContractIndices;
65
- (function (ContractIndices) {
66
- ContractIndices[ContractIndices["NOT_USED_0"] = 0] = "NOT_USED_0";
67
- ContractIndices[ContractIndices["SEED_TOKEN_1"] = 1] = "SEED_TOKEN_1";
68
- ContractIndices[ContractIndices["TGE_TOKEN_2"] = 2] = "TGE_TOKEN_2";
69
- ContractIndices[ContractIndices["TOKEN_3"] = 3] = "TOKEN_3";
70
- ContractIndices[ContractIndices["X_TOKEN_4"] = 4] = "X_TOKEN_4";
71
- ContractIndices[ContractIndices["DAO_TOKEN_5"] = 5] = "DAO_TOKEN_5";
72
- ContractIndices[ContractIndices["STAKING_6"] = 6] = "STAKING_6";
73
- ContractIndices[ContractIndices["RECOVERY_7"] = 7] = "RECOVERY_7";
74
- ContractIndices[ContractIndices["TOKEN_BRIDGE_8"] = 8] = "TOKEN_BRIDGE_8";
75
- ContractIndices[ContractIndices["X_TOKEN_BRIDGE_9"] = 9] = "X_TOKEN_BRIDGE_9";
76
- ContractIndices[ContractIndices["DAO_TOKEN_BRIDGE_10"] = 10] = "DAO_TOKEN_BRIDGE_10";
77
- ContractIndices[ContractIndices["VESTING_1_11"] = 11] = "VESTING_1_11";
78
- ContractIndices[ContractIndices["VESTING_2_12"] = 12] = "VESTING_2_12";
79
- ContractIndices[ContractIndices["VESTING_3_13"] = 13] = "VESTING_3_13";
80
- ContractIndices[ContractIndices["VESTING_4_14"] = 14] = "VESTING_4_14";
81
- ContractIndices[ContractIndices["VESTING_5_15"] = 15] = "VESTING_5_15";
82
- ContractIndices[ContractIndices["VESTING_6_16"] = 16] = "VESTING_6_16";
83
- ContractIndices[ContractIndices["VESTING_7_17"] = 17] = "VESTING_7_17";
84
- ContractIndices[ContractIndices["VESTING_8_18"] = 18] = "VESTING_8_18";
85
- ContractIndices[ContractIndices["VESTING_9_19"] = 19] = "VESTING_9_19";
86
- ContractIndices[ContractIndices["VESTING_10_20"] = 20] = "VESTING_10_20";
87
- ContractIndices[ContractIndices["REVENUE_ROUTER_21"] = 21] = "REVENUE_ROUTER_21";
88
- // add new indices here if necessary
89
- ContractIndices[ContractIndices["COUNT_CONTRACT_INDICES"] = 22] = "COUNT_CONTRACT_INDICES";
90
- })(ContractIndices || (exports.ContractIndices = ContractIndices = {}));
15
+ const host_types_1 = require("./host.types");
91
16
  exports.daoContractIndices = {
92
- [ContractIndices.SEED_TOKEN_1]: {
17
+ [host_types_1.ContractIndices.SEED_TOKEN_1]: {
93
18
  name: "Seed token",
94
19
  description: "Seed round receipt token",
95
20
  },
96
- [ContractIndices.TGE_TOKEN_2]: {
21
+ [host_types_1.ContractIndices.TGE_TOKEN_2]: {
97
22
  name: "Presale token",
98
23
  description: "TGE pre-sale receipt token",
99
24
  },
100
- [ContractIndices.TOKEN_3]: {
25
+ [host_types_1.ContractIndices.TOKEN_3]: {
101
26
  name: "Token",
102
27
  description: "Main tradable DAO token",
103
28
  },
104
- [ContractIndices.X_TOKEN_4]: {
29
+ [host_types_1.ContractIndices.X_TOKEN_4]: {
105
30
  name: "VE-token",
106
31
  description: "VE-tokenomics entry token",
107
32
  },
108
- [ContractIndices.DAO_TOKEN_5]: {
33
+ [host_types_1.ContractIndices.DAO_TOKEN_5]: {
109
34
  name: "DAO token",
110
35
  description: "Governance token",
111
36
  },
112
- [ContractIndices.STAKING_6]: {
37
+ [host_types_1.ContractIndices.STAKING_6]: {
113
38
  name: "Staking",
114
39
  description: "Staking contract",
115
40
  },
116
- [ContractIndices.RECOVERY_7]: {
41
+ [host_types_1.ContractIndices.RECOVERY_7]: {
117
42
  name: "Recovery",
118
43
  description: "Accident recovery system contract",
119
44
  },
120
- [ContractIndices.TOKEN_BRIDGE_8]: {
45
+ [host_types_1.ContractIndices.TOKEN_BRIDGE_8]: {
121
46
  name: "Token bridge",
122
47
  description: "Bridge for main token",
123
48
  },
124
- [ContractIndices.X_TOKEN_BRIDGE_9]: {
49
+ [host_types_1.ContractIndices.X_TOKEN_BRIDGE_9]: {
125
50
  name: "VE-token bridge",
126
51
  description: "Bridge for VE-token",
127
52
  },
128
- [ContractIndices.DAO_TOKEN_BRIDGE_10]: {
53
+ [host_types_1.ContractIndices.DAO_TOKEN_BRIDGE_10]: {
129
54
  name: "DAO token bridge",
130
55
  description: "Bridge for Governance token",
131
56
  },
132
- [ContractIndices.VESTING_1_11]: {
57
+ [host_types_1.ContractIndices.VESTING_1_11]: {
133
58
  name: "Vesting 1",
134
59
  },
135
- [ContractIndices.VESTING_2_12]: {
60
+ [host_types_1.ContractIndices.VESTING_2_12]: {
136
61
  name: "Vesting 2",
137
62
  },
138
- [ContractIndices.VESTING_3_13]: {
63
+ [host_types_1.ContractIndices.VESTING_3_13]: {
139
64
  name: "Vesting 3",
140
65
  },
141
- [ContractIndices.VESTING_4_14]: {
66
+ [host_types_1.ContractIndices.VESTING_4_14]: {
142
67
  name: "Vesting 4",
143
68
  },
144
- [ContractIndices.VESTING_5_15]: {
69
+ [host_types_1.ContractIndices.VESTING_5_15]: {
145
70
  name: "Vesting 5",
146
71
  },
147
- [ContractIndices.VESTING_6_16]: {
72
+ [host_types_1.ContractIndices.VESTING_6_16]: {
148
73
  name: "Vesting 6",
149
74
  },
150
- [ContractIndices.VESTING_7_17]: {
75
+ [host_types_1.ContractIndices.VESTING_7_17]: {
151
76
  name: "Vesting 7",
152
77
  },
153
- [ContractIndices.VESTING_8_18]: {
78
+ [host_types_1.ContractIndices.VESTING_8_18]: {
154
79
  name: "Vesting 8",
155
80
  },
156
- [ContractIndices.VESTING_9_19]: {
81
+ [host_types_1.ContractIndices.VESTING_9_19]: {
157
82
  name: "Vesting 9",
158
83
  },
159
- [ContractIndices.VESTING_10_20]: {
84
+ [host_types_1.ContractIndices.VESTING_10_20]: {
160
85
  name: "Vesting 10",
161
86
  },
162
- [ContractIndices.REVENUE_ROUTER_21]: {
87
+ [host_types_1.ContractIndices.REVENUE_ROUTER_21]: {
163
88
  name: "Revenue Router",
164
89
  description: "Revenue collector and utilizer contract",
165
90
  },
@@ -224,9 +149,9 @@ class Host {
224
149
  }
225
150
  static isLiveDAO(phase) {
226
151
  return [
227
- LifecyclePhase.LIVE_CLIFF,
228
- LifecyclePhase.LIVE_VESTING,
229
- LifecyclePhase.LIVE,
152
+ host_types_1.LifecyclePhase.LIVE_CLIFF,
153
+ host_types_1.LifecyclePhase.LIVE_VESTING,
154
+ host_types_1.LifecyclePhase.LIVE,
230
155
  ].includes(phase);
231
156
  }
232
157
  /**
@@ -235,7 +160,7 @@ class Host {
235
160
  */
236
161
  createDAO(name, symbol, activity, params, funding, metaDataLocation) {
237
162
  const dao = {
238
- phase: LifecyclePhase.DRAFT,
163
+ phase: host_types_1.LifecyclePhase.DRAFT,
239
164
  name,
240
165
  symbol,
241
166
  activity,
@@ -293,8 +218,8 @@ class Host {
293
218
  if (currentTasks.length > 0) {
294
219
  throw new Error("SolveTasksFirst");
295
220
  }
296
- if (dao.phase === LifecyclePhase.DRAFT) {
297
- const seed = dao.funding[this.getFundingIndex(symbol, FundingType.SEED)];
221
+ if (dao.phase === host_types_1.LifecyclePhase.DRAFT) {
222
+ const seed = dao.funding[this.getFundingIndex(symbol, host_types_1.FundingType.SEED)];
298
223
  // SEED can be started not later than 1 week after must start
299
224
  // todo settings.maxSeedStartDelay
300
225
  if (seed.start < this.blockTimestamp &&
@@ -305,83 +230,83 @@ class Host {
305
230
  if (seed.end - this.blockTimestamp < 7 * 86400) {
306
231
  throw new Error("TooLateSoSetupFundingAgain")
307
232
  }*/
308
- this.daos[symbol].phase = LifecyclePhase.INCEPTION;
233
+ this.daos[symbol].phase = host_types_1.LifecyclePhase.INCEPTION;
309
234
  }
310
- else if (dao.phase === LifecyclePhase.INCEPTION) {
311
- const seed = dao.funding[this.getFundingIndex(symbol, FundingType.SEED)];
235
+ else if (dao.phase === host_types_1.LifecyclePhase.INCEPTION) {
236
+ const seed = dao.funding[this.getFundingIndex(symbol, host_types_1.FundingType.SEED)];
312
237
  if (seed.start > this.blockTimestamp) {
313
238
  throw new Error("WaitFundingStart");
314
239
  }
315
240
  // deploy seedToken
316
241
  this.daos[symbol].deployments[this.chainId] = {
317
- [ContractIndices.SEED_TOKEN_1]: "0xProxyDeployed",
242
+ [host_types_1.ContractIndices.SEED_TOKEN_1]: "0xProxyDeployed",
318
243
  };
319
- this.daos[symbol].phase = LifecyclePhase.SEED;
244
+ this.daos[symbol].phase = host_types_1.LifecyclePhase.SEED;
320
245
  }
321
- else if (dao.phase === LifecyclePhase.SEED) {
322
- const seed = dao.funding[this.getFundingIndex(symbol, FundingType.SEED)];
246
+ else if (dao.phase === host_types_1.LifecyclePhase.SEED) {
247
+ const seed = dao.funding[this.getFundingIndex(symbol, host_types_1.FundingType.SEED)];
323
248
  if (seed.end > this.blockTimestamp) {
324
249
  throw new Error("WaitFundingEnd");
325
250
  }
326
251
  const success = seed.raised >= seed.minRaise;
327
252
  if (success) {
328
- this.daos[symbol].phase = LifecyclePhase.DEVELOPMENT;
253
+ this.daos[symbol].phase = host_types_1.LifecyclePhase.DEVELOPMENT;
329
254
  }
330
255
  else {
331
256
  // send all raised back to seeders
332
- this.daos[symbol].phase = LifecyclePhase.SEED_FAILED;
257
+ this.daos[symbol].phase = host_types_1.LifecyclePhase.SEED_FAILED;
333
258
  }
334
259
  }
335
- else if (dao.phase === LifecyclePhase.DEVELOPMENT) {
336
- const tge = dao.funding[this.getFundingIndex(symbol, FundingType.TGE)];
260
+ else if (dao.phase === host_types_1.LifecyclePhase.DEVELOPMENT) {
261
+ const tge = dao.funding[this.getFundingIndex(symbol, host_types_1.FundingType.TGE)];
337
262
  if (tge.start > this.blockTimestamp) {
338
263
  throw new Error("WaitFundingStart");
339
264
  }
340
265
  // deploy tgeToken
341
- this.daos[symbol].deployments[this.chainId][ContractIndices.TGE_TOKEN_2] =
266
+ this.daos[symbol].deployments[this.chainId][host_types_1.ContractIndices.TGE_TOKEN_2] =
342
267
  "0xProxyDeployedTge";
343
- this.daos[symbol].phase = LifecyclePhase.TGE;
268
+ this.daos[symbol].phase = host_types_1.LifecyclePhase.TGE;
344
269
  }
345
- else if (dao.phase === LifecyclePhase.TGE) {
346
- const tge = dao.funding[this.getFundingIndex(symbol, FundingType.TGE)];
270
+ else if (dao.phase === host_types_1.LifecyclePhase.TGE) {
271
+ const tge = dao.funding[this.getFundingIndex(symbol, host_types_1.FundingType.TGE)];
347
272
  if (tge.end > this.blockTimestamp) {
348
273
  throw new Error("WaitFundingEnd");
349
274
  }
350
275
  const success = tge.raised >= tge.minRaise;
351
276
  if (success) {
352
277
  // deploy token, xToken, staking, daoToken
353
- this.daos[symbol].deployments[this.chainId][ContractIndices.TOKEN_3] =
278
+ this.daos[symbol].deployments[this.chainId][host_types_1.ContractIndices.TOKEN_3] =
354
279
  "0xProxyToken";
355
- this.daos[symbol].deployments[this.chainId][ContractIndices.X_TOKEN_4] =
280
+ this.daos[symbol].deployments[this.chainId][host_types_1.ContractIndices.X_TOKEN_4] =
356
281
  "0xProxyXToken";
357
- this.daos[symbol].deployments[this.chainId][ContractIndices.STAKING_6] =
282
+ this.daos[symbol].deployments[this.chainId][host_types_1.ContractIndices.STAKING_6] =
358
283
  "0xProxyStaking";
359
- this.daos[symbol].deployments[this.chainId][ContractIndices.DAO_TOKEN_5] = "0xProxyDAOToken";
284
+ this.daos[symbol].deployments[this.chainId][host_types_1.ContractIndices.DAO_TOKEN_5] = "0xProxyDAOToken";
360
285
  // todo deploy vesting contracts and allocate token
361
286
  // todo seedToken holders became xToken holders by predefined rate
362
287
  // todo deploy v2 liquidity from TGE funds at predefined price
363
- this.daos[symbol].phase = LifecyclePhase.LIVE_CLIFF;
288
+ this.daos[symbol].phase = host_types_1.LifecyclePhase.LIVE_CLIFF;
364
289
  }
365
290
  else {
366
291
  // send all raised TGE funds back to funders
367
- this.daos[symbol].phase = LifecyclePhase.DEVELOPMENT;
292
+ this.daos[symbol].phase = host_types_1.LifecyclePhase.DEVELOPMENT;
368
293
  }
369
294
  }
370
- else if (dao.phase === LifecyclePhase.LIVE_CLIFF) {
295
+ else if (dao.phase === host_types_1.LifecyclePhase.LIVE_CLIFF) {
371
296
  // if any vesting started then phase changed
372
297
  const isVestingStarted = !!dao.vesting?.filter((v) => v.start < this.blockTimestamp).length;
373
298
  if (!isVestingStarted) {
374
299
  throw new Error("WaitVestingStart");
375
300
  }
376
- this.daos[symbol].phase = LifecyclePhase.LIVE_VESTING;
301
+ this.daos[symbol].phase = host_types_1.LifecyclePhase.LIVE_VESTING;
377
302
  }
378
- else if (dao.phase === LifecyclePhase.LIVE_VESTING) {
303
+ else if (dao.phase === host_types_1.LifecyclePhase.LIVE_VESTING) {
379
304
  // if any vesting started then phase changed
380
305
  const isVestingEnded = !dao.vesting?.filter((v) => v.end > this.blockTimestamp).length;
381
306
  if (!isVestingEnded) {
382
307
  throw new Error("WaitVestingEnd");
383
308
  }
384
- this.daos[symbol].phase = LifecyclePhase.LIVE;
309
+ this.daos[symbol].phase = host_types_1.LifecyclePhase.LIVE;
385
310
  }
386
311
  else {
387
312
  // nothing to change
@@ -393,7 +318,7 @@ class Host {
393
318
  // check DAO symbol
394
319
  const dao = this.getDAO(symbol);
395
320
  // instant execute for DRAFT
396
- if (dao.phase === LifecyclePhase.DRAFT) {
321
+ if (dao.phase === host_types_1.LifecyclePhase.DRAFT) {
397
322
  this._onlyOwnerOf(symbol);
398
323
  this._updateImages(symbol, images);
399
324
  return true;
@@ -408,7 +333,7 @@ class Host {
408
333
  // check DAO symbol
409
334
  const dao = this.getDAO(symbol);
410
335
  // instant execute for DRAFT
411
- if (dao.phase === LifecyclePhase.DRAFT) {
336
+ if (dao.phase === host_types_1.LifecyclePhase.DRAFT) {
412
337
  this._onlyOwnerOf(symbol);
413
338
  this._updateSocials(symbol, socials);
414
339
  return true;
@@ -423,7 +348,7 @@ class Host {
423
348
  // check DAO symbol
424
349
  const dao = this.getDAO(symbol);
425
350
  // instant execute for DRAFT
426
- if (dao.phase === LifecyclePhase.DRAFT) {
351
+ if (dao.phase === host_types_1.LifecyclePhase.DRAFT) {
427
352
  this._onlyOwnerOf(symbol);
428
353
  this._updateUnits(symbol, units, unitsMetaData);
429
354
  return true;
@@ -441,7 +366,7 @@ class Host {
441
366
  // validate payload
442
367
  this.validateFunding(dao.phase, [funding]);
443
368
  // instant execute for DRAFT
444
- if (dao.phase === LifecyclePhase.DRAFT) {
369
+ if (dao.phase === host_types_1.LifecyclePhase.DRAFT) {
445
370
  this._onlyOwnerOf(symbol);
446
371
  this._updateFunding(symbol, funding);
447
372
  return true;
@@ -478,7 +403,7 @@ class Host {
478
403
  // validate
479
404
  this.validateVesting(dao.phase, vestings, this.getTgeData(dao));
480
405
  // instant execute for DRAFT
481
- if (dao.phase === LifecyclePhase.DRAFT) {
406
+ if (dao.phase === host_types_1.LifecyclePhase.DRAFT) {
482
407
  this._onlyOwnerOf(symbol);
483
408
  this._updateVesting(symbol, vestings);
484
409
  return true;
@@ -507,8 +432,8 @@ class Host {
507
432
  fund(symbol, amount) {
508
433
  // todo check settings.minFunding
509
434
  const dao = this.getDAO(symbol);
510
- if (dao.phase === LifecyclePhase.SEED) {
511
- const seedIndex = this.getFundingIndex(symbol, FundingType.SEED);
435
+ if (dao.phase === host_types_1.LifecyclePhase.SEED) {
436
+ const seedIndex = this.getFundingIndex(symbol, host_types_1.FundingType.SEED);
512
437
  const seed = dao.funding[seedIndex];
513
438
  if (seed.raised + amount >= seed.maxRaise) {
514
439
  throw new Error("RaiseMaxExceed");
@@ -518,8 +443,8 @@ class Host {
518
443
  // mint seedToken to user
519
444
  return;
520
445
  }
521
- if (dao.phase === LifecyclePhase.TGE) {
522
- const tgeIndex = this.getFundingIndex(symbol, FundingType.TGE);
446
+ if (dao.phase === host_types_1.LifecyclePhase.TGE) {
447
+ const tgeIndex = this.getFundingIndex(symbol, host_types_1.FundingType.TGE);
523
448
  const tge = dao.funding[tgeIndex];
524
449
  if (tge.raised + amount >= tge.maxRaise) {
525
450
  throw new Error("RaiseMaxExceed");
@@ -568,28 +493,28 @@ class Host {
568
493
  const r = [];
569
494
  let tgeRun = 0;
570
495
  for (const funding of dao.funding) {
571
- if (funding.type === FundingType.SEED) {
496
+ if (funding.type === host_types_1.FundingType.SEED) {
572
497
  r.push({
573
- phase: LifecyclePhase.INCEPTION,
498
+ phase: host_types_1.LifecyclePhase.INCEPTION,
574
499
  });
575
500
  r.push({
576
- phase: LifecyclePhase.SEED,
501
+ phase: host_types_1.LifecyclePhase.SEED,
577
502
  start: funding.start,
578
503
  end: funding.end,
579
504
  });
580
505
  }
581
- if (funding.type === FundingType.TGE) {
506
+ if (funding.type === host_types_1.FundingType.TGE) {
582
507
  // if SEED was done
583
508
  if (r.length > 0) {
584
509
  r.push({
585
- phase: LifecyclePhase.DEVELOPMENT,
510
+ phase: host_types_1.LifecyclePhase.DEVELOPMENT,
586
511
  start: r[0].end + 1,
587
512
  end: funding.start - 1,
588
513
  });
589
514
  }
590
515
  tgeRun = funding.claim || funding.end;
591
516
  r.push({
592
- phase: LifecyclePhase.TGE,
517
+ phase: host_types_1.LifecyclePhase.TGE,
593
518
  start: funding.start,
594
519
  end: tgeRun,
595
520
  });
@@ -607,17 +532,17 @@ class Host {
607
532
  }
608
533
  }
609
534
  r.push({
610
- phase: LifecyclePhase.LIVE_CLIFF,
535
+ phase: host_types_1.LifecyclePhase.LIVE_CLIFF,
611
536
  start: tgeRun + 1,
612
537
  end: vestingStart - 1,
613
538
  });
614
539
  r.push({
615
- phase: LifecyclePhase.LIVE_VESTING,
540
+ phase: host_types_1.LifecyclePhase.LIVE_VESTING,
616
541
  start: vestingStart,
617
542
  end: vestingEnd,
618
543
  });
619
544
  r.push({
620
- phase: LifecyclePhase.LIVE,
545
+ phase: host_types_1.LifecyclePhase.LIVE,
621
546
  start: vestingEnd + 1,
622
547
  });
623
548
  }
@@ -627,7 +552,7 @@ class Host {
627
552
  tasks(symbol) {
628
553
  const dao = this.getDAO(symbol);
629
554
  const r = [];
630
- if (dao.phase === LifecyclePhase.DRAFT) {
555
+ if (dao.phase === host_types_1.LifecyclePhase.DRAFT) {
631
556
  // images
632
557
  if (!dao.images.seedToken || !dao.images.token) {
633
558
  r.push({
@@ -647,12 +572,12 @@ class Host {
647
572
  });
648
573
  }
649
574
  }
650
- else if (dao.phase === LifecyclePhase.INCEPTION) {
575
+ else if (dao.phase === host_types_1.LifecyclePhase.INCEPTION) {
651
576
  // only off-chain tasks, mean SEED will be started anyway
652
577
  // todo off-chain tasks like minimal socials users number, units emitted data, etc
653
578
  }
654
- else if (dao.phase === LifecyclePhase.SEED) {
655
- const seedIndex = this.getFundingIndex(symbol, FundingType.SEED);
579
+ else if (dao.phase === host_types_1.LifecyclePhase.SEED) {
580
+ const seedIndex = this.getFundingIndex(symbol, host_types_1.FundingType.SEED);
656
581
  if (dao.funding[seedIndex].raised < dao.funding[seedIndex].minRaise &&
657
582
  dao.funding[seedIndex].end > this.blockTimestamp) {
658
583
  r.push({
@@ -660,9 +585,9 @@ class Host {
660
585
  });
661
586
  }
662
587
  }
663
- else if (dao.phase === LifecyclePhase.DEVELOPMENT) {
588
+ else if (dao.phase === host_types_1.LifecyclePhase.DEVELOPMENT) {
664
589
  // check funding
665
- const tgeExist = dao.funding.filter((f) => f.type === FundingType.TGE).length === 1;
590
+ const tgeExist = dao.funding.filter((f) => f.type === host_types_1.FundingType.TGE).length === 1;
666
591
  if (!tgeExist) {
667
592
  r.push({
668
593
  name: "Need add pre-TGE funding",
@@ -686,8 +611,8 @@ class Host {
686
611
  });
687
612
  }
688
613
  }
689
- else if (dao.phase === LifecyclePhase.TGE) {
690
- const tgeIndex = this.getFundingIndex(symbol, FundingType.TGE);
614
+ else if (dao.phase === host_types_1.LifecyclePhase.TGE) {
615
+ const tgeIndex = this.getFundingIndex(symbol, host_types_1.FundingType.TGE);
691
616
  if (dao.funding[tgeIndex].raised < dao.funding[tgeIndex].minRaise &&
692
617
  dao.funding[tgeIndex].end > this.blockTimestamp) {
693
618
  r.push({
@@ -695,12 +620,12 @@ class Host {
695
620
  });
696
621
  }
697
622
  }
698
- else if (dao.phase === LifecyclePhase.LIVE_CLIFF) {
623
+ else if (dao.phase === host_types_1.LifecyclePhase.LIVE_CLIFF) {
699
624
  // establish and improve
700
625
  // build money markets
701
626
  // bridge to chains
702
627
  }
703
- else if (dao.phase === LifecyclePhase.LIVE_VESTING) {
628
+ else if (dao.phase === host_types_1.LifecyclePhase.LIVE_VESTING) {
704
629
  // distribute vesting funds to leverage token
705
630
  }
706
631
  /*if (dao.phase === LifecyclePhase.LIVE)*/
@@ -735,17 +660,17 @@ class Host {
735
660
  }
736
661
  getDaoOwner(symbol) {
737
662
  const dao = this.getDAO(symbol);
738
- if (dao.phase === LifecyclePhase.DRAFT) {
663
+ if (dao.phase === host_types_1.LifecyclePhase.DRAFT) {
739
664
  return dao.deployer;
740
665
  }
741
666
  if ([
742
- LifecyclePhase.SEED,
743
- LifecyclePhase.DEVELOPMENT,
744
- LifecyclePhase.TGE,
667
+ host_types_1.LifecyclePhase.SEED,
668
+ host_types_1.LifecyclePhase.DEVELOPMENT,
669
+ host_types_1.LifecyclePhase.TGE,
745
670
  ].includes(dao.phase)) {
746
- return dao.deployments[(0, chains_1.getChainByName)(dao.initialChain).chainId][ContractIndices.SEED_TOKEN_1];
671
+ return dao.deployments[(0, chains_1.getChainByName)(dao.initialChain).chainId][host_types_1.ContractIndices.SEED_TOKEN_1];
747
672
  }
748
- return dao.deployments[this.chainId][ContractIndices.DAO_TOKEN_5];
673
+ return dao.deployments[this.chainId][host_types_1.ContractIndices.DAO_TOKEN_5];
749
674
  }
750
675
  hasRevenue(symbol) {
751
676
  const dao = this.getDAO(symbol);
@@ -761,9 +686,9 @@ class Host {
761
686
  return false;
762
687
  }
763
688
  getTgeData(dao) {
764
- const fundingExist = dao.funding.filter((f) => f.type === FundingType.TGE).length === 1;
689
+ const fundingExist = dao.funding.filter((f) => f.type === host_types_1.FundingType.TGE).length === 1;
765
690
  if (fundingExist) {
766
- const fundingIndex = this.getFundingIndex(dao.symbol, FundingType.TGE);
691
+ const fundingIndex = this.getFundingIndex(dao.symbol, host_types_1.FundingType.TGE);
767
692
  return dao.funding[fundingIndex];
768
693
  }
769
694
  }
@@ -916,10 +841,10 @@ function getBridgeTokens(daos) {
916
841
  const deploymentChainIds = Object.keys(dao.deployments);
917
842
  if (deploymentChainIds.length > 1) {
918
843
  for (const chainId of deploymentChainIds) {
919
- const tokenAddress = dao.deployments[chainId][ContractIndices.TOKEN_3];
920
- const tokenBridge = dao.deployments[chainId][ContractIndices.TOKEN_BRIDGE_8];
921
- const xTokenAddress = dao.deployments[chainId][ContractIndices.X_TOKEN_4];
922
- const xTokenBridge = dao.deployments[chainId][ContractIndices.X_TOKEN_BRIDGE_9];
844
+ const tokenAddress = dao.deployments[chainId][host_types_1.ContractIndices.TOKEN_3];
845
+ const tokenBridge = dao.deployments[chainId][host_types_1.ContractIndices.TOKEN_BRIDGE_8];
846
+ const xTokenAddress = dao.deployments[chainId][host_types_1.ContractIndices.X_TOKEN_4];
847
+ const xTokenBridge = dao.deployments[chainId][host_types_1.ContractIndices.X_TOKEN_BRIDGE_9];
923
848
  if (tokenAddress && tokenBridge) {
924
849
  const tokenData = (0, assets_1.getTokenData)(chainId, tokenAddress);
925
850
  if (tokenData) {