@agoric/inter-protocol 0.13.4-pismo-dev-0d5327f.0 → 0.14.0

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.
Files changed (141) hide show
  1. package/CHANGELOG.md +287 -0
  2. package/README.md +26 -20
  3. package/bundles/bundle-auctioneer-js-meta.json +722 -0
  4. package/bundles/bundle-auctioneer.js +1 -0
  5. package/bundles/bundle-econCommitteeCharter-js-meta.json +514 -0
  6. package/bundles/bundle-econCommitteeCharter.js +1 -0
  7. package/bundles/bundle-feeDistributor-js-meta.json +458 -0
  8. package/bundles/bundle-feeDistributor.js +1 -1
  9. package/bundles/bundle-fluxAggregatorKit-js-meta.json +674 -0
  10. package/bundles/bundle-fluxAggregatorKit.js +1 -0
  11. package/bundles/bundle-psm-js-meta.json +666 -0
  12. package/bundles/bundle-psm.js +1 -1
  13. package/bundles/bundle-reserve-js-meta.json +662 -0
  14. package/bundles/bundle-reserve.js +1 -1
  15. package/bundles/bundle-scaledPriceAuthority-js-meta.json +542 -0
  16. package/bundles/bundle-scaledPriceAuthority.js +1 -1
  17. package/bundles/bundle-vaultFactory-js-meta.json +786 -0
  18. package/bundles/bundle-vaultFactory.js +1 -1
  19. package/exported.js +0 -2
  20. package/package.json +34 -31
  21. package/scripts/add-collateral-core.js +14 -4
  22. package/scripts/build-bundles.js +9 -2
  23. package/scripts/deploy-contracts.js +1 -4
  24. package/scripts/init-core.js +20 -38
  25. package/scripts/invite-committee-core.js +1 -1
  26. package/scripts/manual-price-feed.js +2 -2
  27. package/scripts/price-feed-core.js +7 -6
  28. package/scripts/start-local-chain.sh +84 -0
  29. package/src/auction/auctionBook.js +755 -0
  30. package/src/auction/auctioneer.js +720 -0
  31. package/src/auction/offerBook.js +221 -0
  32. package/src/auction/params.js +174 -0
  33. package/src/auction/scheduleMath.js +167 -0
  34. package/src/auction/scheduler.js +370 -0
  35. package/src/auction/sortedOffers.js +136 -0
  36. package/src/auction/util.js +55 -0
  37. package/src/clientSupport.js +324 -0
  38. package/src/collectFees.js +8 -14
  39. package/src/contractSupport.js +24 -68
  40. package/src/econCommitteeCharter.js +161 -77
  41. package/src/feeDistributor.js +60 -20
  42. package/src/index.js +2 -0
  43. package/src/interest-math.js +1 -4
  44. package/src/interest.js +20 -13
  45. package/src/price/README.md +57 -0
  46. package/src/price/fluxAggregatorContract.js +190 -0
  47. package/src/price/fluxAggregatorKit.js +375 -0
  48. package/src/price/priceOracleKit.js +127 -0
  49. package/src/price/roundsManager.js +726 -0
  50. package/src/proposals/addAssetToVault.js +89 -94
  51. package/src/proposals/committee-proposal.js +141 -40
  52. package/src/proposals/core-proposal.js +100 -167
  53. package/src/proposals/econ-behaviors.js +320 -564
  54. package/src/proposals/price-feed-proposal.js +175 -78
  55. package/src/proposals/startEconCommittee.js +25 -12
  56. package/src/proposals/startPSM.js +231 -211
  57. package/src/proposals/utils.js +31 -17
  58. package/src/psm/README.md +71 -0
  59. package/src/psm/psm.js +272 -160
  60. package/src/psm/types.js +2 -0
  61. package/src/reserve/assetReserve.js +56 -413
  62. package/src/reserve/assetReserveKit.js +303 -0
  63. package/src/reserve/doc.md +1 -3
  64. package/src/reserve/params.js +2 -5
  65. package/src/typeGuards.js +13 -0
  66. package/src/vaultFactory/Liquidation.md +100 -0
  67. package/src/vaultFactory/burn.js +2 -1
  68. package/src/vaultFactory/liquidation.js +270 -108
  69. package/src/vaultFactory/math.js +95 -0
  70. package/src/vaultFactory/orderedVaultStore.js +0 -1
  71. package/src/vaultFactory/params.js +133 -112
  72. package/src/vaultFactory/prioritizedVaults.js +36 -79
  73. package/src/vaultFactory/storeUtils.js +67 -9
  74. package/src/vaultFactory/type-imports.js +2 -0
  75. package/src/vaultFactory/types.js +22 -26
  76. package/src/vaultFactory/vault.js +772 -709
  77. package/src/vaultFactory/vaultDirector.js +480 -483
  78. package/src/vaultFactory/vaultFactory.js +99 -60
  79. package/src/vaultFactory/vaultHolder.js +121 -95
  80. package/src/vaultFactory/vaultKit.js +39 -31
  81. package/src/vaultFactory/vaultManager.js +1249 -868
  82. package/bundles/bundle-amm-meta.js +0 -618
  83. package/bundles/bundle-amm.js +0 -1
  84. package/bundles/bundle-feeDistributor-meta.js +0 -346
  85. package/bundles/bundle-interchainPool-meta.js +0 -534
  86. package/bundles/bundle-interchainPool.js +0 -1
  87. package/bundles/bundle-liquidateIncrementally-meta.js +0 -442
  88. package/bundles/bundle-liquidateIncrementally.js +0 -1
  89. package/bundles/bundle-liquidateMinimum-meta.js +0 -442
  90. package/bundles/bundle-liquidateMinimum.js +0 -1
  91. package/bundles/bundle-psm-meta.js +0 -538
  92. package/bundles/bundle-psmCharter-meta.js +0 -418
  93. package/bundles/bundle-psmCharter.js +0 -1
  94. package/bundles/bundle-reserve-meta.js +0 -542
  95. package/bundles/bundle-scaledPriceAuthority-meta.js +0 -442
  96. package/bundles/bundle-stakeFactory-meta.js +0 -574
  97. package/bundles/bundle-stakeFactory.js +0 -1
  98. package/bundles/bundle-vaultFactory-meta.js +0 -598
  99. package/scripts/add-initial-liquidity.js +0 -180
  100. package/src/collect.js +0 -13
  101. package/src/interchainPool.js +0 -135
  102. package/src/makeTracer.js +0 -36
  103. package/src/my-lien.js +0 -85
  104. package/src/proposals/demoIssuers.js +0 -685
  105. package/src/proposals/sim-behaviors.js +0 -40
  106. package/src/psm/psmCharter.js +0 -139
  107. package/src/stakeFactory/README.md +0 -62
  108. package/src/stakeFactory/attestation.js +0 -267
  109. package/src/stakeFactory/attestationTool.js +0 -66
  110. package/src/stakeFactory/constants.js +0 -16
  111. package/src/stakeFactory/params.js +0 -31
  112. package/src/stakeFactory/stakeFactory.js +0 -236
  113. package/src/stakeFactory/stakeFactoryKit.js +0 -455
  114. package/src/stakeFactory/stakeFactoryManager.js +0 -296
  115. package/src/stakeFactory/types.js +0 -42
  116. package/src/vaultFactory/liquidateIncrementally.js +0 -350
  117. package/src/vaultFactory/liquidateMinimum.js +0 -100
  118. package/src/vpool-xyk-amm/AttackersGuide.md +0 -89
  119. package/src/vpool-xyk-amm/addLiquidity.js +0 -222
  120. package/src/vpool-xyk-amm/addPool.js +0 -197
  121. package/src/vpool-xyk-amm/constantProduct/AMM-Trade.jpeg +0 -0
  122. package/src/vpool-xyk-amm/constantProduct/README.md +0 -204
  123. package/src/vpool-xyk-amm/constantProduct/calcFees.js +0 -99
  124. package/src/vpool-xyk-amm/constantProduct/calcSwapPrices.js +0 -85
  125. package/src/vpool-xyk-amm/constantProduct/core.js +0 -153
  126. package/src/vpool-xyk-amm/constantProduct/defaults.js +0 -5
  127. package/src/vpool-xyk-amm/constantProduct/getXY.js +0 -52
  128. package/src/vpool-xyk-amm/constantProduct/internal-types.js +0 -116
  129. package/src/vpool-xyk-amm/constantProduct/invariants.js +0 -43
  130. package/src/vpool-xyk-amm/constantProduct/swap.js +0 -272
  131. package/src/vpool-xyk-amm/constantProduct/types.js +0 -32
  132. package/src/vpool-xyk-amm/doublePool.js +0 -194
  133. package/src/vpool-xyk-amm/estimate.js +0 -155
  134. package/src/vpool-xyk-amm/multipoolMarketMaker.js +0 -520
  135. package/src/vpool-xyk-amm/params.js +0 -61
  136. package/src/vpool-xyk-amm/pool.js +0 -396
  137. package/src/vpool-xyk-amm/priceAuthority.js +0 -94
  138. package/src/vpool-xyk-amm/removeLiquidity.js +0 -31
  139. package/src/vpool-xyk-amm/singlePool.js +0 -73
  140. package/src/vpool-xyk-amm/swap.js +0 -69
  141. package/src/vpool-xyk-amm/types.js +0 -154
package/exported.js CHANGED
@@ -1,4 +1,2 @@
1
- import './src/stakeFactory/types.js';
2
1
  import './src/psm/types.js';
3
2
  import './src/vaultFactory/types.js';
4
- import './src/vpool-xyk-amm/types.js';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agoric/inter-protocol",
3
- "version": "0.13.4-pismo-dev-0d5327f.0+0d5327f",
3
+ "version": "0.14.0",
4
4
  "description": "Core cryptoeconomy contracts",
5
5
  "type": "module",
6
6
  "main": "src/index.js",
@@ -16,7 +16,7 @@
16
16
  "lint-fix": "yarn lint:eslint --fix",
17
17
  "lint": "run-s --continue-on-error lint:*",
18
18
  "lint:eslint": "eslint .",
19
- "lint:types": "tsc --maxNodeModuleJsDepth 5 -p jsconfig.json"
19
+ "lint:types": "tsc -p jsconfig.json"
20
20
  },
21
21
  "repository": {
22
22
  "type": "git",
@@ -29,33 +29,37 @@
29
29
  },
30
30
  "homepage": "https://github.com/Agoric/agoric-sdk#readme",
31
31
  "dependencies": {
32
- "@agoric/assert": "0.5.2-pismo-dev-0d5327f.0+0d5327f",
33
- "@agoric/ertp": "0.15.6-pismo-dev-0d5327f.0+0d5327f",
34
- "@agoric/governance": "0.9.4-pismo-dev-0d5327f.0+0d5327f",
35
- "@agoric/internal": "0.2.2-pismo-dev-0d5327f.0+0d5327f",
36
- "@agoric/nat": "^4.1.0",
37
- "@agoric/notifier": "0.5.2-pismo-dev-0d5327f.0+0d5327f",
38
- "@agoric/store": "0.8.6-pismo-dev-0d5327f.0+0d5327f",
39
- "@agoric/swingset-vat": "0.31.1-pismo-dev-0d5327f.0+0d5327f",
40
- "@agoric/vat-data": "0.4.6-pismo-dev-0d5327f.0+0d5327f",
41
- "@agoric/vats": "0.13.3-pismo-dev-0d5327f.0+0d5327f",
42
- "@agoric/zoe": "0.25.6-pismo-dev-0d5327f.0+0d5327f",
43
- "@endo/bundle-source": "^2.3.1",
44
- "@endo/captp": "^2.0.15",
45
- "@endo/eventual-send": "^0.16.5",
46
- "@endo/far": "^0.2.11",
47
- "@endo/marshal": "^0.7.5",
48
- "@endo/nat": "^4.1.20",
49
- "@endo/promise-kit": "^0.2.49"
32
+ "@agoric/assert": "^0.6.0",
33
+ "@agoric/ertp": "^0.16.0",
34
+ "@agoric/governance": "^0.10.0",
35
+ "@agoric/internal": "^0.3.0",
36
+ "@agoric/notifier": "^0.6.0",
37
+ "@agoric/store": "^0.9.0",
38
+ "@agoric/time": "^0.3.0",
39
+ "@agoric/vat-data": "^0.5.0",
40
+ "@agoric/vats": "^0.14.0",
41
+ "@agoric/zoe": "^0.26.0",
42
+ "@endo/captp": "^3.1.1",
43
+ "@endo/eventual-send": "^0.17.2",
44
+ "@endo/far": "^0.2.18",
45
+ "@endo/marshal": "^0.8.5",
46
+ "@endo/nat": "^4.1.27",
47
+ "agoric": "^0.19.0",
48
+ "jessie.js": "^0.3.2"
50
49
  },
51
50
  "devDependencies": {
52
- "@agoric/deploy-script-support": "0.9.7-pismo-dev-0d5327f.0+0d5327f",
53
- "@endo/init": "^0.5.49",
54
- "@fast-check/ava": "^1.0.1",
55
- "ava": "^4.3.1",
56
- "c8": "^7.11.0",
57
- "deep-object-diff": "^1.1.7",
58
- "import-meta-resolve": "^1.1.1"
51
+ "@agoric/deploy-script-support": "^0.10.0",
52
+ "@agoric/smart-wallet": "^0.5.0",
53
+ "@agoric/swingset-liveslots": "^0.10.0",
54
+ "@agoric/swingset-vat": "^0.32.0",
55
+ "@endo/bundle-source": "^2.5.1",
56
+ "@endo/init": "^0.5.56",
57
+ "@endo/promise-kit": "^0.2.56",
58
+ "@fast-check/ava": "^1.1.3",
59
+ "ava": "^5.2.0",
60
+ "c8": "^7.13.0",
61
+ "deep-object-diff": "^1.1.9",
62
+ "import-meta-resolve": "^2.2.1"
59
63
  },
60
64
  "files": [
61
65
  "bundles/",
@@ -68,13 +72,12 @@
68
72
  "files": [
69
73
  "test/**/test-*.js"
70
74
  ],
75
+ "concurrency": 2,
76
+ "workerThreads": false,
71
77
  "timeout": "10m"
72
78
  },
73
- "eslintIgnore": [
74
- "bundle-*.js"
75
- ],
76
79
  "publishConfig": {
77
80
  "access": "public"
78
81
  },
79
- "gitHead": "0d5327f87310cf523834853b0546d0e217f37009"
82
+ "gitHead": "ea8c1c64911b4c58fb43635b25e17e3d50d0cf2a"
80
83
  }
@@ -1,14 +1,18 @@
1
1
  /* global process */
2
- // @ts-check
3
2
  import { makeHelpers } from '@agoric/deploy-script-support';
4
3
 
5
4
  import { getManifestForAddAssetToVault } from '../src/proposals/addAssetToVault.js';
6
5
  import { getManifestForPsm } from '../src/proposals/startPSM.js';
7
6
  import { makeInstallCache } from '../src/proposals/utils.js';
8
7
 
8
+ /** @type {import('@agoric/deploy-script-support/src/externalTypes.js').ProposalBuilder} */
9
9
  export const defaultProposalBuilder = async (
10
10
  { publishRef, install: install0, wrapInstall },
11
- { interchainAssetOptions = /** @type {object} */ ({}) } = {},
11
+ {
12
+ debtLimitValue = undefined,
13
+ interestRateValue = undefined,
14
+ interchainAssetOptions = /** @type {object} */ ({}),
15
+ } = {},
12
16
  { env = process.env } = {},
13
17
  ) => {
14
18
  /** @type {import('../src/proposals/addAssetToVault.js').InterchainAssetOptions} */
@@ -17,8 +21,9 @@ export const defaultProposalBuilder = async (
17
21
  denom = env.INTERCHAIN_DENOM,
18
22
  oracleBrand = 'ATOM',
19
23
  decimalPlaces = 6,
20
- keyword = 'IbcATOM',
24
+ keyword = 'ATOM',
21
25
  proposedName = oracleBrand,
26
+ initialPrice = undefined,
22
27
  } = interchainAssetOptions;
23
28
 
24
29
  if (!denom) {
@@ -32,10 +37,13 @@ export const defaultProposalBuilder = async (
32
37
  getManifestCall: [
33
38
  getManifestForAddAssetToVault.name,
34
39
  {
40
+ debtLimitValue: debtLimitValue && BigInt(debtLimitValue),
41
+ interestRateValue: interestRateValue && BigInt(interestRateValue),
35
42
  interchainAssetOptions: {
36
43
  denom,
37
44
  issuerBoardId,
38
45
  decimalPlaces,
46
+ initialPrice,
39
47
  keyword,
40
48
  proposedName,
41
49
  oracleBrand,
@@ -52,6 +60,7 @@ export const defaultProposalBuilder = async (
52
60
  });
53
61
  };
54
62
 
63
+ /** @type {import('@agoric/deploy-script-support/src/externalTypes.js').ProposalBuilder} */
55
64
  export const psmProposalBuilder = async (
56
65
  { publishRef, install: install0, wrapInstall },
57
66
  { anchorOptions = /** @type {object} */ ({}) } = {},
@@ -64,11 +73,12 @@ export const psmProposalBuilder = async (
64
73
  const install = wrapInstall ? wrapInstall(install0) : install0;
65
74
 
66
75
  return harden({
67
- sourceSpec: '../src/proposals/addAssetToVault.js',
76
+ sourceSpec: '../src/proposals/startPSM.js',
68
77
  getManifestCall: [
69
78
  getManifestForPsm.name,
70
79
  {
71
80
  anchorOptions: {
81
+ ...anchorOptions,
72
82
  denom,
73
83
  decimalPlaces,
74
84
  },
@@ -3,7 +3,7 @@ import '@endo/init';
3
3
  import {
4
4
  createBundles,
5
5
  extractProposalBundles,
6
- } from '@agoric/deploy-script-support';
6
+ } from '@agoric/internal/src/node/createBundles.js';
7
7
  import url from 'url';
8
8
  import process from 'process';
9
9
 
@@ -25,7 +25,14 @@ await extractProposalBundles(
25
25
  await createBundles(
26
26
  [
27
27
  ['../src/psm/psm.js', '../bundles/bundle-psm.js'],
28
- ['../src/psm/psmCharter.js', '../bundles/bundle-psmCharter.js'],
28
+ [
29
+ '../src/econCommitteeCharter.js',
30
+ '../bundles/bundle-econCommitteeCharter.js',
31
+ ],
32
+ [
33
+ '../src/price/fluxAggregatorContract.js',
34
+ '../bundles/bundle-fluxAggregatorKit.js',
35
+ ],
29
36
  ],
30
37
  dirname,
31
38
  );
@@ -1,5 +1,4 @@
1
1
  #!/usr/bin/env node
2
- // @ts-check
3
2
  import url from 'url';
4
3
  import { makeHelpers } from '@agoric/deploy-script-support';
5
4
  import { E } from '@endo/eventual-send';
@@ -10,12 +9,10 @@ const contractRefs = [
10
9
  '../../governance/bundles/bundle-contractGovernor.js',
11
10
  '../../governance/bundles/bundle-committee.js',
12
11
  '../../governance/bundles/bundle-binaryVoteCounter.js',
13
- '../bundles/bundle-stakeFactory.js',
14
- '../bundles/bundle-amm.js',
15
12
  '../bundles/bundle-vaultFactory.js',
16
- '../bundles/bundle-liquidateMinimum.js',
17
13
  '../bundles/bundle-reserve.js',
18
14
  '../bundles/bundle-psm.js',
15
+ '../bundles/bundle-auctioneer.js',
19
16
  '../../vats/bundles/bundle-mintHolder.js',
20
17
  ];
21
18
  const contractRoots = contractRefs.map(ref =>
@@ -1,5 +1,8 @@
1
1
  /* global process */
2
- // @ts-check
2
+ /**
3
+ * @file can be run with `agoric deploy` after a chain is running (depends on chain state)
4
+ * Only works with "local" chain and not sim-chain b/c it needs governance votes (n/a on sim-chain).
5
+ */
3
6
  import { makeHelpers } from '@agoric/deploy-script-support';
4
7
  import { objectMap } from '@agoric/internal';
5
8
 
@@ -26,20 +29,10 @@ const installKeyGroups = {
26
29
  '../../governance/bundles/bundle-binaryVoteCounter.js',
27
30
  ],
28
31
  },
29
- stakeFactory: {
30
- stakeFactory: [
31
- '../src/stakeFactory/stakeFactory.js',
32
- '../bundles/bundle-stakeFactory.js',
33
- ],
34
- },
35
32
  main: {
36
- amm: [
37
- '../src/vpool-xyk-amm/multipoolMarketMaker.js',
38
- '../bundles/bundle-amm.js',
39
- ],
40
- interchainPool: [
41
- '../src/interchainPool.js',
42
- '../bundles/bundle-interchainPool.js',
33
+ auctioneer: [
34
+ '../src/auction/auctioneer.js',
35
+ '../bundles/bundle-auctioneer.js',
43
36
  ],
44
37
  vaultFactory: [
45
38
  '../src/vaultFactory/vaultFactory.js',
@@ -49,35 +42,25 @@ const installKeyGroups = {
49
42
  '../src/feeDistributor.js',
50
43
  '../bundles/bundle-feeDistributor.js',
51
44
  ],
52
- liquidateMinimum: [
53
- '../src/vaultFactory/liquidateMinimum.js',
54
- '../bundles/bundle-liquidateMinimum.js',
55
- ],
56
- liquidate: [
57
- '../src/vaultFactory/liquidateIncrementally.js',
58
- '../bundles/bundle-liquidateIncrementally.js',
59
- ],
60
45
  reserve: ['../src/reserve/assetReserve.js', '../bundles/bundle-reserve.js'],
61
46
  },
62
47
  };
63
48
 
64
49
  /**
65
- *
66
50
  * @param {object} opts
67
51
  * @param {(i: I) => R} opts.publishRef
68
52
  * @param {(m: string, b: string, opts?: any) => I} opts.install
69
53
  * @param {<T>(f: T) => T} [opts.wrapInstall]
70
54
  *
55
+ * @param {object} [options]
56
+ * @param {{ committeeName?: string, committeeSize?: number}} [options.econCommitteeOptions]
71
57
  * @template I
72
58
  * @template R
73
59
  */
74
- export const committeeProposalBuilder = async ({
75
- publishRef,
76
- install: install0,
77
- wrapInstall,
78
- }) => {
79
- const { ROLE = 'chain' } = process.env;
80
-
60
+ export const committeeProposalBuilder = async (
61
+ { publishRef, install: install0, wrapInstall },
62
+ { econCommitteeOptions } = {},
63
+ ) => {
81
64
  const install = wrapInstall ? wrapInstall(install0) : install0;
82
65
 
83
66
  /** @param {Record<string, [string, string]>} group */
@@ -90,7 +73,7 @@ export const committeeProposalBuilder = async ({
90
73
  getManifestCall: [
91
74
  getManifestForEconCommittee.name,
92
75
  {
93
- ROLE,
76
+ econCommitteeOptions,
94
77
  installKeys: {
95
78
  ...publishGroup(installKeyGroups.econCommittee),
96
79
  },
@@ -100,7 +83,6 @@ export const committeeProposalBuilder = async ({
100
83
  };
101
84
 
102
85
  /**
103
- *
104
86
  * @param {object} opts
105
87
  * @param {(i: I) => R} opts.publishRef
106
88
  * @param {(m: string, b: string, opts?: any) => I} opts.install
@@ -114,7 +96,7 @@ export const mainProposalBuilder = async ({
114
96
  install: install0,
115
97
  wrapInstall,
116
98
  }) => {
117
- const { ROLE = 'chain', VAULT_FACTORY_CONTROLLER_ADDR } = process.env;
99
+ const { VAULT_FACTORY_CONTROLLER_ADDR } = process.env;
118
100
 
119
101
  const install = wrapInstall ? wrapInstall(install0) : install0;
120
102
 
@@ -129,11 +111,9 @@ export const mainProposalBuilder = async ({
129
111
  getManifestCall: [
130
112
  getManifestForMain.name,
131
113
  {
132
- ROLE,
133
114
  vaultFactoryControllerAddress: VAULT_FACTORY_CONTROLLER_ADDR,
134
115
  installKeys: {
135
116
  ...publishGroup(installKeyGroups.main),
136
- ...publishGroup(installKeyGroups.stakeFactory),
137
117
  },
138
118
  },
139
119
  ],
@@ -141,6 +121,7 @@ export const mainProposalBuilder = async ({
141
121
  };
142
122
 
143
123
  // Build proposal for sim-chain etc.
124
+ /** @type {import('@agoric/deploy-script-support/src/externalTypes.js').ProposalBuilder} */
144
125
  export const defaultProposalBuilder = async (
145
126
  { publishRef, install },
146
127
  options = {},
@@ -149,14 +130,15 @@ export const defaultProposalBuilder = async (
149
130
  /** @param {string|undefined} s */
150
131
  const optBigInt = s => s && BigInt(s);
151
132
  const {
152
- ROLE = env.ROLE || 'chain',
153
133
  vaultFactoryControllerAddress = env.VAULT_FACTORY_CONTROLLER_ADDR,
154
134
  minInitialPoolLiquidity = env.MIN_INITIAL_POOL_LIQUIDITY,
135
+ endorsedUi,
155
136
  anchorOptions: {
156
137
  anchorDenom = env.ANCHOR_DENOM,
157
138
  anchorDecimalPlaces = '6',
158
139
  anchorKeyword = 'AUSD',
159
140
  anchorProposedName = anchorKeyword,
141
+ initialPrice = undefined,
160
142
  } = {},
161
143
  econCommitteeOptions: {
162
144
  committeeSize: econCommitteeSize = env.ECON_COMMITTEE_SIZE || '3',
@@ -170,6 +152,7 @@ export const defaultProposalBuilder = async (
170
152
  const anchorOptions = anchorDenom && {
171
153
  denom: anchorDenom,
172
154
  decimalPlaces: parseInt(anchorDecimalPlaces, 10),
155
+ initialPrice,
173
156
  keyword: anchorKeyword,
174
157
  proposedName: anchorProposedName,
175
158
  };
@@ -183,14 +166,13 @@ export const defaultProposalBuilder = async (
183
166
  getManifestCall: [
184
167
  getManifestForInterProtocol.name,
185
168
  {
186
- ROLE,
187
169
  vaultFactoryControllerAddress,
188
170
  minInitialPoolLiquidity: optBigInt(minInitialPoolLiquidity),
171
+ endorsedUi,
189
172
  anchorOptions,
190
173
  econCommitteeOptions,
191
174
  installKeys: {
192
175
  ...publishGroup(installKeyGroups.econCommittee),
193
- ...publishGroup(installKeyGroups.stakeFactory),
194
176
  ...publishGroup(installKeyGroups.main),
195
177
  },
196
178
  },
@@ -1,10 +1,10 @@
1
1
  /* global process */
2
- // @ts-check
3
2
  import { makeHelpers } from '@agoric/deploy-script-support';
4
3
 
5
4
  import { getManifestForInviteCommittee } from '../src/proposals/committee-proposal.js';
6
5
 
7
6
  // Build proposal for sim-chain etc.
7
+ /** @type {import('@agoric/deploy-script-support/src/externalTypes.js').ProposalBuilder} */
8
8
  export const defaultProposalBuilder = async (
9
9
  { publishRef, install },
10
10
  options = {},
@@ -21,7 +21,7 @@ import process from 'process';
21
21
  * E(oa).pushResult('19.37')
22
22
  * E(qn).getUpdateSince()
23
23
  *
24
- * @typedef {{ board: Board, chainTimerService, scratch, zoe }} Home
24
+ * @typedef {{ board: import('@agoric/vats').Board, chainTimerService, scratch, zoe }} Home
25
25
  * @param {Promise<Home>} homePromise
26
26
  * @param {object} root0
27
27
  * @param {(...path: string[]) => Promise<any>} root0.lookup
@@ -50,7 +50,7 @@ export default async function priceAuthorityFromNotifier(
50
50
  );
51
51
  if (invitations.length > 1) {
52
52
  console.error('Multiple oracle invitations found', invitations);
53
- throw new Error('You need an AGGREGATOR_INSTANCE_LOOKUP to disambiguate');
53
+ throw Error('You need an AGGREGATOR_INSTANCE_LOOKUP to disambiguate');
54
54
  }
55
55
  if (invitations.length === 0) {
56
56
  console.error(
@@ -4,13 +4,14 @@ import { makeHelpers } from '@agoric/deploy-script-support';
4
4
  const DEFAULT_CONTRACT_TERMS = {
5
5
  POLL_INTERVAL: 30n,
6
6
  maxSubmissionCount: 1000,
7
- minSubmissionCount: 1,
8
- restartDelay: 5, // in seconds according to chainTimerService
7
+ minSubmissionCount: 2,
8
+ restartDelay: 1, // the number of rounds an Oracle has to wait before they can initiate another round
9
9
  timeout: 10, // in seconds according to chainTimerService
10
10
  minSubmissionValue: 1n,
11
11
  maxSubmissionValue: 2n ** 256n,
12
12
  };
13
13
 
14
+ /** @type {import('@agoric/deploy-script-support/src/externalTypes.js').ProposalBuilder} */
14
15
  export const defaultProposalBuilder = async (
15
16
  { publishRef, install },
16
17
  options = {},
@@ -57,8 +58,8 @@ export const defaultProposalBuilder = async (
57
58
  brandOutRef: brandOut && publishRef(brandOut),
58
59
  priceAggregatorRef: publishRef(
59
60
  install(
60
- '@agoric/zoe/src/contracts/priceAggregator.js',
61
- '../bundles/bundle-priceAggregator.js',
61
+ '@agoric/inter-protocol/src/price/fluxAggregatorContract.js',
62
+ '../bundles/bundle-fluxAggregatorKit.js',
62
63
  ),
63
64
  ),
64
65
  },
@@ -71,9 +72,9 @@ export const createGov = async (homeP, endowments) => {
71
72
 
72
73
  const {
73
74
  AGORIC_INSTANCE_NAME,
74
- IN_BRAND_DECIMALS,
75
+ IN_BRAND_DECIMALS = '6',
75
76
  IN_BRAND_LOOKUP = JSON.stringify(['wallet', 'brand', 'BLD']),
76
- OUT_BRAND_DECIMALS,
77
+ OUT_BRAND_DECIMALS = '6',
77
78
  OUT_BRAND_LOOKUP = JSON.stringify(['agoricNames', 'oracleBrand', 'USD']),
78
79
  ORACLE_ADDRESSES,
79
80
  } = process.env;
@@ -0,0 +1,84 @@
1
+ #!/bin/bash
2
+ #
3
+ # Start a chain with "economy" and provision wallet to use it
4
+ #
5
+
6
+ # run an Archive node to keep all history https://docs.desmos.network/fullnode/overview/
7
+ # (the Makefile passes this to agd start)
8
+ export AGC_START_ARGS="--pruning=nothing"
9
+
10
+ CHAIN_LOG=$(mktemp -t Agoric-start-local-chain-log-XXXXXXX)
11
+ if [[ $(uname) == "Darwin" ]]; then
12
+ open -a /System/Applications/Utilities/Console.app "$CHAIN_LOG"
13
+ fi
14
+
15
+ # ugly way to get SDK path regardless of cwd
16
+ SDK=$(readlink -f "$(dirname -- "$(readlink -f -- "$0")")/../../..")
17
+
18
+ WALLET=gov1
19
+ WALLET_BECH32=$(agd keys --keyring-backend=test show "$WALLET" --output json | jq -r .address)
20
+
21
+ if [ -z "$WALLET_BECH32" ]; then
22
+ echo "USAGE: $0 wallet-key"
23
+ # The key must be from the 'test' keyring, for non-interactive use.
24
+ # To migrate one of your 'os' keys:
25
+ # agd keys export the-wallet-key-name > wallet.key
26
+ # agd keys import --keyring-backend=test the-wallet-key-name wallet.key
27
+ exit 1
28
+ fi
29
+
30
+ # this is in economy-template.json in the oracleAddresses list (agoric1dy0yegdsev4xvce3dx7zrz2ad9pesf5svzud6y)
31
+ # to use it run `agd keys --keyring-backend=test add oracle2 --interactive` and enter this mnenomic:
32
+ # dizzy scale gentle good play scene certain acquire approve alarm retreat recycle inch journey fitness grass minimum learn funny way unlock what buzz upon
33
+ WALLET2=gov2
34
+ WALLET2_BECH32=$(agd keys --keyring-backend=test show "$WALLET2" --output json | jq -r .address)
35
+ if [ -z "$WALLET2_BECH32" ]; then
36
+ echo "missing oracle2 key in test keyring"
37
+ exit 1
38
+ fi
39
+
40
+ echo CHAIN_LOG "$CHAIN_LOG"
41
+ echo SDK "$SDK"
42
+ echo WALLET "$WALLET"
43
+ echo WALLET_BECH32 "$WALLET_BECH32"
44
+
45
+ cd "$SDK"/packages/cosmic-swingset || exit 1
46
+
47
+ echo "Logs written to $CHAIN_LOG"
48
+ # specifies the address to use for chain config
49
+ export PRIMARY_ADDRESS=$WALLET_BECH32
50
+ # nobuild variety skips Golang artifacts; if you get errors try make scenario2-setup
51
+ make scenario2-setup-nobuild >>"$CHAIN_LOG" 2>&1
52
+
53
+ # TODO detect it's already running, indicate when it started and offer to restart
54
+ # e.g. killall node xsnap-worker
55
+ echo "Starting the chain..."
56
+ # use -economy target to get the kitchen sink
57
+ # disable pruning to keep all history https://docs.desmos.network/fullnode/overview/
58
+ make AGC_START_ARGS="--pruning=nothing" CHAIN_BOOTSTRAP_VAT_CONFIG=@agoric/vats/decentral-test-vaults-config.json scenario2-run-chain >>"$CHAIN_LOG" 2>&1 &
59
+ make wait-for-cosmos
60
+
61
+ # xxx sleep to let it settle
62
+ sleep 15
63
+
64
+ echo "Funding the pool..."
65
+ make fund-provision-pool
66
+
67
+ echo "Funding your wallet account..."
68
+ # After `fund-provision-pool` there is 900 IST remaining for other account funding.
69
+ # A wallet can be tested with 20 BLD for provisioning wallet and 20 USDC for psm trading
70
+ # Also include 1M ATOM
71
+ make ACCT_ADDR="$WALLET_BECH32" FUNDS=20000000ubld,20000000ibc/toyusdc,1000000000000ibc/toyatom fund-acct
72
+ agd query bank balances "$WALLET_BECH32" | grep ubld || exit 1
73
+
74
+ echo "Provisioning your smart wallet..."
75
+ agoric wallet --keyring-backend=test provision --spend --account "$WALLET"
76
+ echo "waiting for blocks"
77
+ sleep 15
78
+ # verify
79
+ agoric wallet --keyring-backend=test list
80
+ agoric wallet --keyring-backend=test show --from "$WALLET"
81
+
82
+ echo "Repeating for gov2 account..."
83
+ make ACCT_ADDR="$WALLET2_BECH32" FUNDS=20000000ubld,20000000ibc/toyusdc fund-acct
84
+ agoric wallet --keyring-backend=test provision --spend --account "$WALLET2"