@agoric/fast-usdc 0.1.1-dev-e596a01.0 → 0.1.1-dev-ef9088c.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/cli/operator-commands.js +0 -1
- package/src/exos/advancer.js +15 -5
- package/src/exos/settler.js +9 -1
- package/src/fast-usdc.contract.js +15 -5
- package/src/fast-usdc.flows.js +10 -0
- package/src/type-guards.js +2 -3
- package/src/types.ts +0 -1
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-ef9088c.0+ef9088c",
|
|
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-ef9088c.0+ef9088c",
|
|
26
|
+
"@agoric/vats": "0.15.2-dev-ef9088c.0+ef9088c",
|
|
27
|
+
"@agoric/zone": "0.2.3-dev-ef9088c.0+ef9088c",
|
|
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.1"
|
|
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-ef9088c.0+ef9088c",
|
|
36
|
+
"@agoric/ertp": "0.16.3-dev-ef9088c.0+ef9088c",
|
|
37
|
+
"@agoric/internal": "0.3.3-dev-ef9088c.0+ef9088c",
|
|
38
|
+
"@agoric/notifier": "0.6.3-dev-ef9088c.0+ef9088c",
|
|
39
|
+
"@agoric/orchestration": "0.1.1-dev-ef9088c.0+ef9088c",
|
|
40
|
+
"@agoric/store": "0.9.3-dev-ef9088c.0+ef9088c",
|
|
41
|
+
"@agoric/vat-data": "0.5.3-dev-ef9088c.0+ef9088c",
|
|
42
|
+
"@agoric/vow": "0.1.1-dev-ef9088c.0+ef9088c",
|
|
43
|
+
"@agoric/zoe": "0.26.3-dev-ef9088c.0+ef9088c",
|
|
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": "ef9088ccf090a4cc7d4090a73af422b5a2640ca9"
|
|
84
84
|
}
|
|
@@ -85,7 +85,6 @@ export const addOperatorCommands = (
|
|
|
85
85
|
.requiredOption('--recipientAddress <string>', 'bech32 address', String)
|
|
86
86
|
.requiredOption('--blockHash <0xhex>', 'hex hash', parseHex)
|
|
87
87
|
.requiredOption('--blockNumber <number>', 'number', parseNat)
|
|
88
|
-
.requiredOption('--blockTimestamp <number>', 'number', parseNat)
|
|
89
88
|
.requiredOption('--chainId <string>', 'chain id', Number)
|
|
90
89
|
.requiredOption('--amount <number>', 'number', parseNat)
|
|
91
90
|
.requiredOption('--forwardingAddress <string>', 'bech32 address', String)
|
package/src/exos/advancer.js
CHANGED
|
@@ -116,6 +116,7 @@ export const prepareAdvancerKit = (
|
|
|
116
116
|
* notifyFacet: import('./settler.js').SettlerKit['notify'];
|
|
117
117
|
* borrowerFacet: LiquidityPoolKit['borrower'];
|
|
118
118
|
* poolAccount: HostInterface<OrchestrationAccount<{chainId: 'agoric'}>>;
|
|
119
|
+
* intermediateRecipient: ChainAddress;
|
|
119
120
|
* }} config
|
|
120
121
|
*/
|
|
121
122
|
config => harden(config),
|
|
@@ -187,12 +188,20 @@ export const prepareAdvancerKit = (
|
|
|
187
188
|
* @param {AdvancerVowCtx & { tmpSeat: ZCFSeat }} ctx
|
|
188
189
|
*/
|
|
189
190
|
onFulfilled(result, ctx) {
|
|
190
|
-
const { poolAccount } = this.state;
|
|
191
|
+
const { poolAccount, intermediateRecipient } = this.state;
|
|
191
192
|
const { destination, advanceAmount, ...detail } = ctx;
|
|
192
|
-
const transferV = E(poolAccount).transfer(
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
193
|
+
const transferV = E(poolAccount).transfer(
|
|
194
|
+
destination,
|
|
195
|
+
{
|
|
196
|
+
denom: usdc.denom,
|
|
197
|
+
value: advanceAmount.value,
|
|
198
|
+
},
|
|
199
|
+
{
|
|
200
|
+
forwardOpts: {
|
|
201
|
+
intermediateRecipient,
|
|
202
|
+
},
|
|
203
|
+
},
|
|
204
|
+
);
|
|
196
205
|
return watch(transferV, this.facets.transferHandler, {
|
|
197
206
|
destination,
|
|
198
207
|
advanceAmount,
|
|
@@ -250,6 +259,7 @@ export const prepareAdvancerKit = (
|
|
|
250
259
|
notifyFacet: M.remotable(),
|
|
251
260
|
borrowerFacet: M.remotable(),
|
|
252
261
|
poolAccount: M.remotable(),
|
|
262
|
+
intermediateRecipient: ChainAddressShape,
|
|
253
263
|
}),
|
|
254
264
|
},
|
|
255
265
|
);
|
package/src/exos/settler.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { AmountMath } from '@agoric/ertp';
|
|
2
2
|
import { assertAllDefined, makeTracer } from '@agoric/internal';
|
|
3
|
+
import { ChainAddressShape } from '@agoric/orchestration';
|
|
3
4
|
import { atob } from '@endo/base64';
|
|
4
5
|
import { E } from '@endo/far';
|
|
5
6
|
import { M } from '@endo/patterns';
|
|
@@ -93,6 +94,7 @@ export const prepareSettler = (
|
|
|
93
94
|
* remoteDenom: Denom;
|
|
94
95
|
* repayer: LiquidityPoolKit['repayer'];
|
|
95
96
|
* settlementAccount: HostInterface<OrchestrationAccount<{ chainId: 'agoric' }>>
|
|
97
|
+
* intermediateRecipient: ChainAddress;
|
|
96
98
|
* }} config
|
|
97
99
|
*/
|
|
98
100
|
config => {
|
|
@@ -255,7 +257,7 @@ export const prepareSettler = (
|
|
|
255
257
|
* @param {string} EUD
|
|
256
258
|
*/
|
|
257
259
|
forward(txHash, sender, fullValue, EUD) {
|
|
258
|
-
const { settlementAccount } = this.state;
|
|
260
|
+
const { settlementAccount, intermediateRecipient } = this.state;
|
|
259
261
|
|
|
260
262
|
const dest = chainHub.makeChainAddress(EUD);
|
|
261
263
|
|
|
@@ -263,6 +265,11 @@ export const prepareSettler = (
|
|
|
263
265
|
const txfrV = E(settlementAccount).transfer(
|
|
264
266
|
dest,
|
|
265
267
|
AmountMath.make(USDC, fullValue),
|
|
268
|
+
{
|
|
269
|
+
forwardOpts: {
|
|
270
|
+
intermediateRecipient,
|
|
271
|
+
},
|
|
272
|
+
},
|
|
266
273
|
);
|
|
267
274
|
void vowTools.watch(txfrV, this.facets.transferHandler, {
|
|
268
275
|
txHash,
|
|
@@ -305,6 +312,7 @@ export const prepareSettler = (
|
|
|
305
312
|
sourceChannel: M.string(),
|
|
306
313
|
remoteDenom: M.string(),
|
|
307
314
|
mintedEarly: M.remotable('mintedEarly'),
|
|
315
|
+
intermediateRecipient: ChainAddressShape,
|
|
308
316
|
}),
|
|
309
317
|
},
|
|
310
318
|
);
|
|
@@ -140,7 +140,7 @@ export const contract = async (zcf, privateArgs, zone, tools) => {
|
|
|
140
140
|
'test of forcing evidence',
|
|
141
141
|
);
|
|
142
142
|
|
|
143
|
-
const { makeLocalAccount } = orchestrateAll(flows, {});
|
|
143
|
+
const { makeLocalAccount, makeNobleAccount } = orchestrateAll(flows, {});
|
|
144
144
|
|
|
145
145
|
const creatorFacet = zone.exo('Fast USDC Creator', undefined, {
|
|
146
146
|
/** @type {(operatorId: string) => Promise<Invitation<OperatorKit>>} */
|
|
@@ -214,7 +214,7 @@ export const contract = async (zcf, privateArgs, zone, tools) => {
|
|
|
214
214
|
privateArgs.assetInfo,
|
|
215
215
|
);
|
|
216
216
|
}
|
|
217
|
-
|
|
217
|
+
const nobleAccountV = zone.makeOnce('NobleAccount', () => makeNobleAccount());
|
|
218
218
|
const feedKit = zone.makeOnce('Feed Kit', () => makeFeedKit());
|
|
219
219
|
|
|
220
220
|
const poolAccountV = zone.makeOnce('PoolAccount', () => makeLocalAccount());
|
|
@@ -222,10 +222,18 @@ export const contract = async (zcf, privateArgs, zone, tools) => {
|
|
|
222
222
|
makeLocalAccount(),
|
|
223
223
|
);
|
|
224
224
|
// when() is OK here since this clearly resolves promptly.
|
|
225
|
-
/** @type {HostInterface<OrchestrationAccount<{chainId: 'agoric';}>>
|
|
226
|
-
const [poolAccount, settlementAccount] = await vowTools.when(
|
|
227
|
-
vowTools.all([poolAccountV, settleAccountV]),
|
|
225
|
+
/** @type {[HostInterface<OrchestrationAccount<{chainId: 'noble-1';}>>, HostInterface<OrchestrationAccount<{chainId: 'agoric-3';}>>, HostInterface<OrchestrationAccount<{chainId: 'agoric-3';}>>]} */
|
|
226
|
+
const [nobleAccount, poolAccount, settlementAccount] = await vowTools.when(
|
|
227
|
+
vowTools.all([nobleAccountV, poolAccountV, settleAccountV]),
|
|
228
|
+
);
|
|
229
|
+
trace('settlementAccount', settlementAccount);
|
|
230
|
+
trace('poolAccount', poolAccount);
|
|
231
|
+
trace('nobleAccount', nobleAccount);
|
|
232
|
+
|
|
233
|
+
const intermediateRecipient = await vowTools.when(
|
|
234
|
+
E(nobleAccount).getAddress(),
|
|
228
235
|
);
|
|
236
|
+
trace('intermediateRecipient', intermediateRecipient);
|
|
229
237
|
|
|
230
238
|
const [_agoric, _noble, agToNoble] = await vowTools.when(
|
|
231
239
|
chainHub.getChainsAndConnection('agoric', 'noble'),
|
|
@@ -235,6 +243,7 @@ export const contract = async (zcf, privateArgs, zone, tools) => {
|
|
|
235
243
|
sourceChannel: agToNoble.transferChannel.counterPartyChannelId,
|
|
236
244
|
remoteDenom: 'uusdc',
|
|
237
245
|
settlementAccount,
|
|
246
|
+
intermediateRecipient,
|
|
238
247
|
});
|
|
239
248
|
|
|
240
249
|
const advancer = zone.makeOnce('Advancer', () =>
|
|
@@ -242,6 +251,7 @@ export const contract = async (zcf, privateArgs, zone, tools) => {
|
|
|
242
251
|
borrowerFacet: poolKit.borrower,
|
|
243
252
|
notifyFacet: settlerKit.notify,
|
|
244
253
|
poolAccount,
|
|
254
|
+
intermediateRecipient,
|
|
245
255
|
}),
|
|
246
256
|
);
|
|
247
257
|
// Connect evidence stream to advancer
|
package/src/fast-usdc.flows.js
CHANGED
|
@@ -11,3 +11,13 @@ export const makeLocalAccount = async orch => {
|
|
|
11
11
|
return agoricChain.makeAccount();
|
|
12
12
|
};
|
|
13
13
|
harden(makeLocalAccount);
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* @satisfies {OrchestrationFlow}
|
|
17
|
+
* @param {Orchestrator} orch
|
|
18
|
+
*/
|
|
19
|
+
export const makeNobleAccount = async orch => {
|
|
20
|
+
const nobleChain = await orch.getChain('noble');
|
|
21
|
+
return nobleChain.makeAccount();
|
|
22
|
+
};
|
|
23
|
+
harden(makeNobleAccount);
|
package/src/type-guards.js
CHANGED
|
@@ -49,11 +49,10 @@ export const CctpTxEvidenceShape = {
|
|
|
49
49
|
recipientAddress: M.string(),
|
|
50
50
|
},
|
|
51
51
|
blockHash: EvmHashShape,
|
|
52
|
-
blockNumber: M.
|
|
53
|
-
blockTimestamp: M.bigint(),
|
|
52
|
+
blockNumber: M.nat(),
|
|
54
53
|
chainId: M.number(),
|
|
55
54
|
tx: {
|
|
56
|
-
amount: M.
|
|
55
|
+
amount: M.nat(),
|
|
57
56
|
forwardingAddress: M.string(),
|
|
58
57
|
},
|
|
59
58
|
txHash: EvmHashShape,
|