@agoric/inter-protocol 0.16.2-other-dev-1f26562.0 → 0.16.2-other-dev-3eb1a1d.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/README.md +6 -6
- package/package.json +42 -36
- package/scripts/build-bundles.js +5 -21
- package/src/auction/auctionBook.d.ts +147 -0
- package/src/auction/auctionBook.d.ts.map +1 -0
- package/src/auction/auctionBook.js +156 -150
- package/src/auction/auctionMath.d.ts +17 -0
- package/src/auction/auctionMath.d.ts.map +1 -0
- package/src/auction/auctionMath.js +81 -0
- package/src/auction/auctioneer.d.ts +69 -0
- package/src/auction/auctioneer.d.ts.map +1 -0
- package/src/auction/auctioneer.js +70 -59
- package/src/auction/offerBook.d.ts +45 -0
- package/src/auction/offerBook.d.ts.map +1 -0
- package/src/auction/offerBook.js +13 -12
- package/src/auction/params.d.ts +144 -0
- package/src/auction/params.d.ts.map +1 -0
- package/src/auction/params.js +10 -9
- package/src/auction/scheduleMath.d.ts +5 -0
- package/src/auction/scheduleMath.d.ts.map +1 -0
- package/src/auction/scheduleMath.js +18 -16
- package/src/auction/scheduler.d.ts +50 -0
- package/src/auction/scheduler.d.ts.map +1 -0
- package/src/auction/scheduler.js +53 -47
- package/src/auction/sortedOffers.d.ts +8 -0
- package/src/auction/sortedOffers.d.ts.map +1 -0
- package/src/auction/sortedOffers.js +10 -9
- package/src/auction/util.d.ts +30 -0
- package/src/auction/util.d.ts.map +1 -0
- package/src/auction/util.js +9 -6
- package/src/clientSupport.d.ts +167 -0
- package/src/clientSupport.d.ts.map +1 -0
- package/src/clientSupport.js +155 -97
- package/src/collectFees.d.ts +2 -0
- package/src/collectFees.d.ts.map +1 -0
- package/src/contractSupport.d.ts +28 -0
- package/src/contractSupport.d.ts.map +1 -0
- package/src/contractSupport.js +19 -13
- package/src/econCommitteeCharter.d.ts +40 -0
- package/src/econCommitteeCharter.d.ts.map +1 -0
- package/src/econCommitteeCharter.js +21 -20
- package/src/feeDistributor.d.ts +224 -0
- package/src/feeDistributor.d.ts.map +1 -0
- package/src/feeDistributor.js +37 -33
- package/src/index.d.ts +2 -0
- package/src/index.d.ts.map +1 -0
- package/src/index.js +1 -0
- package/src/interest-math.d.ts +3 -0
- package/src/interest-math.d.ts.map +1 -0
- package/src/interest.d.ts +28 -0
- package/src/interest.d.ts.map +1 -0
- package/src/interest.js +23 -18
- package/src/price/README.md +13 -0
- package/src/price/fluxAggregatorContract.d.ts +71 -0
- package/src/price/fluxAggregatorContract.d.ts.map +1 -0
- package/src/price/fluxAggregatorContract.js +64 -55
- package/src/price/fluxAggregatorKit.d.ts +103 -0
- package/src/price/fluxAggregatorKit.d.ts.map +1 -0
- package/src/price/fluxAggregatorKit.js +52 -40
- package/src/price/priceOracleKit.d.ts +38 -0
- package/src/price/priceOracleKit.d.ts.map +1 -0
- package/src/price/priceOracleKit.js +12 -14
- package/src/price/roundsManager.d.ts +204 -0
- package/src/price/roundsManager.d.ts.map +1 -0
- package/src/price/roundsManager.js +131 -85
- package/src/proposals/README.md +2 -3
- package/src/proposals/add-auction.d.ts +109 -0
- package/src/proposals/add-auction.d.ts.map +1 -0
- package/src/proposals/add-auction.js +256 -0
- package/src/proposals/addAssetToVault.d.ts +173 -0
- package/src/proposals/addAssetToVault.d.ts.map +1 -0
- package/src/proposals/addAssetToVault.js +192 -40
- package/src/proposals/committee-proposal.d.ts +113 -0
- package/src/proposals/committee-proposal.d.ts.map +1 -0
- package/src/proposals/committee-proposal.js +25 -31
- package/src/proposals/core-proposal.d.ts +149 -0
- package/src/proposals/core-proposal.d.ts.map +1 -0
- package/src/proposals/core-proposal.js +9 -11
- package/src/proposals/deploy-price-feeds.d.ts +76 -0
- package/src/proposals/deploy-price-feeds.d.ts.map +1 -0
- package/src/proposals/deploy-price-feeds.js +316 -0
- package/src/proposals/econ-behaviors.d.ts +541 -0
- package/src/proposals/econ-behaviors.d.ts.map +1 -0
- package/src/proposals/econ-behaviors.js +64 -45
- package/src/proposals/price-feed-proposal.d.ts +84 -0
- package/src/proposals/price-feed-proposal.d.ts.map +1 -0
- package/src/proposals/price-feed-proposal.js +109 -51
- package/src/proposals/replace-fee-distributor.d.ts +48 -0
- package/src/proposals/replace-fee-distributor.d.ts.map +1 -0
- package/src/proposals/replace-fee-distributor.js +195 -0
- package/src/proposals/replace-scaledPriceAuthorities.d.ts +30 -0
- package/src/proposals/replace-scaledPriceAuthorities.d.ts.map +1 -0
- package/src/proposals/replace-scaledPriceAuthorities.js +124 -0
- package/src/proposals/replaceElectorate.d.ts +55 -0
- package/src/proposals/replaceElectorate.d.ts.map +1 -0
- package/src/proposals/replaceElectorate.js +521 -0
- package/src/proposals/startEconCommittee.d.ts +34 -0
- package/src/proposals/startEconCommittee.d.ts.map +1 -0
- package/src/proposals/startEconCommittee.js +2 -2
- package/src/proposals/startPSM.d.ts +59 -0
- package/src/proposals/startPSM.d.ts.map +1 -0
- package/src/proposals/startPSM.js +44 -29
- package/src/proposals/upgrade-scaledPriceAuthorities.d.ts +24 -0
- package/src/proposals/upgrade-scaledPriceAuthorities.d.ts.map +1 -0
- package/src/proposals/upgrade-scaledPriceAuthorities.js +78 -0
- package/src/proposals/upgrade-vaults.d.ts +41 -0
- package/src/proposals/upgrade-vaults.d.ts.map +1 -0
- package/src/proposals/upgrade-vaults.js +202 -0
- package/src/proposals/utils.d.ts +19 -0
- package/src/proposals/utils.d.ts.map +1 -0
- package/src/proposals/utils.js +43 -9
- package/src/provisionPool.d.ts +163 -0
- package/src/provisionPool.d.ts.map +1 -0
- package/src/provisionPool.js +122 -0
- package/src/provisionPoolKit.d.ts +359 -0
- package/src/provisionPoolKit.d.ts.map +1 -0
- package/src/provisionPoolKit.js +522 -0
- package/src/psm/psm.d.ts +125 -0
- package/src/psm/psm.d.ts.map +1 -0
- package/src/psm/psm.js +80 -79
- package/src/psm/types-ambient.d.ts +2 -0
- package/src/psm/types-ambient.d.ts.map +1 -0
- package/src/psm/types-ambient.js +3 -0
- package/src/reserve/assetReserve.d.ts +47 -0
- package/src/reserve/assetReserve.d.ts.map +1 -0
- package/src/reserve/assetReserve.js +28 -19
- package/src/reserve/assetReserveKit.d.ts +74 -0
- package/src/reserve/assetReserveKit.d.ts.map +1 -0
- package/src/reserve/assetReserveKit.js +24 -30
- package/src/reserve/params.d.ts +10 -0
- package/src/reserve/params.d.ts.map +1 -0
- package/src/tokens.d.ts +3 -0
- package/src/tokens.d.ts.map +1 -0
- package/src/tokens.js +5 -0
- package/src/vaultFactory/burn.d.ts +2 -0
- package/src/vaultFactory/burn.d.ts.map +1 -0
- package/src/vaultFactory/burn.js +1 -1
- package/src/vaultFactory/liquidation.d.ts +23 -0
- package/src/vaultFactory/liquidation.d.ts.map +1 -0
- package/src/vaultFactory/liquidation.js +37 -24
- package/src/vaultFactory/math.d.ts +11 -0
- package/src/vaultFactory/math.d.ts.map +1 -0
- package/src/vaultFactory/math.js +10 -9
- package/src/vaultFactory/orderedVaultStore.d.ts +93 -0
- package/src/vaultFactory/orderedVaultStore.d.ts.map +1 -0
- package/src/vaultFactory/orderedVaultStore.js +8 -11
- package/src/vaultFactory/params.d.ts +140 -0
- package/src/vaultFactory/params.d.ts.map +1 -0
- package/src/vaultFactory/params.js +52 -24
- package/src/vaultFactory/prioritizedVaults.d.ts +279 -0
- package/src/vaultFactory/prioritizedVaults.d.ts.map +1 -0
- package/src/vaultFactory/prioritizedVaults.js +4 -4
- package/src/vaultFactory/proceeds.d.ts +35 -0
- package/src/vaultFactory/proceeds.d.ts.map +1 -0
- package/src/vaultFactory/proceeds.js +26 -18
- package/src/vaultFactory/storeUtils.d.ts +25 -0
- package/src/vaultFactory/storeUtils.d.ts.map +1 -0
- package/src/vaultFactory/storeUtils.js +10 -12
- package/src/vaultFactory/types-ambient.d.ts +137 -0
- package/src/vaultFactory/types-ambient.d.ts.map +1 -0
- package/src/vaultFactory/{types.js → types-ambient.js} +42 -42
- package/src/vaultFactory/vault.d.ts +343 -0
- package/src/vaultFactory/vault.d.ts.map +1 -0
- package/src/vaultFactory/vault.js +105 -99
- package/src/vaultFactory/vaultDirector.d.ts +341 -0
- package/src/vaultFactory/vaultDirector.d.ts.map +1 -0
- package/src/vaultFactory/vaultDirector.js +86 -64
- package/src/vaultFactory/vaultFactory.d.ts +202 -0
- package/src/vaultFactory/vaultFactory.d.ts.map +1 -0
- package/src/vaultFactory/vaultFactory.js +52 -33
- package/src/vaultFactory/vaultHolder.d.ts +126 -0
- package/src/vaultFactory/vaultHolder.d.ts.map +1 -0
- package/src/vaultFactory/vaultHolder.js +11 -16
- package/src/vaultFactory/vaultKit.d.ts +32 -0
- package/src/vaultFactory/vaultKit.d.ts.map +1 -0
- package/src/vaultFactory/vaultKit.js +5 -4
- package/src/vaultFactory/vaultManager.d.ts +674 -0
- package/src/vaultFactory/vaultManager.d.ts.map +1 -0
- package/src/vaultFactory/vaultManager.js +257 -158
- package/CHANGELOG.md +0 -1041
- package/exported.js +0 -2
- package/scripts/add-collateral-core.js +0 -112
- package/scripts/deploy-contracts.js +0 -100
- package/scripts/init-core.js +0 -198
- package/scripts/invite-committee-core.js +0 -42
- package/scripts/manual-price-feed.js +0 -117
- package/scripts/price-feed-core.js +0 -104
- package/scripts/start-local-chain.sh +0 -84
- package/src/psm/types.js +0 -3
- package/src/typeGuards.js +0 -13
- package/src/vaultFactory/type-imports.js +0 -4
package/exported.js
DELETED
|
@@ -1,112 +0,0 @@
|
|
|
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
|
-
};
|
|
@@ -1,100 +0,0 @@
|
|
|
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
|
-
};
|
package/scripts/init-core.js
DELETED
|
@@ -1,198 +0,0 @@
|
|
|
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
|
-
};
|
|
@@ -1,42 +0,0 @@
|
|
|
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
|
-
};
|
|
@@ -1,117 +0,0 @@
|
|
|
1
|
-
import { E } from '@endo/far';
|
|
2
|
-
import { deeplyFulfilled } from '@endo/marshal';
|
|
3
|
-
import { makeNotifierFromAsyncIterable } from '@agoric/notifier';
|
|
4
|
-
|
|
5
|
-
import process from 'process';
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* After extracting the oracleAdmins to entries in home.scratch, you can use one
|
|
9
|
-
* from the REPL like:
|
|
10
|
-
*
|
|
11
|
-
* lookup('agoricNames', 'oracleBrand', 'ATOM').then(brand => atom = brand)
|
|
12
|
-
* -> [Object Alleged: ATOM brand]{}
|
|
13
|
-
* lookup('agoricNames', 'oracleBrand', 'USD').then(brand => usd = brand)
|
|
14
|
-
* -> [Object Alleged: USD brand]{}
|
|
15
|
-
* pa = home.priceAuthority
|
|
16
|
-
* -> [Object Alleged: PriceAuthority]{}
|
|
17
|
-
* qn = E(pa).makeQuoteNotifier({ value: 1n * 10n ** 6n, brand: atom }, usd)
|
|
18
|
-
* -> [Object Alleged: QuoteNotifier]{}
|
|
19
|
-
* oa = E(home.scratch).get("offerResult unknown#1652669688625")
|
|
20
|
-
* -> [Object Alleged: OracleAdmin]{}
|
|
21
|
-
* E(oa).pushResult('19.37')
|
|
22
|
-
* E(qn).getUpdateSince()
|
|
23
|
-
*
|
|
24
|
-
* @typedef {{ board: import('@agoric/vats').Board, chainTimerService, scratch, zoe }} Home
|
|
25
|
-
* @param {Promise<Home>} homePromise
|
|
26
|
-
* @param {object} root0
|
|
27
|
-
* @param {(...path: string[]) => Promise<any>} root0.lookup
|
|
28
|
-
* A promise for the references available from REPL home
|
|
29
|
-
*/
|
|
30
|
-
export default async function priceAuthorityFromNotifier(
|
|
31
|
-
homePromise,
|
|
32
|
-
{ lookup },
|
|
33
|
-
) {
|
|
34
|
-
const { AGGREGATOR_INSTANCE_LOOKUP } = process.env;
|
|
35
|
-
|
|
36
|
-
// Let's wait for the promise to resolve.
|
|
37
|
-
const home = await deeplyFulfilled(homePromise);
|
|
38
|
-
|
|
39
|
-
let aggregatorInstance;
|
|
40
|
-
if (AGGREGATOR_INSTANCE_LOOKUP) {
|
|
41
|
-
aggregatorInstance = await lookup(JSON.parse(AGGREGATOR_INSTANCE_LOOKUP));
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
if (!aggregatorInstance) {
|
|
45
|
-
console.log('Autodetecting aggregator instance...');
|
|
46
|
-
const purse = E(home.wallet).getPurse('Default Zoe invite purse');
|
|
47
|
-
const { value } = await E(purse).getCurrentAmount();
|
|
48
|
-
const invitations = value.filter(
|
|
49
|
-
({ description }) => description === 'oracle invitation',
|
|
50
|
-
);
|
|
51
|
-
if (invitations.length > 1) {
|
|
52
|
-
console.error('Multiple oracle invitations found', invitations);
|
|
53
|
-
throw Error('You need an AGGREGATOR_INSTANCE_LOOKUP to disambiguate');
|
|
54
|
-
}
|
|
55
|
-
if (invitations.length === 0) {
|
|
56
|
-
console.error(
|
|
57
|
-
'No oracle invitations found; you may need an AGGREGATOR_INSTANCE_LOOKUP',
|
|
58
|
-
);
|
|
59
|
-
} else {
|
|
60
|
-
console.log('Found oracle invitation', invitations);
|
|
61
|
-
aggregatorInstance = invitations[0].instance;
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
if (!aggregatorInstance) {
|
|
66
|
-
return;
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
const offer = {
|
|
70
|
-
id: Date.now(),
|
|
71
|
-
proposalTemplate: {},
|
|
72
|
-
invitationQuery: {
|
|
73
|
-
description: 'oracle invitation',
|
|
74
|
-
instance: aggregatorInstance,
|
|
75
|
-
},
|
|
76
|
-
};
|
|
77
|
-
|
|
78
|
-
console.log('Getting wallet bridge...');
|
|
79
|
-
const bridge = await E(home.wallet).getBridge();
|
|
80
|
-
|
|
81
|
-
// Consume an aggregator invitation for this instance.
|
|
82
|
-
await E(bridge)
|
|
83
|
-
.addOffer(offer)
|
|
84
|
-
.then(
|
|
85
|
-
() =>
|
|
86
|
-
console.log(
|
|
87
|
-
`Please approve your wallet's proposal to connect the aggregator ${aggregatorInstance}...`,
|
|
88
|
-
),
|
|
89
|
-
() => {},
|
|
90
|
-
);
|
|
91
|
-
|
|
92
|
-
const walletAdmin = E(home.wallet).getAdminFacet();
|
|
93
|
-
|
|
94
|
-
console.log('=====================================================');
|
|
95
|
-
console.log('=== Extracting oracleAdmins from price feed offers...');
|
|
96
|
-
console.log('=== Control-C to cancel');
|
|
97
|
-
const offerIt = E(walletAdmin).getOffersNotifier();
|
|
98
|
-
for await (const offers of makeNotifierFromAsyncIterable(offerIt)) {
|
|
99
|
-
// console.log(offers);
|
|
100
|
-
offers
|
|
101
|
-
.filter(
|
|
102
|
-
({ status, invitationQuery: { instance } }) =>
|
|
103
|
-
status === 'complete' && instance === aggregatorInstance,
|
|
104
|
-
)
|
|
105
|
-
.forEach(async ({ id }) => {
|
|
106
|
-
const orKey = `offerResult ${id}`;
|
|
107
|
-
await E(home.scratch).set(
|
|
108
|
-
orKey,
|
|
109
|
-
E(home.wallet).lookup('offerResult', id),
|
|
110
|
-
);
|
|
111
|
-
console.log(
|
|
112
|
-
'Use this oracleAdmin:',
|
|
113
|
-
`E(home.scratch).get(${JSON.stringify(orKey)})`,
|
|
114
|
-
);
|
|
115
|
-
});
|
|
116
|
-
}
|
|
117
|
-
}
|
|
@@ -1,104 +0,0 @@
|
|
|
1
|
-
/* global process */
|
|
2
|
-
import { makeHelpers } from '@agoric/deploy-script-support';
|
|
3
|
-
|
|
4
|
-
const DEFAULT_CONTRACT_TERMS = {
|
|
5
|
-
POLL_INTERVAL: 30n,
|
|
6
|
-
maxSubmissionCount: 1000,
|
|
7
|
-
minSubmissionCount: 2,
|
|
8
|
-
restartDelay: 1, // the number of rounds an Oracle has to wait before they can initiate another round
|
|
9
|
-
timeout: 10, // in seconds according to chainTimerService
|
|
10
|
-
minSubmissionValue: 1n,
|
|
11
|
-
maxSubmissionValue: 2n ** 256n,
|
|
12
|
-
};
|
|
13
|
-
|
|
14
|
-
/** @type {import('@agoric/deploy-script-support/src/externalTypes.js').ProposalBuilder} */
|
|
15
|
-
export const defaultProposalBuilder = async (
|
|
16
|
-
{ publishRef, install },
|
|
17
|
-
options = {},
|
|
18
|
-
) => {
|
|
19
|
-
const {
|
|
20
|
-
brandIn,
|
|
21
|
-
brandOut,
|
|
22
|
-
contractTerms = DEFAULT_CONTRACT_TERMS,
|
|
23
|
-
AGORIC_INSTANCE_NAME,
|
|
24
|
-
IN_BRAND_LOOKUP,
|
|
25
|
-
OUT_BRAND_LOOKUP,
|
|
26
|
-
IN_BRAND_NAME = IN_BRAND_LOOKUP[IN_BRAND_LOOKUP.length - 1],
|
|
27
|
-
OUT_BRAND_NAME = OUT_BRAND_LOOKUP[OUT_BRAND_LOOKUP.length - 1],
|
|
28
|
-
oracleAddresses,
|
|
29
|
-
...optionsRest
|
|
30
|
-
} = options;
|
|
31
|
-
|
|
32
|
-
assert(AGORIC_INSTANCE_NAME, 'AGORIC_INSTANCE_NAME is required');
|
|
33
|
-
assert(Array.isArray(oracleAddresses), 'oracleAddresses array is required');
|
|
34
|
-
|
|
35
|
-
if (!brandIn) {
|
|
36
|
-
assert.equal(IN_BRAND_LOOKUP[0], 'agoricNames');
|
|
37
|
-
assert(IN_BRAND_NAME);
|
|
38
|
-
}
|
|
39
|
-
if (!brandOut) {
|
|
40
|
-
assert.equal(OUT_BRAND_LOOKUP[0], 'agoricNames');
|
|
41
|
-
assert(OUT_BRAND_NAME);
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
return harden({
|
|
45
|
-
sourceSpec: '../src/proposals/price-feed-proposal.js',
|
|
46
|
-
getManifestCall: [
|
|
47
|
-
'getManifestForPriceFeed',
|
|
48
|
-
{
|
|
49
|
-
...optionsRest,
|
|
50
|
-
AGORIC_INSTANCE_NAME,
|
|
51
|
-
contractTerms,
|
|
52
|
-
oracleAddresses,
|
|
53
|
-
IN_BRAND_LOOKUP,
|
|
54
|
-
OUT_BRAND_LOOKUP,
|
|
55
|
-
IN_BRAND_NAME,
|
|
56
|
-
OUT_BRAND_NAME,
|
|
57
|
-
brandInRef: brandIn && publishRef(brandIn),
|
|
58
|
-
brandOutRef: brandOut && publishRef(brandOut),
|
|
59
|
-
priceAggregatorRef: publishRef(
|
|
60
|
-
install(
|
|
61
|
-
'@agoric/inter-protocol/src/price/fluxAggregatorContract.js',
|
|
62
|
-
'../bundles/bundle-fluxAggregatorKit.js',
|
|
63
|
-
),
|
|
64
|
-
),
|
|
65
|
-
},
|
|
66
|
-
],
|
|
67
|
-
});
|
|
68
|
-
};
|
|
69
|
-
|
|
70
|
-
export const createGov = async (homeP, endowments) => {
|
|
71
|
-
const { lookup } = endowments;
|
|
72
|
-
|
|
73
|
-
const {
|
|
74
|
-
AGORIC_INSTANCE_NAME,
|
|
75
|
-
IN_BRAND_DECIMALS = '6',
|
|
76
|
-
IN_BRAND_LOOKUP = JSON.stringify(['wallet', 'brand', 'BLD']),
|
|
77
|
-
OUT_BRAND_DECIMALS = '6',
|
|
78
|
-
OUT_BRAND_LOOKUP = JSON.stringify(['agoricNames', 'oracleBrand', 'USD']),
|
|
79
|
-
ORACLE_ADDRESSES,
|
|
80
|
-
} = process.env;
|
|
81
|
-
|
|
82
|
-
assert(AGORIC_INSTANCE_NAME, 'AGORIC_INSTANCE_NAME is required');
|
|
83
|
-
assert(ORACLE_ADDRESSES, 'ORACLE_ADDRESSES is required');
|
|
84
|
-
|
|
85
|
-
const oracleAddresses = ORACLE_ADDRESSES.split(',');
|
|
86
|
-
|
|
87
|
-
const { writeCoreProposal } = await makeHelpers(homeP, endowments);
|
|
88
|
-
|
|
89
|
-
const inLookup = JSON.parse(IN_BRAND_LOOKUP);
|
|
90
|
-
const outLookup = JSON.parse(OUT_BRAND_LOOKUP);
|
|
91
|
-
|
|
92
|
-
const proposalBuilder = powers =>
|
|
93
|
-
defaultProposalBuilder(powers, {
|
|
94
|
-
AGORIC_INSTANCE_NAME,
|
|
95
|
-
IN_BRAND_DECIMALS: parseInt(IN_BRAND_DECIMALS, 10),
|
|
96
|
-
OUT_BRAND_DECIMALS: parseInt(OUT_BRAND_DECIMALS, 10),
|
|
97
|
-
oracleAddresses,
|
|
98
|
-
brandIn: lookup(inLookup).catch(() => undefined),
|
|
99
|
-
brandOut: lookup(outLookup).catch(() => undefined),
|
|
100
|
-
});
|
|
101
|
-
await writeCoreProposal('gov-price-feed', proposalBuilder); // gov-price-feed.js gov-price-feed-permit.json
|
|
102
|
-
};
|
|
103
|
-
|
|
104
|
-
export default createGov;
|