@agoric/inter-protocol 0.16.2-dev-7cc5def.0 → 0.16.2-u11.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.
- package/CHANGELOG.md +1041 -0
- package/bundles/bundle-auctioneer-js-meta.json +722 -0
- package/bundles/bundle-auctioneer.js +1 -0
- package/bundles/bundle-econCommitteeCharter-js-meta.json +222 -242
- package/bundles/bundle-econCommitteeCharter.js +1 -1
- package/bundles/bundle-feeDistributor-js-meta.json +458 -0
- package/bundles/bundle-feeDistributor.js +1 -0
- package/bundles/bundle-fluxAggregatorKit-js-meta.json +327 -343
- package/bundles/bundle-fluxAggregatorKit.js +1 -1
- package/bundles/bundle-psm-js-meta.json +308 -328
- package/bundles/bundle-psm.js +1 -1
- package/bundles/bundle-reserve-js-meta.json +662 -0
- package/bundles/bundle-reserve.js +1 -0
- package/bundles/bundle-scaledPriceAuthority-js-meta.json +542 -0
- package/bundles/bundle-scaledPriceAuthority.js +1 -0
- package/bundles/bundle-vaultFactory-js-meta.json +790 -0
- package/bundles/bundle-vaultFactory.js +1 -0
- package/package.json +31 -31
- package/scripts/add-collateral-core.js +112 -0
- package/scripts/build-bundles.js +21 -5
- package/scripts/deploy-contracts.js +100 -0
- package/scripts/init-core.js +198 -0
- package/scripts/invite-committee-core.js +42 -0
- package/scripts/manual-price-feed.js +117 -0
- package/scripts/price-feed-core.js +104 -0
- package/scripts/start-local-chain.sh +84 -0
- package/src/auction/auctionBook.js +56 -68
- package/src/auction/auctioneer.js +44 -56
- package/src/auction/offerBook.js +11 -12
- package/src/auction/params.js +5 -3
- package/src/auction/scheduleMath.js +13 -13
- package/src/auction/scheduler.js +32 -22
- package/src/auction/sortedOffers.js +7 -8
- package/src/auction/util.js +4 -4
- package/src/clientSupport.js +96 -152
- package/src/contractSupport.js +5 -5
- package/src/econCommitteeCharter.js +15 -16
- package/src/feeDistributor.js +33 -34
- package/src/interest.js +14 -20
- package/src/price/fluxAggregatorContract.js +45 -51
- package/src/price/fluxAggregatorKit.js +32 -47
- package/src/price/priceOracleKit.js +13 -11
- package/src/price/roundsManager.js +64 -52
- package/src/proposals/addAssetToVault.js +3 -15
- package/src/proposals/committee-proposal.js +9 -5
- package/src/proposals/core-proposal.js +7 -7
- package/src/proposals/econ-behaviors.js +32 -57
- package/src/proposals/price-feed-proposal.js +26 -59
- package/src/proposals/startEconCommittee.js +1 -1
- package/src/proposals/startPSM.js +22 -32
- package/src/proposals/utils.js +7 -26
- package/src/psm/psm.js +63 -69
- package/src/reserve/assetReserve.js +18 -27
- package/src/reserve/assetReserveKit.js +22 -14
- package/src/typeGuards.js +13 -0
- package/src/vaultFactory/liquidation.js +17 -30
- package/src/vaultFactory/math.js +9 -8
- package/src/vaultFactory/orderedVaultStore.js +9 -6
- package/src/vaultFactory/params.js +18 -24
- package/src/vaultFactory/prioritizedVaults.js +2 -2
- package/src/vaultFactory/proceeds.js +18 -24
- package/src/vaultFactory/storeUtils.js +12 -8
- package/src/vaultFactory/types.js +28 -38
- package/src/vaultFactory/vault.js +89 -88
- package/src/vaultFactory/vaultDirector.js +41 -33
- package/src/vaultFactory/vaultFactory.js +26 -33
- package/src/vaultFactory/vaultHolder.js +13 -8
- package/src/vaultFactory/vaultKit.js +2 -3
- package/src/vaultFactory/vaultManager.js +120 -138
- package/src/auction/auctionBook.d.ts +0 -83
- package/src/auction/auctionBook.d.ts.map +0 -1
- package/src/auction/auctioneer.d.ts +0 -75
- package/src/auction/auctioneer.d.ts.map +0 -1
- package/src/auction/offerBook.d.ts +0 -72
- package/src/auction/offerBook.d.ts.map +0 -1
- package/src/auction/params.d.ts +0 -142
- package/src/auction/params.d.ts.map +0 -1
- package/src/auction/scheduleMath.d.ts +0 -4
- package/src/auction/scheduleMath.d.ts.map +0 -1
- package/src/auction/scheduler.d.ts +0 -49
- package/src/auction/scheduler.d.ts.map +0 -1
- package/src/auction/sortedOffers.d.ts +0 -8
- package/src/auction/sortedOffers.d.ts.map +0 -1
- package/src/auction/util.d.ts +0 -30
- package/src/auction/util.d.ts.map +0 -1
- package/src/clientSupport.d.ts +0 -167
- package/src/clientSupport.d.ts.map +0 -1
- package/src/collectFees.d.ts +0 -2
- package/src/collectFees.d.ts.map +0 -1
- package/src/contractSupport.d.ts +0 -33
- package/src/contractSupport.d.ts.map +0 -1
- package/src/econCommitteeCharter.d.ts +0 -41
- package/src/econCommitteeCharter.d.ts.map +0 -1
- package/src/feeDistributor.d.ts +0 -212
- package/src/feeDistributor.d.ts.map +0 -1
- package/src/index.d.ts +0 -2
- package/src/index.d.ts.map +0 -1
- package/src/interest-math.d.ts +0 -3
- package/src/interest-math.d.ts.map +0 -1
- package/src/interest.d.ts +0 -29
- package/src/interest.d.ts.map +0 -1
- package/src/price/fluxAggregatorContract.d.ts +0 -112
- package/src/price/fluxAggregatorContract.d.ts.map +0 -1
- package/src/price/fluxAggregatorKit.d.ts +0 -155
- package/src/price/fluxAggregatorKit.d.ts.map +0 -1
- package/src/price/priceOracleKit.d.ts +0 -52
- package/src/price/priceOracleKit.d.ts.map +0 -1
- package/src/price/roundsManager.d.ts +0 -330
- package/src/price/roundsManager.d.ts.map +0 -1
- package/src/proposals/addAssetToVault.d.ts +0 -155
- package/src/proposals/addAssetToVault.d.ts.map +0 -1
- package/src/proposals/committee-proposal.d.ts +0 -121
- package/src/proposals/committee-proposal.d.ts.map +0 -1
- package/src/proposals/core-proposal.d.ts +0 -149
- package/src/proposals/core-proposal.d.ts.map +0 -1
- package/src/proposals/econ-behaviors.d.ts +0 -201
- package/src/proposals/econ-behaviors.d.ts.map +0 -1
- package/src/proposals/price-feed-proposal.d.ts +0 -83
- package/src/proposals/price-feed-proposal.d.ts.map +0 -1
- package/src/proposals/startEconCommittee.d.ts +0 -34
- package/src/proposals/startEconCommittee.d.ts.map +0 -1
- package/src/proposals/startPSM.d.ts +0 -61
- package/src/proposals/startPSM.d.ts.map +0 -1
- package/src/proposals/utils.d.ts +0 -15
- package/src/proposals/utils.d.ts.map +0 -1
- package/src/provisionPool.d.ts +0 -165
- package/src/provisionPool.d.ts.map +0 -1
- package/src/provisionPool.js +0 -119
- package/src/provisionPoolKit.d.ts +0 -379
- package/src/provisionPoolKit.d.ts.map +0 -1
- package/src/provisionPoolKit.js +0 -461
- package/src/psm/psm.d.ts +0 -178
- package/src/psm/psm.d.ts.map +0 -1
- package/src/psm/types.d.ts +0 -2
- package/src/psm/types.d.ts.map +0 -1
- package/src/reserve/assetReserve.d.ts +0 -44
- package/src/reserve/assetReserve.d.ts.map +0 -1
- package/src/reserve/assetReserveKit.d.ts +0 -114
- package/src/reserve/assetReserveKit.d.ts.map +0 -1
- package/src/reserve/params.d.ts +0 -10
- package/src/reserve/params.d.ts.map +0 -1
- package/src/tokens.d.ts +0 -3
- package/src/tokens.d.ts.map +0 -1
- package/src/tokens.js +0 -5
- package/src/vaultFactory/burn.d.ts +0 -2
- package/src/vaultFactory/burn.d.ts.map +0 -1
- package/src/vaultFactory/liquidation.d.ts +0 -24
- package/src/vaultFactory/liquidation.d.ts.map +0 -1
- package/src/vaultFactory/math.d.ts +0 -10
- package/src/vaultFactory/math.d.ts.map +0 -1
- package/src/vaultFactory/orderedVaultStore.d.ts +0 -94
- package/src/vaultFactory/orderedVaultStore.d.ts.map +0 -1
- package/src/vaultFactory/params.d.ts +0 -159
- package/src/vaultFactory/params.d.ts.map +0 -1
- package/src/vaultFactory/prioritizedVaults.d.ts +0 -279
- package/src/vaultFactory/prioritizedVaults.d.ts.map +0 -1
- package/src/vaultFactory/proceeds.d.ts +0 -34
- package/src/vaultFactory/proceeds.d.ts.map +0 -1
- package/src/vaultFactory/storeUtils.d.ts +0 -25
- package/src/vaultFactory/storeUtils.d.ts.map +0 -1
- package/src/vaultFactory/type-imports.d.ts +0 -2
- package/src/vaultFactory/type-imports.d.ts.map +0 -1
- package/src/vaultFactory/types.d.ts +0 -137
- package/src/vaultFactory/types.d.ts.map +0 -1
- package/src/vaultFactory/vault.d.ts +0 -529
- package/src/vaultFactory/vault.d.ts.map +0 -1
- package/src/vaultFactory/vaultDirector.d.ts +0 -560
- package/src/vaultFactory/vaultDirector.d.ts.map +0 -1
- package/src/vaultFactory/vaultFactory.d.ts +0 -162
- package/src/vaultFactory/vaultFactory.d.ts.map +0 -1
- package/src/vaultFactory/vaultHolder.d.ts +0 -201
- package/src/vaultFactory/vaultHolder.d.ts.map +0 -1
- package/src/vaultFactory/vaultKit.d.ts +0 -32
- package/src/vaultFactory/vaultKit.d.ts.map +0 -1
- package/src/vaultFactory/vaultManager.d.ts +0 -554
- package/src/vaultFactory/vaultManager.d.ts.map +0 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@agoric/inter-protocol",
|
|
3
|
-
"version": "0.16.2-
|
|
3
|
+
"version": "0.16.2-u11.0",
|
|
4
4
|
"description": "Core cryptoeconomy contracts",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "src/index.js",
|
|
@@ -10,15 +10,13 @@
|
|
|
10
10
|
"scripts": {
|
|
11
11
|
"build": "yarn build:bundles",
|
|
12
12
|
"build:bundles": "node ./scripts/build-bundles.js",
|
|
13
|
-
"prepack": "tsc --build tsconfig.build.json",
|
|
14
|
-
"postpack": "git clean -f '*.d.ts*' src/types.js",
|
|
15
13
|
"test": "ava",
|
|
16
14
|
"test:c8": "c8 $C8_OPTIONS ava --config=ava-nesm.config.js",
|
|
17
15
|
"test:xs": "exit 0",
|
|
18
16
|
"lint-fix": "yarn lint:eslint --fix",
|
|
19
17
|
"lint": "run-s --continue-on-error lint:*",
|
|
20
18
|
"lint:eslint": "eslint .",
|
|
21
|
-
"lint:types": "tsc"
|
|
19
|
+
"lint:types": "tsc -p jsconfig.json"
|
|
22
20
|
},
|
|
23
21
|
"repository": {
|
|
24
22
|
"type": "git",
|
|
@@ -31,40 +29,41 @@
|
|
|
31
29
|
},
|
|
32
30
|
"homepage": "https://github.com/Agoric/agoric-sdk#readme",
|
|
33
31
|
"dependencies": {
|
|
34
|
-
"@agoric/assert": "0.6.
|
|
35
|
-
"@agoric/ertp": "0.16.3-
|
|
36
|
-
"@agoric/governance": "0.10.4-
|
|
37
|
-
"@agoric/internal": "0.3.3-
|
|
38
|
-
"@agoric/notifier": "0.6.3-
|
|
39
|
-
"@agoric/store": "0.9.3-
|
|
40
|
-
"@agoric/time": "0.3.3-
|
|
41
|
-
"@agoric/vat-data": "0.5.3-
|
|
42
|
-
"@agoric/vats": "0.15.2-
|
|
43
|
-
"@agoric/zoe": "0.26.3-
|
|
44
|
-
"@endo/captp": "^3.1.
|
|
45
|
-
"@endo/eventual-send": "^0.17.
|
|
46
|
-
"@endo/far": "^0.2.
|
|
47
|
-
"@endo/marshal": "^0.8.
|
|
48
|
-
"@endo/nat": "^4.1.
|
|
32
|
+
"@agoric/assert": "^0.6.0",
|
|
33
|
+
"@agoric/ertp": "^0.16.3-u11.0",
|
|
34
|
+
"@agoric/governance": "^0.10.4-u11.0",
|
|
35
|
+
"@agoric/internal": "^0.3.3-u11.0",
|
|
36
|
+
"@agoric/notifier": "^0.6.3-u11.0",
|
|
37
|
+
"@agoric/store": "^0.9.3-u11.0",
|
|
38
|
+
"@agoric/time": "^0.3.3-u11.0",
|
|
39
|
+
"@agoric/vat-data": "^0.5.3-u11.0",
|
|
40
|
+
"@agoric/vats": "^0.15.2-u11.0",
|
|
41
|
+
"@agoric/zoe": "^0.26.3-u11.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.21.2-u11.0",
|
|
49
48
|
"jessie.js": "^0.3.2"
|
|
50
49
|
},
|
|
51
50
|
"devDependencies": {
|
|
52
|
-
"@agoric/
|
|
53
|
-
"@agoric/
|
|
54
|
-
"@agoric/swingset-
|
|
55
|
-
"@agoric/
|
|
56
|
-
"@endo/bundle-source": "^2.5.
|
|
57
|
-
"@endo/init": "^0.5.
|
|
58
|
-
"@endo/promise-kit": "^0.2.
|
|
59
|
-
"@fast-check/ava": "^1.1.
|
|
60
|
-
"ava": "^5.
|
|
51
|
+
"@agoric/deploy-script-support": "^0.10.4-u11.0",
|
|
52
|
+
"@agoric/smart-wallet": "^0.5.4-u11.0",
|
|
53
|
+
"@agoric/swingset-liveslots": "^0.10.3-u11.0",
|
|
54
|
+
"@agoric/swingset-vat": "^0.32.3-u11.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",
|
|
61
60
|
"c8": "^7.13.0",
|
|
62
61
|
"deep-object-diff": "^1.1.9",
|
|
63
62
|
"import-meta-resolve": "^2.2.1"
|
|
64
63
|
},
|
|
65
64
|
"files": [
|
|
66
|
-
"bundles",
|
|
67
|
-
"scripts",
|
|
65
|
+
"bundles/",
|
|
66
|
+
"scripts/",
|
|
68
67
|
"src/",
|
|
69
68
|
"exported.js",
|
|
70
69
|
"NEWS.md"
|
|
@@ -73,11 +72,12 @@
|
|
|
73
72
|
"files": [
|
|
74
73
|
"test/**/test-*.js"
|
|
75
74
|
],
|
|
75
|
+
"concurrency": 2,
|
|
76
76
|
"workerThreads": false,
|
|
77
77
|
"timeout": "10m"
|
|
78
78
|
},
|
|
79
79
|
"publishConfig": {
|
|
80
80
|
"access": "public"
|
|
81
81
|
},
|
|
82
|
-
"gitHead": "
|
|
82
|
+
"gitHead": "92b6cd72484079b0349d8ccfa4510aeb820e8d67"
|
|
83
83
|
}
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
/* global process */
|
|
2
|
+
import { makeHelpers } from '@agoric/deploy-script-support';
|
|
3
|
+
|
|
4
|
+
import { getManifestForAddAssetToVault } from '../src/proposals/addAssetToVault.js';
|
|
5
|
+
import { getManifestForPsm } from '../src/proposals/startPSM.js';
|
|
6
|
+
import { makeInstallCache } from '../src/proposals/utils.js';
|
|
7
|
+
|
|
8
|
+
/** @type {import('@agoric/deploy-script-support/src/externalTypes.js').ProposalBuilder} */
|
|
9
|
+
export const defaultProposalBuilder = async (
|
|
10
|
+
{ publishRef, install: install0, wrapInstall },
|
|
11
|
+
{
|
|
12
|
+
debtLimitValue = undefined,
|
|
13
|
+
interestRateValue = undefined,
|
|
14
|
+
interchainAssetOptions = /** @type {object} */ ({}),
|
|
15
|
+
} = {},
|
|
16
|
+
{ env = process.env } = {},
|
|
17
|
+
) => {
|
|
18
|
+
/** @type {import('../src/proposals/addAssetToVault.js').InterchainAssetOptions} */
|
|
19
|
+
const {
|
|
20
|
+
issuerBoardId = env.INTERCHAIN_ISSUER_BOARD_ID,
|
|
21
|
+
denom = env.INTERCHAIN_DENOM,
|
|
22
|
+
oracleBrand = 'ATOM',
|
|
23
|
+
decimalPlaces = 6,
|
|
24
|
+
keyword = 'ATOM',
|
|
25
|
+
proposedName = oracleBrand,
|
|
26
|
+
initialPrice = undefined,
|
|
27
|
+
} = interchainAssetOptions;
|
|
28
|
+
|
|
29
|
+
if (!denom) {
|
|
30
|
+
assert(issuerBoardId, 'INTERCHAIN_ISSUER_BOARD_ID is required');
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
const install = wrapInstall ? wrapInstall(install0) : install0;
|
|
34
|
+
|
|
35
|
+
return harden({
|
|
36
|
+
sourceSpec: '../src/proposals/addAssetToVault.js',
|
|
37
|
+
getManifestCall: [
|
|
38
|
+
getManifestForAddAssetToVault.name,
|
|
39
|
+
{
|
|
40
|
+
debtLimitValue: debtLimitValue && BigInt(debtLimitValue),
|
|
41
|
+
interestRateValue: interestRateValue && BigInt(interestRateValue),
|
|
42
|
+
interchainAssetOptions: {
|
|
43
|
+
denom,
|
|
44
|
+
issuerBoardId,
|
|
45
|
+
decimalPlaces,
|
|
46
|
+
initialPrice,
|
|
47
|
+
keyword,
|
|
48
|
+
proposedName,
|
|
49
|
+
oracleBrand,
|
|
50
|
+
},
|
|
51
|
+
scaledPriceAuthorityRef: publishRef(
|
|
52
|
+
install(
|
|
53
|
+
'@agoric/zoe/src/contracts/scaledPriceAuthority.js',
|
|
54
|
+
'../bundles/bundle-scaledPriceAuthority.js',
|
|
55
|
+
{ persist: true },
|
|
56
|
+
),
|
|
57
|
+
),
|
|
58
|
+
},
|
|
59
|
+
],
|
|
60
|
+
});
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
/** @type {import('@agoric/deploy-script-support/src/externalTypes.js').ProposalBuilder} */
|
|
64
|
+
export const psmProposalBuilder = async (
|
|
65
|
+
{ publishRef, install: install0, wrapInstall },
|
|
66
|
+
{ anchorOptions = /** @type {object} */ ({}) } = {},
|
|
67
|
+
{ env = process.env } = {},
|
|
68
|
+
) => {
|
|
69
|
+
const { denom = env.ANCHOR_DENOM, decimalPlaces = 6 } = anchorOptions;
|
|
70
|
+
|
|
71
|
+
assert(denom, 'ANCHOR_DENOM is required');
|
|
72
|
+
|
|
73
|
+
const install = wrapInstall ? wrapInstall(install0) : install0;
|
|
74
|
+
|
|
75
|
+
return harden({
|
|
76
|
+
sourceSpec: '../src/proposals/startPSM.js',
|
|
77
|
+
getManifestCall: [
|
|
78
|
+
getManifestForPsm.name,
|
|
79
|
+
{
|
|
80
|
+
anchorOptions: {
|
|
81
|
+
...anchorOptions,
|
|
82
|
+
denom,
|
|
83
|
+
decimalPlaces,
|
|
84
|
+
},
|
|
85
|
+
installKeys: {
|
|
86
|
+
psm: publishRef(
|
|
87
|
+
install('../src/psm/psm.js', '../bundles/bundle-psm.js'),
|
|
88
|
+
),
|
|
89
|
+
mintHolder: publishRef(
|
|
90
|
+
install(
|
|
91
|
+
'@agoric/vats/src/mintHolder.js',
|
|
92
|
+
'../../vats/bundles/bundle-mintHolder.js',
|
|
93
|
+
),
|
|
94
|
+
),
|
|
95
|
+
},
|
|
96
|
+
},
|
|
97
|
+
],
|
|
98
|
+
});
|
|
99
|
+
};
|
|
100
|
+
|
|
101
|
+
export default async (homeP, endowments) => {
|
|
102
|
+
const { writeCoreProposal } = await makeHelpers(homeP, endowments);
|
|
103
|
+
|
|
104
|
+
const tool = await makeInstallCache(homeP, {
|
|
105
|
+
loadBundle: spec => import(spec),
|
|
106
|
+
});
|
|
107
|
+
|
|
108
|
+
await writeCoreProposal('gov-add-collateral', defaultProposalBuilder);
|
|
109
|
+
await writeCoreProposal('gov-start-psm', opts =>
|
|
110
|
+
psmProposalBuilder({ ...opts, wrapInstall: tool.wrapInstall }),
|
|
111
|
+
);
|
|
112
|
+
};
|
package/scripts/build-bundles.js
CHANGED
|
@@ -1,20 +1,36 @@
|
|
|
1
1
|
#! /usr/bin/env node
|
|
2
2
|
import '@endo/init';
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
import {
|
|
4
|
+
createBundles,
|
|
5
|
+
extractProposalBundles,
|
|
6
|
+
} from '@agoric/internal/src/node/createBundles.js';
|
|
5
7
|
import url from 'url';
|
|
8
|
+
import process from 'process';
|
|
9
|
+
|
|
10
|
+
import { defaultProposalBuilder } from './init-core.js';
|
|
11
|
+
import { defaultProposalBuilder as collateralProposalBuilder } from './add-collateral-core.js';
|
|
12
|
+
|
|
13
|
+
process.env.INTERCHAIN_ISSUER_BOARD_ID =
|
|
14
|
+
'arbitrary value to prevent build error';
|
|
6
15
|
|
|
7
16
|
const dirname = url.fileURLToPath(new URL('.', import.meta.url));
|
|
17
|
+
await extractProposalBundles(
|
|
18
|
+
[
|
|
19
|
+
['.', defaultProposalBuilder],
|
|
20
|
+
['.', collateralProposalBuilder],
|
|
21
|
+
],
|
|
22
|
+
dirname,
|
|
23
|
+
);
|
|
8
24
|
|
|
9
25
|
await createBundles(
|
|
10
26
|
[
|
|
11
|
-
['
|
|
27
|
+
['../src/psm/psm.js', '../bundles/bundle-psm.js'],
|
|
12
28
|
[
|
|
13
|
-
'
|
|
29
|
+
'../src/econCommitteeCharter.js',
|
|
14
30
|
'../bundles/bundle-econCommitteeCharter.js',
|
|
15
31
|
],
|
|
16
32
|
[
|
|
17
|
-
'
|
|
33
|
+
'../src/price/fluxAggregatorContract.js',
|
|
18
34
|
'../bundles/bundle-fluxAggregatorKit.js',
|
|
19
35
|
],
|
|
20
36
|
],
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import url from 'url';
|
|
3
|
+
import { makeHelpers } from '@agoric/deploy-script-support';
|
|
4
|
+
import { E } from '@endo/eventual-send';
|
|
5
|
+
import { getCopyMapEntries, makeCopyMap } from '@agoric/store';
|
|
6
|
+
|
|
7
|
+
// TODO: CLI options to choose contracts
|
|
8
|
+
const contractRefs = [
|
|
9
|
+
'../../governance/bundles/bundle-contractGovernor.js',
|
|
10
|
+
'../../governance/bundles/bundle-committee.js',
|
|
11
|
+
'../../governance/bundles/bundle-binaryVoteCounter.js',
|
|
12
|
+
'../bundles/bundle-vaultFactory.js',
|
|
13
|
+
'../bundles/bundle-reserve.js',
|
|
14
|
+
'../bundles/bundle-psm.js',
|
|
15
|
+
'../bundles/bundle-auctioneer.js',
|
|
16
|
+
'../../vats/bundles/bundle-mintHolder.js',
|
|
17
|
+
];
|
|
18
|
+
const contractRoots = contractRefs.map(ref =>
|
|
19
|
+
url.fileURLToPath(new URL(ref, import.meta.url)),
|
|
20
|
+
);
|
|
21
|
+
|
|
22
|
+
/** @type {<T>(store: any, key: string, make: () => T) => Promise<T>} */
|
|
23
|
+
const provideWhen = async (store, key, make) => {
|
|
24
|
+
const found = await E(store).get(key);
|
|
25
|
+
if (found) {
|
|
26
|
+
return found;
|
|
27
|
+
}
|
|
28
|
+
const value = make();
|
|
29
|
+
await E(store).set(key, value);
|
|
30
|
+
return value;
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
export default async (homeP, endowments) => {
|
|
34
|
+
const home = await homeP;
|
|
35
|
+
const { zoe, scratch, board } = home;
|
|
36
|
+
|
|
37
|
+
const { installInPieces, getBundlerMaker } = await makeHelpers(
|
|
38
|
+
homeP,
|
|
39
|
+
endowments,
|
|
40
|
+
);
|
|
41
|
+
const bundler = E(getBundlerMaker({ log: console.log })).makeBundler({
|
|
42
|
+
zoe,
|
|
43
|
+
});
|
|
44
|
+
|
|
45
|
+
console.log('getting installCache...');
|
|
46
|
+
/** @type {CopyMap<string, {installation: Installation, boardId: string, path?: string}>} */
|
|
47
|
+
const initial = await provideWhen(scratch, 'installCache', () =>
|
|
48
|
+
makeCopyMap([]),
|
|
49
|
+
);
|
|
50
|
+
console.log('initially:', initial.payload.keys.length, 'entries');
|
|
51
|
+
|
|
52
|
+
// ISSUE: getCopyMapEntries of CopyMap<K, V> loses K, V.
|
|
53
|
+
/** @type {Map<string, {installation: Installation, boardId: string, path?: string}>} */
|
|
54
|
+
const working = new Map(getCopyMapEntries(initial));
|
|
55
|
+
|
|
56
|
+
let added = 0;
|
|
57
|
+
|
|
58
|
+
/** @type {EndoZipBase64Bundle[]} */
|
|
59
|
+
const bundles = await Promise.all(
|
|
60
|
+
contractRoots.map(path => import(path).then(m => m.default)),
|
|
61
|
+
);
|
|
62
|
+
|
|
63
|
+
let ix = 0;
|
|
64
|
+
for await (const bundle of bundles) {
|
|
65
|
+
const sha512 = bundle.endoZipBase64Sha512;
|
|
66
|
+
if (working.has(bundle.endoZipBase64Sha512)) {
|
|
67
|
+
console.log('hit:', { path: contractRefs[ix], sha512 });
|
|
68
|
+
} else {
|
|
69
|
+
console.log('miss:', {
|
|
70
|
+
path: contractRefs[ix],
|
|
71
|
+
length: bundle.endoZipBase64.length,
|
|
72
|
+
sha512,
|
|
73
|
+
});
|
|
74
|
+
const installation = await installInPieces(bundle, bundler, {
|
|
75
|
+
persist: true,
|
|
76
|
+
});
|
|
77
|
+
const boardId = await E(board).getId(installation);
|
|
78
|
+
working.set(sha512, { installation, boardId, path: contractRefs[ix] });
|
|
79
|
+
added += 1;
|
|
80
|
+
}
|
|
81
|
+
ix += 1;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
const final = makeCopyMap(working);
|
|
85
|
+
assert.equal(final.payload.keys.length, working.size);
|
|
86
|
+
await (added > 0 && E(home.scratch).set('installCache', final));
|
|
87
|
+
console.log({
|
|
88
|
+
initial: initial.payload.keys.length,
|
|
89
|
+
added,
|
|
90
|
+
total: working.size,
|
|
91
|
+
});
|
|
92
|
+
|
|
93
|
+
const items = [...working.entries()]
|
|
94
|
+
.map(([sha512, { boardId, path }]) => ({ sha512, boardId, path }))
|
|
95
|
+
.sort();
|
|
96
|
+
const boardId = await E(board).getId(JSON.stringify(items));
|
|
97
|
+
console.log({
|
|
98
|
+
boardId,
|
|
99
|
+
});
|
|
100
|
+
};
|
|
@@ -0,0 +1,198 @@
|
|
|
1
|
+
/* global process */
|
|
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
|
+
*/
|
|
6
|
+
import { makeHelpers } from '@agoric/deploy-script-support';
|
|
7
|
+
import { objectMap } from '@agoric/internal';
|
|
8
|
+
|
|
9
|
+
import {
|
|
10
|
+
getManifestForInterProtocol,
|
|
11
|
+
getManifestForEconCommittee,
|
|
12
|
+
getManifestForMain,
|
|
13
|
+
} from '../src/proposals/core-proposal.js';
|
|
14
|
+
import { makeInstallCache } from '../src/proposals/utils.js';
|
|
15
|
+
|
|
16
|
+
/** @type {Record<string, Record<string, [string, string]>>} */
|
|
17
|
+
const installKeyGroups = {
|
|
18
|
+
econCommittee: {
|
|
19
|
+
contractGovernor: [
|
|
20
|
+
'@agoric/governance/src/contractGovernor.js',
|
|
21
|
+
'../../governance/bundles/bundle-contractGovernor.js',
|
|
22
|
+
],
|
|
23
|
+
committee: [
|
|
24
|
+
'@agoric/governance/src/committee.js',
|
|
25
|
+
'../../governance/bundles/bundle-committee.js',
|
|
26
|
+
],
|
|
27
|
+
binaryVoteCounter: [
|
|
28
|
+
'@agoric/governance/src/binaryVoteCounter.js',
|
|
29
|
+
'../../governance/bundles/bundle-binaryVoteCounter.js',
|
|
30
|
+
],
|
|
31
|
+
},
|
|
32
|
+
main: {
|
|
33
|
+
auctioneer: [
|
|
34
|
+
'../src/auction/auctioneer.js',
|
|
35
|
+
'../bundles/bundle-auctioneer.js',
|
|
36
|
+
],
|
|
37
|
+
vaultFactory: [
|
|
38
|
+
'../src/vaultFactory/vaultFactory.js',
|
|
39
|
+
'../bundles/bundle-vaultFactory.js',
|
|
40
|
+
],
|
|
41
|
+
feeDistributor: [
|
|
42
|
+
'../src/feeDistributor.js',
|
|
43
|
+
'../bundles/bundle-feeDistributor.js',
|
|
44
|
+
],
|
|
45
|
+
reserve: ['../src/reserve/assetReserve.js', '../bundles/bundle-reserve.js'],
|
|
46
|
+
},
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* @param {object} opts
|
|
51
|
+
* @param {(i: I) => R} opts.publishRef
|
|
52
|
+
* @param {(m: string, b: string, opts?: any) => I} opts.install
|
|
53
|
+
* @param {<T>(f: T) => T} [opts.wrapInstall]
|
|
54
|
+
*
|
|
55
|
+
* @param {object} [options]
|
|
56
|
+
* @param {{ committeeName?: string, committeeSize?: number}} [options.econCommitteeOptions]
|
|
57
|
+
* @template I
|
|
58
|
+
* @template R
|
|
59
|
+
*/
|
|
60
|
+
export const committeeProposalBuilder = async (
|
|
61
|
+
{ publishRef, install: install0, wrapInstall },
|
|
62
|
+
{ econCommitteeOptions } = {},
|
|
63
|
+
) => {
|
|
64
|
+
const install = wrapInstall ? wrapInstall(install0) : install0;
|
|
65
|
+
|
|
66
|
+
/** @param {Record<string, [string, string]>} group */
|
|
67
|
+
const publishGroup = group =>
|
|
68
|
+
objectMap(group, ([mod, bundle]) =>
|
|
69
|
+
publishRef(install(mod, bundle, { persist: true })),
|
|
70
|
+
);
|
|
71
|
+
return harden({
|
|
72
|
+
sourceSpec: '../src/proposals/core-proposal.js',
|
|
73
|
+
getManifestCall: [
|
|
74
|
+
getManifestForEconCommittee.name,
|
|
75
|
+
{
|
|
76
|
+
econCommitteeOptions,
|
|
77
|
+
installKeys: {
|
|
78
|
+
...publishGroup(installKeyGroups.econCommittee),
|
|
79
|
+
},
|
|
80
|
+
},
|
|
81
|
+
],
|
|
82
|
+
});
|
|
83
|
+
};
|
|
84
|
+
|
|
85
|
+
/**
|
|
86
|
+
* @param {object} opts
|
|
87
|
+
* @param {(i: I) => R} opts.publishRef
|
|
88
|
+
* @param {(m: string, b: string, opts?: any) => I} opts.install
|
|
89
|
+
* @param {<T>(f: T) => T} [opts.wrapInstall]
|
|
90
|
+
*
|
|
91
|
+
* @template I
|
|
92
|
+
* @template R
|
|
93
|
+
*/
|
|
94
|
+
export const mainProposalBuilder = async ({
|
|
95
|
+
publishRef,
|
|
96
|
+
install: install0,
|
|
97
|
+
wrapInstall,
|
|
98
|
+
}) => {
|
|
99
|
+
const { VAULT_FACTORY_CONTROLLER_ADDR } = process.env;
|
|
100
|
+
|
|
101
|
+
const install = wrapInstall ? wrapInstall(install0) : install0;
|
|
102
|
+
|
|
103
|
+
const persist = true;
|
|
104
|
+
/** @param {Record<string, [string, string]>} group */
|
|
105
|
+
const publishGroup = group =>
|
|
106
|
+
objectMap(group, ([mod, bundle]) =>
|
|
107
|
+
publishRef(install(mod, bundle, { persist })),
|
|
108
|
+
);
|
|
109
|
+
return harden({
|
|
110
|
+
sourceSpec: '../src/proposals/core-proposal.js',
|
|
111
|
+
getManifestCall: [
|
|
112
|
+
getManifestForMain.name,
|
|
113
|
+
{
|
|
114
|
+
vaultFactoryControllerAddress: VAULT_FACTORY_CONTROLLER_ADDR,
|
|
115
|
+
installKeys: {
|
|
116
|
+
...publishGroup(installKeyGroups.main),
|
|
117
|
+
},
|
|
118
|
+
},
|
|
119
|
+
],
|
|
120
|
+
});
|
|
121
|
+
};
|
|
122
|
+
|
|
123
|
+
// Build proposal for sim-chain etc.
|
|
124
|
+
/** @type {import('@agoric/deploy-script-support/src/externalTypes.js').ProposalBuilder} */
|
|
125
|
+
export const defaultProposalBuilder = async (
|
|
126
|
+
{ publishRef, install },
|
|
127
|
+
options = {},
|
|
128
|
+
{ env = process.env } = {},
|
|
129
|
+
) => {
|
|
130
|
+
/** @param {string|undefined} s */
|
|
131
|
+
const optBigInt = s => s && BigInt(s);
|
|
132
|
+
const {
|
|
133
|
+
vaultFactoryControllerAddress = env.VAULT_FACTORY_CONTROLLER_ADDR,
|
|
134
|
+
minInitialPoolLiquidity = env.MIN_INITIAL_POOL_LIQUIDITY,
|
|
135
|
+
referencedUi,
|
|
136
|
+
anchorOptions: {
|
|
137
|
+
anchorDenom = env.ANCHOR_DENOM,
|
|
138
|
+
anchorDecimalPlaces = '6',
|
|
139
|
+
anchorKeyword = 'AUSD',
|
|
140
|
+
anchorProposedName = anchorKeyword,
|
|
141
|
+
initialPrice = undefined,
|
|
142
|
+
} = {},
|
|
143
|
+
econCommitteeOptions: {
|
|
144
|
+
committeeSize: econCommitteeSize = env.ECON_COMMITTEE_SIZE || '3',
|
|
145
|
+
} = {},
|
|
146
|
+
} = options;
|
|
147
|
+
|
|
148
|
+
/** @param {Record<string, [string, string]>} group */
|
|
149
|
+
const publishGroup = group =>
|
|
150
|
+
objectMap(group, ([mod, bundle]) => publishRef(install(mod, bundle)));
|
|
151
|
+
|
|
152
|
+
const anchorOptions = anchorDenom && {
|
|
153
|
+
denom: anchorDenom,
|
|
154
|
+
decimalPlaces: parseInt(anchorDecimalPlaces, 10),
|
|
155
|
+
initialPrice,
|
|
156
|
+
keyword: anchorKeyword,
|
|
157
|
+
proposedName: anchorProposedName,
|
|
158
|
+
};
|
|
159
|
+
|
|
160
|
+
const econCommitteeOptions = {
|
|
161
|
+
committeeSize: parseInt(econCommitteeSize, 10),
|
|
162
|
+
};
|
|
163
|
+
|
|
164
|
+
return harden({
|
|
165
|
+
sourceSpec: '../src/proposals/core-proposal.js',
|
|
166
|
+
getManifestCall: [
|
|
167
|
+
getManifestForInterProtocol.name,
|
|
168
|
+
{
|
|
169
|
+
vaultFactoryControllerAddress,
|
|
170
|
+
minInitialPoolLiquidity: optBigInt(minInitialPoolLiquidity),
|
|
171
|
+
referencedUi,
|
|
172
|
+
anchorOptions,
|
|
173
|
+
econCommitteeOptions,
|
|
174
|
+
installKeys: {
|
|
175
|
+
...publishGroup(installKeyGroups.econCommittee),
|
|
176
|
+
...publishGroup(installKeyGroups.main),
|
|
177
|
+
},
|
|
178
|
+
},
|
|
179
|
+
],
|
|
180
|
+
});
|
|
181
|
+
};
|
|
182
|
+
|
|
183
|
+
export default async (homeP, endowments) => {
|
|
184
|
+
const { writeCoreProposal } = await makeHelpers(homeP, endowments);
|
|
185
|
+
|
|
186
|
+
const tool = await makeInstallCache(homeP, {
|
|
187
|
+
loadBundle: spec => import(spec),
|
|
188
|
+
});
|
|
189
|
+
await Promise.all([
|
|
190
|
+
writeCoreProposal('gov-econ-committee', opts =>
|
|
191
|
+
committeeProposalBuilder({ ...opts, wrapInstall: tool.wrapInstall }),
|
|
192
|
+
),
|
|
193
|
+
writeCoreProposal('gov-amm-vaults-etc', opts =>
|
|
194
|
+
mainProposalBuilder({ ...opts, wrapInstall: tool.wrapInstall }),
|
|
195
|
+
),
|
|
196
|
+
]);
|
|
197
|
+
await tool.saveCache();
|
|
198
|
+
};
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/* global process */
|
|
2
|
+
import { makeHelpers } from '@agoric/deploy-script-support';
|
|
3
|
+
|
|
4
|
+
import { getManifestForInviteCommittee } from '../src/proposals/committee-proposal.js';
|
|
5
|
+
|
|
6
|
+
// Build proposal for sim-chain etc.
|
|
7
|
+
/** @type {import('@agoric/deploy-script-support/src/externalTypes.js').ProposalBuilder} */
|
|
8
|
+
export const defaultProposalBuilder = async (
|
|
9
|
+
{ publishRef, install },
|
|
10
|
+
options = {},
|
|
11
|
+
) => {
|
|
12
|
+
const {
|
|
13
|
+
ECON_COMMITTEE_ADDRESSES = process.env.ECON_COMMITTEE_ADDRESSES,
|
|
14
|
+
voterAddresses = JSON.parse(ECON_COMMITTEE_ADDRESSES),
|
|
15
|
+
} = options;
|
|
16
|
+
|
|
17
|
+
assert(voterAddresses, 'ECON_COMMITTEE_ADDRESSES is required');
|
|
18
|
+
|
|
19
|
+
return harden({
|
|
20
|
+
sourceSpec: '../src/proposals/committee-proposal.js',
|
|
21
|
+
getManifestCall: [
|
|
22
|
+
getManifestForInviteCommittee.name,
|
|
23
|
+
{
|
|
24
|
+
voterAddresses,
|
|
25
|
+
econCommitteeCharterRef: publishRef(
|
|
26
|
+
install(
|
|
27
|
+
'../src/econCommitteeCharter.js',
|
|
28
|
+
'../bundles/bundle-econCommitteeCharter.js',
|
|
29
|
+
{
|
|
30
|
+
persist: true,
|
|
31
|
+
},
|
|
32
|
+
),
|
|
33
|
+
),
|
|
34
|
+
},
|
|
35
|
+
],
|
|
36
|
+
});
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
export default async (homeP, endowments) => {
|
|
40
|
+
const { writeCoreProposal } = await makeHelpers(homeP, endowments);
|
|
41
|
+
await writeCoreProposal('gov-invite-committee', defaultProposalBuilder);
|
|
42
|
+
};
|