@agoric/inter-protocol 0.16.2-upgrade-14-dev-0169c7e.0 → 0.16.2-upgrade-16-dev-8879538.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.
Files changed (175) hide show
  1. package/package.json +41 -34
  2. package/scripts/build-bundles.js +5 -21
  3. package/src/auction/auctionBook.d.ts +84 -0
  4. package/src/auction/auctionBook.d.ts.map +1 -0
  5. package/src/auction/auctionBook.js +135 -103
  6. package/src/auction/auctioneer.d.ts +83 -0
  7. package/src/auction/auctioneer.d.ts.map +1 -0
  8. package/src/auction/auctioneer.js +63 -49
  9. package/src/auction/offerBook.d.ts +45 -0
  10. package/src/auction/offerBook.d.ts.map +1 -0
  11. package/src/auction/offerBook.js +13 -12
  12. package/src/auction/params.d.ts +149 -0
  13. package/src/auction/params.d.ts.map +1 -0
  14. package/src/auction/params.js +10 -9
  15. package/src/auction/scheduleMath.d.ts +5 -0
  16. package/src/auction/scheduleMath.d.ts.map +1 -0
  17. package/src/auction/scheduleMath.js +17 -15
  18. package/src/auction/scheduler.d.ts +49 -0
  19. package/src/auction/scheduler.d.ts.map +1 -0
  20. package/src/auction/scheduler.js +51 -43
  21. package/src/auction/sortedOffers.d.ts +8 -0
  22. package/src/auction/sortedOffers.d.ts.map +1 -0
  23. package/src/auction/sortedOffers.js +9 -7
  24. package/src/auction/util.d.ts +32 -0
  25. package/src/auction/util.d.ts.map +1 -0
  26. package/src/auction/util.js +6 -4
  27. package/src/clientSupport.d.ts +167 -0
  28. package/src/clientSupport.d.ts.map +1 -0
  29. package/src/clientSupport.js +97 -40
  30. package/src/collectFees.d.ts +2 -0
  31. package/src/collectFees.d.ts.map +1 -0
  32. package/src/contractSupport.d.ts +28 -0
  33. package/src/contractSupport.d.ts.map +1 -0
  34. package/src/contractSupport.js +14 -12
  35. package/src/econCommitteeCharter.d.ts +39 -0
  36. package/src/econCommitteeCharter.d.ts.map +1 -0
  37. package/src/econCommitteeCharter.js +21 -20
  38. package/src/feeDistributor.d.ts +224 -0
  39. package/src/feeDistributor.d.ts.map +1 -0
  40. package/src/feeDistributor.js +37 -33
  41. package/src/index.d.ts +2 -0
  42. package/src/index.d.ts.map +1 -0
  43. package/src/index.js +1 -0
  44. package/src/interest-math.d.ts +3 -0
  45. package/src/interest-math.d.ts.map +1 -0
  46. package/src/interest.d.ts +28 -0
  47. package/src/interest.d.ts.map +1 -0
  48. package/src/interest.js +21 -16
  49. package/src/price/README.md +13 -0
  50. package/src/price/fluxAggregatorContract.d.ts +70 -0
  51. package/src/price/fluxAggregatorContract.d.ts.map +1 -0
  52. package/src/price/fluxAggregatorContract.js +62 -55
  53. package/src/price/fluxAggregatorKit.d.ts +103 -0
  54. package/src/price/fluxAggregatorKit.d.ts.map +1 -0
  55. package/src/price/fluxAggregatorKit.js +50 -37
  56. package/src/price/priceOracleKit.d.ts +38 -0
  57. package/src/price/priceOracleKit.d.ts.map +1 -0
  58. package/src/price/priceOracleKit.js +11 -13
  59. package/src/price/roundsManager.d.ts +238 -0
  60. package/src/price/roundsManager.d.ts.map +1 -0
  61. package/src/price/roundsManager.js +77 -82
  62. package/src/proposals/README.md +2 -3
  63. package/src/proposals/add-auction.d.ts +69 -0
  64. package/src/proposals/add-auction.d.ts.map +1 -0
  65. package/src/proposals/add-auction.js +181 -0
  66. package/src/proposals/addAssetToVault.d.ts +160 -0
  67. package/src/proposals/addAssetToVault.d.ts.map +1 -0
  68. package/src/proposals/addAssetToVault.js +172 -38
  69. package/src/proposals/committee-proposal.d.ts +113 -0
  70. package/src/proposals/committee-proposal.d.ts.map +1 -0
  71. package/src/proposals/committee-proposal.js +25 -31
  72. package/src/proposals/core-proposal.d.ts +149 -0
  73. package/src/proposals/core-proposal.d.ts.map +1 -0
  74. package/src/proposals/core-proposal.js +9 -11
  75. package/src/proposals/econ-behaviors.d.ts +1169 -0
  76. package/src/proposals/econ-behaviors.d.ts.map +1 -0
  77. package/src/proposals/econ-behaviors.js +66 -45
  78. package/src/proposals/price-feed-proposal.d.ts +84 -0
  79. package/src/proposals/price-feed-proposal.d.ts.map +1 -0
  80. package/src/proposals/price-feed-proposal.js +108 -51
  81. package/src/proposals/startEconCommittee.d.ts +34 -0
  82. package/src/proposals/startEconCommittee.d.ts.map +1 -0
  83. package/src/proposals/startEconCommittee.js +2 -2
  84. package/src/proposals/startPSM.d.ts +59 -0
  85. package/src/proposals/startPSM.d.ts.map +1 -0
  86. package/src/proposals/startPSM.js +38 -27
  87. package/src/proposals/upgrade-scaledPriceAuthorities.d.ts +24 -0
  88. package/src/proposals/upgrade-scaledPriceAuthorities.d.ts.map +1 -0
  89. package/src/proposals/upgrade-scaledPriceAuthorities.js +78 -0
  90. package/src/proposals/upgrade-vaults.d.ts +35 -0
  91. package/src/proposals/upgrade-vaults.d.ts.map +1 -0
  92. package/src/proposals/upgrade-vaults.js +202 -0
  93. package/src/proposals/utils.d.ts +17 -0
  94. package/src/proposals/utils.d.ts.map +1 -0
  95. package/src/proposals/utils.js +34 -7
  96. package/src/provisionPool.d.ts +167 -0
  97. package/src/provisionPool.d.ts.map +1 -0
  98. package/src/provisionPool.js +122 -0
  99. package/src/provisionPoolKit.d.ts +770 -0
  100. package/src/provisionPoolKit.d.ts.map +1 -0
  101. package/src/provisionPoolKit.js +463 -0
  102. package/src/psm/psm.d.ts +122 -0
  103. package/src/psm/psm.d.ts.map +1 -0
  104. package/src/psm/psm.js +73 -69
  105. package/src/psm/types-ambient.d.ts +2 -0
  106. package/src/psm/types-ambient.d.ts.map +1 -0
  107. package/src/psm/types-ambient.js +3 -0
  108. package/src/reserve/assetReserve.d.ts +47 -0
  109. package/src/reserve/assetReserve.d.ts.map +1 -0
  110. package/src/reserve/assetReserve.js +28 -19
  111. package/src/reserve/assetReserveKit.d.ts +74 -0
  112. package/src/reserve/assetReserveKit.d.ts.map +1 -0
  113. package/src/reserve/assetReserveKit.js +18 -24
  114. package/src/reserve/params.d.ts +10 -0
  115. package/src/reserve/params.d.ts.map +1 -0
  116. package/src/tokens.d.ts +3 -0
  117. package/src/tokens.d.ts.map +1 -0
  118. package/src/tokens.js +5 -0
  119. package/src/vaultFactory/burn.d.ts +2 -0
  120. package/src/vaultFactory/burn.d.ts.map +1 -0
  121. package/src/vaultFactory/burn.js +1 -1
  122. package/src/vaultFactory/liquidation.d.ts +163 -0
  123. package/src/vaultFactory/liquidation.d.ts.map +1 -0
  124. package/src/vaultFactory/liquidation.js +36 -22
  125. package/src/vaultFactory/math.d.ts +11 -0
  126. package/src/vaultFactory/math.d.ts.map +1 -0
  127. package/src/vaultFactory/math.js +10 -9
  128. package/src/vaultFactory/orderedVaultStore.d.ts +360 -0
  129. package/src/vaultFactory/orderedVaultStore.d.ts.map +1 -0
  130. package/src/vaultFactory/orderedVaultStore.js +8 -11
  131. package/src/vaultFactory/params.d.ts +145 -0
  132. package/src/vaultFactory/params.d.ts.map +1 -0
  133. package/src/vaultFactory/params.js +52 -24
  134. package/src/vaultFactory/prioritizedVaults.d.ts +992 -0
  135. package/src/vaultFactory/prioritizedVaults.d.ts.map +1 -0
  136. package/src/vaultFactory/prioritizedVaults.js +4 -4
  137. package/src/vaultFactory/proceeds.d.ts +35 -0
  138. package/src/vaultFactory/proceeds.d.ts.map +1 -0
  139. package/src/vaultFactory/proceeds.js +26 -18
  140. package/src/vaultFactory/storeUtils.d.ts +25 -0
  141. package/src/vaultFactory/storeUtils.d.ts.map +1 -0
  142. package/src/vaultFactory/storeUtils.js +10 -12
  143. package/src/vaultFactory/types-ambient.d.ts +234 -0
  144. package/src/vaultFactory/types-ambient.d.ts.map +1 -0
  145. package/src/vaultFactory/{types.js → types-ambient.js} +42 -42
  146. package/src/vaultFactory/vault.d.ts +402 -0
  147. package/src/vaultFactory/vault.d.ts.map +1 -0
  148. package/src/vaultFactory/vault.js +99 -93
  149. package/src/vaultFactory/vaultDirector.d.ts +388 -0
  150. package/src/vaultFactory/vaultDirector.d.ts.map +1 -0
  151. package/src/vaultFactory/vaultDirector.js +61 -50
  152. package/src/vaultFactory/vaultFactory.d.ts +277 -0
  153. package/src/vaultFactory/vaultFactory.d.ts.map +1 -0
  154. package/src/vaultFactory/vaultFactory.js +49 -32
  155. package/src/vaultFactory/vaultHolder.d.ts +270 -0
  156. package/src/vaultFactory/vaultHolder.d.ts.map +1 -0
  157. package/src/vaultFactory/vaultHolder.js +10 -14
  158. package/src/vaultFactory/vaultKit.d.ts +102 -0
  159. package/src/vaultFactory/vaultKit.d.ts.map +1 -0
  160. package/src/vaultFactory/vaultKit.js +5 -4
  161. package/src/vaultFactory/vaultManager.d.ts +819 -0
  162. package/src/vaultFactory/vaultManager.d.ts.map +1 -0
  163. package/src/vaultFactory/vaultManager.js +248 -151
  164. package/CHANGELOG.md +0 -1066
  165. package/exported.js +0 -2
  166. package/scripts/add-collateral-core.js +0 -113
  167. package/scripts/deploy-contracts.js +0 -100
  168. package/scripts/init-core.js +0 -200
  169. package/scripts/invite-committee-core.js +0 -42
  170. package/scripts/manual-price-feed.js +0 -117
  171. package/scripts/price-feed-core.js +0 -104
  172. package/scripts/start-local-chain.sh +0 -84
  173. package/src/psm/types.js +0 -3
  174. package/src/typeGuards.js +0 -13
  175. package/src/vaultFactory/type-imports.js +0 -4
@@ -0,0 +1,238 @@
1
+ /** @type {bigint} */
2
+ export const ROUND_MAX: bigint;
3
+ export function prepareRoundsManagerKit(baggage: any): (args_0: Readonly<import("./fluxAggregatorKit.js").ChainlinkConfig & {
4
+ quoteKit: QuoteKit;
5
+ answerPublisher: Publisher<void>;
6
+ brandIn: Brand<"nat">;
7
+ brandOut: Brand<"nat">;
8
+ latestRoundPublisher: import("@agoric/zoe/src/contractSupport/recorder.js").Recorder<LatestRound>;
9
+ timerPresence: TimerService;
10
+ }> & {
11
+ unitAmountIn: Amount<"nat">;
12
+ }) => import("@endo/exo").GuardedKit<{
13
+ helper: {
14
+ /** @param {bigint} roundId */
15
+ acceptingSubmissions(roundId: bigint): boolean;
16
+ /**
17
+ * @param {OracleStatus} status
18
+ * @param {bigint} roundId
19
+ */
20
+ delayed(status: OracleStatus, roundId: bigint): boolean;
21
+ /** @param {bigint} roundId */
22
+ deleteRoundDetails(roundId: bigint): void;
23
+ /** @param {bigint} roundId */
24
+ isNextRound(roundId: bigint): boolean;
25
+ /**
26
+ * @param {bigint} roundId
27
+ * @param {Timestamp} blockTimestamp
28
+ * @param {string} oracleId
29
+ */
30
+ initializeNewRound(roundId: bigint, blockTimestamp: Timestamp, oracleId: string): void;
31
+ /**
32
+ * @param {bigint} roundId
33
+ * @param {bigint} rrId reporting round ID
34
+ */
35
+ previousAndCurrentUnanswered(roundId: bigint, rrId: bigint): boolean;
36
+ /**
37
+ * @param {bigint} roundId
38
+ * @param {OracleStatus} status
39
+ * @param {Timestamp} blockTimestamp
40
+ * @returns {OracleStatus | undefined} the new status
41
+ */
42
+ proposeNewRound(roundId: bigint, status: OracleStatus, blockTimestamp: Timestamp): OracleStatus | undefined;
43
+ /**
44
+ * @param {bigint} submission
45
+ * @param {bigint} roundId
46
+ * @param {OracleStatus} status
47
+ * @returns {OracleStatus} the new status
48
+ */
49
+ recordSubmission(submission: bigint, roundId: bigint, status: OracleStatus): OracleStatus;
50
+ /**
51
+ * @param {bigint} roundId
52
+ * @param {Timestamp} blockTimestamp
53
+ */
54
+ supersedable(roundId: bigint, blockTimestamp: Timestamp): boolean;
55
+ /**
56
+ * @param {bigint} roundId
57
+ * @param {Timestamp} blockTimestamp
58
+ */
59
+ timedOut(roundId: bigint, blockTimestamp: Timestamp): boolean;
60
+ /**
61
+ * @param {bigint} roundId
62
+ * @param {Timestamp} blockTimestamp
63
+ */
64
+ updateRoundAnswer(roundId: bigint, blockTimestamp: Timestamp): (number | boolean)[] | (bigint | boolean)[];
65
+ /**
66
+ * @param {bigint} roundId
67
+ * @param {Timestamp} blockTimestamp
68
+ */
69
+ updateTimedOutRoundInfo(roundId: bigint, blockTimestamp: Timestamp): void;
70
+ /**
71
+ * @param {OracleStatus} status
72
+ * @param {bigint} roundId
73
+ * @param {Timestamp} blockTimestamp
74
+ * @returns {string | null} error message, if there is one
75
+ */
76
+ validateOracleRound(status: OracleStatus, roundId: bigint, blockTimestamp: Timestamp): string | null;
77
+ };
78
+ contract: {
79
+ /** @param {PriceQuoteValue} quote */
80
+ authenticateQuote(quote: PriceQuoteValue): Promise<{
81
+ quoteAmount: import("@agoric/ertp/src/types.js").SetAmount<PriceDescription>;
82
+ quotePayment: globalThis.Payment<"set", PriceDescription>;
83
+ }>;
84
+ /**
85
+ * @param {object} param0
86
+ * @param {number} [param0.overrideValueOut]
87
+ * @param {Timestamp} [param0.timestamp]
88
+ */
89
+ makeCreateQuote({ overrideValueOut, timestamp }?: {
90
+ overrideValueOut?: number | undefined;
91
+ timestamp?: Timestamp | undefined;
92
+ }): ((priceQuery: any) => Promise<{
93
+ quoteAmount: import("@agoric/ertp/src/types.js").SetAmount<PriceDescription>;
94
+ quotePayment: globalThis.Payment<"set", PriceDescription>;
95
+ }> | undefined) & import("@endo/marshal").RemotableObject<`Alleged: ${string}`> & import("@endo/eventual-send").RemotableBrand<{}, (priceQuery: any) => Promise<{
96
+ quoteAmount: import("@agoric/ertp/src/types.js").SetAmount<PriceDescription>;
97
+ quotePayment: globalThis.Payment<"set", PriceDescription>;
98
+ }> | undefined>;
99
+ /**
100
+ * @param {OracleStatus} status
101
+ * @param {bigint} queriedRoundId
102
+ * @param {Timestamp} blockTimestamp
103
+ */
104
+ eligibleForSpecificRound(status: OracleStatus, queriedRoundId: bigint, blockTimestamp: Timestamp): boolean;
105
+ /**
106
+ * consumers are encouraged to check that they're receiving fresh data
107
+ * by inspecting the updatedAt and answeredInRound return values.
108
+ *
109
+ * @param {bigint | number} roundIdRaw
110
+ * @returns {Promise<RoundData>}
111
+ */
112
+ getRoundData(roundIdRaw: bigint | number): Promise<RoundData>;
113
+ /** @type {(roundId: bigint) => Readonly<RoundDetails & Round>} */
114
+ getRoundStatus(roundId: bigint): Readonly<RoundDetails & Round>;
115
+ /**
116
+ * a method to provide all current info oracleStatuses need. Intended
117
+ * only only to be callable by oracleStatuses. Not for use by contracts
118
+ * to read state.
119
+ *
120
+ * @param {OracleStatus} status
121
+ * @param {Timestamp} blockTimestamp
122
+ */
123
+ oracleRoundStateSuggestRound(status: OracleStatus, blockTimestamp: Timestamp): {
124
+ eligibleForSpecificRound: boolean;
125
+ queriedRoundId: bigint;
126
+ latestSubmission: bigint;
127
+ startedAt: Timestamp;
128
+ roundTimeout: number;
129
+ };
130
+ };
131
+ oracle: {
132
+ /**
133
+ * push a unitPrice result from this oracle
134
+ *
135
+ * @param {OracleStatus} status
136
+ * @param {PriceRound} result
137
+ */
138
+ handlePush(status: OracleStatus, { roundId: roundIdRaw, unitPrice: valueRaw }: PriceRound): Promise<OracleStatus>;
139
+ };
140
+ }>;
141
+ export type PriceRound = {
142
+ roundId: number | undefined;
143
+ unitPrice: NatValue;
144
+ };
145
+ export type LatestRound = Pick<RoundData, "roundId" | "startedAt"> & {
146
+ startedBy: string;
147
+ };
148
+ export type RoundData = Round & {
149
+ roundId: bigint;
150
+ };
151
+ export type Round = {
152
+ /**
153
+ * the answer for the given round
154
+ */
155
+ answer: bigint;
156
+ /**
157
+ * the timestamp when the round was started.
158
+ * This is 0 if the round hasn't been started yet.
159
+ */
160
+ startedAt: Timestamp;
161
+ /**
162
+ * the timestamp when the round last was updated
163
+ * (i.e. answer was last computed)
164
+ */
165
+ updatedAt: Timestamp;
166
+ /**
167
+ * the round ID of the round in which the
168
+ * answer was computed. answeredInRound may be smaller than roundId when the
169
+ * round timed out. answeredInRound is equal to roundId when the round didn't
170
+ * time out and was completed regularly.
171
+ */
172
+ answeredInRound: bigint;
173
+ };
174
+ export type RoundDetails = {
175
+ submissions: bigint[];
176
+ maxSubmissions: number;
177
+ minSubmissions: number;
178
+ roundTimeout: number;
179
+ };
180
+ export type QuoteKit = {
181
+ mint: globalThis.Mint<"set", PriceDescription>;
182
+ /**
183
+ * Externally useful only if this
184
+ * issuer uses recovery sets. Can be used to get the recovery set associated
185
+ * with minted payments that are still live.
186
+ */
187
+ mintRecoveryPurse: globalThis.Purse<"set", PriceDescription>;
188
+ issuer: globalThis.Issuer<"set", PriceDescription>;
189
+ brand: globalThis.Brand<"set">;
190
+ displayInfo: globalThis.DisplayInfo;
191
+ };
192
+ export type HeldParams = {
193
+ readonly maxSubmissionCount: number;
194
+ readonly minSubmissionCount: number;
195
+ /**
196
+ * the number of rounds an Oracle has to wait
197
+ * before they can initiate a round
198
+ */
199
+ readonly restartDelay: bigint;
200
+ /**
201
+ * an immutable check for a lower bound of
202
+ * what submission values are accepted from an oracle
203
+ */
204
+ readonly minSubmissionValue: number;
205
+ /**
206
+ * an immutable check for an upper bound
207
+ * of what submission values are accepted from an oracle
208
+ */
209
+ readonly maxSubmissionValue: number;
210
+ /**
211
+ * the number of seconds after the previous round
212
+ * that allowed to lapse before allowing an oracle to skip an unfinished
213
+ * round
214
+ */
215
+ readonly timeout: number;
216
+ readonly quoteKit: QuoteKit;
217
+ readonly answerPublisher: Publisher<void>;
218
+ readonly brandIn: Brand<"nat">;
219
+ readonly brandOut: Brand<"nat">;
220
+ readonly latestRoundPublisher: import("@agoric/zoe/src/contractSupport/recorder.js").Recorder<LatestRound>;
221
+ readonly timerPresence: TimerService;
222
+ };
223
+ export type ImmutableState = Readonly<HeldParams & {
224
+ details: MapStore<bigint, RoundDetails>;
225
+ rounds: MapStore<bigint, Round>;
226
+ unitIn: bigint;
227
+ }>;
228
+ export type MutableState = {
229
+ lastValueOutForUnitIn: bigint | null;
230
+ reportingRoundId: bigint;
231
+ };
232
+ export type State = ImmutableState & MutableState;
233
+ import type { TimerService } from '@agoric/time';
234
+ import type { OracleStatus } from './priceOracleKit.js';
235
+ import type { Timestamp } from '@agoric/time';
236
+ import type { PriceQuoteValue } from '@agoric/zoe/tools/types.js';
237
+ import type { PriceDescription } from '@agoric/zoe/tools/types.js';
238
+ //# sourceMappingURL=roundsManager.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"roundsManager.d.ts","sourceRoot":"","sources":["roundsManager.js"],"names":[],"mappings":"AAyBA,qBAAqB;AACrB,wBADW,MAAM,CAC4B;AAmEtC;cAxBU,QAAQ;qBACD,SAAS,CAAC,IAAI,CAAC;aACvB,KAAK,CAAC,KAAK,CAAC;cACX,KAAK,CAAC,KAAK,CAAC;0BACA,OAAO,6CAA6C,EAAE,QAAQ,CAAC,WAAW,CAAC;;;kBAmD5D,MAAM,CAAC,KAAK,CAAC;;;QAwDjD,8BAA8B;sCAAlB,MAAM;QAQlB;;;WAGG;+CADQ,MAAM;QAQjB,8BAA8B;oCAAlB,MAAM;QASlB,8BAA8B;6BAAlB,MAAM;QAMlB;;;;WAIG;oCAHQ,MAAM,uCAEN,MAAM;QA4CjB;;;WAGG;8CAFQ,MAAM,QACN,MAAM;QAOjB;;;;;WAKG;iCAJQ,MAAM;QAoBjB;;;;;WAKG;qCAJQ,MAAM,WACN,MAAM;QA0BjB;;;WAGG;8BAFQ,MAAM;QAYjB;;;WAGG;0BAFQ,MAAM;QA0BjB;;;WAGG;mCAFQ,MAAM;QAiCjB;;;WAGG;yCAFQ,MAAM;QA4BjB;;;;;WAKG;2DAHQ,MAAM,8BAEJ,MAAM,GAAG,IAAI;;;QA8B1B,qCAAqC;;;;;QAQrC;;;;WAIG;;YAFwB,gBAAgB;YACb,SAAS;;;;;;;;QAwEvC;;;;WAIG;uEAFQ,MAAM;QAoBjB;;;;;;WAMG;iCAFQ,MAAM,GAAG,MAAM,GACb,OAAO,CAAC,SAAS,CAAC;QAwB/B,kEAAkE;gCAA7C,MAAM,GAAK,QAAQ,CAAC,YAAY,GAAG,KAAK,CAAC;QAS9D;;;;;;;WAOG;;;;;;;;;;QAwDH;;;;;WAKG;uFADQ,UAAU;;GA+D1B;yBAprBU;IAAE,OAAO,EAAE,MAAM,GAAG,SAAS,CAAC;IAAC,SAAS,EAAE,QAAQ,CAAA;CAAE;0BAEpD,IAAI,CAAC,SAAS,EAAE,SAAS,GAAG,WAAW,CAAC,GAAG;IAAE,SAAS,EAAE,MAAM,CAAA;CAAE;wBAG/D,KAAK,GAAG;IAAE,OAAO,EAAE,MAAM,CAAA;CAAE;;;;;YAI3B,MAAM;;;;;;;;;;;;;;;;;qBAKN,MAAM;;;iBAQN,MAAM,EAAE;oBACR,MAAM;oBACN,MAAM;kBACN,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;uBAQH,QAAQ;8BACD,SAAS,CAAC,IAAI,CAAC;sBACvB,KAAK,CAAC,KAAK,CAAC;uBACX,KAAK,CAAC,KAAK,CAAC;mCACA,OAAO,6CAA6C,EAAE,QAAQ,CAAC,WAAW,CAAC;;;6BAK3F,QAAQ,CACpB,UAAc,GAAG;IACjB,OAAa,EAAE,QAAQ,CAAC,MAAM,EAAE,YAAY,CAAC,CAAC;IAC9C,MAAY,EAAE,QAAQ,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;IACtC,MAAY,EAAE,MAAM,CAAC;CAChB,CACF;2BAES;IACZ,qBAAyB,EAAE,MAAM,QAAE;IACnC,gBAAoB,EAAE,MAAM,CAAC;CAC1B;oBAEU,cAAc,GAAG,YAAY;kCAzED,cAAc;kCACzB,qBAAqB;+BADV,cAAc;qCADqC,4BAA4B;sCAA5B,4BAA4B"}
@@ -1,7 +1,7 @@
1
1
  import { Fail, q } from '@agoric/assert';
2
2
  import { AmountMath } from '@agoric/ertp';
3
3
  import { makeTracer } from '@agoric/internal';
4
- import { TimeMath } from '@agoric/time';
4
+ import { TimeMath, TimestampShape } from '@agoric/time';
5
5
  import { M, makeScalarBigMapStore, prepareExoClassKit } from '@agoric/vat-data';
6
6
  import {
7
7
  calculateMedian,
@@ -10,14 +10,14 @@ import {
10
10
  import { E } from '@endo/eventual-send';
11
11
  import { Far } from '@endo/marshal';
12
12
  import { isNat, Nat } from '@endo/nat';
13
- import { UnguardedHelperI } from '../typeGuards.js';
13
+ import { UnguardedHelperI } from '@agoric/internal/src/typeGuards.js';
14
14
 
15
15
  const { add, subtract, multiply, floorDivide, ceilDivide, isGTE } = natSafeMath;
16
16
 
17
- /** @typedef {import('./priceOracleKit.js').OracleStatus} OracleStatus */
18
17
  /**
19
- * @typedef {import('@agoric/time/src/types').Timestamp} Timestamp
20
- * @typedef {import('@agoric/time/src/types').TimerService} TimerService
18
+ * @import {PriceAuthority, PriceDescription, PriceQuote, PriceQuoteValue, PriceQuery,} from '@agoric/zoe/tools/types.js';
19
+ * @import {Timestamp, TimerService} from '@agoric/time'
20
+ * @import {OracleStatus} from './priceOracleKit.js'
21
21
  */
22
22
 
23
23
  /** @type {string} */
@@ -28,34 +28,30 @@ export const ROUND_MAX = BigInt(2 ** 32 - 1);
28
28
 
29
29
  const trace = makeTracer('RoundsM', false);
30
30
 
31
- /**
32
- * @param {bigint} roundId
33
- */
31
+ /** @param {bigint} roundId */
34
32
  const validRoundId = roundId => {
35
33
  return roundId <= ROUND_MAX;
36
34
  };
37
35
 
38
36
  /**
39
- * @typedef {{ roundId: number | undefined, unitPrice: NatValue }} PriceRound
37
+ * @typedef {{ roundId: number | undefined; unitPrice: NatValue }} PriceRound
40
38
  *
41
- * @typedef {Pick<RoundData, 'roundId' | 'startedAt'> & { startedBy: string }} LatestRound
39
+ * @typedef {Pick<RoundData, 'roundId' | 'startedAt'> & { startedBy: string }} LatestRound
42
40
  */
43
41
 
44
- /**
45
- * @typedef {Round & {roundId: bigint}} RoundData
46
- */
42
+ /** @typedef {Round & { roundId: bigint }} RoundData */
47
43
 
48
44
  /**
49
45
  * @typedef {object} Round
50
46
  * @property {bigint} answer the answer for the given round
51
- * @property {Timestamp} startedAt the timestamp when the round was started. This is 0
52
- * if the round hasn't been started yet.
53
- * @property {Timestamp} updatedAt the timestamp when the round last was updated (i.e.
54
- * answer was last computed)
55
- * @property {bigint} answeredInRound the round ID of the round in which the answer
56
- * was computed. answeredInRound may be smaller than roundId when the round
57
- * timed out. answeredInRound is equal to roundId when the round didn't time out
58
- * and was completed regularly.
47
+ * @property {Timestamp} startedAt the timestamp when the round was started.
48
+ * This is 0 if the round hasn't been started yet.
49
+ * @property {Timestamp} updatedAt the timestamp when the round last was updated
50
+ * (i.e. answer was last computed)
51
+ * @property {bigint} answeredInRound the round ID of the round in which the
52
+ * answer was computed. answeredInRound may be smaller than roundId when the
53
+ * round timed out. answeredInRound is equal to roundId when the round didn't
54
+ * time out and was completed regularly.
59
55
  */
60
56
 
61
57
  /**
@@ -66,29 +62,31 @@ const validRoundId = roundId => {
66
62
  * @property {number} roundTimeout
67
63
  */
68
64
 
69
- /**
70
- * @typedef {IssuerKit<'set'>} QuoteKit
71
- */
65
+ /** @typedef {IssuerKit<'set', PriceDescription>} QuoteKit */
72
66
 
73
67
  /**
74
- * @typedef {Readonly<import('./fluxAggregatorKit.js').ChainlinkConfig & {
75
- * quoteKit: QuoteKit,
76
- * answerPublisher: Publisher<void>,
77
- * brandIn: Brand<'nat'>,
78
- * brandOut: Brand<'nat'>,
79
- * latestRoundPublisher: import('@agoric/zoe/src/contractSupport/recorder.js').Recorder<LatestRound>,
80
- * timerPresence: TimerService,
81
- * }>} HeldParams
68
+ * @typedef {Readonly<
69
+ * import('./fluxAggregatorKit.js').ChainlinkConfig & {
70
+ * quoteKit: QuoteKit;
71
+ * answerPublisher: Publisher<void>;
72
+ * brandIn: Brand<'nat'>;
73
+ * brandOut: Brand<'nat'>;
74
+ * latestRoundPublisher: import('@agoric/zoe/src/contractSupport/recorder.js').Recorder<LatestRound>;
75
+ * timerPresence: TimerService;
76
+ * }
77
+ * >} HeldParams
82
78
  *
83
- * @typedef {Readonly<HeldParams & {
84
- * details: MapStore<bigint, RoundDetails>,
85
- * rounds: MapStore<bigint, Round>,
86
- * unitIn: bigint,
87
- * }>} ImmutableState
79
+ * @typedef {Readonly<
80
+ * HeldParams & {
81
+ * details: MapStore<bigint, RoundDetails>;
82
+ * rounds: MapStore<bigint, Round>;
83
+ * unitIn: bigint;
84
+ * }
85
+ * >} ImmutableState
88
86
  *
89
87
  * @typedef {{
90
- * lastValueOutForUnitIn: bigint?,
91
- * reportingRoundId: bigint,
88
+ * lastValueOutForUnitIn: bigint?;
89
+ * reportingRoundId: bigint;
92
90
  * }} MutableState
93
91
  */
94
92
  /** @typedef {ImmutableState & MutableState} State */
@@ -99,24 +97,34 @@ export const prepareRoundsManagerKit = baggage =>
99
97
  'RoundsManager',
100
98
  {
101
99
  helper: UnguardedHelperI,
102
- contract: M.interface(
103
- 'contract',
104
- {
105
- authenticateQuote: M.call(M.any()).returns(M.any()),
106
- makeCreateQuote: M.call().optional(M.any()).returns(M.any()),
107
- eligibleForSpecificRound: M.call(M.any()).returns(M.boolean()),
108
- getRoundData: M.call(M.any()).returns(M.promise()),
109
- getRoundStatus: M.call(M.any()).returns(M.record()),
110
- oracleRoundStateSuggestRound: M.call(M.any()).returns(M.record()),
111
- },
112
- // TODO(6571) stop sloppy
113
- { sloppy: true },
114
- ),
100
+ contract: M.interface('contract', {
101
+ authenticateQuote: M.call([M.record()]).returns(M.any()),
102
+ makeCreateQuote: M.call()
103
+ .optional({
104
+ overrideValueOut: M.number(),
105
+ timestamp: TimestampShape,
106
+ })
107
+ .returns(M.any()),
108
+ eligibleForSpecificRound: M.call(
109
+ M.any(),
110
+ M.bigint(),
111
+ TimestampShape,
112
+ ).returns(M.boolean()),
113
+ getRoundData: M.call(M.any()).returns(M.promise()),
114
+ getRoundStatus: M.call(M.bigint()).returns(M.record()),
115
+ oracleRoundStateSuggestRound: M.call(M.any(), TimestampShape).returns(
116
+ M.record(),
117
+ ),
118
+ }),
115
119
  oracle: M.interface('oracle', {
116
120
  handlePush: M.call(M.record(), M.record()).returns(M.promise()),
117
121
  }),
118
122
  },
119
- /** @type {(opts: HeldParams & { unitAmountIn: Amount<'nat'> }) => State} */
123
+ /**
124
+ * @type {(
125
+ * opts: HeldParams & { unitAmountIn: Amount<'nat'> },
126
+ * ) => State}
127
+ */
120
128
  ({
121
129
  // ChainlinkConfig
122
130
  maxSubmissionCount,
@@ -170,9 +178,7 @@ export const prepareRoundsManagerKit = baggage =>
170
178
  },
171
179
  {
172
180
  helper: {
173
- /**
174
- * @param {bigint} roundId
175
- */
181
+ /** @param {bigint} roundId */
176
182
  acceptingSubmissions(roundId) {
177
183
  const { details } = this.state;
178
184
  return (
@@ -190,9 +196,7 @@ export const prepareRoundsManagerKit = baggage =>
190
196
  return roundId > add(lastStarted, restartDelay) || lastStarted === 0n;
191
197
  },
192
198
 
193
- /**
194
- * @param {bigint} roundId
195
- */
199
+ /** @param {bigint} roundId */
196
200
  deleteRoundDetails(roundId) {
197
201
  const { details } = this.state;
198
202
  const roundDetails = details.get(roundId);
@@ -201,9 +205,7 @@ export const prepareRoundsManagerKit = baggage =>
201
205
  details.delete(roundId);
202
206
  },
203
207
 
204
- /**
205
- * @param {bigint} roundId
206
- */
208
+ /** @param {bigint} roundId */
207
209
  isNextRound(roundId) {
208
210
  const { reportingRoundId } = this.state;
209
211
  return roundId === add(reportingRoundId, 1);
@@ -421,7 +423,7 @@ export const prepareRoundsManagerKit = baggage =>
421
423
  * @param {OracleStatus} status
422
424
  * @param {bigint} roundId
423
425
  * @param {Timestamp} blockTimestamp
424
- * @returns {string?} error message, if there is one
426
+ * @returns {string | null} error message, if there is one
425
427
  */
426
428
  validateOracleRound(status, roundId, blockTimestamp) {
427
429
  const { reportingRoundId } = this.state;
@@ -435,8 +437,10 @@ export const prepareRoundsManagerKit = baggage =>
435
437
  );
436
438
  }
437
439
 
438
- if (status.lastReportedRound >= roundId)
440
+ if (status.lastReportedRound >= roundId) {
439
441
  return 'cannot report on previous rounds';
442
+ }
443
+
440
444
  if (
441
445
  roundId !== reportingRoundId &&
442
446
  roundId !== add(reportingRoundId, 1) &&
@@ -449,10 +453,7 @@ export const prepareRoundsManagerKit = baggage =>
449
453
  },
450
454
  },
451
455
  contract: {
452
- /**
453
- *
454
- * @param {PriceQuoteValue} quote
455
- */
456
+ /** @param {PriceQuoteValue} quote */
456
457
  async authenticateQuote(quote) {
457
458
  const { quoteKit } = this.state;
458
459
  const quoteAmount = AmountMath.make(quoteKit.brand, harden(quote));
@@ -470,9 +471,7 @@ export const prepareRoundsManagerKit = baggage =>
470
471
  const { brandIn, brandOut, timerPresence } = state;
471
472
  const { contract } = this.facets;
472
473
 
473
- /**
474
- * @param {PriceQuery} priceQuery
475
- */
474
+ /** @param {PriceQuery} priceQuery */
476
475
  return Far('createQuote', priceQuery => {
477
476
  const { lastValueOutForUnitIn, unitIn } = state;
478
477
 
@@ -486,9 +485,7 @@ export const prepareRoundsManagerKit = baggage =>
486
485
  return undefined;
487
486
  }
488
487
 
489
- /**
490
- * @param {Amount<'nat'>} amountIn the given amountIn
491
- */
488
+ /** @param {Amount<'nat'>} amountIn the given amountIn */
492
489
  const calcAmountOut = amountIn => {
493
490
  const valueIn = AmountMath.getValue(brandIn, amountIn);
494
491
  return AmountMath.make(
@@ -497,9 +494,7 @@ export const prepareRoundsManagerKit = baggage =>
497
494
  );
498
495
  };
499
496
 
500
- /**
501
- * @param {Amount<'nat'>} amountOut the wanted amountOut
502
- */
497
+ /** @param {Amount<'nat'>} amountOut the wanted amountOut */
503
498
  const calcAmountIn = amountOut => {
504
499
  const valueOut = AmountMath.getValue(brandOut, amountOut);
505
500
  return AmountMath.make(
@@ -564,9 +559,8 @@ export const prepareRoundsManagerKit = baggage =>
564
559
  },
565
560
 
566
561
  /**
567
- * consumers are encouraged to check
568
- * that they're receiving fresh data by inspecting the updatedAt and
569
- * answeredInRound return values.
562
+ * consumers are encouraged to check that they're receiving fresh data
563
+ * by inspecting the updatedAt and answeredInRound return values.
570
564
  *
571
565
  * @param {bigint | number} roundIdRaw
572
566
  * @returns {Promise<RoundData>}
@@ -603,8 +597,9 @@ export const prepareRoundsManagerKit = baggage =>
603
597
  },
604
598
 
605
599
  /**
606
- * a method to provide all current info oracleStatuses need. Intended only
607
- * only to be callable by oracleStatuses. Not for use by contracts to read state.
600
+ * a method to provide all current info oracleStatuses need. Intended
601
+ * only only to be callable by oracleStatuses. Not for use by contracts
602
+ * to read state.
608
603
  *
609
604
  * @param {OracleStatus} status
610
605
  * @param {Timestamp} blockTimestamp
@@ -1,7 +1,6 @@
1
1
  # Proposals
2
2
 
3
- These are code snippets that go into propoals to the BLDer DAO to start the Inter Protocol.
3
+ These scripts are referenced by proposals to the BLDer DAO to run on the chain.
4
4
 
5
- One of the latest is `startPSM.js` so best to model after that. The style in `econ-behaviors.js` will be refactored to be like startPSM.
5
+ See the documentation in .../deploy-script-support/README.md
6
6
 
7
- [syntax of the manifests](../../packages/vats/src/core/manifest.js)
@@ -0,0 +1,69 @@
1
+ export function addAuction({ consume: { zoe, board, chainTimerService, priceAuthority, chainStorage, economicCommitteeCreatorFacet: electorateCreatorFacet, auctioneerKit: legacyKitP, }, produce: { newAuctioneerKit }, instance: { consume: { reserve: reserveInstance }, }, installation: { consume: { auctioneer: auctionInstallation, contractGovernor: contractGovernorInstallation, }, }, issuer: { consume: { [Stable.symbol]: stableIssuerP }, }, }: import("./econ-behaviors.js").EconomyBootstrapPowers): Promise<void>;
2
+ export const ADD_AUCTION_MANIFEST: {
3
+ [x: string]: {
4
+ consume: {
5
+ zoe: boolean;
6
+ board: boolean;
7
+ chainTimerService: boolean;
8
+ priceAuthority: boolean;
9
+ chainStorage: boolean;
10
+ economicCommitteeCreatorFacet: boolean;
11
+ auctioneerKit: boolean;
12
+ };
13
+ produce: {
14
+ newAuctioneerKit: boolean;
15
+ };
16
+ instance: {
17
+ consume: {
18
+ reserve: boolean;
19
+ };
20
+ };
21
+ installation: {
22
+ consume: {
23
+ auctioneer: boolean;
24
+ contractGovernor: boolean;
25
+ };
26
+ };
27
+ issuer: {
28
+ consume: {
29
+ IST: boolean;
30
+ };
31
+ };
32
+ };
33
+ };
34
+ export function getManifestForAddAuction(): Promise<{
35
+ manifest: {
36
+ [x: string]: {
37
+ consume: {
38
+ zoe: boolean;
39
+ board: boolean;
40
+ chainTimerService: boolean;
41
+ priceAuthority: boolean;
42
+ chainStorage: boolean;
43
+ economicCommitteeCreatorFacet: boolean;
44
+ auctioneerKit: boolean;
45
+ };
46
+ produce: {
47
+ newAuctioneerKit: boolean;
48
+ };
49
+ instance: {
50
+ consume: {
51
+ reserve: boolean;
52
+ };
53
+ };
54
+ installation: {
55
+ consume: {
56
+ auctioneer: boolean;
57
+ contractGovernor: boolean;
58
+ };
59
+ };
60
+ issuer: {
61
+ consume: {
62
+ IST: boolean;
63
+ };
64
+ };
65
+ };
66
+ };
67
+ }>;
68
+ import { Stable } from '@agoric/internal/src/tokens.js';
69
+ //# sourceMappingURL=add-auction.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"add-auction.d.ts","sourceRoot":"","sources":["add-auction.js"],"names":[],"mappings":"AASO,8bADK,OAAO,qBAAqB,EAAE,sBAAsB,iBA0I/D;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA2BG;AAGI;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAEN;uBAjLsB,gCAAgC"}