Skip to content

Commit 96ad41c

Browse files
committed
fix: fusdc contract integration
- Advancer now relies on a Settler facet
1 parent 1a8aafd commit 96ad41c

File tree

4 files changed

+22
-29
lines changed

4 files changed

+22
-29
lines changed

Diff for: packages/fast-usdc/src/exos/liquidity-pool.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { AmountMath, AmountShape } from '@agoric/ertp';
1+
import { AmountMath } from '@agoric/ertp';
22
import {
33
makeRecorderTopic,
44
TopicsRecordShape,

Diff for: packages/fast-usdc/src/fast-usdc.contract.js

+19-26
Original file line numberDiff line numberDiff line change
@@ -214,18 +214,27 @@ export const contract = async (zcf, privateArgs, zone, tools) => {
214214

215215
const feedKit = zone.makeOnce('Feed Kit', () => makeFeedKit());
216216

217-
const poolAccountV =
218-
// cast to HostInterface
219-
/** @type { Vow<HostInterface<OrchestrationAccount<{chainId: 'agoric';}>>>} */ (
220-
/** @type {unknown}*/ (
221-
zone.makeOnce('Pool Local Orch Account', () => makeLocalAccount())
222-
)
223-
);
224-
const poolAccount = await vowTools.when(poolAccountV);
217+
const poolAccountV = zone.makeOnce('PoolAccount', () => makeLocalAccount());
218+
const settleAccountV = zone.makeOnce('SettleAccount', () =>
219+
makeLocalAccount(),
220+
);
221+
// when() is OK here since this clearly resolves promptly.
222+
/** @type {HostInterface<OrchestrationAccount<{chainId: 'agoric';}>>[]} */
223+
const [poolAccount, settlementAccount] = await vowTools.when(
224+
vowTools.all([poolAccountV, settleAccountV]),
225+
);
226+
227+
const settlerKit = makeSettler({
228+
repayer: poolKit.repayer,
229+
sourceChannel: 'channel-1234', // TODO: fix this as soon as testing needs it',
230+
remoteDenom: 'uusdc',
231+
settlementAccount,
232+
});
225233

226234
const advancer = zone.makeOnce('Advancer', () =>
227235
makeAdvancer({
228236
borrowerFacet: poolKit.borrower,
237+
notifyFacet: settlerKit.notify,
229238
poolAccount,
230239
}),
231240
);
@@ -240,28 +249,12 @@ export const contract = async (zcf, privateArgs, zone, tools) => {
240249
},
241250
});
242251

243-
console.log('\n\n\nDEBUG making settlementAccount');
244-
245-
const settleAccountV = zone.makeOnce('settleAccount', () =>
246-
makeLocalAccount(),
247-
);
248-
// when() is OK here since this clearly resolves promptly.
249-
/** @type {Parameters<typeof makeSettler>[0]['settlementAccount']} */
250-
const settlementAccount = await tools.vowTools.when(settleAccountV);
251-
252252
console.log('DEBUG settlementAccount', settlementAccount.getAddress());
253253

254-
const { creator: settlerCreator } = makeSettler({
255-
repayer: poolKit.repayer,
256-
sourceChannel: 'channel-1234', // TODO: fix this as soon as testing needs it',
257-
remoteDenom: 'uusdc',
258-
settlementAccount,
259-
});
260-
261-
console.log('DEBUG made settler', settlerCreator);
254+
console.log('DEBUG made settler', settlerKit);
262255
// FIXME triggers a race in packet-tools, but it can't be called earlier and the only way to do it later is to have the
263256
// await settler.monitorMintingDeposits();
264-
await settlerCreator.monitorMintingDeposits();
257+
await settlerKit.creator.monitorMintingDeposits();
265258

266259
return harden({ creatorFacet, publicFacet });
267260
};

Diff for: packages/fast-usdc/test/snapshots/fast-usdc.contract.test.ts.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -82,8 +82,9 @@ Generated by [AVA](https://avajs.dev).
8282
'Liquidity Pool_kindHandle': 'Alleged: kind',
8383
'Operator Kit_kindHandle': 'Alleged: kind',
8484
PendingTxs: {},
85-
'Pool Local Orch Account': 'Vow',
85+
PoolAccount: 'Vow',
8686
SeenTxs: [],
87+
SettleAccount: 'Vow',
8788
mint: {
8889
PoolShare: 'Alleged: zcfMint',
8990
},
@@ -94,7 +95,6 @@ Generated by [AVA](https://avajs.dev).
9495
},
9596
},
9697
pending: {},
97-
settleAccount: 'Vow',
9898
vstorage: {
9999
'Durable Publish Kit_kindHandle': 'Alleged: kind',
100100
Recorder_kindHandle: 'Alleged: kind',
-12 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)