@agoric/fast-usdc 0.1.1-dev-86e3b2d.0 → 0.1.1-dev-1231911.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.1.1-dev-86e3b2d.0+86e3b2d",
3
+ "version": "0.1.1-dev-1231911.0+1231911",
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-86e3b2d.0+86e3b2d",
26
- "@agoric/vats": "0.15.2-dev-86e3b2d.0+86e3b2d",
27
- "@agoric/zone": "0.2.3-dev-86e3b2d.0+86e3b2d",
25
+ "@agoric/swingset-liveslots": "0.10.3-dev-1231911.0+1231911",
26
+ "@agoric/vats": "0.15.2-dev-1231911.0+1231911",
27
+ "@agoric/zone": "0.2.3-dev-1231911.0+1231911",
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-86e3b2d.0+86e3b2d",
36
- "@agoric/ertp": "0.16.3-dev-86e3b2d.0+86e3b2d",
37
- "@agoric/internal": "0.3.3-dev-86e3b2d.0+86e3b2d",
38
- "@agoric/notifier": "0.6.3-dev-86e3b2d.0+86e3b2d",
39
- "@agoric/orchestration": "0.1.1-dev-86e3b2d.0+86e3b2d",
40
- "@agoric/store": "0.9.3-dev-86e3b2d.0+86e3b2d",
41
- "@agoric/vat-data": "0.5.3-dev-86e3b2d.0+86e3b2d",
42
- "@agoric/vow": "0.1.1-dev-86e3b2d.0+86e3b2d",
43
- "@agoric/zoe": "0.26.3-dev-86e3b2d.0+86e3b2d",
35
+ "@agoric/client-utils": "0.1.1-dev-1231911.0+1231911",
36
+ "@agoric/ertp": "0.16.3-dev-1231911.0+1231911",
37
+ "@agoric/internal": "0.3.3-dev-1231911.0+1231911",
38
+ "@agoric/notifier": "0.6.3-dev-1231911.0+1231911",
39
+ "@agoric/orchestration": "0.1.1-dev-1231911.0+1231911",
40
+ "@agoric/store": "0.9.3-dev-1231911.0+1231911",
41
+ "@agoric/vat-data": "0.5.3-dev-1231911.0+1231911",
42
+ "@agoric/vow": "0.1.1-dev-1231911.0+1231911",
43
+ "@agoric/zoe": "0.26.3-dev-1231911.0+1231911",
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": "86e3b2d6a2bd916d1a4012e8229fea8414228501"
83
+ "gitHead": "1231911e6c1bb4d5604f0e49c3a26c99131eb52e"
84
84
  }
@@ -56,6 +56,7 @@ const AdvancerVowCtxShape = M.splitRecord(
56
56
  const AdvancerKitI = harden({
57
57
  advancer: M.interface('AdvancerI', {
58
58
  handleTransactionEvent: M.callWhen(CctpTxEvidenceShape).returns(),
59
+ setIntermediateRecipient: M.call(ChainAddressShape).returns(),
59
60
  }),
60
61
  depositHandler: M.interface('DepositHandlerI', {
61
62
  onFulfilled: M.call(M.undefined(), AdvancerVowCtxShape).returns(VowShape),
@@ -95,7 +96,7 @@ export const prepareAdvancerKit = (
95
96
  usdc,
96
97
  vowTools: { watch, when },
97
98
  zcf,
98
- } = /** @type {AdvancerKitPowers} */ ({}),
99
+ },
99
100
  ) => {
100
101
  assertAllDefined({
101
102
  chainHub,
@@ -116,10 +117,15 @@ export const prepareAdvancerKit = (
116
117
  * notifyFacet: import('./settler.js').SettlerKit['notify'];
117
118
  * borrowerFacet: LiquidityPoolKit['borrower'];
118
119
  * poolAccount: HostInterface<OrchestrationAccount<{chainId: 'agoric'}>>;
119
- * intermediateRecipient: ChainAddress;
120
+ * intermediateRecipient?: ChainAddress;
120
121
  * }} config
121
122
  */
122
- config => harden(config),
123
+ config =>
124
+ harden({
125
+ ...config,
126
+ // make sure the state record has this property, perhaps with an undefined value
127
+ intermediateRecipient: config.intermediateRecipient,
128
+ }),
123
129
  {
124
130
  advancer: {
125
131
  /**
@@ -181,6 +187,10 @@ export const prepareAdvancerKit = (
181
187
  statusManager.observe(evidence);
182
188
  }
183
189
  },
190
+ /** @param {ChainAddress} intermediateRecipient */
191
+ setIntermediateRecipient(intermediateRecipient) {
192
+ this.state.intermediateRecipient = intermediateRecipient;
193
+ },
184
194
  },
185
195
  depositHandler: {
186
196
  /**
@@ -192,15 +202,8 @@ export const prepareAdvancerKit = (
192
202
  const { destination, advanceAmount, ...detail } = ctx;
193
203
  const transferV = E(poolAccount).transfer(
194
204
  destination,
195
- {
196
- denom: usdc.denom,
197
- value: advanceAmount.value,
198
- },
199
- {
200
- forwardOpts: {
201
- intermediateRecipient,
202
- },
203
- },
205
+ { denom: usdc.denom, value: advanceAmount.value },
206
+ { forwardOpts: { intermediateRecipient } },
204
207
  );
205
208
  return watch(transferV, this.facets.transferHandler, {
206
209
  destination,
@@ -259,7 +262,7 @@ export const prepareAdvancerKit = (
259
262
  notifyFacet: M.remotable(),
260
263
  borrowerFacet: M.remotable(),
261
264
  poolAccount: M.remotable(),
262
- intermediateRecipient: ChainAddressShape,
265
+ intermediateRecipient: M.opt(ChainAddressShape),
263
266
  }),
264
267
  },
265
268
  );
@@ -62,6 +62,7 @@ export const prepareSettler = (
62
62
  {
63
63
  creator: M.interface('SettlerCreatorI', {
64
64
  monitorMintingDeposits: M.callWhen().returns(M.any()),
65
+ setIntermediateRecipient: M.call(ChainAddressShape).returns(),
65
66
  }),
66
67
  tap: M.interface('SettlerTapI', {
67
68
  receiveUpcall: M.call(M.record()).returns(M.promise()),
@@ -94,13 +95,15 @@ export const prepareSettler = (
94
95
  * remoteDenom: Denom;
95
96
  * repayer: LiquidityPoolKit['repayer'];
96
97
  * settlementAccount: HostInterface<OrchestrationAccount<{ chainId: 'agoric' }>>
97
- * intermediateRecipient: ChainAddress;
98
+ * intermediateRecipient?: ChainAddress;
98
99
  * }} config
99
100
  */
100
101
  config => {
101
102
  log('config', config);
102
103
  return {
103
104
  ...config,
105
+ // make sure the state record has this property, perhaps with an undefined value
106
+ intermediateRecipient: config.intermediateRecipient,
104
107
  /** @type {HostInterface<TargetRegistration>|undefined} */
105
108
  registration: undefined,
106
109
  /** @type {SetStore<ReturnType<typeof makeMintedEarlyKey>>} */
@@ -117,6 +120,10 @@ export const prepareSettler = (
117
120
  assert.typeof(registration, 'object');
118
121
  this.state.registration = registration;
119
122
  },
123
+ /** @param {ChainAddress} intermediateRecipient */
124
+ setIntermediateRecipient(intermediateRecipient) {
125
+ this.state.intermediateRecipient = intermediateRecipient;
126
+ },
120
127
  },
121
128
  tap: {
122
129
  /** @param {VTransferIBCEvent} event */
@@ -265,11 +272,7 @@ export const prepareSettler = (
265
272
  const txfrV = E(settlementAccount).transfer(
266
273
  dest,
267
274
  AmountMath.make(USDC, fullValue),
268
- {
269
- forwardOpts: {
270
- intermediateRecipient,
271
- },
272
- },
275
+ { forwardOpts: { intermediateRecipient } },
273
276
  );
274
277
  void vowTools.watch(txfrV, this.facets.transferHandler, {
275
278
  txHash,
@@ -312,7 +315,7 @@ export const prepareSettler = (
312
315
  sourceChannel: M.string(),
313
316
  remoteDenom: M.string(),
314
317
  mintedEarly: M.remotable('mintedEarly'),
315
- intermediateRecipient: ChainAddressShape,
318
+ intermediateRecipient: M.opt(ChainAddressShape),
316
319
  }),
317
320
  },
318
321
  );
@@ -13,21 +13,29 @@ import { PendingTxStatus, TxStatus } from '../constants.js';
13
13
  /**
14
14
  * @import {MapStore, SetStore} from '@agoric/store';
15
15
  * @import {Zone} from '@agoric/zone';
16
- * @import {CctpTxEvidence, NobleAddress, SeenTxKey, PendingTxKey, PendingTx, EvmHash, LogFn} from '../types.js';
16
+ * @import {CctpTxEvidence, NobleAddress, PendingTx, EvmHash, LogFn} from '../types.js';
17
+ */
18
+
19
+ /**
20
+ * @typedef {`pendingTx:${bigint}:${NobleAddress}`} PendingTxKey
21
+ * The string template is for developer visibility but not meant to ever be parsed.
22
+ *
23
+ * @typedef {`seenTx:${string}:${EvmHash}`} SeenTxKey
24
+ * The string template is for developer visibility but not meant to ever be parsed.
17
25
  */
18
26
 
19
27
  /**
20
28
  * Create the key for the pendingTxs MapStore.
21
29
  *
22
- * The key is a composite of `txHash` and `chainId` and not meant to be
23
- * parsable.
30
+ * The key is a composite but not meant to be parsable.
24
31
  *
25
32
  * @param {NobleAddress} addr
26
33
  * @param {bigint} amount
27
34
  * @returns {PendingTxKey}
28
35
  */
29
36
  const makePendingTxKey = (addr, amount) =>
30
- `pendingTx:${JSON.stringify([addr, String(amount)])}`;
37
+ // amount can't contain colon
38
+ `pendingTx:${amount}:${addr}`;
31
39
 
32
40
  /**
33
41
  * Get the key for the pendingTxs MapStore.
@@ -43,15 +51,15 @@ const pendingTxKeyOf = evidence => {
43
51
  /**
44
52
  * Get the key for the seenTxs SetStore.
45
53
  *
46
- * The key is a composite of `NobleAddress` and transaction `amount` and not
47
- * meant to be parsable.
54
+ * The key is a composite but not meant to be parsable.
48
55
  *
49
56
  * @param {CctpTxEvidence} evidence
50
57
  * @returns {SeenTxKey}
51
58
  */
52
59
  const seenTxKeyOf = evidence => {
53
60
  const { txHash, chainId } = evidence;
54
- return `seenTx:${JSON.stringify([txHash, chainId])}`;
61
+ // chainId can't contain colon
62
+ return `seenTx:${chainId}:${txHash}`;
55
63
  };
56
64
 
57
65
  /**
@@ -68,12 +76,12 @@ const seenTxKeyOf = evidence => {
68
76
  * XXX consider separate facets for `Advancing` and `Settling` capabilities.
69
77
  *
70
78
  * @param {Zone} zone
71
- * @param {() => Promise<StorageNode>} makeStatusNode
79
+ * @param {ERef<StorageNode>} transactionsNode
72
80
  * @param {StatusManagerPowers} caps
73
81
  */
74
82
  export const prepareStatusManager = (
75
83
  zone,
76
- makeStatusNode,
84
+ transactionsNode,
77
85
  {
78
86
  log = makeTracer('Advancer', true),
79
87
  } = /** @type {StatusManagerPowers} */ ({}),
@@ -93,9 +101,8 @@ export const prepareStatusManager = (
93
101
  * @param {CctpTxEvidence['txHash']} hash
94
102
  * @param {TxStatus} status
95
103
  */
96
- const recordStatus = (hash, status) => {
97
- const statusNodeP = makeStatusNode();
98
- const txnNodeP = E(statusNodeP).makeChildNode(hash);
104
+ const publishStatus = (hash, status) => {
105
+ const txnNodeP = E(transactionsNode).makeChildNode(hash);
99
106
  // Don't await, just writing to vstorage.
100
107
  void E(txnNodeP).setValue(status);
101
108
  };
@@ -109,7 +116,7 @@ export const prepareStatusManager = (
109
116
  * @param {CctpTxEvidence} evidence
110
117
  * @param {PendingTxStatus} status
111
118
  */
112
- const recordPendingTx = (evidence, status) => {
119
+ const initPendingTx = (evidence, status) => {
113
120
  const seenKey = seenTxKeyOf(evidence);
114
121
  if (seenTxs.has(seenKey)) {
115
122
  throw makeError(`Transaction already seen: ${q(seenKey)}`);
@@ -121,9 +128,31 @@ export const prepareStatusManager = (
121
128
  pendingTxKeyOf(evidence),
122
129
  harden({ ...evidence, status }),
123
130
  );
124
- recordStatus(evidence.txHash, status);
131
+ publishStatus(evidence.txHash, status);
125
132
  };
126
133
 
134
+ /**
135
+ * Update the pending transaction status.
136
+ *
137
+ * @param {{sender: NobleAddress, amount: bigint}} keyParts
138
+ * @param {PendingTxStatus} status
139
+ */
140
+ function setPendingTxStatus({ sender, amount }, status) {
141
+ const key = makePendingTxKey(sender, amount);
142
+ pendingTxs.has(key) || Fail`no advancing tx with ${{ sender, amount }}`;
143
+ const pending = pendingTxs.get(key);
144
+ const ix = pending.findIndex(tx => tx.status === PendingTxStatus.Advancing);
145
+ ix >= 0 || Fail`no advancing tx with ${{ sender, amount }}`;
146
+ const [prefix, tx, suffix] = [
147
+ pending.slice(0, ix),
148
+ pending[ix],
149
+ pending.slice(ix + 1),
150
+ ];
151
+ const txpost = { ...tx, status };
152
+ pendingTxs.set(key, harden([...prefix, txpost, ...suffix]));
153
+ publishStatus(tx.txHash, status);
154
+ }
155
+
127
156
  return zone.exo(
128
157
  'Fast USDC Status Manager',
129
158
  M.interface('StatusManagerI', {
@@ -156,10 +185,13 @@ export const prepareStatusManager = (
156
185
  {
157
186
  /**
158
187
  * Add a new transaction with ADVANCING status
188
+ *
189
+ * NB: this acts like observe() but skips recording the OBSERVED state
190
+ *
159
191
  * @param {CctpTxEvidence} evidence
160
192
  */
161
193
  advance(evidence) {
162
- recordPendingTx(evidence, PendingTxStatus.Advancing);
194
+ initPendingTx(evidence, PendingTxStatus.Advancing);
163
195
  },
164
196
 
165
197
  /**
@@ -171,24 +203,10 @@ export const prepareStatusManager = (
171
203
  * @throws {Error} if nothing to advance
172
204
  */
173
205
  advanceOutcome(sender, amount, success) {
174
- const key = makePendingTxKey(sender, amount);
175
- pendingTxs.has(key) || Fail`no advancing tx with ${{ sender, amount }}`;
176
- const pending = pendingTxs.get(key);
177
- const ix = pending.findIndex(
178
- tx => tx.status === PendingTxStatus.Advancing,
206
+ setPendingTxStatus(
207
+ { sender, amount },
208
+ success ? PendingTxStatus.Advanced : PendingTxStatus.AdvanceFailed,
179
209
  );
180
- ix >= 0 || Fail`no advancing tx with ${{ sender, amount }}`;
181
- const [prefix, tx, suffix] = [
182
- pending.slice(0, ix),
183
- pending[ix],
184
- pending.slice(ix + 1),
185
- ];
186
- const status = success
187
- ? PendingTxStatus.Advanced
188
- : PendingTxStatus.AdvanceFailed;
189
- const txpost = { ...tx, status };
190
- pendingTxs.set(key, harden([...prefix, txpost, ...suffix]));
191
- recordStatus(tx.txHash, status);
192
210
  },
193
211
 
194
212
  /**
@@ -196,7 +214,7 @@ export const prepareStatusManager = (
196
214
  * @param {CctpTxEvidence} evidence
197
215
  */
198
216
  observe(evidence) {
199
- recordPendingTx(evidence, PendingTxStatus.Observed);
217
+ initPendingTx(evidence, PendingTxStatus.Observed);
200
218
  },
201
219
 
202
220
  /**
@@ -247,7 +265,7 @@ export const prepareStatusManager = (
247
265
  * @param {EvmHash} txHash
248
266
  */
249
267
  disbursed(txHash) {
250
- recordStatus(txHash, TxStatus.Disbursed);
268
+ publishStatus(txHash, TxStatus.Disbursed);
251
269
  },
252
270
 
253
271
  /**
@@ -259,7 +277,7 @@ export const prepareStatusManager = (
259
277
  */
260
278
  forwarded(txHash, address, amount) {
261
279
  if (txHash) {
262
- recordStatus(txHash, TxStatus.Forwarded);
280
+ publishStatus(txHash, TxStatus.Forwarded);
263
281
  } else {
264
282
  // TODO store (early) `Minted` transactions to check against incoming evidence
265
283
  log(
@@ -1,5 +1,5 @@
1
1
  import { AssetKind } from '@agoric/ertp';
2
- import { assertAllDefined, makeTracer } from '@agoric/internal';
2
+ import { makeTracer } from '@agoric/internal';
3
3
  import { observeIteration, subscribeEach } from '@agoric/notifier';
4
4
  import {
5
5
  CosmosChainInfoShape,
@@ -95,8 +95,8 @@ export const contract = async (zcf, privateArgs, zone, tools) => {
95
95
  marshaller,
96
96
  );
97
97
 
98
- const makeStatusNode = () => E(storageNode).makeChildNode(STATUS_NODE);
99
- const statusManager = prepareStatusManager(zone, makeStatusNode);
98
+ const statusNode = E(storageNode).makeChildNode(STATUS_NODE);
99
+ const statusManager = prepareStatusManager(zone, statusNode);
100
100
 
101
101
  const { USDC } = terms.brands;
102
102
  const { withdrawToSeat } = tools.zoeTools;
@@ -126,7 +126,6 @@ export const contract = async (zcf, privateArgs, zone, tools) => {
126
126
  });
127
127
 
128
128
  const makeFeedKit = prepareTransactionFeedKit(zone, zcf);
129
- assertAllDefined({ makeFeedKit, makeAdvancer, makeSettler, statusManager });
130
129
 
131
130
  const makeLiquidityPoolKit = prepareLiquidityPoolKit(
132
131
  zone,
@@ -147,6 +146,20 @@ export const contract = async (zcf, privateArgs, zone, tools) => {
147
146
  async makeOperatorInvitation(operatorId) {
148
147
  return feedKit.creator.makeOperatorInvitation(operatorId);
149
148
  },
149
+ async connectToNoble() {
150
+ return vowTools.when(nobleAccountV, nobleAccount => {
151
+ trace('nobleAccount', nobleAccount);
152
+ return vowTools.when(
153
+ E(nobleAccount).getAddress(),
154
+ intermediateRecipient => {
155
+ trace('intermediateRecipient', intermediateRecipient);
156
+ advancer.setIntermediateRecipient(intermediateRecipient);
157
+ settlerKit.creator.setIntermediateRecipient(intermediateRecipient);
158
+ return intermediateRecipient;
159
+ },
160
+ );
161
+ });
162
+ },
150
163
  });
151
164
 
152
165
  const publicFacet = zone.exo('Fast USDC Public', undefined, {
@@ -214,7 +227,9 @@ export const contract = async (zcf, privateArgs, zone, tools) => {
214
227
  privateArgs.assetInfo,
215
228
  );
216
229
  }
230
+
217
231
  const nobleAccountV = zone.makeOnce('NobleAccount', () => makeNobleAccount());
232
+
218
233
  const feedKit = zone.makeOnce('Feed Kit', () => makeFeedKit());
219
234
 
220
235
  const poolAccountV = zone.makeOnce('PoolAccount', () => makeLocalAccount());
@@ -222,18 +237,12 @@ export const contract = async (zcf, privateArgs, zone, tools) => {
222
237
  makeLocalAccount(),
223
238
  );
224
239
  // when() is OK here since this clearly resolves promptly.
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]),
240
+ /** @type {[HostInterface<OrchestrationAccount<{chainId: 'agoric-3';}>>, HostInterface<OrchestrationAccount<{chainId: 'agoric-3';}>>]} */
241
+ const [poolAccount, settlementAccount] = await vowTools.when(
242
+ vowTools.all([poolAccountV, settleAccountV]),
228
243
  );
229
244
  trace('settlementAccount', settlementAccount);
230
245
  trace('poolAccount', poolAccount);
231
- trace('nobleAccount', nobleAccount);
232
-
233
- const intermediateRecipient = await vowTools.when(
234
- E(nobleAccount).getAddress(),
235
- );
236
- trace('intermediateRecipient', intermediateRecipient);
237
246
 
238
247
  const [_agoric, _noble, agToNoble] = await vowTools.when(
239
248
  chainHub.getChainsAndConnection('agoric', 'noble'),
@@ -243,7 +252,6 @@ export const contract = async (zcf, privateArgs, zone, tools) => {
243
252
  sourceChannel: agToNoble.transferChannel.counterPartyChannelId,
244
253
  remoteDenom: 'uusdc',
245
254
  settlementAccount,
246
- intermediateRecipient,
247
255
  });
248
256
 
249
257
  const advancer = zone.makeOnce('Advancer', () =>
@@ -251,7 +259,6 @@ export const contract = async (zcf, privateArgs, zone, tools) => {
251
259
  borrowerFacet: poolKit.borrower,
252
260
  notifyFacet: settlerKit.notify,
253
261
  poolAccount,
254
- intermediateRecipient,
255
262
  }),
256
263
  );
257
264
  // Connect evidence stream to advancer
@@ -147,12 +147,11 @@ export const startFastUSDC = async (
147
147
  USDC: await E(USDCissuer).getBrand(),
148
148
  });
149
149
 
150
- const { terms, oracles, feeConfig, feedPolicy, chainInfo, assetInfo } =
151
- fromExternalConfig(
152
- config?.options, // just in case config is missing somehow
153
- brands,
154
- FastUSDCConfigShape,
155
- );
150
+ const { terms, oracles, feeConfig, feedPolicy, ...net } = fromExternalConfig(
151
+ config.options,
152
+ brands,
153
+ FastUSDCConfigShape,
154
+ );
156
155
  trace('using terms', terms);
157
156
  trace('using fee config', feeConfig);
158
157
 
@@ -186,8 +185,8 @@ export const startFastUSDC = async (
186
185
  storageNode,
187
186
  timerService,
188
187
  marshaller,
189
- chainInfo,
190
- assetInfo,
188
+ chainInfo: net.chainInfo,
189
+ assetInfo: net.assetInfo,
191
190
  }),
192
191
  );
193
192
 
@@ -224,6 +223,11 @@ export const startFastUSDC = async (
224
223
 
225
224
  produceInstance.reset();
226
225
  produceInstance.resolve(instance);
226
+
227
+ if (!net.noNoble) {
228
+ const addr = await E(kit.creatorFacet).connectToNoble();
229
+ trace('noble intermediate recipient', addr);
230
+ }
227
231
  trace('startFastUSDC done', instance);
228
232
  };
229
233
  harden(startFastUSDC);
package/src/types.ts CHANGED
@@ -6,7 +6,7 @@ import type {
6
6
  } from '@agoric/orchestration';
7
7
  import type { IBCChannelID } from '@agoric/vats';
8
8
  import type { Amount } from '@agoric/ertp';
9
- import type { Passable } from '@endo/pass-style';
9
+ import type { CopyRecord, Passable } from '@endo/pass-style';
10
10
  import type { PendingTxStatus } from './constants.js';
11
11
  import type { FastUsdcTerms } from './fast-usdc.contract.js';
12
12
 
@@ -38,12 +38,6 @@ export interface PendingTx extends CctpTxEvidence {
38
38
  status: PendingTxStatus;
39
39
  }
40
40
 
41
- /** internal key for `StatusManager` exo */
42
- export type PendingTxKey = `pendingTx:${string}`;
43
-
44
- /** internal key for `StatusManager` exo */
45
- export type SeenTxKey = `seenTx:${string}`;
46
-
47
41
  export type FeeConfig = {
48
42
  flat: Amount<'nat'>;
49
43
  variableRate: Ratio;
@@ -78,14 +72,15 @@ export interface FeedPolicy {
78
72
  eventFilter?: string;
79
73
  }
80
74
 
81
- export type FastUSDCConfig = Passable & {
75
+ export type FastUSDCConfig = {
82
76
  terms: FastUsdcTerms;
83
77
  oracles: Record<string, string>;
84
78
  feeConfig: FeeConfig;
85
79
  feedPolicy: FeedPolicy & Passable;
80
+ noNoble: boolean; // support a3p-integration, which has no noble chain
86
81
  chainInfo: Record<string, CosmosChainInfo & Passable>;
87
82
  assetInfo: [Denom, DenomDetail & { brandKey?: string }][];
88
- };
83
+ } & CopyRecord;
89
84
 
90
85
  export type * from './constants.js';
91
86
  export type { LiquidityPoolKit } from './exos/liquidity-pool.js';
@@ -5,7 +5,7 @@ export const queryFastUSDCLocalChainAccount = async (
5
5
  out = console,
6
6
  ) => {
7
7
  const agoricAddr = await vstorage.readLatest(
8
- 'published.fastUSDC.settlementAccount',
8
+ 'published.fastUsdc.settlementAccount',
9
9
  );
10
10
  out.log(`Got Fast USDC Local Chain Account ${agoricAddr}`);
11
11
  return agoricAddr;
@@ -35,6 +35,11 @@ export const defaultAssetInfo = [
35
35
  },
36
36
  ],
37
37
  ];
38
+ harden(defaultAssetInfo);
39
+
40
+ const agoricAssetInfo = defaultAssetInfo.filter(
41
+ ([_d, i]) => i.chainName === 'agoric',
42
+ );
38
43
 
39
44
  /**
40
45
  * @type {Record<string, Pick<FastUSDCConfig, 'oracles' | 'feedPolicy' | 'chainInfo' | 'assetInfo' >>}
@@ -43,6 +48,11 @@ export const defaultAssetInfo = [
43
48
  * meanwhile, use price oracle addresses (from updatePriceFeeds.js).
44
49
  */
45
50
  export const configurations = {
51
+ /**
52
+ * NOTE: The a3p-integration runtime does _not_ include
53
+ * a noble chain; this limits functionality to advancing
54
+ * to the Agoric chain.
55
+ */
46
56
  A3P_INTEGRATION: {
47
57
  oracles: {
48
58
  gov1: 'agoric1ee9hr0jyrxhy999y755mp862ljgycmwyp4pl7q',
@@ -50,7 +60,7 @@ export const configurations = {
50
60
  gov3: 'agoric1ydzxwh6f893jvpaslmaz6l8j2ulup9a7x8qvvq',
51
61
  },
52
62
  feedPolicy: {
53
- nobleAgoricChannelId: 'TODO',
63
+ nobleAgoricChannelId: 'channel-does-not-exist',
54
64
  nobleDomainId: 4,
55
65
  chainPolicies: {
56
66
  Arbitrum: {
@@ -63,9 +73,13 @@ export const configurations = {
63
73
  },
64
74
  },
65
75
  chainInfo: /** @type {Record<string, CosmosChainInfo & Passable>} */ (
66
- withChainCapabilities(fetchedChainInfo)
76
+ withChainCapabilities({
77
+ agoric: fetchedChainInfo.agoric,
78
+ // registering USDC-on-agoric requires registering the noble chain
79
+ noble: fetchedChainInfo.noble,
80
+ })
67
81
  ),
68
- assetInfo: defaultAssetInfo,
82
+ assetInfo: agoricAssetInfo,
69
83
  },
70
84
  MAINNET: {
71
85
  oracles: {
@@ -139,3 +153,4 @@ export const configurations = {
139
153
  assetInfo: defaultAssetInfo, // TODO: use emerynet values
140
154
  },
141
155
  };
156
+ harden(configurations);