@agoric/fast-usdc 0.1.1-dev-6112a8b.0 → 0.1.1-dev-a7bee20.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-6112a8b.0+6112a8b",
3
+ "version": "0.1.1-dev-a7bee20.0+a7bee20",
4
4
  "description": "CLI and library for Fast USDC product",
5
5
  "type": "module",
6
6
  "files": [
@@ -21,9 +21,9 @@
21
21
  "lint:eslint": "eslint ."
22
22
  },
23
23
  "devDependencies": {
24
- "@agoric/swingset-liveslots": "0.10.3-dev-6112a8b.0+6112a8b",
25
- "@agoric/vats": "0.15.2-dev-6112a8b.0+6112a8b",
26
- "@agoric/zone": "0.2.3-dev-6112a8b.0+6112a8b",
24
+ "@agoric/swingset-liveslots": "0.10.3-dev-a7bee20.0+a7bee20",
25
+ "@agoric/vats": "0.15.2-dev-a7bee20.0+a7bee20",
26
+ "@agoric/zone": "0.2.3-dev-a7bee20.0+a7bee20",
27
27
  "@fast-check/ava": "^2.0.1",
28
28
  "ava": "^5.3.0",
29
29
  "c8": "^9.1.0",
@@ -31,15 +31,15 @@
31
31
  "ts-blank-space": "^0.4.1"
32
32
  },
33
33
  "dependencies": {
34
- "@agoric/client-utils": "0.1.1-dev-6112a8b.0+6112a8b",
35
- "@agoric/ertp": "0.16.3-dev-6112a8b.0+6112a8b",
36
- "@agoric/internal": "0.3.3-dev-6112a8b.0+6112a8b",
37
- "@agoric/notifier": "0.6.3-dev-6112a8b.0+6112a8b",
38
- "@agoric/orchestration": "0.1.1-dev-6112a8b.0+6112a8b",
39
- "@agoric/store": "0.9.3-dev-6112a8b.0+6112a8b",
40
- "@agoric/vat-data": "0.5.3-dev-6112a8b.0+6112a8b",
41
- "@agoric/vow": "0.1.1-dev-6112a8b.0+6112a8b",
42
- "@agoric/zoe": "0.26.3-dev-6112a8b.0+6112a8b",
34
+ "@agoric/client-utils": "0.1.1-dev-a7bee20.0+a7bee20",
35
+ "@agoric/ertp": "0.16.3-dev-a7bee20.0+a7bee20",
36
+ "@agoric/internal": "0.3.3-dev-a7bee20.0+a7bee20",
37
+ "@agoric/notifier": "0.6.3-dev-a7bee20.0+a7bee20",
38
+ "@agoric/orchestration": "0.1.1-dev-a7bee20.0+a7bee20",
39
+ "@agoric/store": "0.9.3-dev-a7bee20.0+a7bee20",
40
+ "@agoric/vat-data": "0.5.3-dev-a7bee20.0+a7bee20",
41
+ "@agoric/vow": "0.1.1-dev-a7bee20.0+a7bee20",
42
+ "@agoric/zoe": "0.26.3-dev-a7bee20.0+a7bee20",
43
43
  "@cosmjs/proto-signing": "^0.32.4",
44
44
  "@cosmjs/stargate": "^0.32.4",
45
45
  "@endo/base64": "^1.0.9",
@@ -77,5 +77,5 @@
77
77
  "publishConfig": {
78
78
  "access": "public"
79
79
  },
80
- "gitHead": "6112a8b0fc5482e7930f5aa092a340dcef1a2a66"
80
+ "gitHead": "a7bee20c0cdb7cb9ead0106d92ce848048f2a0af"
81
81
  }
@@ -68,7 +68,7 @@ export const prepareTransactionFeedKit = (zone, zcf) => {
68
68
  creator: {
69
69
  /**
70
70
  * An "operator invitation" is an invitation to be an operator in the
71
- * oracle netowrk, with the able to submit data to submit evidence of
71
+ * oracle network, with the able to submit data to submit evidence of
72
72
  * CCTP transactions.
73
73
  *
74
74
  * @param {string} operatorId unique per contract instance
@@ -3,7 +3,11 @@ import { Fail } from '@endo/errors';
3
3
  import { E } from '@endo/far';
4
4
  import { makeMarshal } from '@endo/marshal';
5
5
  import { M } from '@endo/patterns';
6
- import { FastUSDCTermsShape, FeeConfigShape } from './type-guards.js';
6
+ import {
7
+ FastUSDCTermsShape,
8
+ FeeConfigShape,
9
+ FeedPolicyShape,
10
+ } from './type-guards.js';
7
11
  import { fromExternalConfig } from './utils/config-marshal.js';
8
12
 
9
13
  /**
@@ -13,9 +17,10 @@ import { fromExternalConfig } from './utils/config-marshal.js';
13
17
  * @import {Board} from '@agoric/vats'
14
18
  * @import {ManifestBundleRef} from '@agoric/deploy-script-support/src/externalTypes.js'
15
19
  * @import {BootstrapManifest} from '@agoric/vats/src/core/lib-boot.js'
20
+ * @import {Passable} from '@endo/marshal';
16
21
  * @import {LegibleCapData} from './utils/config-marshal.js'
17
22
  * @import {FastUsdcSF, FastUsdcTerms} from './fast-usdc.contract.js'
18
- * @import {FeeConfig} from './types.js'
23
+ * @import {FeeConfig, FeedPolicy} from './types.js'
19
24
  */
20
25
 
21
26
  const trace = makeTracer('FUSD-Start', true);
@@ -27,6 +32,7 @@ const contractName = 'fastUsdc';
27
32
  * terms: FastUsdcTerms;
28
33
  * oracles: Record<string, string>;
29
34
  * feeConfig: FeeConfig;
35
+ * feedPolicy: FeedPolicy & Passable;
30
36
  * }} FastUSDCConfig
31
37
  */
32
38
  /** @type {TypedPattern<FastUSDCConfig>} */
@@ -34,6 +40,7 @@ export const FastUSDCConfigShape = M.splitRecord({
34
40
  terms: FastUSDCTermsShape,
35
41
  oracles: M.recordOf(M.string(), M.string()),
36
42
  feeConfig: FeeConfigShape,
43
+ feedPolicy: FeedPolicyShape,
37
44
  });
38
45
 
39
46
  /**
@@ -72,6 +79,17 @@ const publishDisplayInfo = async (brand, { board, chainStorage }) => {
72
79
  await E(node).setValue(JSON.stringify(aux));
73
80
  };
74
81
 
82
+ const FEED_POLICY = 'feedPolicy';
83
+
84
+ /**
85
+ * @param {ERef<StorageNode>} node
86
+ * @param {FeedPolicy} policy
87
+ */
88
+ const publishFeedPolicy = async (node, policy) => {
89
+ const feedPolicy = E(node).makeChildNode(FEED_POLICY);
90
+ await E(feedPolicy).setValue(JSON.stringify(policy));
91
+ };
92
+
75
93
  /**
76
94
  * @typedef { PromiseSpaceOf<{
77
95
  * fastUsdcKit: FastUSDCKit
@@ -131,7 +149,7 @@ export const startFastUSDC = async (
131
149
  USDC: await E(USDCissuer).getBrand(),
132
150
  });
133
151
 
134
- const { terms, oracles, feeConfig } = fromExternalConfig(
152
+ const { terms, oracles, feeConfig, feedPolicy } = fromExternalConfig(
135
153
  config?.options, // just in case config is missing somehow
136
154
  brands,
137
155
  FastUSDCConfigShape,
@@ -182,6 +200,8 @@ export const startFastUSDC = async (
182
200
  fastUsdcKit.resolve(harden({ ...kit, privateArgs }));
183
201
  const { instance, creatorFacet } = kit;
184
202
 
203
+ await publishFeedPolicy(storageNode, feedPolicy);
204
+
185
205
  const {
186
206
  issuers: { PoolShares: shareIssuer },
187
207
  brands: { PoolShares: shareBrand },
@@ -6,7 +6,7 @@ import { PendingTxStatus } from './constants.js';
6
6
  * @import {TypedPattern} from '@agoric/internal';
7
7
  * @import {FastUsdcTerms} from './fast-usdc.contract.js';
8
8
  * @import {USDCProposalShapes} from './pool-share-math.js';
9
- * @import {CctpTxEvidence, FeeConfig, PendingTx, PoolMetrics} from './types.js';
9
+ * @import {CctpTxEvidence, FeeConfig, PendingTx, PoolMetrics, ChainPolicy, FeedPolicy} from './types.js';
10
10
  */
11
11
 
12
12
  /**
@@ -93,3 +93,31 @@ export const PoolMetricsShape = {
93
93
  totalRepays: AmountShape,
94
94
  };
95
95
  harden(PoolMetricsShape);
96
+
97
+ /** @type {TypedPattern<ChainPolicy>} */
98
+ export const ChainPoliciesShape = M.splitRecord(
99
+ {
100
+ nobleContractAddress: EvmHashShape,
101
+ cctpTokenMessengerAddress: EvmHashShape,
102
+ confirmations: M.number(),
103
+ chainId: M.number(),
104
+ },
105
+ { chainType: M.number() },
106
+ );
107
+ harden(ChainPoliciesShape);
108
+
109
+ /**
110
+ * @type {TypedPattern<FeedPolicy>}
111
+ *
112
+ * Should be JSON serializable so CLI can specify policy. E.g. no bigint,
113
+ * undefined, remotable, etc.
114
+ */
115
+ export const FeedPolicyShape = M.splitRecord(
116
+ {
117
+ nobleDomainId: M.number(),
118
+ nobleAgoricChannelId: M.string(),
119
+ chainPolicies: M.recordOf(M.string(), ChainPoliciesShape),
120
+ },
121
+ { eventFilter: M.string() },
122
+ );
123
+ harden(FeedPolicyShape);
package/src/types.ts CHANGED
@@ -5,6 +5,8 @@ import type { PendingTxStatus } from './constants.js';
5
5
 
6
6
  export type EvmHash = `0x${string}`;
7
7
  export type NobleAddress = `noble1${string}`;
8
+ export type EvmChainID = number;
9
+ export type EvmChainName = string;
8
10
 
9
11
  export interface CctpTxEvidence {
10
12
  /** from Noble RPC */
@@ -55,4 +57,19 @@ export interface PoolMetrics extends PoolStats {
55
57
  shareWorth: Ratio;
56
58
  }
57
59
 
60
+ export interface ChainPolicy {
61
+ nobleContractAddress: EvmHash;
62
+ cctpTokenMessengerAddress: EvmHash;
63
+ confirmations: number;
64
+ chainId: EvmChainID;
65
+ chainType?: number;
66
+ }
67
+
68
+ export interface FeedPolicy {
69
+ nobleDomainId: number;
70
+ nobleAgoricChannelId: string;
71
+ chainPolicies: Record<EvmChainName, ChainPolicy>;
72
+ eventFilter?: string;
73
+ }
74
+
58
75
  export type * from './constants.js';