@agoric/fast-usdc 0.1.1-dev-274240a.0 → 0.1.1-dev-7b7ceb9.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-274240a.0+274240a",
3
+ "version": "0.1.1-dev-7b7ceb9.0+7b7ceb9",
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-274240a.0+274240a",
26
- "@agoric/vats": "0.15.2-dev-274240a.0+274240a",
27
- "@agoric/zone": "0.2.3-dev-274240a.0+274240a",
25
+ "@agoric/swingset-liveslots": "0.10.3-dev-7b7ceb9.0+7b7ceb9",
26
+ "@agoric/vats": "0.15.2-dev-7b7ceb9.0+7b7ceb9",
27
+ "@agoric/zone": "0.2.3-dev-7b7ceb9.0+7b7ceb9",
28
28
  "@fast-check/ava": "^2.0.1",
29
29
  "ava": "^5.3.0",
30
30
  "c8": "^10.1.2",
@@ -32,16 +32,16 @@
32
32
  "ts-blank-space": "^0.4.4"
33
33
  },
34
34
  "dependencies": {
35
- "@agoric/client-utils": "0.1.1-dev-274240a.0+274240a",
36
- "@agoric/cosmic-proto": "0.4.1-dev-274240a.0+274240a",
37
- "@agoric/ertp": "0.16.3-dev-274240a.0+274240a",
38
- "@agoric/internal": "0.3.3-dev-274240a.0+274240a",
39
- "@agoric/notifier": "0.6.3-dev-274240a.0+274240a",
40
- "@agoric/orchestration": "0.1.1-dev-274240a.0+274240a",
41
- "@agoric/store": "0.9.3-dev-274240a.0+274240a",
42
- "@agoric/vat-data": "0.5.3-dev-274240a.0+274240a",
43
- "@agoric/vow": "0.1.1-dev-274240a.0+274240a",
44
- "@agoric/zoe": "0.26.3-dev-274240a.0+274240a",
35
+ "@agoric/client-utils": "0.1.1-dev-7b7ceb9.0+7b7ceb9",
36
+ "@agoric/cosmic-proto": "0.4.1-dev-7b7ceb9.0+7b7ceb9",
37
+ "@agoric/ertp": "0.16.3-dev-7b7ceb9.0+7b7ceb9",
38
+ "@agoric/internal": "0.3.3-dev-7b7ceb9.0+7b7ceb9",
39
+ "@agoric/notifier": "0.6.3-dev-7b7ceb9.0+7b7ceb9",
40
+ "@agoric/orchestration": "0.1.1-dev-7b7ceb9.0+7b7ceb9",
41
+ "@agoric/store": "0.9.3-dev-7b7ceb9.0+7b7ceb9",
42
+ "@agoric/vat-data": "0.5.3-dev-7b7ceb9.0+7b7ceb9",
43
+ "@agoric/vow": "0.1.1-dev-7b7ceb9.0+7b7ceb9",
44
+ "@agoric/zoe": "0.26.3-dev-7b7ceb9.0+7b7ceb9",
45
45
  "@cosmjs/proto-signing": "^0.32.4",
46
46
  "@cosmjs/stargate": "^0.32.4",
47
47
  "@endo/base64": "^1.0.9",
@@ -81,5 +81,5 @@
81
81
  "publishConfig": {
82
82
  "access": "public"
83
83
  },
84
- "gitHead": "274240a27b625635555a0bef9cdae4286c4d1ef9"
84
+ "gitHead": "7b7ceb911dff780df7b4e562b7d87ed2fd628b92"
85
85
  }
@@ -6,6 +6,7 @@ import { pickFacet } from '@agoric/vat-data';
6
6
  import { VowShape } from '@agoric/vow';
7
7
  import { E } from '@endo/far';
8
8
  import { M, mustMatch } from '@endo/patterns';
9
+ import { Fail, q } from '@endo/errors';
9
10
  import {
10
11
  CctpTxEvidenceShape,
11
12
  AddressHookShape,
@@ -116,6 +117,7 @@ export const prepareAdvancerKit = (
116
117
  * notifyFacet: import('./settler.js').SettlerKit['notify'];
117
118
  * borrowerFacet: LiquidityPoolKit['borrower'];
118
119
  * poolAccount: HostInterface<OrchestrationAccount<{chainId: 'agoric'}>>;
120
+ * settlementAddress: ChainAddress;
119
121
  * intermediateRecipient?: ChainAddress;
120
122
  * }} config
121
123
  */
@@ -145,10 +147,14 @@ export const prepareAdvancerKit = (
145
147
  return;
146
148
  }
147
149
 
148
- const { borrowerFacet, poolAccount } = this.state;
150
+ const { borrowerFacet, poolAccount, settlementAddress } =
151
+ this.state;
149
152
  const { recipientAddress } = evidence.aux;
150
153
  const decoded = decodeAddressHook(recipientAddress);
151
154
  mustMatch(decoded, AddressHookShape);
155
+ if (decoded.baseAddress !== settlementAddress.value) {
156
+ throw Fail`⚠️ baseAddress of address hook ${q(decoded.baseAddress)} does not match the expected address ${q(settlementAddress.value)}`;
157
+ }
152
158
  const { EUD } = /** @type {AddressHook['query']} */ (decoded.query);
153
159
  log(`decoded EUD: ${EUD}`);
154
160
  // throws if the bech32 prefix is not found
@@ -172,10 +178,10 @@ export const prepareAdvancerKit = (
172
178
  harden({ USDC: advanceAmount }),
173
179
  );
174
180
  void watch(depositV, this.facets.depositHandler, {
175
- fullAmount,
176
181
  advanceAmount,
177
182
  destination,
178
183
  forwardingAddress: evidence.tx.forwardingAddress,
184
+ fullAmount,
179
185
  tmpSeat,
180
186
  txHash: evidence.txHash,
181
187
  });
@@ -271,6 +277,7 @@ export const prepareAdvancerKit = (
271
277
  borrowerFacet: M.remotable(),
272
278
  poolAccount: M.remotable(),
273
279
  intermediateRecipient: M.opt(ChainAddressShape),
280
+ settlementAddress: M.opt(ChainAddressShape),
274
281
  }),
275
282
  },
276
283
  );
@@ -179,16 +179,12 @@ export const contract = async (zcf, privateArgs, zone, tools) => {
179
179
  },
180
180
  async publishAddresses() {
181
181
  !baggage.has(ADDRESSES_BAGGAGE_KEY) || Fail`Addresses already published`;
182
- const [poolAccountAddress, settlementAccountAddress] =
183
- await vowTools.when(
184
- vowTools.all([
185
- E(poolAccount).getAddress(),
186
- E(settlementAccount).getAddress(),
187
- ]),
188
- );
182
+ const [poolAccountAddress] = await vowTools.when(
183
+ vowTools.all([E(poolAccount).getAddress()]),
184
+ );
189
185
  const addresses = harden({
190
186
  poolAccount: poolAccountAddress.value,
191
- settlementAccount: settlementAccountAddress.value,
187
+ settlementAccount: settlementAddress.value,
192
188
  });
193
189
  baggage.init(ADDRESSES_BAGGAGE_KEY, addresses);
194
190
  await publishAddresses(storageNode, addresses);
@@ -284,6 +280,8 @@ export const contract = async (zcf, privateArgs, zone, tools) => {
284
280
  );
285
281
  trace('settlementAccount', settlementAccount);
286
282
  trace('poolAccount', poolAccount);
283
+ const settlementAddress = await E(settlementAccount).getAddress();
284
+ trace('settlementAddress', settlementAddress);
287
285
 
288
286
  const [_agoric, _noble, agToNoble] = await vowTools.when(
289
287
  chainHub.getChainsAndConnection('agoric', 'noble'),
@@ -300,6 +298,7 @@ export const contract = async (zcf, privateArgs, zone, tools) => {
300
298
  borrowerFacet: poolKit.borrower,
301
299
  notifyFacet: settlerKit.notify,
302
300
  poolAccount,
301
+ settlementAddress,
303
302
  }),
304
303
  );
305
304
  // Connect evidence stream to advancer
@@ -27,6 +27,13 @@ import { fromExternalConfig } from './utils/config-marshal.js';
27
27
  * @import {FeedPolicy, FastUSDCConfig} from './types.js'
28
28
  */
29
29
 
30
+ const ShareAssetInfo = /** @type {const} */ harden({
31
+ issuerName: 'FastLP',
32
+ denom: 'ufastlp',
33
+ assetKind: 'nat',
34
+ decimalPlaces: 6,
35
+ });
36
+
30
37
  const trace = makeTracer('FUSD-Start', true);
31
38
 
32
39
  const contractName = 'fastUsdc';
@@ -116,6 +123,7 @@ export const startFastUSDC = async (
116
123
  consume: {
117
124
  agoricNames,
118
125
  namesByAddress,
126
+ bankManager,
119
127
  board,
120
128
  chainStorage,
121
129
  chainTimerService: timerService,
@@ -206,13 +214,23 @@ export const startFastUSDC = async (
206
214
  await publishFeedPolicy(storageNode, feedPolicy);
207
215
 
208
216
  const {
209
- issuers: { PoolShares: shareIssuer },
217
+ issuers: fastUsdcIssuers,
210
218
  brands: { PoolShares: shareBrand },
211
219
  } = await E(zoe).getTerms(instance);
220
+ /** @type {{ PoolShares: Issuer<'nat'> }} */
221
+ // @ts-expect-error see zcf.makeZCFMint(...) in fast-usdc.contract.js
222
+ const { PoolShares: shareIssuer } = fastUsdcIssuers;
212
223
  produceShareIssuer.resolve(shareIssuer);
213
224
  produceShareBrand.resolve(shareBrand);
214
225
  await publishDisplayInfo(shareBrand, { board, chainStorage });
215
226
 
227
+ const { denom, issuerName } = ShareAssetInfo;
228
+ trace('addAsset', denom, shareBrand);
229
+ await E(bankManager).addAsset(denom, issuerName, issuerName, {
230
+ issuer: shareIssuer,
231
+ brand: shareBrand,
232
+ });
233
+
216
234
  await Promise.all(
217
235
  Object.entries(oracleDepositFacets).map(async ([name, depositFacet]) => {
218
236
  const address = oracles[name];
@@ -258,6 +276,8 @@ export const getManifestForFastUSDC = (
258
276
  fastUsdcKit: true,
259
277
  },
260
278
  consume: {
279
+ bankManager: true, // to add FastLP as vbank asset
280
+
261
281
  chainStorage: true,
262
282
  chainTimerService: true,
263
283
  localchain: true,