@agoric/fast-usdc 0.2.0-upgrade-19-dev-0754752.0 → 0.2.0-upgrade-18a-dev-4ee0508.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/fast-usdc",
3
- "version": "0.2.0-upgrade-19-dev-0754752.0+0754752",
3
+ "version": "0.2.0-upgrade-18a-dev-4ee0508.0+4ee0508",
4
4
  "description": "CLI and library for Fast USDC product",
5
5
  "type": "module",
6
6
  "files": [
@@ -8,7 +8,6 @@
8
8
  "src",
9
9
  "tools"
10
10
  ],
11
- "main": "src/main.js",
12
11
  "bin": {
13
12
  "fast-usdc": "./src/cli/bin.js"
14
13
  },
@@ -23,9 +22,9 @@
23
22
  "lint:eslint": "eslint ."
24
23
  },
25
24
  "devDependencies": {
26
- "@agoric/swingset-liveslots": "0.10.3-upgrade-19-dev-0754752.0+0754752",
27
- "@agoric/vats": "0.16.0-upgrade-19-dev-0754752.0+0754752",
28
- "@agoric/zone": "0.3.0-upgrade-19-dev-0754752.0+0754752",
25
+ "@agoric/swingset-liveslots": "0.10.3-upgrade-18a-dev-4ee0508.0+4ee0508",
26
+ "@agoric/vats": "0.16.0-upgrade-18a-dev-4ee0508.0+4ee0508",
27
+ "@agoric/zone": "0.3.0-upgrade-18a-dev-4ee0508.0+4ee0508",
29
28
  "@fast-check/ava": "^2.0.1",
30
29
  "ava": "^5.3.0",
31
30
  "c8": "^10.1.2",
@@ -33,29 +32,29 @@
33
32
  "ts-blank-space": "^0.4.4"
34
33
  },
35
34
  "dependencies": {
36
- "@agoric/client-utils": "0.2.0-upgrade-19-dev-0754752.0+0754752",
37
- "@agoric/cosmic-proto": "0.5.0-upgrade-19-dev-0754752.0+0754752",
38
- "@agoric/ertp": "0.16.3-upgrade-19-dev-0754752.0+0754752",
39
- "@agoric/internal": "0.4.0-upgrade-19-dev-0754752.0+0754752",
40
- "@agoric/notifier": "0.7.0-upgrade-19-dev-0754752.0+0754752",
41
- "@agoric/orchestration": "0.2.0-upgrade-19-dev-0754752.0+0754752",
42
- "@agoric/store": "0.9.3-upgrade-19-dev-0754752.0+0754752",
43
- "@agoric/vat-data": "0.5.3-upgrade-19-dev-0754752.0+0754752",
44
- "@agoric/vow": "0.2.0-upgrade-19-dev-0754752.0+0754752",
45
- "@agoric/zoe": "0.27.0-upgrade-19-dev-0754752.0+0754752",
35
+ "@agoric/client-utils": "0.2.0-upgrade-18a-dev-4ee0508.0+4ee0508",
36
+ "@agoric/cosmic-proto": "0.5.0-upgrade-18a-dev-4ee0508.0+4ee0508",
37
+ "@agoric/ertp": "0.16.3-upgrade-18a-dev-4ee0508.0+4ee0508",
38
+ "@agoric/internal": "0.4.0-upgrade-18a-dev-4ee0508.0+4ee0508",
39
+ "@agoric/notifier": "0.7.0-upgrade-18a-dev-4ee0508.0+4ee0508",
40
+ "@agoric/orchestration": "0.2.0-upgrade-18a-dev-4ee0508.0+4ee0508",
41
+ "@agoric/store": "0.9.3-upgrade-18a-dev-4ee0508.0+4ee0508",
42
+ "@agoric/vat-data": "0.5.3-upgrade-18a-dev-4ee0508.0+4ee0508",
43
+ "@agoric/vow": "0.2.0-upgrade-18a-dev-4ee0508.0+4ee0508",
44
+ "@agoric/zoe": "0.26.3-upgrade-18a-dev-4ee0508.0+4ee0508",
46
45
  "@cosmjs/proto-signing": "^0.32.4",
47
46
  "@cosmjs/stargate": "^0.32.4",
48
47
  "@endo/base64": "^1.0.9",
49
- "@endo/common": "^1.2.9",
50
- "@endo/errors": "^1.2.9",
51
- "@endo/eventual-send": "^1.3.0",
52
- "@endo/far": "^1.1.10",
53
- "@endo/init": "^1.1.8",
54
- "@endo/marshal": "^1.6.3",
55
- "@endo/nat": "^5.0.14",
56
- "@endo/pass-style": "^1.4.8",
57
- "@endo/patterns": "^1.4.8",
58
- "@endo/promise-kit": "^1.1.9",
48
+ "@endo/common": "^1.2.8",
49
+ "@endo/errors": "^1.2.8",
50
+ "@endo/eventual-send": "^1.2.8",
51
+ "@endo/far": "^1.1.9",
52
+ "@endo/init": "^1.1.7",
53
+ "@endo/marshal": "^1.6.2",
54
+ "@endo/nat": "^5.0.13",
55
+ "@endo/pass-style": "^1.4.7",
56
+ "@endo/patterns": "^1.4.7",
57
+ "@endo/promise-kit": "^1.1.8",
59
58
  "@nick134-bit/noblejs": "0.0.2",
60
59
  "bech32": "^2.0.0",
61
60
  "commander": "^12.1.0",
@@ -82,5 +81,5 @@
82
81
  "publishConfig": {
83
82
  "access": "public"
84
83
  },
85
- "gitHead": "07547522e9d8a06692fa5ff12c35230ddb4b252b"
84
+ "gitHead": "4ee05088e5ada989a866a11ff65838d395505ce6"
86
85
  }
package/src/cli/cli.js CHANGED
@@ -13,7 +13,7 @@ import { addConfigCommands } from './config-commands.js';
13
13
  import { addOperatorCommands } from './operator-commands.js';
14
14
  import * as configLib from './config.js';
15
15
  import transferLib from './transfer.js';
16
- import { makeFile } from './util/file.js';
16
+ import { makeFile } from '../util/file.js';
17
17
  import { addLPCommands } from './lp-commands.js';
18
18
 
19
19
  const packageJson = JSON.parse(
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @import {Command} from 'commander';
3
- * @import {File} from './util/file.js';
3
+ * @import {File} from '../util/file.js';
4
4
  * @import * as ConfigHelpers from './config.js';
5
5
  */
6
6
  /**
package/src/cli/config.js CHANGED
@@ -23,7 +23,7 @@ import { stdin as input, stdout as output } from 'node:process';
23
23
  }} ConfigOpts
24
24
  */
25
25
 
26
- /** @import { File } from './util/file' */
26
+ /** @import { File } from '../util/file' */
27
27
 
28
28
  export const init = async (
29
29
  /** @type {File} */ configFile,
@@ -1,7 +1,6 @@
1
1
  /* eslint-env node */
2
2
  /**
3
3
  * @import {Command} from 'commander';
4
- * @import {Amount, Brand} from '@agoric/ertp';
5
4
  * @import {OfferSpec} from '@agoric/smart-wallet/src/offers.js';
6
5
  * @import {ExecuteOfferAction} from '@agoric/smart-wallet/src/smartWallet.js';
7
6
  * @import {USDCProposalShapes} from '../pool-share-math.js';
@@ -15,13 +14,11 @@ import { AmountMath } from '@agoric/ertp';
15
14
  import {
16
15
  assertParsableNumber,
17
16
  ceilDivideBy,
18
- floorDivideBy,
19
17
  multiplyBy,
20
18
  parseRatio,
21
19
  } from '@agoric/zoe/src/contractSupport/ratio.js';
22
20
  import { InvalidArgumentError } from 'commander';
23
21
  import { outputActionAndHint } from './bridge-action.js';
24
- import { Offers } from '../clientSupport.js';
25
22
 
26
23
  export const delay = ms => new Promise(resolve => setTimeout(resolve, ms));
27
24
 
@@ -84,27 +81,30 @@ export const addLPCommands = (
84
81
  .action(async opts => {
85
82
  swkP ||= loadSwk();
86
83
  const swk = await swkP;
87
-
88
84
  /** @type {Brand<'nat'>} */
89
85
  // @ts-expect-error it doesnt recognize usdc as a Brand type
90
86
  const usdc = swk.agoricNames.brand.USDC;
91
87
  assert(usdc, 'USDC brand not in agoricNames');
92
88
 
93
- /** @type {Brand<'nat'>} */
94
- // @ts-expect-error it doesnt recognize FastLP as a Brand type
95
- const poolShare = swk.agoricNames.brand.FastLP;
96
- assert(poolShare, 'FastLP brand not in agoricNames');
97
-
98
89
  const usdcAmount = parseUSDCAmount(opts.amount, usdc);
99
90
 
100
- const metrics = await swk.readPublished('fastUsdc.poolMetrics');
101
- const fastLPAmount = floorDivideBy(usdcAmount, metrics.shareWorth);
91
+ /** @type {USDCProposalShapes['deposit']} */
92
+ const proposal = {
93
+ give: {
94
+ USDC: usdcAmount,
95
+ },
96
+ };
102
97
 
103
- const offer = Offers.fastUsdc.Deposit(swk.agoricNames, {
104
- offerId: opts.offerId,
105
- fastLPAmount: fastLPAmount.value,
106
- usdcAmount: usdcAmount.value,
107
- });
98
+ /** @type {OfferSpec} */
99
+ const offer = {
100
+ id: opts.offerId,
101
+ invitationSpec: {
102
+ source: 'agoricContract',
103
+ instancePath: ['fastUsdc'],
104
+ callPipe: [['makeDepositInvitation', []]],
105
+ },
106
+ proposal,
107
+ };
108
108
 
109
109
  /** @type {ExecuteOfferAction} */
110
110
  const bridgeAction = {
@@ -125,6 +125,7 @@ export const addLPCommands = (
125
125
  .requiredOption('--amount <number>', 'USDC amount', parseDecimal)
126
126
  .option('--offerId <string>', 'Offer id', String, `lpWithdraw-${now()}`)
127
127
  .action(async opts => {
128
+ swkP ||= loadSwk();
128
129
  swkP ||= loadSwk();
129
130
  const swk = await swkP;
130
131
 
@@ -140,14 +141,31 @@ export const addLPCommands = (
140
141
 
141
142
  const usdcAmount = parseUSDCAmount(opts.amount, usdc);
142
143
 
144
+ /** @type {import('../types.js').PoolMetrics} */
145
+ // @ts-expect-error it treats this as "unknown"
143
146
  const metrics = await swk.readPublished('fastUsdc.poolMetrics');
144
147
  const fastLPAmount = ceilDivideBy(usdcAmount, metrics.shareWorth);
145
148
 
146
- const offer = Offers.fastUsdc.Withdraw(swk.agoricNames, {
147
- offerId: opts.offerId,
148
- fastLPAmount: fastLPAmount.value,
149
- usdcAmount: usdcAmount.value,
150
- });
149
+ /** @type {USDCProposalShapes['withdraw']} */
150
+ const proposal = {
151
+ give: {
152
+ PoolShare: fastLPAmount,
153
+ },
154
+ want: {
155
+ USDC: usdcAmount,
156
+ },
157
+ };
158
+
159
+ /** @type {OfferSpec} */
160
+ const offer = {
161
+ id: opts.offerId,
162
+ invitationSpec: {
163
+ source: 'agoricContract',
164
+ instancePath: ['fastUsdc'],
165
+ callPipe: [['makeWithdrawInvitation', []]],
166
+ },
167
+ proposal,
168
+ };
151
169
 
152
170
  outputActionAndHint(
153
171
  { method: 'executeOffer', offer },
@@ -96,7 +96,6 @@ export const addOperatorCommands = (
96
96
  .requiredOption('--recipientAddress <string>', 'bech32 address', String)
97
97
  .requiredOption('--blockHash <0xhex>', 'hex hash', parseHex)
98
98
  .requiredOption('--blockNumber <number>', 'number', parseNat)
99
- .requiredOption('--blockTimestamp <number>', 'number', parseNat)
100
99
  .requiredOption('--chainId <string>', 'chain id', Number)
101
100
  .requiredOption('--amount <number>', 'number', parseNat)
102
101
  .requiredOption('--forwardingAddress <string>', 'bech32 address', String)
@@ -7,16 +7,16 @@ import {
7
7
  pickEndpoint,
8
8
  } from '@agoric/client-utils';
9
9
  import { encodeAddressHook } from '@agoric/cosmic-proto/address-hooks.js';
10
- import { queryFastUSDCLocalChainAccount } from './util/agoric.js';
11
- import { depositForBurn, makeProvider } from './util/cctp.js';
10
+ import { queryFastUSDCLocalChainAccount } from '../util/agoric.js';
11
+ import { depositForBurn, makeProvider } from '../util/cctp.js';
12
12
  import {
13
13
  makeSigner,
14
14
  queryForwardingAccount,
15
15
  registerFwdAccount,
16
- } from './util/noble.js';
17
- import { queryUSDCBalance } from './util/bank.js';
16
+ } from '../util/noble.js';
17
+ import { queryUSDCBalance } from '../util/bank.js';
18
18
 
19
- /** @import { File } from './util/file' */
19
+ /** @import { File } from '../util/file' */
20
20
  /** @import { VStorage } from '@agoric/client-utils' */
21
21
  /** @import { SigningStargateClient } from '@cosmjs/stargate' */
22
22
  /** @import { JsonRpcProvider as ethProvider } from 'ethers' */
@@ -16,14 +16,13 @@ import { makeFeeTools } from '../utils/fees.js';
16
16
 
17
17
  /**
18
18
  * @import {HostInterface} from '@agoric/async-flow';
19
- * @import {Amount, Brand} from '@agoric/ertp';
20
19
  * @import {TypedPattern} from '@agoric/internal'
21
20
  * @import {NatAmount} from '@agoric/ertp';
22
21
  * @import {ChainAddress, ChainHub, Denom, OrchestrationAccount} from '@agoric/orchestration';
23
22
  * @import {ZoeTools} from '@agoric/orchestration/src/utils/zoe-tools.js';
24
23
  * @import {VowTools} from '@agoric/vow';
25
24
  * @import {Zone} from '@agoric/zone';
26
- * @import {AddressHook, EvmHash, FeeConfig, LogFn, NobleAddress, EvidenceWithRisk} from '../types.js';
25
+ * @import {CctpTxEvidence, AddressHook, EvmHash, FeeConfig, LogFn, NobleAddress, EvidenceWithRisk} from '../types.js';
27
26
  * @import {StatusManager} from './status-manager.js';
28
27
  * @import {LiquidityPoolKit} from './liquidity-pool.js';
29
28
  */
@@ -32,12 +31,12 @@ import { makeFeeTools } from '../utils/fees.js';
32
31
  * @typedef {{
33
32
  * chainHub: ChainHub;
34
33
  * feeConfig: FeeConfig;
34
+ * localTransfer: ZoeTools['localTransfer'];
35
35
  * log?: LogFn;
36
36
  * statusManager: StatusManager;
37
37
  * usdc: { brand: Brand<'nat'>; denom: Denom; };
38
38
  * vowTools: VowTools;
39
39
  * zcf: ZCF;
40
- * zoeTools: ZoeTools;
41
40
  * }} AdvancerKitPowers
42
41
  */
43
42
 
@@ -64,21 +63,12 @@ const AdvancerKitI = harden({
64
63
  onRejected: M.call(M.error(), AdvancerVowCtxShape).returns(),
65
64
  }),
66
65
  transferHandler: M.interface('TransferHandlerI', {
66
+ // TODO confirm undefined, and not bigint (sequence)
67
67
  onFulfilled: M.call(M.undefined(), AdvancerVowCtxShape).returns(
68
68
  M.undefined(),
69
69
  ),
70
70
  onRejected: M.call(M.error(), AdvancerVowCtxShape).returns(M.undefined()),
71
71
  }),
72
- withdrawHandler: M.interface('WithdrawHandlerI', {
73
- onFulfilled: M.call(M.undefined(), {
74
- advanceAmount: AnyNatAmountShape,
75
- tmpReturnSeat: M.remotable(),
76
- }).returns(M.undefined()),
77
- onRejected: M.call(M.error(), {
78
- advanceAmount: AnyNatAmountShape,
79
- tmpReturnSeat: M.remotable(),
80
- }).returns(M.undefined()),
81
- }),
82
72
  });
83
73
 
84
74
  /**
@@ -91,14 +81,6 @@ const AdvancerKitI = harden({
91
81
  * }} AdvancerVowCtx
92
82
  */
93
83
 
94
- export const stateShape = harden({
95
- notifier: M.remotable(),
96
- borrower: M.remotable(),
97
- poolAccount: M.remotable(),
98
- intermediateRecipient: M.opt(ChainAddressShape),
99
- settlementAddress: M.opt(ChainAddressShape),
100
- });
101
-
102
84
  /**
103
85
  * @param {Zone} zone
104
86
  * @param {AdvancerKitPowers} caps
@@ -108,12 +90,12 @@ export const prepareAdvancerKit = (
108
90
  {
109
91
  chainHub,
110
92
  feeConfig,
93
+ localTransfer,
111
94
  log = makeTracer('Advancer', true),
112
95
  statusManager,
113
96
  usdc,
114
97
  vowTools: { watch, when },
115
98
  zcf,
116
- zoeTools: { localTransfer, withdrawToSeat },
117
99
  },
118
100
  ) => {
119
101
  assertAllDefined({
@@ -132,8 +114,8 @@ export const prepareAdvancerKit = (
132
114
  AdvancerKitI,
133
115
  /**
134
116
  * @param {{
135
- * notifier: import('./settler.js').SettlerKit['notifier'];
136
- * borrower: LiquidityPoolKit['borrower'];
117
+ * notifyFacet: import('./settler.js').SettlerKit['notify'];
118
+ * borrowerFacet: LiquidityPoolKit['borrower'];
137
119
  * poolAccount: HostInterface<OrchestrationAccount<{chainId: 'agoric'}>>;
138
120
  * settlementAddress: ChainAddress;
139
121
  * intermediateRecipient?: ChainAddress;
@@ -170,7 +152,9 @@ export const prepareAdvancerKit = (
170
152
  statusManager.skipAdvance(evidence, risk.risksIdentified);
171
153
  return;
172
154
  }
173
- const { settlementAddress } = this.state;
155
+
156
+ const { borrowerFacet, poolAccount, settlementAddress } =
157
+ this.state;
174
158
  const { recipientAddress } = evidence.aux;
175
159
  const decoded = decodeAddressHook(recipientAddress);
176
160
  mustMatch(decoded, AddressHookShape);
@@ -183,20 +167,12 @@ export const prepareAdvancerKit = (
183
167
  const destination = chainHub.makeChainAddress(EUD);
184
168
 
185
169
  const fullAmount = toAmount(evidence.tx.amount);
186
- const { borrower, notifier, poolAccount } = this.state;
187
- // do not advance if we've already received a mint/settlement
188
- const mintedEarly = notifier.checkMintedEarly(
189
- evidence,
190
- destination,
191
- );
192
- if (mintedEarly) return;
193
-
194
170
  // throws if requested does not exceed fees
195
171
  const advanceAmount = feeTools.calculateAdvance(fullAmount);
196
172
 
197
173
  const { zcfSeat: tmpSeat } = zcf.makeEmptySeatKit();
198
174
  // throws if the pool has insufficient funds
199
- borrower.borrow(tmpSeat, advanceAmount);
175
+ borrowerFacet.borrow(tmpSeat, advanceAmount);
200
176
 
201
177
  // this cannot throw since `.isSeen()` is called in the same turn
202
178
  statusManager.advance(evidence);
@@ -217,7 +193,7 @@ export const prepareAdvancerKit = (
217
193
  });
218
194
  } catch (error) {
219
195
  log('Advancer error:', error);
220
- statusManager.skipAdvance(evidence, [error.message]);
196
+ statusManager.observe(evidence);
221
197
  }
222
198
  },
223
199
  /** @param {ChainAddress} intermediateRecipient */
@@ -231,21 +207,14 @@ export const prepareAdvancerKit = (
231
207
  * @param {AdvancerVowCtx & { tmpSeat: ZCFSeat }} ctx
232
208
  */
233
209
  onFulfilled(result, ctx) {
234
- const { poolAccount, intermediateRecipient, settlementAddress } =
235
- this.state;
236
- const { destination, advanceAmount, tmpSeat, ...detail } = ctx;
237
- tmpSeat.exit();
238
- const amount = harden({
239
- denom: usdc.denom,
240
- value: advanceAmount.value,
241
- });
242
- const transferOrSendV =
243
- destination.chainId === settlementAddress.chainId
244
- ? E(poolAccount).send(destination, amount)
245
- : E(poolAccount).transfer(destination, amount, {
246
- forwardOpts: { intermediateRecipient },
247
- });
248
- return watch(transferOrSendV, this.facets.transferHandler, {
210
+ const { poolAccount, intermediateRecipient } = this.state;
211
+ const { destination, advanceAmount, ...detail } = ctx;
212
+ const transferV = E(poolAccount).transfer(
213
+ destination,
214
+ { denom: usdc.denom, value: advanceAmount.value },
215
+ { forwardOpts: { intermediateRecipient } },
216
+ );
217
+ return watch(transferV, this.facets.transferHandler, {
249
218
  destination,
250
219
  advanceAmount,
251
220
  ...detail,
@@ -268,10 +237,9 @@ export const prepareAdvancerKit = (
268
237
  error,
269
238
  );
270
239
  try {
271
- const { borrower, notifier } = this.state;
272
- notifier.notifyAdvancingResult(restCtx, false);
273
- borrower.returnToPool(tmpSeat, advanceAmount);
274
- tmpSeat.exit();
240
+ const { borrowerFacet, notifyFacet } = this.state;
241
+ notifyFacet.notifyAdvancingResult(restCtx, false);
242
+ borrowerFacet.returnToPool(tmpSeat, advanceAmount);
275
243
  } catch (e) {
276
244
  log('🚨 deposit to localOrchAccount failure recovery failed', e);
277
245
  }
@@ -279,80 +247,44 @@ export const prepareAdvancerKit = (
279
247
  },
280
248
  transferHandler: {
281
249
  /**
282
- * @param {undefined} result
250
+ * @param {unknown} result TODO confirm this is not a bigint (sequence)
283
251
  * @param {AdvancerVowCtx} ctx
284
252
  */
285
253
  onFulfilled(result, ctx) {
286
- const { notifier } = this.state;
254
+ const { notifyFacet } = this.state;
287
255
  const { advanceAmount, destination, ...detail } = ctx;
288
- log('Advance succeeded', { advanceAmount, destination });
256
+ log('Advance transfer fulfilled', {
257
+ advanceAmount,
258
+ destination,
259
+ result,
260
+ });
289
261
  // During development, due to a bug, this call threw.
290
262
  // The failure was silent (no diagnostics) due to:
291
263
  // - #10576 Vows do not report unhandled rejections
292
264
  // For now, the advancer kit relies on consistency between
293
- // notify, statusManager, and callers of handleTransactionEvent().
265
+ // notifyFacet, statusManager, and callers of handleTransactionEvent().
294
266
  // TODO: revisit #10576 during #10510
295
- notifier.notifyAdvancingResult({ destination, ...detail }, true);
267
+ notifyFacet.notifyAdvancingResult({ destination, ...detail }, true);
296
268
  },
297
269
  /**
298
270
  * @param {Error} error
299
271
  * @param {AdvancerVowCtx} ctx
300
272
  */
301
273
  onRejected(error, ctx) {
302
- const { notifier, poolAccount } = this.state;
303
- log('Advance failed', error);
304
- const { advanceAmount, ...restCtx } = ctx;
305
- notifier.notifyAdvancingResult(restCtx, false);
306
- const { zcfSeat: tmpReturnSeat } = zcf.makeEmptySeatKit();
307
- const withdrawV = withdrawToSeat(
308
- // @ts-expect-error LocalAccountMethods vs OrchestrationAccount
309
- poolAccount,
310
- tmpReturnSeat,
311
- harden({ USDC: advanceAmount }),
312
- );
313
- void watch(withdrawV, this.facets.withdrawHandler, {
314
- advanceAmount,
315
- tmpReturnSeat,
316
- });
317
- },
318
- },
319
- withdrawHandler: {
320
- /**
321
- *
322
- * @param {undefined} result
323
- * @param {{ advanceAmount: Amount<'nat'>; tmpReturnSeat: ZCFSeat; }} ctx
324
- */
325
- onFulfilled(result, { advanceAmount, tmpReturnSeat }) {
326
- const { borrower } = this.state;
327
- try {
328
- borrower.returnToPool(tmpReturnSeat, advanceAmount);
329
- } catch (e) {
330
- // If we reach here, the unused advance funds will remain in `tmpReturnSeat`
331
- // and must be retrieved from recovery sets.
332
- log(
333
- `🚨 return ${q(advanceAmount)} to pool failed. funds remain on "tmpReturnSeat"`,
334
- e,
335
- );
336
- }
337
- tmpReturnSeat.exit();
338
- },
339
- /**
340
- * @param {Error} error
341
- * @param {{ advanceAmount: Amount<'nat'>; tmpReturnSeat: ZCFSeat; }} ctx
342
- */
343
- onRejected(error, { advanceAmount, tmpReturnSeat }) {
344
- log(
345
- `🚨 withdraw ${q(advanceAmount)} from "poolAccount" to return to pool failed`,
346
- error,
347
- );
348
- // If we reach here, the unused advance funds will remain in the `poolAccount`.
349
- // A contract update will be required to return them to the LiquidityPool.
350
- tmpReturnSeat.exit();
274
+ const { notifyFacet } = this.state;
275
+ log('Advance transfer rejected', error);
276
+ notifyFacet.notifyAdvancingResult(ctx, false);
351
277
  },
352
278
  },
353
279
  },
354
280
  {
355
- stateShape,
281
+ stateShape: harden({
282
+ notifyFacet: M.remotable(),
283
+ borrowerFacet: M.remotable(),
284
+ poolAccount: M.remotable(),
285
+ intermediateRecipient: M.opt(ChainAddressShape),
286
+ settlementAddress: M.opt(ChainAddressShape),
287
+ }),
356
288
  },
357
289
  );
358
290
  };