@agoric/inter-protocol 0.17.0 → 0.17.1-upgrade-23-dev-bd79330.0.bd79330

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 (148) hide show
  1. package/package.json +23 -27
  2. package/source-spec-registry.js +67 -0
  3. package/src/auction/util.d.ts +3 -1
  4. package/src/auction/util.d.ts.map +1 -1
  5. package/src/auction/util.js +1 -2
  6. package/src/clientSupport.d.ts +29 -73
  7. package/src/clientSupport.d.ts.map +1 -1
  8. package/src/clientSupport.js +25 -129
  9. package/src/collectFees.d.ts +4 -0
  10. package/src/collectFees.d.ts.map +1 -1
  11. package/src/collectFees.js +5 -2
  12. package/src/contractSupport.d.ts +10 -2
  13. package/src/contractSupport.d.ts.map +1 -1
  14. package/src/contractSupport.js +8 -3
  15. package/src/econCommitteeCharter.d.ts +19 -8
  16. package/src/econCommitteeCharter.d.ts.map +1 -1
  17. package/src/econCommitteeCharter.js +12 -12
  18. package/src/feeDistributor.d.ts +56 -52
  19. package/src/feeDistributor.d.ts.map +1 -1
  20. package/src/feeDistributor.js +5 -3
  21. package/src/index.js +0 -3
  22. package/src/interest-math.d.ts +1 -0
  23. package/src/interest-math.d.ts.map +1 -1
  24. package/src/interest-math.js +1 -2
  25. package/src/interest.d.ts +13 -1
  26. package/src/interest.d.ts.map +1 -1
  27. package/src/interest.js +6 -3
  28. package/src/price/fluxAggregatorContract.d.ts +38 -14
  29. package/src/price/fluxAggregatorContract.d.ts.map +1 -1
  30. package/src/price/fluxAggregatorContract.js +26 -12
  31. package/src/price/fluxAggregatorKit.d.ts +18 -8
  32. package/src/price/fluxAggregatorKit.d.ts.map +1 -1
  33. package/src/price/fluxAggregatorKit.js +22 -8
  34. package/src/price/priceOracleKit.d.ts +3 -1
  35. package/src/price/priceOracleKit.d.ts.map +1 -1
  36. package/src/price/priceOracleKit.js +3 -1
  37. package/src/price/roundsManager.d.ts +15 -8
  38. package/src/price/roundsManager.d.ts.map +1 -1
  39. package/src/price/roundsManager.js +9 -2
  40. package/src/proposals/addAssetToVault.js +17 -105
  41. package/src/proposals/committee-proposal.js +14 -14
  42. package/src/proposals/core-proposal.js +12 -37
  43. package/src/proposals/deploy-price-feeds.js +12 -5
  44. package/src/proposals/econ-behaviors.js +23 -154
  45. package/src/proposals/price-feed-proposal.js +14 -4
  46. package/src/proposals/replace-fee-distributor.js +8 -4
  47. package/src/proposals/replace-scaledPriceAuthorities.js +8 -2
  48. package/src/proposals/replaceElectorate.js +7 -1
  49. package/src/proposals/startEconCommittee.js +5 -1
  50. package/src/proposals/startPSM.js +15 -6
  51. package/src/proposals/upgrade-scaledPriceAuthorities.js +5 -0
  52. package/src/proposals/utils.d.ts +10 -4
  53. package/src/proposals/utils.d.ts.map +1 -1
  54. package/src/proposals/utils.js +16 -8
  55. package/src/proposals/withdraw-reserve-proposal.js +6 -1
  56. package/src/provisionPool.d.ts +36 -18
  57. package/src/provisionPool.d.ts.map +1 -1
  58. package/src/provisionPool.js +19 -12
  59. package/src/provisionPoolKit.d.ts +29 -77
  60. package/src/provisionPoolKit.d.ts.map +1 -1
  61. package/src/provisionPoolKit.js +33 -23
  62. package/src/psm/psm.d.ts +36 -24
  63. package/src/psm/psm.d.ts.map +1 -1
  64. package/src/psm/psm.js +19 -15
  65. package/src/reserve/assetReserve.d.ts +16 -6
  66. package/src/reserve/assetReserve.d.ts.map +1 -1
  67. package/src/reserve/assetReserve.js +17 -9
  68. package/src/reserve/assetReserveKit.d.ts +13 -10
  69. package/src/reserve/assetReserveKit.d.ts.map +1 -1
  70. package/src/reserve/assetReserveKit.js +7 -5
  71. package/src/reserve/params.d.ts +1 -1
  72. package/src/reserve/params.d.ts.map +1 -1
  73. package/src/reserve/params.js +1 -3
  74. package/src/vaultFactory/burn.d.ts +4 -1
  75. package/src/vaultFactory/burn.d.ts.map +1 -1
  76. package/src/vaultFactory/burn.js +5 -4
  77. package/src/vaultFactory/math.d.ts +2 -0
  78. package/src/vaultFactory/math.d.ts.map +1 -1
  79. package/src/vaultFactory/math.js +5 -3
  80. package/src/vaultFactory/orderedVaultStore.d.ts +36 -36
  81. package/src/vaultFactory/params.d.ts +37 -10
  82. package/src/vaultFactory/params.d.ts.map +1 -1
  83. package/src/vaultFactory/params.js +34 -13
  84. package/src/vaultFactory/prioritizedVaults.d.ts +98 -95
  85. package/src/vaultFactory/prioritizedVaults.d.ts.map +1 -1
  86. package/src/vaultFactory/prioritizedVaults.js +3 -2
  87. package/src/vaultFactory/storeUtils.d.ts +8 -3
  88. package/src/vaultFactory/storeUtils.d.ts.map +1 -1
  89. package/src/vaultFactory/storeUtils.js +8 -4
  90. package/src/vaultFactory/{types-ambient.d.ts → types.d.ts} +40 -40
  91. package/src/vaultFactory/types.d.ts.map +1 -0
  92. package/src/vaultFactory/{types-ambient.js → types.js} +26 -25
  93. package/src/vaultFactory/vault.d.ts +51 -35
  94. package/src/vaultFactory/vault.d.ts.map +1 -1
  95. package/src/vaultFactory/vault.js +29 -17
  96. package/src/vaultFactory/vaultDirector.d.ts +102 -112
  97. package/src/vaultFactory/vaultDirector.d.ts.map +1 -1
  98. package/src/vaultFactory/vaultDirector.js +40 -82
  99. package/src/vaultFactory/vaultFactory.d.ts +47 -95
  100. package/src/vaultFactory/vaultFactory.d.ts.map +1 -1
  101. package/src/vaultFactory/vaultFactory.js +27 -27
  102. package/src/vaultFactory/vaultHolder.d.ts +62 -55
  103. package/src/vaultFactory/vaultHolder.d.ts.map +1 -1
  104. package/src/vaultFactory/vaultHolder.js +10 -4
  105. package/src/vaultFactory/vaultKit.d.ts +15 -10
  106. package/src/vaultFactory/vaultKit.d.ts.map +1 -1
  107. package/src/vaultFactory/vaultKit.js +8 -7
  108. package/src/vaultFactory/vaultManager.d.ts +112 -262
  109. package/src/vaultFactory/vaultManager.d.ts.map +1 -1
  110. package/src/vaultFactory/vaultManager.js +42 -319
  111. package/NEWS.md +0 -0
  112. package/scripts/build-bundles.js +0 -22
  113. package/src/auction/auctionBook.d.ts +0 -147
  114. package/src/auction/auctionBook.d.ts.map +0 -1
  115. package/src/auction/auctionBook.js +0 -794
  116. package/src/auction/auctionMath.d.ts +0 -17
  117. package/src/auction/auctionMath.d.ts.map +0 -1
  118. package/src/auction/auctionMath.js +0 -81
  119. package/src/auction/auctioneer.d.ts +0 -70
  120. package/src/auction/auctioneer.d.ts.map +0 -1
  121. package/src/auction/auctioneer.js +0 -733
  122. package/src/auction/offerBook.d.ts +0 -46
  123. package/src/auction/offerBook.d.ts.map +0 -1
  124. package/src/auction/offerBook.js +0 -226
  125. package/src/auction/params.d.ts +0 -145
  126. package/src/auction/params.d.ts.map +0 -1
  127. package/src/auction/params.js +0 -176
  128. package/src/auction/scheduleMath.d.ts +0 -5
  129. package/src/auction/scheduleMath.d.ts.map +0 -1
  130. package/src/auction/scheduleMath.js +0 -169
  131. package/src/auction/scheduler.d.ts +0 -50
  132. package/src/auction/scheduler.d.ts.map +0 -1
  133. package/src/auction/scheduler.js +0 -376
  134. package/src/auction/sortedOffers.d.ts +0 -8
  135. package/src/auction/sortedOffers.d.ts.map +0 -1
  136. package/src/auction/sortedOffers.js +0 -137
  137. package/src/proposals/add-auction.js +0 -285
  138. package/src/proposals/upgrade-vaults.js +0 -207
  139. package/src/psm/types-ambient.d.ts +0 -2
  140. package/src/psm/types-ambient.d.ts.map +0 -1
  141. package/src/psm/types-ambient.js +0 -3
  142. package/src/vaultFactory/liquidation.d.ts +0 -25
  143. package/src/vaultFactory/liquidation.d.ts.map +0 -1
  144. package/src/vaultFactory/liquidation.js +0 -309
  145. package/src/vaultFactory/proceeds.d.ts +0 -35
  146. package/src/vaultFactory/proceeds.d.ts.map +0 -1
  147. package/src/vaultFactory/proceeds.js +0 -282
  148. package/src/vaultFactory/types-ambient.d.ts.map +0 -1
@@ -1,46 +0,0 @@
1
- export function prepareScaledBidBook(baggage: Baggage): (bidScalingPattern: Pattern, collateralBrand: globalThis.Brand) => import("@endo/exo").Guarded<{
2
- /**
3
- * @param {ZCFSeat} seat
4
- * @param {Ratio} bidScaling
5
- * @param {Amount<'nat'>} wanted
6
- * @param {boolean} exitAfterBuy
7
- */
8
- add(seat: ZCFSeat, bidScaling: Ratio, wanted: Amount<"nat">, exitAfterBuy: boolean): string;
9
- /** @param {Ratio} bidScaling */
10
- offersAbove(bidScaling: Ratio): [string, BidderRecord][];
11
- hasOrders(): boolean;
12
- delete(key: any): void;
13
- updateReceived(key: any, sold: any): void;
14
- exitAllSeats(): void;
15
- }>;
16
- export function preparePriceBook(baggage: Baggage): (priceRatioPattern: Pattern, collateralBrand: globalThis.Brand) => import("@endo/exo").Guarded<{
17
- /**
18
- * @param {ZCFSeat} seat
19
- * @param {Ratio} price
20
- * @param {Amount<'nat'>} wanted
21
- * @param {boolean} exitAfterBuy
22
- */
23
- add(seat: ZCFSeat, price: Ratio, wanted: Amount<"nat">, exitAfterBuy: boolean): string;
24
- offersAbove(price: any): [string, BidderRecord][];
25
- hasOrders(): boolean;
26
- delete(key: any): void;
27
- updateReceived(key: any, sold: any): void;
28
- exitAllSeats(): void;
29
- }>;
30
- export type BidderRecord = {
31
- seat: ZCFSeat;
32
- wanted: Amount<"nat">;
33
- seqNum: NatValue;
34
- received: Amount<"nat">;
35
- } & {
36
- exitAfterBuy: boolean;
37
- } & ({
38
- bidScaling: Pattern;
39
- price: undefined;
40
- } | {
41
- bidScaling: undefined;
42
- price: Ratio;
43
- });
44
- import type { Baggage } from '@agoric/vat-data';
45
- import type { Pattern } from '@endo/patterns';
46
- //# sourceMappingURL=offerBook.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"offerBook.d.ts","sourceRoot":"","sources":["offerBook.js"],"names":[],"mappings":"AAsDO,8CAFI,OAAO;IAkBZ;;;;;OAKG;cAJQ,OAAO,cACP,KAAK,UACL,MAAM,CAAC,KAAK,CAAC,gBACb,OAAO;IAsBlB,gCAAgC;4BAApB,KAAK;;;;;GAqCpB;AAcI,0CAFI,OAAO;IAkBZ;;;;;OAKG;cAJQ,OAAO,SACP,KAAK,UACL,MAAM,CAAC,KAAK,CAAC,gBACb,OAAO;;;;;;GA0DrB;2BAnMU;IACR,IAAI,EAAE,OAAO,CAAC;IACd,MAAM,EAAE,MAAM,CAAC,KAAK,CAAC,CAAC;IACtB,MAAM,EAAE,QAAQ,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC,KAAK,CAAC,CAAC;CACzB,GAAG;IAAE,YAAY,EAAE,OAAO,CAAA;CAAE,GAAG,CAC1B;IAAE,UAAU,EAAE,OAAO,CAAC;IAAC,KAAK,EAAE,SAAS,CAAA;CAAE,GACzC;IAAE,UAAU,EAAE,SAAS,CAAC;IAAC,KAAK,EAAE,KAAK,CAAA;CAAE,CAC1C;6BAtBoB,kBAAkB;6BACb,gBAAgB"}
@@ -1,226 +0,0 @@
1
- // book of offers to buy liquidating vaults with prices in terms of
2
- // discount/markup from the current oracle price.
3
-
4
- import { AmountMath } from '@agoric/ertp';
5
- import { M, mustMatch } from '@agoric/store';
6
- import { makeScalarBigMapStore, prepareExoClass } from '@agoric/vat-data';
7
-
8
- import {
9
- toBidScalingComparator,
10
- toPartialOfferKey,
11
- toPriceOfferKey,
12
- toScaledRateOfferKey,
13
- } from './sortedOffers.js';
14
-
15
- /**
16
- * @import {MapStore} from '@agoric/store';
17
- * @import {Baggage} from '@agoric/vat-data';
18
- * @import {Key, Pattern} from '@endo/patterns';
19
- */
20
-
21
- // multiple offers might be provided at the same time (since the time
22
- // granularity is limited to blocks), so we increment a sequenceNumber with each
23
- // offer for uniqueness.
24
- let latestSequenceNumber = 0n;
25
- const nextSequenceNumber = () => {
26
- latestSequenceNumber += 1n;
27
- return latestSequenceNumber;
28
- };
29
-
30
- /**
31
- * @typedef {{
32
- * seat: ZCFSeat;
33
- * wanted: Amount<'nat'>;
34
- * seqNum: NatValue;
35
- * received: Amount<'nat'>;
36
- * } & { exitAfterBuy: boolean } & (
37
- * | { bidScaling: Pattern; price: undefined }
38
- * | { bidScaling: undefined; price: Ratio }
39
- * )} BidderRecord
40
- */
41
-
42
- const ScaledBidBookStateShape = harden({
43
- bidScalingPattern: M.any(),
44
- collateralBrand: M.any(),
45
- records: M.any(),
46
- });
47
-
48
- /**
49
- * Prices in this book are expressed as percentage of the full oracle price
50
- * snapshot taken when the auction started. .4 is 60% off. 1.1 is 10% above
51
- * par.
52
- *
53
- * @param {Baggage} baggage
54
- */
55
- export const prepareScaledBidBook = baggage =>
56
- prepareExoClass(
57
- baggage,
58
- 'scaledBidBook',
59
- undefined,
60
- /**
61
- * @param {Pattern} bidScalingPattern
62
- * @param {Brand} collateralBrand
63
- */
64
- (bidScalingPattern, collateralBrand) => ({
65
- bidScalingPattern,
66
- collateralBrand,
67
- /** @type {MapStore<string, BidderRecord>} */
68
- records: makeScalarBigMapStore('scaledBidRecords', { durable: true }),
69
- }),
70
- {
71
- /**
72
- * @param {ZCFSeat} seat
73
- * @param {Ratio} bidScaling
74
- * @param {Amount<'nat'>} wanted
75
- * @param {boolean} exitAfterBuy
76
- */
77
- add(seat, bidScaling, wanted, exitAfterBuy) {
78
- const { bidScalingPattern, collateralBrand, records } = this.state;
79
- mustMatch(bidScaling, bidScalingPattern);
80
-
81
- const seqNum = nextSequenceNumber();
82
- const key = toScaledRateOfferKey(bidScaling, seqNum);
83
- const empty = AmountMath.makeEmpty(collateralBrand);
84
- /** @type {BidderRecord} */
85
- const bidderRecord = {
86
- bidScaling,
87
- price: undefined,
88
- received: empty,
89
- seat,
90
- seqNum,
91
- wanted,
92
- exitAfterBuy,
93
- };
94
- records.init(key, harden(bidderRecord));
95
- return key;
96
- },
97
- /** @param {Ratio} bidScaling */
98
- offersAbove(bidScaling) {
99
- const { records } = this.state;
100
- return [...records.entries(M.gte(toBidScalingComparator(bidScaling)))];
101
- },
102
- hasOrders() {
103
- const { records } = this.state;
104
- return records.getSize() > 0;
105
- },
106
- delete(key) {
107
- const { records } = this.state;
108
- records.delete(key);
109
- },
110
- updateReceived(key, sold) {
111
- const { records } = this.state;
112
- const oldRec = records.get(key);
113
- records.set(
114
- key,
115
- harden({
116
- ...oldRec,
117
- received: AmountMath.add(oldRec.received, sold),
118
- }),
119
- );
120
- },
121
- exitAllSeats() {
122
- const { records } = this.state;
123
- for (const [key, { seat }] of records.entries()) {
124
- if (!seat.hasExited()) {
125
- seat.exit();
126
- records.delete(key);
127
- }
128
- }
129
- },
130
- },
131
- {
132
- stateShape: ScaledBidBookStateShape,
133
- },
134
- );
135
-
136
- const PriceBookStateShape = harden({
137
- priceRatioPattern: M.any(),
138
- collateralBrand: M.any(),
139
- records: M.any(),
140
- });
141
-
142
- /**
143
- * Prices in this book are actual prices expressed in terms of bid amount and
144
- * collateral amount.
145
- *
146
- * @param {Baggage} baggage
147
- */
148
- export const preparePriceBook = baggage =>
149
- prepareExoClass(
150
- baggage,
151
- 'priceBook',
152
- undefined,
153
- /**
154
- * @param {Pattern} priceRatioPattern
155
- * @param {Brand} collateralBrand
156
- */
157
- (priceRatioPattern, collateralBrand) => ({
158
- priceRatioPattern,
159
- collateralBrand,
160
- /** @type {MapStore<string, BidderRecord>} */
161
- records: makeScalarBigMapStore('scaledBidRecords', { durable: true }),
162
- }),
163
- {
164
- /**
165
- * @param {ZCFSeat} seat
166
- * @param {Ratio} price
167
- * @param {Amount<'nat'>} wanted
168
- * @param {boolean} exitAfterBuy
169
- */
170
- add(seat, price, wanted, exitAfterBuy) {
171
- const { priceRatioPattern, collateralBrand, records } = this.state;
172
- mustMatch(price, priceRatioPattern);
173
-
174
- const seqNum = nextSequenceNumber();
175
- const key = toPriceOfferKey(price, seqNum);
176
- const empty = AmountMath.makeEmpty(collateralBrand);
177
- /** @type {BidderRecord} */
178
- const bidderRecord = {
179
- bidScaling: undefined,
180
- price,
181
- received: empty,
182
- seat,
183
- seqNum,
184
- wanted,
185
- exitAfterBuy,
186
- };
187
- records.init(key, harden(bidderRecord));
188
- return key;
189
- },
190
- offersAbove(price) {
191
- const { records } = this.state;
192
- return [...records.entries(M.gte(toPartialOfferKey(price)))];
193
- },
194
- hasOrders() {
195
- const { records } = this.state;
196
- return records.getSize() > 0;
197
- },
198
- delete(key) {
199
- const { records } = this.state;
200
- records.delete(key);
201
- },
202
- updateReceived(key, sold) {
203
- const { records } = this.state;
204
- const oldRec = records.get(key);
205
- records.set(
206
- key,
207
- harden({
208
- ...oldRec,
209
- received: AmountMath.add(oldRec.received, sold),
210
- }),
211
- );
212
- },
213
- exitAllSeats() {
214
- const { records } = this.state;
215
- for (const [key, { seat }] of records.entries()) {
216
- if (!seat.hasExited()) {
217
- seat.exit();
218
- records.delete(key);
219
- }
220
- }
221
- },
222
- },
223
- {
224
- stateShape: PriceBookStateShape,
225
- },
226
- );
@@ -1,145 +0,0 @@
1
- /**
2
- * @import {AsyncSpecTuple} from '@agoric/governance/src/contractGovernance/typedParamManager.js';
3
- * @import {SyncSpecTuple} from '@agoric/governance/src/contractGovernance/typedParamManager.js';
4
- * @import {PriceAuthority, PriceDescription, PriceQuote, PriceQuoteValue, PriceQuery,} from '@agoric/zoe/tools/types.js';
5
- */
6
- export const InvitationShape: import("@endo/patterns").Matcher;
7
- /**
8
- * In seconds, how often to start an auction. The auction will start at
9
- * AUCTION_START_DELAY seconds after a multiple of START_FREQUENCY, with the
10
- * price at STARTING_RATE_BP. Every CLOCK_STEP, the price will be reduced by
11
- * DISCOUNT_STEP_BP, as long as the rate is at or above LOWEST_RATE_BP, or until
12
- * START_FREQUENCY has elapsed.
13
- */
14
- export const START_FREQUENCY: "StartFrequency";
15
- /** in seconds, how often to reduce the price */
16
- export const CLOCK_STEP: "ClockStep";
17
- /** discount or markup for starting price in basis points. 9999 = 1bp discount */
18
- export const STARTING_RATE_BP: "StartingRate";
19
- /** A limit below which the price will not be discounted. */
20
- export const LOWEST_RATE_BP: "LowestRate";
21
- /** amount to reduce prices each time step in bp, as % of the start price */
22
- export const DISCOUNT_STEP_BP: "DiscountStep";
23
- /**
24
- * VaultManagers liquidate vaults at a frequency configured by START_FREQUENCY.
25
- * Auctions start this long after the hour to give vaults time to finish.
26
- */
27
- export const AUCTION_START_DELAY: "AuctionStartDelay";
28
- export const PRICE_LOCK_PERIOD: "PriceLockPeriod";
29
- export const auctioneerParamPattern: import("@endo/patterns").Matcher;
30
- export namespace auctioneerParamTypes {
31
- let Electorate: "invitation";
32
- let StartFrequency: "relativeTime";
33
- let ClockStep: "relativeTime";
34
- let StartingRate: "nat";
35
- let LowestRate: "nat";
36
- let DiscountStep: "nat";
37
- let AuctionStartDelay: "relativeTime";
38
- let PriceLockPeriod: "relativeTime";
39
- }
40
- export function makeAuctioneerParams({ ElectorateInvitationAmount, StartFrequency, ClockStep, LowestRate, StartingRate, DiscountStep, AuctionStartDelay, PriceLockPeriod, TimerBrand, }: AuctionParams): {
41
- Electorate: {
42
- type: "invitation";
43
- value: import("@agoric/ertp").SetAmount<import("@endo/patterns").Key>;
44
- };
45
- StartFrequency: {
46
- type: "relativeTime";
47
- value: import("@agoric/time").RelativeTimeRecord;
48
- };
49
- ClockStep: {
50
- type: "relativeTime";
51
- value: import("@agoric/time").RelativeTimeRecord;
52
- };
53
- AuctionStartDelay: {
54
- type: "relativeTime";
55
- value: import("@agoric/time").RelativeTimeRecord;
56
- };
57
- PriceLockPeriod: {
58
- type: "relativeTime";
59
- value: import("@agoric/time").RelativeTimeRecord;
60
- };
61
- StartingRate: {
62
- type: "nat";
63
- value: bigint;
64
- };
65
- LowestRate: {
66
- type: "nat";
67
- value: bigint;
68
- };
69
- DiscountStep: {
70
- type: "nat";
71
- value: bigint;
72
- };
73
- };
74
- export function makeAuctioneerParamManager(publisherKit: import("@agoric/notifier").StoredPublisherKit<GovernanceSubscriptionState>, zcf: ZCF, initial: AuctionParams): import("@agoric/governance/src/contractGovernance/typedParamManager.js").TypedParamManager<{
75
- Electorate: "invitation";
76
- StartFrequency: "relativeTime";
77
- ClockStep: "relativeTime";
78
- StartingRate: "nat";
79
- LowestRate: "nat";
80
- DiscountStep: "nat";
81
- AuctionStartDelay: "relativeTime";
82
- PriceLockPeriod: "relativeTime";
83
- }>;
84
- export function makeGovernedTerms({ storageNode: _storageNode, marshaller: _marshaller }: {
85
- storageNode: ERef<StorageNode>;
86
- marshaller: ERef<Marshaller>;
87
- }, timer: ERef<import("@agoric/time").TimerService>, priceAuthority: ERef<PriceAuthority>, reservePublicFacet: ERef<AssetReservePublicFacet>, params: AuctionParams): {
88
- priceAuthority: globalThis.ERef<PriceAuthority>;
89
- reservePublicFacet: globalThis.ERef<globalThis.GovernedPublicFacet<import("@endo/exo").Guarded<{
90
- makeAddCollateralInvitation(): Promise<globalThis.Invitation<string, never>>;
91
- getPublicTopics(): {
92
- metrics: import("@agoric/zoe/src/contractSupport").PublicTopic<import("../reserve/assetReserveKit").MetricsNotification>;
93
- };
94
- }>>>;
95
- timerService: globalThis.ERef<import("@agoric/time").TimerService>;
96
- governedParams: {
97
- Electorate: {
98
- type: "invitation";
99
- value: import("@agoric/ertp").SetAmount<import("@endo/patterns").Key>;
100
- };
101
- StartFrequency: {
102
- type: "relativeTime";
103
- value: import("@agoric/time").RelativeTimeRecord;
104
- };
105
- ClockStep: {
106
- type: "relativeTime";
107
- value: import("@agoric/time").RelativeTimeRecord;
108
- };
109
- AuctionStartDelay: {
110
- type: "relativeTime";
111
- value: import("@agoric/time").RelativeTimeRecord;
112
- };
113
- PriceLockPeriod: {
114
- type: "relativeTime";
115
- value: import("@agoric/time").RelativeTimeRecord;
116
- };
117
- StartingRate: {
118
- type: "nat";
119
- value: bigint;
120
- };
121
- LowestRate: {
122
- type: "nat";
123
- value: bigint;
124
- };
125
- DiscountStep: {
126
- type: "nat";
127
- value: bigint;
128
- };
129
- };
130
- };
131
- export type AuctionParams = {
132
- ElectorateInvitationAmount: Amount<"set">;
133
- StartFrequency: RelativeTime;
134
- ClockStep: RelativeTime;
135
- StartingRate: bigint;
136
- LowestRate: bigint;
137
- DiscountStep: bigint;
138
- AuctionStartDelay: RelativeTime;
139
- PriceLockPeriod: RelativeTime;
140
- TimerBrand: import("@agoric/time").TimerBrand;
141
- };
142
- export type AuctionParamRecord = ReturnType<typeof makeAuctioneerParams>;
143
- export type AuctionParamManager = ReturnType<typeof makeAuctioneerParamManager>;
144
- import type { PriceAuthority } from '@agoric/zoe/tools/types.js';
145
- //# sourceMappingURL=params.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"params.d.ts","sourceRoot":"","sources":["params.js"],"names":[],"mappings":"AAQA;;;;GAIG;AAGH,+DAAyD;AAEzD;;;;;;GAMG;AACH,8BAA+B,gBAAgB,CAAC;AAChD,gDAAgD;AAChD,yBAA0B,WAAW,CAAC;AACtC,iFAAiF;AACjF,+BAAgC,cAAc,CAAC;AAC/C,4DAA4D;AAC5D,6BAA8B,YAAY,CAAC;AAC3C,4EAA4E;AAC5E,+BAAgC,cAAc,CAAC;AAC/C;;;GAGG;AACH,kCAAmC,mBAAmB,CAAC;AAIvD,gCAAiC,iBAAiB,CAAC;AAEnD,sEASG;;;;;;;;;;;AA2BI,yLADK,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAqCxB;AAQM,yDAJI,OAAO,kBAAkB,EAAE,kBAAkB,CAAC,2BAA2B,CAAC,OAC1E,GAAG,WACH,aAAa;;;;;;;;;GA0BvB;AAWM,0FANI;IAAE,WAAW,EAAE,IAAI,CAAC,WAAW,CAAC,CAAC;IAAC,UAAU,EAAE,IAAI,CAAC,UAAU,CAAC,CAAA;CAAE,SAChE,IAAI,CAAC,OAAO,cAAc,EAAE,YAAY,CAAC,kBACzC,IAAI,CAAC,cAAc,CAAC,sBACpB,IAAI,CAAC,uBAAuB,CAAC,UAC7B,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAgBvB;;gCAzGa,MAAM,CAAC,KAAK,CAAC;oBACb,YAAY;eACZ,YAAY;kBACZ,MAAM;gBACN,MAAM;kBACN,MAAM;uBACN,YAAY;qBACZ,YAAY;gBACZ,OAAO,cAAc,EAAE,UAAU;;iCA0EjC,UAAU,CAAC,OAAO,oBAAoB,CAAC;kCA0BvC,UAAU,CAAC,OAAO,0BAA0B,CAAC;oCApKkC,4BAA4B"}
@@ -1,176 +0,0 @@
1
- import {
2
- CONTRACT_ELECTORATE,
3
- makeParamManager,
4
- ParamTypes,
5
- } from '@agoric/governance';
6
- import { TimeMath, RelativeTimeRecordShape } from '@agoric/time';
7
- import { M } from '@agoric/store';
8
-
9
- /**
10
- * @import {AsyncSpecTuple} from '@agoric/governance/src/contractGovernance/typedParamManager.js';
11
- * @import {SyncSpecTuple} from '@agoric/governance/src/contractGovernance/typedParamManager.js';
12
- * @import {PriceAuthority, PriceDescription, PriceQuote, PriceQuoteValue, PriceQuery,} from '@agoric/zoe/tools/types.js';
13
- */
14
-
15
- // TODO duplicated with zoe/src/TypeGuards.js
16
- export const InvitationShape = M.remotable('Invitation');
17
-
18
- /**
19
- * In seconds, how often to start an auction. The auction will start at
20
- * AUCTION_START_DELAY seconds after a multiple of START_FREQUENCY, with the
21
- * price at STARTING_RATE_BP. Every CLOCK_STEP, the price will be reduced by
22
- * DISCOUNT_STEP_BP, as long as the rate is at or above LOWEST_RATE_BP, or until
23
- * START_FREQUENCY has elapsed.
24
- */
25
- export const START_FREQUENCY = 'StartFrequency';
26
- /** in seconds, how often to reduce the price */
27
- export const CLOCK_STEP = 'ClockStep';
28
- /** discount or markup for starting price in basis points. 9999 = 1bp discount */
29
- export const STARTING_RATE_BP = 'StartingRate';
30
- /** A limit below which the price will not be discounted. */
31
- export const LOWEST_RATE_BP = 'LowestRate';
32
- /** amount to reduce prices each time step in bp, as % of the start price */
33
- export const DISCOUNT_STEP_BP = 'DiscountStep';
34
- /**
35
- * VaultManagers liquidate vaults at a frequency configured by START_FREQUENCY.
36
- * Auctions start this long after the hour to give vaults time to finish.
37
- */
38
- export const AUCTION_START_DELAY = 'AuctionStartDelay';
39
-
40
- // /////// used by VaultDirector /////////////////////
41
- // time before each auction that the prices are locked.
42
- export const PRICE_LOCK_PERIOD = 'PriceLockPeriod';
43
-
44
- export const auctioneerParamPattern = M.splitRecord({
45
- [CONTRACT_ELECTORATE]: InvitationShape,
46
- [START_FREQUENCY]: RelativeTimeRecordShape,
47
- [CLOCK_STEP]: RelativeTimeRecordShape,
48
- [STARTING_RATE_BP]: M.nat(),
49
- [LOWEST_RATE_BP]: M.nat(),
50
- [DISCOUNT_STEP_BP]: M.nat(),
51
- [AUCTION_START_DELAY]: RelativeTimeRecordShape,
52
- [PRICE_LOCK_PERIOD]: RelativeTimeRecordShape,
53
- });
54
-
55
- export const auctioneerParamTypes = harden({
56
- [CONTRACT_ELECTORATE]: ParamTypes.INVITATION,
57
- [START_FREQUENCY]: ParamTypes.RELATIVE_TIME,
58
- [CLOCK_STEP]: ParamTypes.RELATIVE_TIME,
59
- [STARTING_RATE_BP]: ParamTypes.NAT,
60
- [LOWEST_RATE_BP]: ParamTypes.NAT,
61
- [DISCOUNT_STEP_BP]: ParamTypes.NAT,
62
- [AUCTION_START_DELAY]: ParamTypes.RELATIVE_TIME,
63
- [PRICE_LOCK_PERIOD]: ParamTypes.RELATIVE_TIME,
64
- });
65
-
66
- /**
67
- * @typedef {object} AuctionParams
68
- * @property {Amount<'set'>} ElectorateInvitationAmount
69
- * @property {RelativeTime} StartFrequency
70
- * @property {RelativeTime} ClockStep
71
- * @property {bigint} StartingRate
72
- * @property {bigint} LowestRate
73
- * @property {bigint} DiscountStep
74
- * @property {RelativeTime} AuctionStartDelay
75
- * @property {RelativeTime} PriceLockPeriod
76
- * @property {import('@agoric/time').TimerBrand} TimerBrand
77
- */
78
-
79
- /** @param {AuctionParams} initial */
80
- export const makeAuctioneerParams = ({
81
- ElectorateInvitationAmount,
82
- StartFrequency,
83
- ClockStep,
84
- LowestRate,
85
- StartingRate,
86
- DiscountStep,
87
- AuctionStartDelay,
88
- PriceLockPeriod,
89
- TimerBrand,
90
- }) => {
91
- return harden({
92
- [CONTRACT_ELECTORATE]: {
93
- type: ParamTypes.INVITATION,
94
- value: ElectorateInvitationAmount,
95
- },
96
- [START_FREQUENCY]: {
97
- type: ParamTypes.RELATIVE_TIME,
98
- value: TimeMath.coerceRelativeTimeRecord(StartFrequency, TimerBrand),
99
- },
100
- [CLOCK_STEP]: {
101
- type: ParamTypes.RELATIVE_TIME,
102
- value: TimeMath.coerceRelativeTimeRecord(ClockStep, TimerBrand),
103
- },
104
- [AUCTION_START_DELAY]: {
105
- type: ParamTypes.RELATIVE_TIME,
106
- value: TimeMath.coerceRelativeTimeRecord(AuctionStartDelay, TimerBrand),
107
- },
108
- [PRICE_LOCK_PERIOD]: {
109
- type: ParamTypes.RELATIVE_TIME,
110
- value: TimeMath.coerceRelativeTimeRecord(PriceLockPeriod, TimerBrand),
111
- },
112
- [STARTING_RATE_BP]: { type: ParamTypes.NAT, value: StartingRate },
113
- [LOWEST_RATE_BP]: { type: ParamTypes.NAT, value: LowestRate },
114
- [DISCOUNT_STEP_BP]: { type: ParamTypes.NAT, value: DiscountStep },
115
- });
116
- };
117
- harden(makeAuctioneerParams);
118
-
119
- /**
120
- * @param {import('@agoric/notifier').StoredPublisherKit<GovernanceSubscriptionState>} publisherKit
121
- * @param {ZCF} zcf
122
- * @param {AuctionParams} initial
123
- */
124
- export const makeAuctioneerParamManager = (publisherKit, zcf, initial) => {
125
- return makeParamManager(
126
- publisherKit,
127
- {
128
- [CONTRACT_ELECTORATE]: [
129
- ParamTypes.INVITATION,
130
- initial[CONTRACT_ELECTORATE],
131
- ],
132
- [START_FREQUENCY]: [ParamTypes.RELATIVE_TIME, initial[START_FREQUENCY]],
133
- [CLOCK_STEP]: [ParamTypes.RELATIVE_TIME, initial[CLOCK_STEP]],
134
- [STARTING_RATE_BP]: [ParamTypes.NAT, initial[STARTING_RATE_BP]],
135
- [LOWEST_RATE_BP]: [ParamTypes.NAT, initial[LOWEST_RATE_BP]],
136
- [DISCOUNT_STEP_BP]: [ParamTypes.NAT, initial[DISCOUNT_STEP_BP]],
137
- [AUCTION_START_DELAY]: [
138
- ParamTypes.RELATIVE_TIME,
139
- initial[AUCTION_START_DELAY],
140
- ],
141
- [PRICE_LOCK_PERIOD]: [
142
- ParamTypes.RELATIVE_TIME,
143
- initial[PRICE_LOCK_PERIOD],
144
- ],
145
- },
146
- zcf,
147
- );
148
- };
149
- harden(makeAuctioneerParamManager);
150
- /** @typedef {ReturnType<typeof makeAuctioneerParams>} AuctionParamRecord */
151
-
152
- /**
153
- * @param {{ storageNode: ERef<StorageNode>; marshaller: ERef<Marshaller> }} caps
154
- * @param {ERef<import('@agoric/time').TimerService>} timer
155
- * @param {ERef<PriceAuthority>} priceAuthority
156
- * @param {ERef<AssetReservePublicFacet>} reservePublicFacet
157
- * @param {AuctionParams} params
158
- */
159
- export const makeGovernedTerms = (
160
- { storageNode: _storageNode, marshaller: _marshaller },
161
- timer,
162
- priceAuthority,
163
- reservePublicFacet,
164
- params,
165
- ) => {
166
- // XXX use storageNode and Marshaller
167
- return harden({
168
- priceAuthority,
169
- reservePublicFacet,
170
- timerService: timer,
171
- governedParams: makeAuctioneerParams(params),
172
- });
173
- };
174
- harden(makeGovernedTerms);
175
-
176
- /** @typedef {ReturnType<typeof makeAuctioneerParamManager>} AuctionParamManager */
@@ -1,5 +0,0 @@
1
- export function computeRoundTiming(params: Awaited<import("./params.js").AuctionParamManager>, baseTime: TimestampRecord): import("./scheduler.js").Schedule;
2
- export function nextDescendingStepTime(liveSchedule: import("./scheduler.js").Schedule | null, nextSchedule: import("./scheduler.js").Schedule | null, now: Timestamp): Timestamp | null;
3
- export function timeVsSchedule(time: Timestamp, schedule: import("./scheduler.js").Schedule): "before" | "during" | "endExactly" | "after";
4
- import type { TimestampRecord } from '@agoric/time';
5
- //# sourceMappingURL=scheduleMath.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"scheduleMath.d.ts","sourceRoot":"","sources":["scheduleMath.js"],"names":[],"mappings":"AA0CO,2CAJI,OAAO,CAAC,OAAO,aAAa,EAAE,mBAAmB,CAAC,YAClD,eAAe,GACb,OAAO,gBAAgB,EAAE,QAAQ,CAqE7C;AAcM,qDALI,OAAO,gBAAgB,EAAE,QAAQ,GAAG,IAAI,gBACxC,OAAO,gBAAgB,EAAE,QAAQ,GAAG,IAAI,OACxC,SAAS,GACP,SAAS,GAAG,IAAI,CAuB5B;AAQM,qCAJI,SAAS,YACT,OAAO,gBAAgB,EAAE,QAAQ,GAC/B,QAAQ,GAAG,QAAQ,GAAG,YAAY,GAAG,OAAO,CAiBxD;qCAhKkC,cAAc"}