@agoric/inter-protocol 0.16.1 → 0.16.2-calypso-dev-84eb287.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 (192) hide show
  1. package/README.md +6 -6
  2. package/package.json +41 -36
  3. package/scripts/build-bundles.js +5 -21
  4. package/src/auction/auctionBook.d.ts +147 -0
  5. package/src/auction/auctionBook.d.ts.map +1 -0
  6. package/src/auction/auctionBook.js +135 -103
  7. package/src/auction/auctioneer.d.ts +69 -0
  8. package/src/auction/auctioneer.d.ts.map +1 -0
  9. package/src/auction/auctioneer.js +63 -49
  10. package/src/auction/offerBook.d.ts +45 -0
  11. package/src/auction/offerBook.d.ts.map +1 -0
  12. package/src/auction/offerBook.js +13 -12
  13. package/src/auction/params.d.ts +144 -0
  14. package/src/auction/params.d.ts.map +1 -0
  15. package/src/auction/params.js +10 -9
  16. package/src/auction/scheduleMath.d.ts +5 -0
  17. package/src/auction/scheduleMath.d.ts.map +1 -0
  18. package/src/auction/scheduleMath.js +17 -15
  19. package/src/auction/scheduler.d.ts +49 -0
  20. package/src/auction/scheduler.d.ts.map +1 -0
  21. package/src/auction/scheduler.js +51 -43
  22. package/src/auction/sortedOffers.d.ts +8 -0
  23. package/src/auction/sortedOffers.d.ts.map +1 -0
  24. package/src/auction/sortedOffers.js +9 -7
  25. package/src/auction/util.d.ts +32 -0
  26. package/src/auction/util.d.ts.map +1 -0
  27. package/src/auction/util.js +6 -4
  28. package/src/clientSupport.d.ts +167 -0
  29. package/src/clientSupport.d.ts.map +1 -0
  30. package/src/clientSupport.js +154 -96
  31. package/src/collectFees.d.ts +2 -0
  32. package/src/collectFees.d.ts.map +1 -0
  33. package/src/contractSupport.d.ts +28 -0
  34. package/src/contractSupport.d.ts.map +1 -0
  35. package/src/contractSupport.js +14 -12
  36. package/src/econCommitteeCharter.d.ts +39 -0
  37. package/src/econCommitteeCharter.d.ts.map +1 -0
  38. package/src/econCommitteeCharter.js +21 -20
  39. package/src/feeDistributor.d.ts +224 -0
  40. package/src/feeDistributor.d.ts.map +1 -0
  41. package/src/feeDistributor.js +37 -33
  42. package/src/index.d.ts +2 -0
  43. package/src/index.d.ts.map +1 -0
  44. package/src/index.js +1 -0
  45. package/src/interest-math.d.ts +3 -0
  46. package/src/interest-math.d.ts.map +1 -0
  47. package/src/interest.d.ts +28 -0
  48. package/src/interest.d.ts.map +1 -0
  49. package/src/interest.js +21 -16
  50. package/src/price/README.md +13 -0
  51. package/src/price/fluxAggregatorContract.d.ts +70 -0
  52. package/src/price/fluxAggregatorContract.d.ts.map +1 -0
  53. package/src/price/fluxAggregatorContract.js +62 -55
  54. package/src/price/fluxAggregatorKit.d.ts +103 -0
  55. package/src/price/fluxAggregatorKit.d.ts.map +1 -0
  56. package/src/price/fluxAggregatorKit.js +50 -37
  57. package/src/price/priceOracleKit.d.ts +38 -0
  58. package/src/price/priceOracleKit.d.ts.map +1 -0
  59. package/src/price/priceOracleKit.js +11 -13
  60. package/src/price/roundsManager.d.ts +204 -0
  61. package/src/price/roundsManager.d.ts.map +1 -0
  62. package/src/price/roundsManager.js +79 -82
  63. package/src/proposals/README.md +2 -3
  64. package/src/proposals/add-auction.d.ts +69 -0
  65. package/src/proposals/add-auction.d.ts.map +1 -0
  66. package/src/proposals/add-auction.js +180 -0
  67. package/src/proposals/addAssetToVault.d.ts +160 -0
  68. package/src/proposals/addAssetToVault.d.ts.map +1 -0
  69. package/src/proposals/addAssetToVault.js +172 -38
  70. package/src/proposals/committee-proposal.d.ts +113 -0
  71. package/src/proposals/committee-proposal.d.ts.map +1 -0
  72. package/src/proposals/committee-proposal.js +25 -31
  73. package/src/proposals/core-proposal.d.ts +149 -0
  74. package/src/proposals/core-proposal.d.ts.map +1 -0
  75. package/src/proposals/core-proposal.js +9 -11
  76. package/src/proposals/econ-behaviors.d.ts +539 -0
  77. package/src/proposals/econ-behaviors.d.ts.map +1 -0
  78. package/src/proposals/econ-behaviors.js +64 -45
  79. package/src/proposals/price-feed-proposal.d.ts +84 -0
  80. package/src/proposals/price-feed-proposal.d.ts.map +1 -0
  81. package/src/proposals/price-feed-proposal.js +108 -51
  82. package/src/proposals/startEconCommittee.d.ts +34 -0
  83. package/src/proposals/startEconCommittee.d.ts.map +1 -0
  84. package/src/proposals/startEconCommittee.js +2 -2
  85. package/src/proposals/startPSM.d.ts +59 -0
  86. package/src/proposals/startPSM.d.ts.map +1 -0
  87. package/src/proposals/startPSM.js +38 -27
  88. package/src/proposals/upgrade-scaledPriceAuthorities.d.ts +24 -0
  89. package/src/proposals/upgrade-scaledPriceAuthorities.d.ts.map +1 -0
  90. package/src/proposals/upgrade-scaledPriceAuthorities.js +78 -0
  91. package/src/proposals/upgrade-vaults.d.ts +35 -0
  92. package/src/proposals/upgrade-vaults.d.ts.map +1 -0
  93. package/src/proposals/upgrade-vaults.js +235 -0
  94. package/src/proposals/utils.d.ts +17 -0
  95. package/src/proposals/utils.d.ts.map +1 -0
  96. package/src/proposals/utils.js +34 -7
  97. package/src/provisionPool.d.ts +167 -0
  98. package/src/provisionPool.d.ts.map +1 -0
  99. package/src/provisionPool.js +122 -0
  100. package/src/provisionPoolKit.d.ts +367 -0
  101. package/src/provisionPoolKit.d.ts.map +1 -0
  102. package/src/provisionPoolKit.js +522 -0
  103. package/src/psm/psm.d.ts +122 -0
  104. package/src/psm/psm.d.ts.map +1 -0
  105. package/src/psm/psm.js +73 -69
  106. package/src/psm/types-ambient.d.ts +2 -0
  107. package/src/psm/types-ambient.d.ts.map +1 -0
  108. package/src/psm/types-ambient.js +3 -0
  109. package/src/reserve/assetReserve.d.ts +47 -0
  110. package/src/reserve/assetReserve.d.ts.map +1 -0
  111. package/src/reserve/assetReserve.js +28 -19
  112. package/src/reserve/assetReserveKit.d.ts +74 -0
  113. package/src/reserve/assetReserveKit.d.ts.map +1 -0
  114. package/src/reserve/assetReserveKit.js +18 -24
  115. package/src/reserve/params.d.ts +10 -0
  116. package/src/reserve/params.d.ts.map +1 -0
  117. package/src/tokens.d.ts +3 -0
  118. package/src/tokens.d.ts.map +1 -0
  119. package/src/tokens.js +5 -0
  120. package/src/vaultFactory/burn.d.ts +2 -0
  121. package/src/vaultFactory/burn.d.ts.map +1 -0
  122. package/src/vaultFactory/burn.js +1 -1
  123. package/src/vaultFactory/liquidation.d.ts +23 -0
  124. package/src/vaultFactory/liquidation.d.ts.map +1 -0
  125. package/src/vaultFactory/liquidation.js +36 -22
  126. package/src/vaultFactory/math.d.ts +11 -0
  127. package/src/vaultFactory/math.d.ts.map +1 -0
  128. package/src/vaultFactory/math.js +10 -9
  129. package/src/vaultFactory/orderedVaultStore.d.ts +93 -0
  130. package/src/vaultFactory/orderedVaultStore.d.ts.map +1 -0
  131. package/src/vaultFactory/orderedVaultStore.js +8 -11
  132. package/src/vaultFactory/params.d.ts +140 -0
  133. package/src/vaultFactory/params.d.ts.map +1 -0
  134. package/src/vaultFactory/params.js +52 -24
  135. package/src/vaultFactory/prioritizedVaults.d.ts +279 -0
  136. package/src/vaultFactory/prioritizedVaults.d.ts.map +1 -0
  137. package/src/vaultFactory/prioritizedVaults.js +4 -4
  138. package/src/vaultFactory/proceeds.d.ts +35 -0
  139. package/src/vaultFactory/proceeds.d.ts.map +1 -0
  140. package/src/vaultFactory/proceeds.js +26 -18
  141. package/src/vaultFactory/storeUtils.d.ts +25 -0
  142. package/src/vaultFactory/storeUtils.d.ts.map +1 -0
  143. package/src/vaultFactory/storeUtils.js +10 -12
  144. package/src/vaultFactory/types-ambient.d.ts +137 -0
  145. package/src/vaultFactory/types-ambient.d.ts.map +1 -0
  146. package/src/vaultFactory/{types.js → types-ambient.js} +42 -42
  147. package/src/vaultFactory/vault.d.ts +332 -0
  148. package/src/vaultFactory/vault.d.ts.map +1 -0
  149. package/src/vaultFactory/vault.js +99 -93
  150. package/src/vaultFactory/vaultDirector.d.ts +340 -0
  151. package/src/vaultFactory/vaultDirector.d.ts.map +1 -0
  152. package/src/vaultFactory/vaultDirector.js +63 -50
  153. package/src/vaultFactory/vaultFactory.d.ts +201 -0
  154. package/src/vaultFactory/vaultFactory.d.ts.map +1 -0
  155. package/src/vaultFactory/vaultFactory.js +49 -32
  156. package/src/vaultFactory/vaultHolder.d.ts +126 -0
  157. package/src/vaultFactory/vaultHolder.d.ts.map +1 -0
  158. package/src/vaultFactory/vaultHolder.js +10 -14
  159. package/src/vaultFactory/vaultKit.d.ts +32 -0
  160. package/src/vaultFactory/vaultKit.d.ts.map +1 -0
  161. package/src/vaultFactory/vaultKit.js +5 -4
  162. package/src/vaultFactory/vaultManager.d.ts +674 -0
  163. package/src/vaultFactory/vaultManager.d.ts.map +1 -0
  164. package/src/vaultFactory/vaultManager.js +249 -151
  165. package/CHANGELOG.md +0 -1033
  166. package/bundles/bundle-auctioneer-js-meta.json +0 -722
  167. package/bundles/bundle-auctioneer.js +0 -1
  168. package/bundles/bundle-econCommitteeCharter-js-meta.json +0 -514
  169. package/bundles/bundle-econCommitteeCharter.js +0 -1
  170. package/bundles/bundle-feeDistributor-js-meta.json +0 -458
  171. package/bundles/bundle-feeDistributor.js +0 -1
  172. package/bundles/bundle-fluxAggregatorKit-js-meta.json +0 -674
  173. package/bundles/bundle-fluxAggregatorKit.js +0 -1
  174. package/bundles/bundle-psm-js-meta.json +0 -666
  175. package/bundles/bundle-psm.js +0 -1
  176. package/bundles/bundle-reserve-js-meta.json +0 -662
  177. package/bundles/bundle-reserve.js +0 -1
  178. package/bundles/bundle-scaledPriceAuthority-js-meta.json +0 -542
  179. package/bundles/bundle-scaledPriceAuthority.js +0 -1
  180. package/bundles/bundle-vaultFactory-js-meta.json +0 -790
  181. package/bundles/bundle-vaultFactory.js +0 -1
  182. package/exported.js +0 -2
  183. package/scripts/add-collateral-core.js +0 -112
  184. package/scripts/deploy-contracts.js +0 -100
  185. package/scripts/init-core.js +0 -198
  186. package/scripts/invite-committee-core.js +0 -42
  187. package/scripts/manual-price-feed.js +0 -117
  188. package/scripts/price-feed-core.js +0 -104
  189. package/scripts/start-local-chain.sh +0 -84
  190. package/src/psm/types.js +0 -3
  191. package/src/typeGuards.js +0 -13
  192. package/src/vaultFactory/type-imports.js +0 -4
@@ -0,0 +1,204 @@
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 = IssuerKit<"set", PriceDescription>;
181
+ export type HeldParams = Readonly<import("./fluxAggregatorKit.js").ChainlinkConfig & {
182
+ quoteKit: QuoteKit;
183
+ answerPublisher: Publisher<void>;
184
+ brandIn: Brand<"nat">;
185
+ brandOut: Brand<"nat">;
186
+ latestRoundPublisher: import("@agoric/zoe/src/contractSupport/recorder.js").Recorder<LatestRound>;
187
+ timerPresence: TimerService;
188
+ }>;
189
+ export type ImmutableState = Readonly<HeldParams & {
190
+ details: MapStore<bigint, RoundDetails>;
191
+ rounds: MapStore<bigint, Round>;
192
+ unitIn: bigint;
193
+ }>;
194
+ export type MutableState = {
195
+ lastValueOutForUnitIn: bigint | null;
196
+ reportingRoundId: bigint;
197
+ };
198
+ export type State = ImmutableState & MutableState;
199
+ import type { TimerService } from '@agoric/time';
200
+ import type { OracleStatus } from './priceOracleKit.js';
201
+ import type { Timestamp } from '@agoric/time';
202
+ import type { PriceQuoteValue } from '@agoric/zoe/tools/types.js';
203
+ import type { PriceDescription } from '@agoric/zoe/tools/types.js';
204
+ //# sourceMappingURL=roundsManager.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"roundsManager.d.ts","sourceRoot":"","sources":["roundsManager.js"],"names":[],"mappings":"AAyBA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-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,33 @@ 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
78
+ *
79
+ *
80
+ * @typedef {Readonly<
81
+ * HeldParams & {
82
+ * details: MapStore<bigint, RoundDetails>;
83
+ * rounds: MapStore<bigint, Round>;
84
+ * unitIn: bigint;
85
+ * }
86
+ * >} ImmutableState
82
87
  *
83
- * @typedef {Readonly<HeldParams & {
84
- * details: MapStore<bigint, RoundDetails>,
85
- * rounds: MapStore<bigint, Round>,
86
- * unitIn: bigint,
87
- * }>} ImmutableState
88
88
  *
89
89
  * @typedef {{
90
- * lastValueOutForUnitIn: bigint?,
91
- * reportingRoundId: bigint,
90
+ * lastValueOutForUnitIn: bigint?;
91
+ * reportingRoundId: bigint;
92
92
  * }} MutableState
93
93
  */
94
94
  /** @typedef {ImmutableState & MutableState} State */
@@ -99,24 +99,34 @@ export const prepareRoundsManagerKit = baggage =>
99
99
  'RoundsManager',
100
100
  {
101
101
  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
- ),
102
+ contract: M.interface('contract', {
103
+ authenticateQuote: M.call([M.record()]).returns(M.any()),
104
+ makeCreateQuote: M.call()
105
+ .optional({
106
+ overrideValueOut: M.number(),
107
+ timestamp: TimestampShape,
108
+ })
109
+ .returns(M.any()),
110
+ eligibleForSpecificRound: M.call(
111
+ M.any(),
112
+ M.bigint(),
113
+ TimestampShape,
114
+ ).returns(M.boolean()),
115
+ getRoundData: M.call(M.any()).returns(M.promise()),
116
+ getRoundStatus: M.call(M.bigint()).returns(M.record()),
117
+ oracleRoundStateSuggestRound: M.call(M.any(), TimestampShape).returns(
118
+ M.record(),
119
+ ),
120
+ }),
115
121
  oracle: M.interface('oracle', {
116
122
  handlePush: M.call(M.record(), M.record()).returns(M.promise()),
117
123
  }),
118
124
  },
119
- /** @type {(opts: HeldParams & { unitAmountIn: Amount<'nat'> }) => State} */
125
+ /**
126
+ * @type {(
127
+ * opts: HeldParams & { unitAmountIn: Amount<'nat'> },
128
+ * ) => State}
129
+ */
120
130
  ({
121
131
  // ChainlinkConfig
122
132
  maxSubmissionCount,
@@ -170,9 +180,7 @@ export const prepareRoundsManagerKit = baggage =>
170
180
  },
171
181
  {
172
182
  helper: {
173
- /**
174
- * @param {bigint} roundId
175
- */
183
+ /** @param {bigint} roundId */
176
184
  acceptingSubmissions(roundId) {
177
185
  const { details } = this.state;
178
186
  return (
@@ -190,9 +198,7 @@ export const prepareRoundsManagerKit = baggage =>
190
198
  return roundId > add(lastStarted, restartDelay) || lastStarted === 0n;
191
199
  },
192
200
 
193
- /**
194
- * @param {bigint} roundId
195
- */
201
+ /** @param {bigint} roundId */
196
202
  deleteRoundDetails(roundId) {
197
203
  const { details } = this.state;
198
204
  const roundDetails = details.get(roundId);
@@ -201,9 +207,7 @@ export const prepareRoundsManagerKit = baggage =>
201
207
  details.delete(roundId);
202
208
  },
203
209
 
204
- /**
205
- * @param {bigint} roundId
206
- */
210
+ /** @param {bigint} roundId */
207
211
  isNextRound(roundId) {
208
212
  const { reportingRoundId } = this.state;
209
213
  return roundId === add(reportingRoundId, 1);
@@ -421,7 +425,7 @@ export const prepareRoundsManagerKit = baggage =>
421
425
  * @param {OracleStatus} status
422
426
  * @param {bigint} roundId
423
427
  * @param {Timestamp} blockTimestamp
424
- * @returns {string?} error message, if there is one
428
+ * @returns {string | null} error message, if there is one
425
429
  */
426
430
  validateOracleRound(status, roundId, blockTimestamp) {
427
431
  const { reportingRoundId } = this.state;
@@ -435,8 +439,10 @@ export const prepareRoundsManagerKit = baggage =>
435
439
  );
436
440
  }
437
441
 
438
- if (status.lastReportedRound >= roundId)
442
+ if (status.lastReportedRound >= roundId) {
439
443
  return 'cannot report on previous rounds';
444
+ }
445
+
440
446
  if (
441
447
  roundId !== reportingRoundId &&
442
448
  roundId !== add(reportingRoundId, 1) &&
@@ -449,10 +455,7 @@ export const prepareRoundsManagerKit = baggage =>
449
455
  },
450
456
  },
451
457
  contract: {
452
- /**
453
- *
454
- * @param {PriceQuoteValue} quote
455
- */
458
+ /** @param {PriceQuoteValue} quote */
456
459
  async authenticateQuote(quote) {
457
460
  const { quoteKit } = this.state;
458
461
  const quoteAmount = AmountMath.make(quoteKit.brand, harden(quote));
@@ -470,9 +473,7 @@ export const prepareRoundsManagerKit = baggage =>
470
473
  const { brandIn, brandOut, timerPresence } = state;
471
474
  const { contract } = this.facets;
472
475
 
473
- /**
474
- * @param {PriceQuery} priceQuery
475
- */
476
+ /** @param {PriceQuery} priceQuery */
476
477
  return Far('createQuote', priceQuery => {
477
478
  const { lastValueOutForUnitIn, unitIn } = state;
478
479
 
@@ -486,9 +487,7 @@ export const prepareRoundsManagerKit = baggage =>
486
487
  return undefined;
487
488
  }
488
489
 
489
- /**
490
- * @param {Amount<'nat'>} amountIn the given amountIn
491
- */
490
+ /** @param {Amount<'nat'>} amountIn the given amountIn */
492
491
  const calcAmountOut = amountIn => {
493
492
  const valueIn = AmountMath.getValue(brandIn, amountIn);
494
493
  return AmountMath.make(
@@ -497,9 +496,7 @@ export const prepareRoundsManagerKit = baggage =>
497
496
  );
498
497
  };
499
498
 
500
- /**
501
- * @param {Amount<'nat'>} amountOut the wanted amountOut
502
- */
499
+ /** @param {Amount<'nat'>} amountOut the wanted amountOut */
503
500
  const calcAmountIn = amountOut => {
504
501
  const valueOut = AmountMath.getValue(brandOut, amountOut);
505
502
  return AmountMath.make(
@@ -564,9 +561,8 @@ export const prepareRoundsManagerKit = baggage =>
564
561
  },
565
562
 
566
563
  /**
567
- * consumers are encouraged to check
568
- * that they're receiving fresh data by inspecting the updatedAt and
569
- * answeredInRound return values.
564
+ * consumers are encouraged to check that they're receiving fresh data
565
+ * by inspecting the updatedAt and answeredInRound return values.
570
566
  *
571
567
  * @param {bigint | number} roundIdRaw
572
568
  * @returns {Promise<RoundData>}
@@ -603,8 +599,9 @@ export const prepareRoundsManagerKit = baggage =>
603
599
  },
604
600
 
605
601
  /**
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.
602
+ * a method to provide all current info oracleStatuses need. Intended
603
+ * only only to be callable by oracleStatuses. Not for use by contracts
604
+ * to read state.
608
605
  *
609
606
  * @param {OracleStatus} status
610
607
  * @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,iBAyI/D;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA2BG;AAGI;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAEN;uBAhLsB,gCAAgC"}