@agoric/fast-usdc 0.1.1-dev-34f026b.0 → 0.1.1-dev-945fef1.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 +14 -14
- package/src/fast-usdc.contract.js +46 -7
- package/src/fast-usdc.start.js +5 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@agoric/fast-usdc",
|
|
3
|
-
"version": "0.1.1-dev-
|
|
3
|
+
"version": "0.1.1-dev-945fef1.0+945fef1",
|
|
4
4
|
"description": "CLI and library for Fast USDC product",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"files": [
|
|
@@ -22,9 +22,9 @@
|
|
|
22
22
|
"lint:eslint": "eslint ."
|
|
23
23
|
},
|
|
24
24
|
"devDependencies": {
|
|
25
|
-
"@agoric/swingset-liveslots": "0.10.3-dev-
|
|
26
|
-
"@agoric/vats": "0.15.2-dev-
|
|
27
|
-
"@agoric/zone": "0.2.3-dev-
|
|
25
|
+
"@agoric/swingset-liveslots": "0.10.3-dev-945fef1.0+945fef1",
|
|
26
|
+
"@agoric/vats": "0.15.2-dev-945fef1.0+945fef1",
|
|
27
|
+
"@agoric/zone": "0.2.3-dev-945fef1.0+945fef1",
|
|
28
28
|
"@fast-check/ava": "^2.0.1",
|
|
29
29
|
"ava": "^5.3.0",
|
|
30
30
|
"c8": "^10.1.2",
|
|
@@ -32,15 +32,15 @@
|
|
|
32
32
|
"ts-blank-space": "^0.4.4"
|
|
33
33
|
},
|
|
34
34
|
"dependencies": {
|
|
35
|
-
"@agoric/client-utils": "0.1.1-dev-
|
|
36
|
-
"@agoric/ertp": "0.16.3-dev-
|
|
37
|
-
"@agoric/internal": "0.3.3-dev-
|
|
38
|
-
"@agoric/notifier": "0.6.3-dev-
|
|
39
|
-
"@agoric/orchestration": "0.1.1-dev-
|
|
40
|
-
"@agoric/store": "0.9.3-dev-
|
|
41
|
-
"@agoric/vat-data": "0.5.3-dev-
|
|
42
|
-
"@agoric/vow": "0.1.1-dev-
|
|
43
|
-
"@agoric/zoe": "0.26.3-dev-
|
|
35
|
+
"@agoric/client-utils": "0.1.1-dev-945fef1.0+945fef1",
|
|
36
|
+
"@agoric/ertp": "0.16.3-dev-945fef1.0+945fef1",
|
|
37
|
+
"@agoric/internal": "0.3.3-dev-945fef1.0+945fef1",
|
|
38
|
+
"@agoric/notifier": "0.6.3-dev-945fef1.0+945fef1",
|
|
39
|
+
"@agoric/orchestration": "0.1.1-dev-945fef1.0+945fef1",
|
|
40
|
+
"@agoric/store": "0.9.3-dev-945fef1.0+945fef1",
|
|
41
|
+
"@agoric/vat-data": "0.5.3-dev-945fef1.0+945fef1",
|
|
42
|
+
"@agoric/vow": "0.1.1-dev-945fef1.0+945fef1",
|
|
43
|
+
"@agoric/zoe": "0.26.3-dev-945fef1.0+945fef1",
|
|
44
44
|
"@cosmjs/proto-signing": "^0.32.4",
|
|
45
45
|
"@cosmjs/stargate": "^0.32.4",
|
|
46
46
|
"@endo/base64": "^1.0.9",
|
|
@@ -80,5 +80,5 @@
|
|
|
80
80
|
"publishConfig": {
|
|
81
81
|
"access": "public"
|
|
82
82
|
},
|
|
83
|
-
"gitHead": "
|
|
83
|
+
"gitHead": "945fef126631adbf6d14d861a2ceb2fa51f9da5c"
|
|
84
84
|
}
|
|
@@ -12,6 +12,7 @@ import {
|
|
|
12
12
|
import { makeZoeTools } from '@agoric/orchestration/src/utils/zoe-tools.js';
|
|
13
13
|
import { provideSingleton } from '@agoric/zoe/src/contractSupport/durability.js';
|
|
14
14
|
import { prepareRecorderKitMakers } from '@agoric/zoe/src/contractSupport/recorder.js';
|
|
15
|
+
import { Fail } from '@endo/errors';
|
|
15
16
|
import { E } from '@endo/far';
|
|
16
17
|
import { M } from '@endo/patterns';
|
|
17
18
|
import { prepareAdvancer } from './exos/advancer.js';
|
|
@@ -27,10 +28,11 @@ const trace = makeTracer('FastUsdc');
|
|
|
27
28
|
|
|
28
29
|
const STATUS_NODE = 'status';
|
|
29
30
|
const FEE_NODE = 'feeConfig';
|
|
31
|
+
const ADDRESSES_BAGGAGE_KEY = 'addresses';
|
|
30
32
|
|
|
31
33
|
/**
|
|
32
34
|
* @import {HostInterface} from '@agoric/async-flow';
|
|
33
|
-
* @import {CosmosChainInfo, Denom, DenomDetail, OrchestrationAccount} from '@agoric/orchestration';
|
|
35
|
+
* @import {ChainAddress, CosmosChainInfo, Denom, DenomDetail, OrchestrationAccount} from '@agoric/orchestration';
|
|
34
36
|
* @import {OrchestrationPowers, OrchestrationTools} from '@agoric/orchestration/src/utils/start-helper.js';
|
|
35
37
|
* @import {Remote} from '@agoric/internal';
|
|
36
38
|
* @import {Marshaller, StorageNode} from '@agoric/internal/src/lib-chainStorage.js'
|
|
@@ -53,10 +55,11 @@ export const meta = {
|
|
|
53
55
|
privateArgsShape: {
|
|
54
56
|
// @ts-expect-error TypedPattern not recognized as record
|
|
55
57
|
...OrchestrationPowersShape,
|
|
58
|
+
assetInfo: M.arrayOf([DenomShape, DenomDetailShape]),
|
|
59
|
+
chainInfo: M.recordOf(M.string(), CosmosChainInfoShape),
|
|
56
60
|
feeConfig: FeeConfigShape,
|
|
57
61
|
marshaller: M.remotable(),
|
|
58
|
-
|
|
59
|
-
assetInfo: M.arrayOf([DenomShape, DenomDetailShape]),
|
|
62
|
+
poolMetricsNode: M.remotable(),
|
|
60
63
|
},
|
|
61
64
|
};
|
|
62
65
|
harden(meta);
|
|
@@ -72,13 +75,25 @@ const publishFeeConfig = async (node, marshaller, feeConfig) => {
|
|
|
72
75
|
return E(feeNode).setValue(JSON.stringify(value));
|
|
73
76
|
};
|
|
74
77
|
|
|
78
|
+
/**
|
|
79
|
+
* @param {Remote<StorageNode>} contractNode
|
|
80
|
+
* @param {{
|
|
81
|
+
* poolAccount: ChainAddress['value'];
|
|
82
|
+
* settlementAccount: ChainAddress['value'];
|
|
83
|
+
* }} addresses
|
|
84
|
+
*/
|
|
85
|
+
const publishAddresses = (contractNode, addresses) => {
|
|
86
|
+
return E(contractNode).setValue(JSON.stringify(addresses));
|
|
87
|
+
};
|
|
88
|
+
|
|
75
89
|
/**
|
|
76
90
|
* @param {ZCF<FastUsdcTerms>} zcf
|
|
77
91
|
* @param {OrchestrationPowers & {
|
|
78
|
-
* marshaller: Marshaller;
|
|
79
|
-
* feeConfig: FeeConfig;
|
|
80
|
-
* chainInfo: Record<string, CosmosChainInfo>;
|
|
81
92
|
* assetInfo: [Denom, DenomDetail & { brandKey?: string}][];
|
|
93
|
+
* chainInfo: Record<string, CosmosChainInfo>;
|
|
94
|
+
* feeConfig: FeeConfig;
|
|
95
|
+
* marshaller: Marshaller;
|
|
96
|
+
* poolMetricsNode: Remote<StorageNode>;
|
|
82
97
|
* }} privateArgs
|
|
83
98
|
* @param {Zone} zone
|
|
84
99
|
* @param {OrchestrationTools} tools
|
|
@@ -160,6 +175,23 @@ export const contract = async (zcf, privateArgs, zone, tools) => {
|
|
|
160
175
|
);
|
|
161
176
|
});
|
|
162
177
|
},
|
|
178
|
+
async publishAddresses() {
|
|
179
|
+
!baggage.has(ADDRESSES_BAGGAGE_KEY) || Fail`Addresses already published`;
|
|
180
|
+
const [poolAccountAddress, settlementAccountAddress] =
|
|
181
|
+
await vowTools.when(
|
|
182
|
+
vowTools.all([
|
|
183
|
+
E(poolAccount).getAddress(),
|
|
184
|
+
E(settlementAccount).getAddress(),
|
|
185
|
+
]),
|
|
186
|
+
);
|
|
187
|
+
const addresses = harden({
|
|
188
|
+
poolAccount: poolAccountAddress.value,
|
|
189
|
+
settlementAccount: settlementAccountAddress.value,
|
|
190
|
+
});
|
|
191
|
+
baggage.init(ADDRESSES_BAGGAGE_KEY, addresses);
|
|
192
|
+
await publishAddresses(storageNode, addresses);
|
|
193
|
+
return addresses;
|
|
194
|
+
},
|
|
163
195
|
});
|
|
164
196
|
|
|
165
197
|
const publicFacet = zone.exo('Fast USDC Public', undefined, {
|
|
@@ -186,6 +218,13 @@ export const contract = async (zcf, privateArgs, zone, tools) => {
|
|
|
186
218
|
getPublicTopics() {
|
|
187
219
|
return poolKit.public.getPublicTopics();
|
|
188
220
|
},
|
|
221
|
+
getStaticInfo() {
|
|
222
|
+
baggage.has(ADDRESSES_BAGGAGE_KEY) ||
|
|
223
|
+
Fail`no addresses. creator must 'publishAddresses' first`;
|
|
224
|
+
return harden({
|
|
225
|
+
[ADDRESSES_BAGGAGE_KEY]: baggage.get(ADDRESSES_BAGGAGE_KEY),
|
|
226
|
+
});
|
|
227
|
+
},
|
|
189
228
|
});
|
|
190
229
|
|
|
191
230
|
// ^^^ Define all kinds above this line. Keep remote calls below. vvv
|
|
@@ -213,7 +252,7 @@ export const contract = async (zcf, privateArgs, zone, tools) => {
|
|
|
213
252
|
);
|
|
214
253
|
|
|
215
254
|
const poolKit = zone.makeOnce('Liquidity Pool kit', () =>
|
|
216
|
-
makeLiquidityPoolKit(shareMint, privateArgs.
|
|
255
|
+
makeLiquidityPoolKit(shareMint, privateArgs.poolMetricsNode),
|
|
217
256
|
);
|
|
218
257
|
|
|
219
258
|
/** Chain, connection, and asset info can only be registered once */
|
package/src/fast-usdc.start.js
CHANGED
|
@@ -78,6 +78,7 @@ const publishDisplayInfo = async (brand, { board, chainStorage }) => {
|
|
|
78
78
|
};
|
|
79
79
|
|
|
80
80
|
const FEED_POLICY = 'feedPolicy';
|
|
81
|
+
const POOL_METRICS = 'poolMetrics';
|
|
81
82
|
|
|
82
83
|
/**
|
|
83
84
|
* @param {ERef<StorageNode>} node
|
|
@@ -175,6 +176,7 @@ export const startFastUSDC = async (
|
|
|
175
176
|
chainStorage,
|
|
176
177
|
},
|
|
177
178
|
);
|
|
179
|
+
const poolMetricsNode = await E(storageNode).makeChildNode(POOL_METRICS);
|
|
178
180
|
|
|
179
181
|
const privateArgs = await deeplyFulfilledObject(
|
|
180
182
|
harden({
|
|
@@ -182,6 +184,7 @@ export const startFastUSDC = async (
|
|
|
182
184
|
feeConfig,
|
|
183
185
|
localchain,
|
|
184
186
|
orchestrationService: cosmosInterchainService,
|
|
187
|
+
poolMetricsNode,
|
|
185
188
|
storageNode,
|
|
186
189
|
timerService,
|
|
187
190
|
marshaller,
|
|
@@ -224,6 +227,8 @@ export const startFastUSDC = async (
|
|
|
224
227
|
produceInstance.reset();
|
|
225
228
|
produceInstance.resolve(instance);
|
|
226
229
|
|
|
230
|
+
const addresses = await E(kit.creatorFacet).publishAddresses();
|
|
231
|
+
trace('contract orch account addresses', addresses);
|
|
227
232
|
if (!net.noNoble) {
|
|
228
233
|
const addr = await E(kit.creatorFacet).connectToNoble();
|
|
229
234
|
trace('noble intermediate recipient', addr);
|