@agoric/inter-protocol 0.16.2-dev-1cd6408.0 → 0.16.2-dev-2a16ddd.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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@agoric/inter-protocol",
|
|
3
|
-
"version": "0.16.2-dev-
|
|
3
|
+
"version": "0.16.2-dev-2a16ddd.0+2a16ddd",
|
|
4
4
|
"description": "Core cryptoeconomy contracts",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "src/index.js",
|
|
@@ -31,16 +31,16 @@
|
|
|
31
31
|
},
|
|
32
32
|
"homepage": "https://github.com/Agoric/agoric-sdk#readme",
|
|
33
33
|
"dependencies": {
|
|
34
|
-
"@agoric/assert": "0.6.1-dev-
|
|
35
|
-
"@agoric/ertp": "0.16.3-dev-
|
|
36
|
-
"@agoric/governance": "0.10.4-dev-
|
|
37
|
-
"@agoric/internal": "0.3.3-dev-
|
|
38
|
-
"@agoric/notifier": "0.6.3-dev-
|
|
39
|
-
"@agoric/store": "0.9.3-dev-
|
|
40
|
-
"@agoric/time": "0.3.3-dev-
|
|
41
|
-
"@agoric/vat-data": "0.5.3-dev-
|
|
42
|
-
"@agoric/vats": "0.15.2-dev-
|
|
43
|
-
"@agoric/zoe": "0.26.3-dev-
|
|
34
|
+
"@agoric/assert": "0.6.1-dev-2a16ddd.0+2a16ddd",
|
|
35
|
+
"@agoric/ertp": "0.16.3-dev-2a16ddd.0+2a16ddd",
|
|
36
|
+
"@agoric/governance": "0.10.4-dev-2a16ddd.0+2a16ddd",
|
|
37
|
+
"@agoric/internal": "0.3.3-dev-2a16ddd.0+2a16ddd",
|
|
38
|
+
"@agoric/notifier": "0.6.3-dev-2a16ddd.0+2a16ddd",
|
|
39
|
+
"@agoric/store": "0.9.3-dev-2a16ddd.0+2a16ddd",
|
|
40
|
+
"@agoric/time": "0.3.3-dev-2a16ddd.0+2a16ddd",
|
|
41
|
+
"@agoric/vat-data": "0.5.3-dev-2a16ddd.0+2a16ddd",
|
|
42
|
+
"@agoric/vats": "0.15.2-dev-2a16ddd.0+2a16ddd",
|
|
43
|
+
"@agoric/zoe": "0.26.3-dev-2a16ddd.0+2a16ddd",
|
|
44
44
|
"@endo/captp": "^4.0.4",
|
|
45
45
|
"@endo/eventual-send": "^1.1.2",
|
|
46
46
|
"@endo/far": "^1.0.4",
|
|
@@ -50,10 +50,10 @@
|
|
|
50
50
|
"jessie.js": "^0.3.2"
|
|
51
51
|
},
|
|
52
52
|
"devDependencies": {
|
|
53
|
-
"@agoric/smart-wallet": "0.5.4-dev-
|
|
54
|
-
"@agoric/swingset-liveslots": "0.10.3-dev-
|
|
55
|
-
"@agoric/swingset-vat": "0.32.3-dev-
|
|
56
|
-
"@agoric/zone": "0.2.3-dev-
|
|
53
|
+
"@agoric/smart-wallet": "0.5.4-dev-2a16ddd.0+2a16ddd",
|
|
54
|
+
"@agoric/swingset-liveslots": "0.10.3-dev-2a16ddd.0+2a16ddd",
|
|
55
|
+
"@agoric/swingset-vat": "0.32.3-dev-2a16ddd.0+2a16ddd",
|
|
56
|
+
"@agoric/zone": "0.2.3-dev-2a16ddd.0+2a16ddd",
|
|
57
57
|
"@endo/bundle-source": "^3.1.0",
|
|
58
58
|
"@endo/init": "^1.0.4",
|
|
59
59
|
"@endo/promise-kit": "^1.0.4",
|
|
@@ -85,5 +85,5 @@
|
|
|
85
85
|
"typeCoverage": {
|
|
86
86
|
"atLeast": 95.9
|
|
87
87
|
},
|
|
88
|
-
"gitHead": "
|
|
88
|
+
"gitHead": "2a16ddd09a7e81241548e7a29e13c41cae065709"
|
|
89
89
|
}
|
|
@@ -4,7 +4,7 @@ export function ensureOracleBrands({ namedVat: { consume: { agoricNames }, }, or
|
|
|
4
4
|
priceFeedOptions: PriceFeedOptions;
|
|
5
5
|
};
|
|
6
6
|
}): Promise<[Brand<'nat'>, Brand<'nat'>]>;
|
|
7
|
-
export function createPriceFeed({ consume: { agoricNamesAdmin, board, chainStorage, chainTimerService, client, econCharterKit, highPrioritySendersManager, namesByAddressAdmin, priceAuthority, priceAuthorityAdmin, startGovernedUpgradable, }, instance: { produce: produceInstance }, }: ChainBootstrapSpace, { options: { priceFeedOptions: { AGORIC_INSTANCE_NAME, oracleAddresses, contractTerms, IN_BRAND_NAME, OUT_BRAND_NAME, }, }, }: {
|
|
7
|
+
export function createPriceFeed({ consume: { agoricNamesAdmin, board, chainStorage, chainTimerService, client, econCharterKit, highPrioritySendersManager, namesByAddressAdmin, priceAuthority, priceAuthorityAdmin, startGovernedUpgradable, zoe, }, instance: { produce: produceInstance }, }: ChainBootstrapSpace, { options: { priceFeedOptions: { AGORIC_INSTANCE_NAME, oracleAddresses, contractTerms, IN_BRAND_NAME, OUT_BRAND_NAME, priceAggregatorRef, }, }, }: {
|
|
8
8
|
options: {
|
|
9
9
|
priceFeedOptions: {
|
|
10
10
|
AGORIC_INSTANCE_NAME: string;
|
|
@@ -12,6 +12,7 @@ export function createPriceFeed({ consume: { agoricNamesAdmin, board, chainStora
|
|
|
12
12
|
contractTerms: import('@agoric/inter-protocol/src/price/fluxAggregatorKit.js').ChainlinkConfig;
|
|
13
13
|
IN_BRAND_NAME: string;
|
|
14
14
|
OUT_BRAND_NAME: string;
|
|
15
|
+
priceAggregatorRef: Installation;
|
|
15
16
|
};
|
|
16
17
|
};
|
|
17
18
|
}): Promise<void>;
|
|
@@ -32,6 +33,7 @@ export function getManifestForPriceFeed({ restoreRef }: {
|
|
|
32
33
|
priceAuthority: string;
|
|
33
34
|
priceAuthorityAdmin: string;
|
|
34
35
|
startGovernedUpgradable: string;
|
|
36
|
+
zoe: string;
|
|
35
37
|
};
|
|
36
38
|
instance: {
|
|
37
39
|
produce: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"price-feed-proposal.d.ts","sourceRoot":"","sources":["price-feed-proposal.js"],"names":[],"mappings":";AA6CO,+HAJI,m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AC9B,cAAkB,EAAE,MAAM,CAAC;IAC3B,kBAAsB,EAAE,MAAM,CAAC;CAC5B;oCAtBG,YAAY"}
|
|
@@ -63,8 +63,6 @@ export const ensureOracleBrands = async (
|
|
|
63
63
|
},
|
|
64
64
|
},
|
|
65
65
|
) => {
|
|
66
|
-
trace('ensureOracleBrands');
|
|
67
|
-
|
|
68
66
|
const updateFreshBrand = async (brand, name, decimals) => {
|
|
69
67
|
let b = await brand;
|
|
70
68
|
if (!b) {
|
|
@@ -93,6 +91,7 @@ export const ensureOracleBrands = async (
|
|
|
93
91
|
* contractTerms: import('@agoric/inter-protocol/src/price/fluxAggregatorKit.js').ChainlinkConfig;
|
|
94
92
|
* IN_BRAND_NAME: string;
|
|
95
93
|
* OUT_BRAND_NAME: string;
|
|
94
|
+
* priceAggregatorRef: Installation;
|
|
96
95
|
* };
|
|
97
96
|
* };
|
|
98
97
|
* }} config
|
|
@@ -111,6 +110,7 @@ export const createPriceFeed = async (
|
|
|
111
110
|
priceAuthority,
|
|
112
111
|
priceAuthorityAdmin,
|
|
113
112
|
startGovernedUpgradable,
|
|
113
|
+
zoe,
|
|
114
114
|
},
|
|
115
115
|
instance: { produce: produceInstance },
|
|
116
116
|
},
|
|
@@ -122,38 +122,62 @@ export const createPriceFeed = async (
|
|
|
122
122
|
contractTerms,
|
|
123
123
|
IN_BRAND_NAME,
|
|
124
124
|
OUT_BRAND_NAME,
|
|
125
|
+
priceAggregatorRef,
|
|
125
126
|
},
|
|
126
127
|
},
|
|
127
128
|
},
|
|
128
129
|
) => {
|
|
129
|
-
trace('createPriceFeed');
|
|
130
|
+
trace('createPriceFeed', AGORIC_INSTANCE_NAME);
|
|
130
131
|
const STORAGE_PATH = 'priceFeed';
|
|
131
132
|
|
|
132
133
|
void E(client).assignBundle([_addr => ({ priceAuthority })]);
|
|
133
134
|
|
|
134
|
-
|
|
135
|
+
let installationP;
|
|
136
|
+
await null;
|
|
137
|
+
if (priceAggregatorRef) {
|
|
138
|
+
const bundleID = await E.get(priceAggregatorRef).bundleID;
|
|
139
|
+
if (bundleID) {
|
|
140
|
+
installationP = E(zoe).installBundleID(bundleID);
|
|
141
|
+
await E.when(
|
|
142
|
+
installationP,
|
|
143
|
+
installation =>
|
|
144
|
+
E(E(agoricNamesAdmin).lookupAdmin('installation')).update(
|
|
145
|
+
'priceAggregator',
|
|
146
|
+
installation,
|
|
147
|
+
),
|
|
148
|
+
err =>
|
|
149
|
+
console.error(
|
|
150
|
+
`🚨 failed to update priceAggregator instance for ${AGORIC_INSTANCE_NAME}`,
|
|
151
|
+
err,
|
|
152
|
+
),
|
|
153
|
+
);
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
if (!installationP) {
|
|
157
|
+
installationP = E.get(
|
|
158
|
+
reserveThenGetNames(E(agoricNamesAdmin).lookupAdmin('installation'), [
|
|
159
|
+
'priceAggregator',
|
|
160
|
+
]),
|
|
161
|
+
)[0];
|
|
162
|
+
console.error(
|
|
163
|
+
'🚨 failed to install new fluxAggregator bundle, reusing previous one.',
|
|
164
|
+
);
|
|
165
|
+
}
|
|
135
166
|
|
|
136
167
|
/**
|
|
137
|
-
* Values come from economy-template.json, which at this writing had IN:ATOM,
|
|
138
|
-
* OUT:USD
|
|
139
|
-
*
|
|
140
168
|
* @type {[
|
|
141
169
|
* [Brand<'nat'>, Brand<'nat'>],
|
|
142
|
-
* [
|
|
143
|
-
*
|
|
144
|
-
* import('@agoric/inter-protocol/src/price/fluxAggregatorContract.js')['start]
|
|
145
|
-
* >,
|
|
146
|
-
* ],
|
|
170
|
+
* Installation<import('@agoric/inter-protocol/src/price/fluxAggregatorContract.js')['start]>,
|
|
171
|
+
* Timer,
|
|
147
172
|
* ]}
|
|
148
173
|
*/
|
|
149
|
-
const [[brandIn, brandOut],
|
|
174
|
+
const [[brandIn, brandOut], installation, timer] = await Promise.all([
|
|
150
175
|
reserveThenGetNames(E(agoricNamesAdmin).lookupAdmin('oracleBrand'), [
|
|
151
176
|
IN_BRAND_NAME,
|
|
152
177
|
OUT_BRAND_NAME,
|
|
153
178
|
]),
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
]),
|
|
179
|
+
installationP,
|
|
180
|
+
chainTimerService,
|
|
157
181
|
]);
|
|
158
182
|
|
|
159
183
|
const unitAmountIn = await unitAmount(brandIn);
|
|
@@ -165,14 +189,11 @@ export const createPriceFeed = async (
|
|
|
165
189
|
timer,
|
|
166
190
|
unitAmountIn,
|
|
167
191
|
});
|
|
168
|
-
trace('got terms');
|
|
169
|
-
|
|
170
192
|
const label = sanitizePathSegment(AGORIC_INSTANCE_NAME);
|
|
171
193
|
|
|
172
194
|
const storageNode = await makeStorageNodeChild(chainStorage, STORAGE_PATH);
|
|
173
195
|
const marshaller = await E(board).getReadonlyMarshaller();
|
|
174
196
|
|
|
175
|
-
trace('awaiting startInstance');
|
|
176
197
|
const faKit = await E(startGovernedUpgradable)({
|
|
177
198
|
governedParams: {},
|
|
178
199
|
privateArgs: {
|
|
@@ -183,7 +204,7 @@ export const createPriceFeed = async (
|
|
|
183
204
|
},
|
|
184
205
|
terms,
|
|
185
206
|
label,
|
|
186
|
-
installation
|
|
207
|
+
installation,
|
|
187
208
|
});
|
|
188
209
|
|
|
189
210
|
// Publish price feed in home.priceAuthority.
|
|
@@ -203,6 +224,7 @@ export const createPriceFeed = async (
|
|
|
203
224
|
.catch(err =>
|
|
204
225
|
console.error(`🚨 failed to update ${AGORIC_INSTANCE_NAME}`, err),
|
|
205
226
|
);
|
|
227
|
+
|
|
206
228
|
// being after the above awaits means that when this resolves, the consumer
|
|
207
229
|
// gets notified that the authority is in the registry and its instance is in
|
|
208
230
|
// agoricNames.
|
|
@@ -213,7 +235,6 @@ export const createPriceFeed = async (
|
|
|
213
235
|
faKit.governorCreatorFacet,
|
|
214
236
|
AGORIC_INSTANCE_NAME,
|
|
215
237
|
);
|
|
216
|
-
trace('registered', AGORIC_INSTANCE_NAME, faKit.instance);
|
|
217
238
|
|
|
218
239
|
/**
|
|
219
240
|
* Initialize a new oracle and send an invitation to administer it.
|
|
@@ -262,6 +283,7 @@ export const getManifestForPriceFeed = async (
|
|
|
262
283
|
priceAuthority: t,
|
|
263
284
|
priceAuthorityAdmin: t,
|
|
264
285
|
startGovernedUpgradable: t,
|
|
286
|
+
zoe: t,
|
|
265
287
|
},
|
|
266
288
|
instance: {
|
|
267
289
|
produce: t,
|