@agoric/fast-usdc 0.1.1-dev-545fc58.0 → 0.1.1-dev-36f6b6e.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-545fc58.0+545fc58",
3
+ "version": "0.1.1-dev-36f6b6e.0+36f6b6e",
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-545fc58.0+545fc58",
27
- "@agoric/vats": "0.15.2-dev-545fc58.0+545fc58",
28
- "@agoric/zone": "0.2.3-dev-545fc58.0+545fc58",
26
+ "@agoric/swingset-liveslots": "0.10.3-dev-36f6b6e.0+36f6b6e",
27
+ "@agoric/vats": "0.15.2-dev-36f6b6e.0+36f6b6e",
28
+ "@agoric/zone": "0.2.3-dev-36f6b6e.0+36f6b6e",
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-545fc58.0+545fc58",
37
- "@agoric/cosmic-proto": "0.4.1-dev-545fc58.0+545fc58",
38
- "@agoric/ertp": "0.16.3-dev-545fc58.0+545fc58",
39
- "@agoric/internal": "0.3.3-dev-545fc58.0+545fc58",
40
- "@agoric/notifier": "0.6.3-dev-545fc58.0+545fc58",
41
- "@agoric/orchestration": "0.1.1-dev-545fc58.0+545fc58",
42
- "@agoric/store": "0.9.3-dev-545fc58.0+545fc58",
43
- "@agoric/vat-data": "0.5.3-dev-545fc58.0+545fc58",
44
- "@agoric/vow": "0.1.1-dev-545fc58.0+545fc58",
45
- "@agoric/zoe": "0.26.3-dev-545fc58.0+545fc58",
36
+ "@agoric/client-utils": "0.1.1-dev-36f6b6e.0+36f6b6e",
37
+ "@agoric/cosmic-proto": "0.4.1-dev-36f6b6e.0+36f6b6e",
38
+ "@agoric/ertp": "0.16.3-dev-36f6b6e.0+36f6b6e",
39
+ "@agoric/internal": "0.3.3-dev-36f6b6e.0+36f6b6e",
40
+ "@agoric/notifier": "0.6.3-dev-36f6b6e.0+36f6b6e",
41
+ "@agoric/orchestration": "0.1.1-dev-36f6b6e.0+36f6b6e",
42
+ "@agoric/store": "0.9.3-dev-36f6b6e.0+36f6b6e",
43
+ "@agoric/vat-data": "0.5.3-dev-36f6b6e.0+36f6b6e",
44
+ "@agoric/vow": "0.1.1-dev-36f6b6e.0+36f6b6e",
45
+ "@agoric/zoe": "0.26.3-dev-36f6b6e.0+36f6b6e",
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": "545fc5891467147be545b6d3fa765b2e60dde261"
85
+ "gitHead": "36f6b6ee97589b9e0cc9d784b2386951666d4698"
86
86
  }
@@ -175,7 +175,12 @@ export const contract = async (zcf, privateArgs, zone, tools) => {
175
175
  trace('connectToNoble', agoricChainId, nobleChainId, agoricToNoble);
176
176
  chainHub.updateConnection(agoricChainId, nobleChainId, agoricToNoble);
177
177
  // v1 has `NobleAccount` which we don't expect to ever settle.
178
- const nobleAccountV = zone.makeOnce('NobleICA', () => makeNobleAccount());
178
+ // Including the connection_id in the zone key lets us use
179
+ // this before and after null-upgrade in multichain-testing.
180
+ const nobleAccountV = zone.makeOnce(
181
+ `NobleICA-${agoricToNoble.counterparty.connection_id}`,
182
+ () => makeNobleAccount(),
183
+ );
179
184
 
180
185
  return vowTools.when(nobleAccountV, nobleAccount => {
181
186
  trace('nobleAccount', nobleAccount);
@@ -7,14 +7,39 @@ import { feedPolicies } from './utils/chain-policies.js';
7
7
 
8
8
  const trace = makeTracer('FUSD-2', true);
9
9
 
10
+ // avoid importing all of @agoric/ertp
11
+ /** @type {typeof import('@agoric/ertp').AmountMath.make} */
12
+ // @ts-expect-error AssetKind conditionals aren't captured
13
+ const make = (brand, value) => harden({ brand, value });
14
+ /** @type {typeof import('@agoric/zoe/src/contractSupport/ratio').makeRatio} */
15
+ const makeRatio = (numerator, numeratorBrand, denominator = 100n) =>
16
+ harden({
17
+ numerator: make(numeratorBrand, numerator),
18
+ denominator: make(numeratorBrand, denominator),
19
+ });
20
+
10
21
  /**
11
22
  * @import {CopyRecord} from '@endo/pass-style'
12
23
  * @import {IBCConnectionInfo} from '@agoric/orchestration'
13
24
  * @import {ManifestBundleRef} from '@agoric/deploy-script-support/src/externalTypes.js'
14
25
  * @import {BootstrapManifest} from '@agoric/vats/src/core/lib-boot.js'
15
26
  * @import {FastUSDCCorePowers} from './start-fast-usdc.core.js'
16
- * @import {ContractRecord, FeedPolicy} from './types.js'
27
+ * @import {ContractRecord, FeeConfig, FeedPolicy} from './types.js'
28
+ */
29
+
30
+ /**
31
+ * Update feeConfig.variableRate to 0.5%, i.e. 5n/1000n
32
+ *
33
+ * @param {FeeConfig} feeConfigPre
34
+ * @param {Brand<'nat'>} usdcBrand
35
+ * @param {Ratio} [variableRate]
36
+ * @returns {FeeConfig}
17
37
  */
38
+ const updateFeeConfig = (
39
+ feeConfigPre,
40
+ usdcBrand,
41
+ variableRate = makeRatio(5n, usdcBrand, 1000n),
42
+ ) => harden({ ...feeConfigPre, variableRate });
18
43
 
19
44
  /**
20
45
  * @typedef {object} UpdateOpts
@@ -46,13 +71,15 @@ const config = /** @type {const} */ ({
46
71
  });
47
72
  harden(config);
48
73
 
74
+ const { keys } = Object;
75
+
49
76
  /**
50
77
  * @param {BootstrapPowers & FastUSDCCorePowers} powers
51
78
  * @param {object} [config]
52
79
  * @param {UpdateOpts} [config.options]
53
80
  */
54
81
  export const updateNobleICA = async (
55
- { consume: { chainStorage, fastUsdcKit } },
82
+ { consume: { chainStorage, fastUsdcKit }, produce },
56
83
  { options = {} } = {},
57
84
  ) => {
58
85
  trace('options', options);
@@ -60,17 +87,29 @@ export const updateNobleICA = async (
60
87
  agoricToNoble = config.MAINNET.agoricToNoble,
61
88
  fastUsdcCode = assert.fail('missing bundleID'),
62
89
  } = options;
63
- const { adminFacet, creatorFacet, privateArgs, publicFacet } =
64
- await fastUsdcKit;
65
- trace('upgradeContract follows with privateArgs:', Object.keys(privateArgs));
90
+ const kitPre = await fastUsdcKit;
91
+ trace('fastUsdcKit.privateArgs keys:', keys(kitPre.privateArgs));
92
+ const { adminFacet, creatorFacet, publicFacet } = kitPre;
93
+
94
+ const { brand: usdcBrand } = kitPre.privateArgs.feeConfig.flat;
95
+ // TODO: update agoricToNoble in kitPost.privateArgs.chainInfo too
96
+ const kitPost = harden({
97
+ ...kitPre,
98
+ privateArgs: {
99
+ ...kitPre.privateArgs,
100
+ feeConfig: updateFeeConfig(kitPre.privateArgs.feeConfig, usdcBrand),
101
+ },
102
+ });
66
103
  const upgraded = await E(adminFacet).upgradeContract(
67
104
  fastUsdcCode.bundleID,
68
- privateArgs,
105
+ kitPost.privateArgs,
69
106
  );
70
107
  trace(`DON'T PANIC if you see "CORE_EVAL failed" from v1 above. See #11013`);
71
108
  trace('fastUsdc upgraded', upgraded);
109
+ produce.fastUsdcKit.reset();
110
+ produce.fastUsdcKit.resolve(kitPost);
72
111
 
73
- const { agoric, noble } = privateArgs.chainInfo;
112
+ const { agoric, noble } = kitPre.privateArgs.chainInfo;
74
113
  const nobleICAaddr = await E(creatorFacet).connectToNoble(
75
114
  agoric.chainId,
76
115
  noble.chainId,
@@ -112,6 +151,7 @@ export const getManifestForUpdateNobleICA = (
112
151
  manifest: {
113
152
  [updateNobleICA.name]: {
114
153
  consume: { chainStorage: true, fastUsdcKit: true },
154
+ produce: { fastUsdcKit: true },
115
155
  },
116
156
  [updateFeedPolicy.name]: {
117
157
  consume: { chainStorage: true },