@agoric/fast-usdc 0.1.1-dev-d1ef359.0 → 0.1.1-dev-a27f724.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-d1ef359.0+d1ef359",
3
+ "version": "0.1.1-dev-a27f724.0+a27f724",
4
4
  "description": "CLI and library for Fast USDC product",
5
5
  "type": "module",
6
6
  "files": [
@@ -23,9 +23,9 @@
23
23
  "lint:eslint": "eslint ."
24
24
  },
25
25
  "devDependencies": {
26
- "@agoric/swingset-liveslots": "0.10.3-dev-d1ef359.0+d1ef359",
27
- "@agoric/vats": "0.15.2-dev-d1ef359.0+d1ef359",
28
- "@agoric/zone": "0.2.3-dev-d1ef359.0+d1ef359",
26
+ "@agoric/swingset-liveslots": "0.10.3-dev-a27f724.0+a27f724",
27
+ "@agoric/vats": "0.15.2-dev-a27f724.0+a27f724",
28
+ "@agoric/zone": "0.2.3-dev-a27f724.0+a27f724",
29
29
  "@fast-check/ava": "^2.0.1",
30
30
  "ava": "^5.3.0",
31
31
  "c8": "^10.1.2",
@@ -33,16 +33,16 @@
33
33
  "ts-blank-space": "^0.4.4"
34
34
  },
35
35
  "dependencies": {
36
- "@agoric/client-utils": "0.1.1-dev-d1ef359.0+d1ef359",
37
- "@agoric/cosmic-proto": "0.4.1-dev-d1ef359.0+d1ef359",
38
- "@agoric/ertp": "0.16.3-dev-d1ef359.0+d1ef359",
39
- "@agoric/internal": "0.3.3-dev-d1ef359.0+d1ef359",
40
- "@agoric/notifier": "0.6.3-dev-d1ef359.0+d1ef359",
41
- "@agoric/orchestration": "0.1.1-dev-d1ef359.0+d1ef359",
42
- "@agoric/store": "0.9.3-dev-d1ef359.0+d1ef359",
43
- "@agoric/vat-data": "0.5.3-dev-d1ef359.0+d1ef359",
44
- "@agoric/vow": "0.1.1-dev-d1ef359.0+d1ef359",
45
- "@agoric/zoe": "0.26.3-dev-d1ef359.0+d1ef359",
36
+ "@agoric/client-utils": "0.1.1-dev-a27f724.0+a27f724",
37
+ "@agoric/cosmic-proto": "0.4.1-dev-a27f724.0+a27f724",
38
+ "@agoric/ertp": "0.16.3-dev-a27f724.0+a27f724",
39
+ "@agoric/internal": "0.3.3-dev-a27f724.0+a27f724",
40
+ "@agoric/notifier": "0.6.3-dev-a27f724.0+a27f724",
41
+ "@agoric/orchestration": "0.1.1-dev-a27f724.0+a27f724",
42
+ "@agoric/store": "0.9.3-dev-a27f724.0+a27f724",
43
+ "@agoric/vat-data": "0.5.3-dev-a27f724.0+a27f724",
44
+ "@agoric/vow": "0.1.1-dev-a27f724.0+a27f724",
45
+ "@agoric/zoe": "0.26.3-dev-a27f724.0+a27f724",
46
46
  "@cosmjs/proto-signing": "^0.32.4",
47
47
  "@cosmjs/stargate": "^0.32.4",
48
48
  "@endo/base64": "^1.0.9",
@@ -82,5 +82,5 @@
82
82
  "publishConfig": {
83
83
  "access": "public"
84
84
  },
85
- "gitHead": "d1ef35965047ef31f0fa5451d4cfb8bd06c59247"
85
+ "gitHead": "a27f724ae4134ac3b4c094d604afbab58f447b2d"
86
86
  }
@@ -31,14 +31,13 @@ const ADDRESSES_BAGGAGE_KEY = 'addresses';
31
31
 
32
32
  /**
33
33
  * @import {HostInterface} from '@agoric/async-flow';
34
- * @import {CosmosChainAddress, CosmosChainInfo, Denom, DenomDetail, OrchestrationAccount} from '@agoric/orchestration';
34
+ * @import {CosmosChainInfo, Denom, DenomDetail, OrchestrationAccount, IBCConnectionInfo} from '@agoric/orchestration';
35
35
  * @import {OrchestrationPowers, OrchestrationTools} from '@agoric/orchestration/src/utils/start-helper.js';
36
36
  * @import {Remote} from '@agoric/internal';
37
37
  * @import {Marshaller, StorageNode} from '@agoric/internal/src/lib-chainStorage.js'
38
38
  * @import {Zone} from '@agoric/zone';
39
39
  * @import {OperatorOfferResult} from './exos/transaction-feed.js';
40
- * @import {OperatorKit} from './exos/operator-kit.js';
41
- * @import {CctpTxEvidence, ContractRecord, FeeConfig} from './types.js';
40
+ * @import {ContractRecord, FeeConfig} from './types.js';
42
41
  */
43
42
 
44
43
  /**
@@ -167,7 +166,17 @@ export const contract = async (zcf, privateArgs, zone, tools) => {
167
166
  async makeWithdrawFeesInvitation() {
168
167
  return poolKit.feeRecipient.makeWithdrawFeesInvitation();
169
168
  },
170
- async connectToNoble() {
169
+ /**
170
+ * @param {string} agoricChainId
171
+ * @param {string} nobleChainId
172
+ * @param {IBCConnectionInfo} agoricToNoble
173
+ */
174
+ async connectToNoble(agoricChainId, nobleChainId, agoricToNoble) {
175
+ trace('connectToNoble', agoricChainId, nobleChainId, agoricToNoble);
176
+ chainHub.updateConnection(agoricChainId, nobleChainId, agoricToNoble);
177
+ // v1 has `NobleAccount` which we don't expect to ever settle.
178
+ const nobleAccountV = zone.makeOnce('NobleICA', () => makeNobleAccount());
179
+
171
180
  return vowTools.when(nobleAccountV, nobleAccount => {
172
181
  trace('nobleAccount', nobleAccount);
173
182
  return vowTools.when(
@@ -212,8 +221,10 @@ export const contract = async (zcf, privateArgs, zone, tools) => {
212
221
  getStaticInfo() {
213
222
  baggage.has(ADDRESSES_BAGGAGE_KEY) ||
214
223
  Fail`no addresses. creator must 'publishAddresses' first`;
224
+ /** @type {ContractRecord} */
225
+ const addresses = baggage.get(ADDRESSES_BAGGAGE_KEY);
215
226
  return harden({
216
- [ADDRESSES_BAGGAGE_KEY]: baggage.get(ADDRESSES_BAGGAGE_KEY),
227
+ [ADDRESSES_BAGGAGE_KEY]: addresses,
217
228
  });
218
229
  },
219
230
  });
@@ -258,8 +269,6 @@ export const contract = async (zcf, privateArgs, zone, tools) => {
258
269
  );
259
270
  }
260
271
 
261
- const nobleAccountV = zone.makeOnce('NobleAccount', () => makeNobleAccount());
262
-
263
272
  const feedKit = zone.makeOnce('Feed Kit', () => makeFeedKit());
264
273
 
265
274
  const poolAccountV = zone.makeOnce('PoolAccount', () => makeLocalAccount());
@@ -279,12 +288,14 @@ export const contract = async (zcf, privateArgs, zone, tools) => {
279
288
  const [_agoric, _noble, agToNoble] = await vowTools.when(
280
289
  chainHub.getChainsAndConnection('agoric', 'noble'),
281
290
  );
282
- const settlerKit = makeSettler({
283
- repayer: poolKit.repayer,
284
- sourceChannel: agToNoble.transferChannel.counterPartyChannelId,
285
- remoteDenom: 'uusdc',
286
- settlementAccount,
287
- });
291
+ const settlerKit = zone.makeOnce('settlerKit', () =>
292
+ makeSettler({
293
+ repayer: poolKit.repayer,
294
+ sourceChannel: agToNoble.transferChannel.counterPartyChannelId,
295
+ remoteDenom: 'uusdc',
296
+ settlementAccount,
297
+ }),
298
+ );
288
299
 
289
300
  const advancer = zone.makeOnce('Advancer', () =>
290
301
  makeAdvancer({
@@ -181,7 +181,13 @@ export const startFastUSDC = async (
181
181
  const addresses = await E(kit.creatorFacet).publishAddresses();
182
182
  trace('contract orch account addresses', addresses);
183
183
  if (!net.noNoble) {
184
- const addr = await E(kit.creatorFacet).connectToNoble();
184
+ const { agoric, noble } = privateArgs.chainInfo;
185
+ const agoricToNoble = agoric.connections[noble.chainId];
186
+ const addr = await E(kit.creatorFacet).connectToNoble(
187
+ agoric.chainId,
188
+ noble.chainId,
189
+ agoricToNoble,
190
+ );
185
191
  trace('noble intermediate recipient', addr);
186
192
  }
187
193
  trace('startFastUSDC done', instance);
@@ -0,0 +1,108 @@
1
+ /** @file core-eval to 1) update ChainInfo 2) re-request the Noble ICA `intermediateRecipient` */
2
+
3
+ import { E } from '@endo/far';
4
+ import { makeTracer } from '@agoric/internal';
5
+
6
+ const trace = makeTracer('FUSD-2', true);
7
+
8
+ /**
9
+ * @import {CopyRecord} from '@endo/pass-style'
10
+ * @import {IBCConnectionInfo} from '@agoric/orchestration'
11
+ * @import {ManifestBundleRef} from '@agoric/deploy-script-support/src/externalTypes.js'
12
+ * @import {BootstrapManifest} from '@agoric/vats/src/core/lib-boot.js'
13
+ * @import {FastUSDCCorePowers} from './start-fast-usdc.core.js'
14
+ * @import {ContractRecord} from './types.js'
15
+ */
16
+
17
+ /**
18
+ * @typedef {object} UpdateOpts
19
+ * @property {IBCConnectionInfo} [agoricToNoble]
20
+ * @property {{bundleID: BundleID}} [fastUsdcCode]
21
+ */
22
+
23
+ const config = /** @type {const} */ ({
24
+ MAINNET: {
25
+ agoricToNoble: {
26
+ id: 'connection-72',
27
+ client_id: '07-tendermint-77',
28
+ counterparty: {
29
+ client_id: '07-tendermint-32',
30
+ connection_id: 'connection-38', // was: connection-40
31
+ },
32
+ state: 3,
33
+ transferChannel: {
34
+ channelId: 'channel-62',
35
+ portId: 'transfer',
36
+ counterPartyChannelId: 'channel-21',
37
+ counterPartyPortId: 'transfer',
38
+ ordering: 0,
39
+ state: 3,
40
+ version: 'ics20-1',
41
+ },
42
+ },
43
+ },
44
+ });
45
+ harden(config);
46
+
47
+ /**
48
+ * @param {BootstrapPowers & FastUSDCCorePowers} powers
49
+ * @param {object} [config]
50
+ * @param {UpdateOpts} [config.options]
51
+ */
52
+ export const updateNobleICA = async (
53
+ { consume: { chainStorage, fastUsdcKit } },
54
+ { options = {} } = {},
55
+ ) => {
56
+ trace('options', options);
57
+ const {
58
+ agoricToNoble = config.MAINNET.agoricToNoble,
59
+ fastUsdcCode = assert.fail('missing bundleID'),
60
+ } = options;
61
+ const { adminFacet, creatorFacet, privateArgs, publicFacet } =
62
+ await fastUsdcKit;
63
+ trace('got privateArgs', Object.keys(privateArgs));
64
+
65
+ const upgraded = await E(adminFacet).upgradeContract(
66
+ fastUsdcCode.bundleID,
67
+ privateArgs,
68
+ );
69
+ trace(upgraded);
70
+
71
+ const { agoric, noble } = privateArgs.chainInfo;
72
+ const nobleICAaddr = await E(creatorFacet).connectToNoble(
73
+ agoric.chainId,
74
+ noble.chainId,
75
+ agoricToNoble,
76
+ );
77
+ trace('noble ICA', nobleICAaddr);
78
+
79
+ // publish ICA addr with the other addresses
80
+ const contractName = 'fastUsdc';
81
+ const contractNode = E(chainStorage)?.makeChildNode(contractName);
82
+ const { addresses } = await E(publicFacet).getStaticInfo();
83
+ /** @type {ContractRecord} */
84
+ const addrs = { ...addresses, nobleICA: nobleICAaddr.value };
85
+ void E(contractNode)?.setValue(JSON.stringify(addrs));
86
+ };
87
+
88
+ /**
89
+ * @param {unknown} _utils
90
+ * @param {{
91
+ * installKeys: { fastUsdc: ERef<ManifestBundleRef> };
92
+ * options: Omit<UpdateOpts, 'fastUsdcCode'> & CopyRecord;
93
+ * }} opts
94
+ */
95
+ export const getManifestForUpdateNobleICA = (
96
+ _utils,
97
+ { installKeys, options },
98
+ ) => {
99
+ return {
100
+ /** @type {BootstrapManifest} */
101
+ manifest: {
102
+ [updateNobleICA.name]: {
103
+ consume: { chainStorage: true, fastUsdcKit: true },
104
+ },
105
+ },
106
+ options: { ...options, fastUsdcCode: installKeys.fastUsdc },
107
+ };
108
+ };