@agoric/inter-protocol 0.16.2-dev-857e650.0 → 0.16.2-dev-fb922d3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bundles/bundle-auctioneer-js-meta.json +181 -181
- package/bundles/bundle-auctioneer.js +1 -1
- package/bundles/bundle-econCommitteeCharter-js-meta.json +129 -129
- package/bundles/bundle-econCommitteeCharter.js +1 -1
- package/bundles/bundle-feeDistributor-js-meta.json +115 -115
- package/bundles/bundle-feeDistributor.js +1 -1
- package/bundles/bundle-fluxAggregatorKit-js-meta.json +169 -169
- package/bundles/bundle-fluxAggregatorKit.js +1 -1
- package/bundles/bundle-psm-js-meta.json +167 -167
- package/bundles/bundle-psm.js +1 -1
- package/bundles/bundle-reserve-js-meta.json +169 -169
- package/bundles/bundle-reserve.js +1 -1
- package/bundles/bundle-scaledPriceAuthority-js-meta.json +142 -142
- package/bundles/bundle-scaledPriceAuthority.js +1 -1
- package/bundles/bundle-vaultFactory-js-meta.json +200 -200
- package/bundles/bundle-vaultFactory.js +1 -1
- package/package.json +17 -17
- package/scripts/deploy-contracts.js +12 -2
- package/scripts/init-core.js +5 -6
- package/scripts/manual-price-feed.js +20 -15
- package/src/auction/auctionBook.d.ts +16 -13
- package/src/auction/auctionBook.d.ts.map +1 -1
- package/src/auction/auctionBook.js +68 -56
- package/src/auction/auctioneer.d.ts.map +1 -1
- package/src/auction/auctioneer.js +54 -42
- package/src/auction/offerBook.d.ts.map +1 -1
- package/src/auction/offerBook.js +12 -11
- package/src/auction/params.d.ts +1 -1
- package/src/auction/params.d.ts.map +1 -1
- package/src/auction/params.js +3 -5
- package/src/auction/scheduleMath.d.ts.map +1 -1
- package/src/auction/scheduleMath.js +13 -13
- package/src/auction/scheduler.d.ts +4 -4
- package/src/auction/scheduler.d.ts.map +1 -1
- package/src/auction/scheduler.js +20 -20
- package/src/auction/sortedOffers.d.ts.map +1 -1
- package/src/auction/sortedOffers.js +8 -7
- package/src/auction/util.d.ts +1 -1
- package/src/auction/util.js +4 -4
- package/src/clientSupport.d.ts +65 -27
- package/src/clientSupport.d.ts.map +1 -1
- package/src/clientSupport.js +92 -34
- package/src/contractSupport.js +5 -5
- package/src/econCommitteeCharter.d.ts +4 -6
- package/src/econCommitteeCharter.d.ts.map +1 -1
- package/src/econCommitteeCharter.js +7 -11
- package/src/feeDistributor.d.ts +8 -24
- package/src/feeDistributor.d.ts.map +1 -1
- package/src/feeDistributor.js +26 -28
- package/src/interest.d.ts +1 -0
- package/src/interest.d.ts.map +1 -1
- package/src/interest.js +22 -15
- package/src/price/fluxAggregatorContract.d.ts +1 -0
- package/src/price/fluxAggregatorContract.d.ts.map +1 -1
- package/src/price/fluxAggregatorContract.js +24 -19
- package/src/price/fluxAggregatorKit.d.ts +23 -18
- package/src/price/fluxAggregatorKit.d.ts.map +1 -1
- package/src/price/fluxAggregatorKit.js +47 -32
- package/src/price/priceOracleKit.d.ts +2 -8
- package/src/price/priceOracleKit.d.ts.map +1 -1
- package/src/price/priceOracleKit.js +11 -13
- package/src/price/roundsManager.d.ts +28 -46
- package/src/price/roundsManager.d.ts.map +1 -1
- package/src/price/roundsManager.js +51 -63
- package/src/proposals/committee-proposal.d.ts.map +1 -1
- package/src/proposals/committee-proposal.js +5 -9
- package/src/proposals/core-proposal.d.ts.map +1 -1
- package/src/proposals/core-proposal.js +3 -5
- package/src/proposals/econ-behaviors.d.ts.map +1 -1
- package/src/proposals/econ-behaviors.js +55 -28
- package/src/proposals/price-feed-proposal.d.ts.map +1 -1
- package/src/proposals/price-feed-proposal.js +30 -11
- package/src/proposals/startPSM.d.ts.map +1 -1
- package/src/proposals/startPSM.js +24 -17
- package/src/proposals/utils.d.ts +1 -1
- package/src/proposals/utils.d.ts.map +1 -1
- package/src/proposals/utils.js +26 -7
- package/src/psm/psm.d.ts +14 -22
- package/src/psm/psm.d.ts.map +1 -1
- package/src/psm/psm.js +34 -31
- package/src/reserve/assetReserve.d.ts.map +1 -1
- package/src/reserve/assetReserve.js +16 -13
- package/src/reserve/assetReserveKit.d.ts +14 -26
- package/src/reserve/assetReserveKit.d.ts.map +1 -1
- package/src/reserve/assetReserveKit.js +13 -21
- package/src/tokens.d.ts +3 -3
- package/src/tokens.d.ts.map +1 -1
- package/src/tokens.js +5 -5
- package/src/typeGuards.d.ts +1 -3
- package/src/typeGuards.d.ts.map +1 -1
- package/src/typeGuards.js +1 -3
- package/src/vaultFactory/liquidation.d.ts.map +1 -1
- package/src/vaultFactory/liquidation.js +29 -16
- package/src/vaultFactory/math.d.ts.map +1 -1
- package/src/vaultFactory/math.js +8 -9
- package/src/vaultFactory/orderedVaultStore.d.ts.map +1 -1
- package/src/vaultFactory/orderedVaultStore.js +6 -9
- package/src/vaultFactory/params.d.ts +1 -4
- package/src/vaultFactory/params.d.ts.map +1 -1
- package/src/vaultFactory/params.js +24 -18
- package/src/vaultFactory/prioritizedVaults.js +2 -2
- package/src/vaultFactory/proceeds.d.ts +3 -3
- package/src/vaultFactory/proceeds.d.ts.map +1 -1
- package/src/vaultFactory/proceeds.js +24 -18
- package/src/vaultFactory/storeUtils.d.ts +2 -6
- package/src/vaultFactory/storeUtils.d.ts.map +1 -1
- package/src/vaultFactory/storeUtils.js +8 -12
- package/src/vaultFactory/types.d.ts +16 -11
- package/src/vaultFactory/types.d.ts.map +1 -1
- package/src/vaultFactory/types.js +37 -27
- package/src/vaultFactory/vault.d.ts +103 -159
- package/src/vaultFactory/vault.d.ts.map +1 -1
- package/src/vaultFactory/vault.js +84 -85
- package/src/vaultFactory/vaultDirector.d.ts +21 -43
- package/src/vaultFactory/vaultDirector.d.ts.map +1 -1
- package/src/vaultFactory/vaultDirector.js +30 -40
- package/src/vaultFactory/vaultFactory.d.ts +8 -6
- package/src/vaultFactory/vaultFactory.d.ts.map +1 -1
- package/src/vaultFactory/vaultFactory.js +13 -11
- package/src/vaultFactory/vaultHolder.d.ts +12 -16
- package/src/vaultFactory/vaultHolder.d.ts.map +1 -1
- package/src/vaultFactory/vaultHolder.js +7 -12
- package/src/vaultFactory/vaultKit.d.ts +1 -1
- package/src/vaultFactory/vaultKit.d.ts.map +1 -1
- package/src/vaultFactory/vaultKit.js +3 -2
- package/src/vaultFactory/vaultManager.d.ts +454 -68
- package/src/vaultFactory/vaultManager.d.ts.map +1 -1
- package/src/vaultFactory/vaultManager.js +120 -110
package/src/auction/offerBook.js
CHANGED
|
@@ -25,12 +25,14 @@ const nextSequenceNumber = () => {
|
|
|
25
25
|
|
|
26
26
|
/**
|
|
27
27
|
* @typedef {{
|
|
28
|
-
*
|
|
29
|
-
*
|
|
30
|
-
*
|
|
31
|
-
*
|
|
32
|
-
* } &
|
|
33
|
-
* }
|
|
28
|
+
* seat: ZCFSeat;
|
|
29
|
+
* wanted: Amount<'nat'>;
|
|
30
|
+
* seqNum: NatValue;
|
|
31
|
+
* received: Amount<'nat'>;
|
|
32
|
+
* } & { exitAfterBuy: boolean } & (
|
|
33
|
+
* | { bidScaling: Pattern; price: undefined }
|
|
34
|
+
* | { bidScaling: undefined; price: Ratio }
|
|
35
|
+
* )} BidderRecord
|
|
34
36
|
*/
|
|
35
37
|
|
|
36
38
|
const ScaledBidBookStateShape = harden({
|
|
@@ -41,7 +43,8 @@ const ScaledBidBookStateShape = harden({
|
|
|
41
43
|
|
|
42
44
|
/**
|
|
43
45
|
* Prices in this book are expressed as percentage of the full oracle price
|
|
44
|
-
* snapshot taken when the auction started. .4 is 60% off. 1.1 is 10% above
|
|
46
|
+
* snapshot taken when the auction started. .4 is 60% off. 1.1 is 10% above
|
|
47
|
+
* par.
|
|
45
48
|
*
|
|
46
49
|
* @param {Baggage} baggage
|
|
47
50
|
*/
|
|
@@ -51,7 +54,6 @@ export const prepareScaledBidBook = baggage =>
|
|
|
51
54
|
'scaledBidBook',
|
|
52
55
|
undefined,
|
|
53
56
|
/**
|
|
54
|
-
*
|
|
55
57
|
* @param {Pattern} bidScalingPattern
|
|
56
58
|
* @param {Brand} collateralBrand
|
|
57
59
|
*/
|
|
@@ -134,8 +136,8 @@ const PriceBookStateShape = harden({
|
|
|
134
136
|
});
|
|
135
137
|
|
|
136
138
|
/**
|
|
137
|
-
* Prices in this book are actual prices expressed in terms of bid amount
|
|
138
|
-
*
|
|
139
|
+
* Prices in this book are actual prices expressed in terms of bid amount and
|
|
140
|
+
* collateral amount.
|
|
139
141
|
*
|
|
140
142
|
* @param {Baggage} baggage
|
|
141
143
|
*/
|
|
@@ -145,7 +147,6 @@ export const preparePriceBook = baggage =>
|
|
|
145
147
|
'priceBook',
|
|
146
148
|
undefined,
|
|
147
149
|
/**
|
|
148
|
-
*
|
|
149
150
|
* @param {Pattern} priceRatioPattern
|
|
150
151
|
* @param {Brand} collateralBrand
|
|
151
152
|
*/
|
package/src/auction/params.d.ts
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
/** @typedef {import('@agoric/governance/src/contractGovernance/typedParamManager.js').SyncSpecTuple} SyncSpecTuple */
|
|
3
3
|
export const InvitationShape: import("@endo/patterns").Matcher;
|
|
4
4
|
/**
|
|
5
|
-
* In seconds, how often to start an auction.
|
|
5
|
+
* In seconds, how often to start an auction. The auction will start at
|
|
6
6
|
* AUCTION_START_DELAY seconds after a multiple of START_FREQUENCY, with the
|
|
7
7
|
* price at STARTING_RATE_BP. Every CLOCK_STEP, the price will be reduced by
|
|
8
8
|
* DISCOUNT_STEP_BP, as long as the rate is at or above LOWEST_RATE_BP, or until
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"params.d.ts","sourceRoot":"","sources":["params.js"],"names":[],"mappings":"AAQA,wHAAwH;AACxH,sHAAsH;AAGtH,+DAAyD;AAEzD;;;;;;GAMG;AACH,+CAAgD;AAChD,gDAAgD;AAChD,qCAAsC;AACtC,iFAAiF;AACjF,8CAA+C;AAC/C,4DAA4D;AAC5D,0CAA2C;AAC3C,4EAA4E;AAC5E,8CAA+C;AAC/C;;;GAGG;AACH,sDAAuD;AAIvD,kDAAmD;AAEnD,sEASG;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"params.d.ts","sourceRoot":"","sources":["params.js"],"names":[],"mappings":"AAQA,wHAAwH;AACxH,sHAAsH;AAGtH,+DAAyD;AAEzD;;;;;;GAMG;AACH,+CAAgD;AAChD,gDAAgD;AAChD,qCAAsC;AACtC,iFAAiF;AACjF,8CAA+C;AAC/C,4DAA4D;AAC5D,0CAA2C;AAC3C,4EAA4E;AAC5E,8CAA+C;AAC/C;;;GAGG;AACH,sDAAuD;AAIvD,kDAAmD;AAEnD,sEASG;;;;;;;;;;;AA2BI,yLADK,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAqCxB;AAQM,yDAJI,OAAO,kBAAkB,EAAE,kBAAkB,CAAC,2BAA2B,CAAC,OAC1E,GAAG,WACH,aAAa;;;;;;;;;GA0BvB;AAUM,0FANI;IAAE,WAAW,EAAE,KAAK,WAAW,CAAC,CAAC;IAAC,UAAU,EAAE,KAAK,UAAU,CAAC,CAAA;CAAE,SAChE,KAAK,KAAK,CAAC,kBACX,KAAK,cAAc,CAAC,sBACpB,KAAK,uBAAuB,CAAC,UAC7B,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAgBvB;6BAhKa,OAAO,gEAAgE,EAAE,cAAc;4BACvF,OAAO,gEAAgE,EAAE,aAAa;;gCAuDtF,OAAO,KAAK,CAAC;oBACb,YAAY;eACZ,YAAY;kBACZ,MAAM;gBACN,MAAM;kBACN,MAAM;uBACN,YAAY;qBACZ,YAAY;gBACZ,OAAO,wBAAwB,EAAE,UAAU;;kCAmG3C,WAAW,iCAAiC,CAAC"}
|
package/src/auction/params.js
CHANGED
|
@@ -13,7 +13,7 @@ import { M } from '@agoric/store';
|
|
|
13
13
|
export const InvitationShape = M.remotable('Invitation');
|
|
14
14
|
|
|
15
15
|
/**
|
|
16
|
-
* In seconds, how often to start an auction.
|
|
16
|
+
* In seconds, how often to start an auction. The auction will start at
|
|
17
17
|
* AUCTION_START_DELAY seconds after a multiple of START_FREQUENCY, with the
|
|
18
18
|
* price at STARTING_RATE_BP. Every CLOCK_STEP, the price will be reduced by
|
|
19
19
|
* DISCOUNT_STEP_BP, as long as the rate is at or above LOWEST_RATE_BP, or until
|
|
@@ -73,9 +73,7 @@ export const auctioneerParamTypes = harden({
|
|
|
73
73
|
* @property {import('@agoric/time/src/types').TimerBrand} TimerBrand
|
|
74
74
|
*/
|
|
75
75
|
|
|
76
|
-
/**
|
|
77
|
-
* @param {AuctionParams} initial
|
|
78
|
-
*/
|
|
76
|
+
/** @param {AuctionParams} initial */
|
|
79
77
|
export const makeAuctioneerParams = ({
|
|
80
78
|
ElectorateInvitationAmount,
|
|
81
79
|
StartFrequency,
|
|
@@ -148,7 +146,7 @@ export const makeAuctioneerParamManager = (publisherKit, zcf, initial) => {
|
|
|
148
146
|
harden(makeAuctioneerParamManager);
|
|
149
147
|
|
|
150
148
|
/**
|
|
151
|
-
* @param {{storageNode: ERef<StorageNode
|
|
149
|
+
* @param {{ storageNode: ERef<StorageNode>; marshaller: ERef<Marshaller> }} caps
|
|
152
150
|
* @param {ERef<Timer>} timer
|
|
153
151
|
* @param {ERef<PriceAuthority>} priceAuthority
|
|
154
152
|
* @param {ERef<AssetReservePublicFacet>} reservePublicFacet
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"scheduleMath.d.ts","sourceRoot":"","sources":["scheduleMath.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"scheduleMath.d.ts","sourceRoot":"","sources":["scheduleMath.js"],"names":[],"mappings":"AAwCO,2CAJI,QAAQ,OAAO,aAAa,EAAE,mBAAmB,CAAC,YAClD,SAAS,GACP,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"}
|
|
@@ -18,17 +18,18 @@ const subtract1 = relTime =>
|
|
|
18
18
|
/**
|
|
19
19
|
* The length of the auction has to be inferred from the governed params.
|
|
20
20
|
*
|
|
21
|
-
* 1. The auction starts by offering collateral at a `StartingRate` (e.g., 105%)
|
|
22
|
-
*
|
|
23
|
-
*
|
|
21
|
+
* 1. The auction starts by offering collateral at a `StartingRate` (e.g., 105%) of
|
|
22
|
+
* the market price at auction start, and continues until it reaches (or
|
|
23
|
+
* would exceed on its next step) LowestRate (e.g., 65%)
|
|
24
24
|
* 2. The offer price changes every `ClockStep` seconds
|
|
25
|
-
* 3. The offer price changes by `DiscountStep` amount (e.g., 5%) each step So
|
|
26
|
-
*
|
|
27
|
-
*
|
|
25
|
+
* 3. The offer price changes by `DiscountStep` amount (e.g., 5%) each step So it
|
|
26
|
+
* must run however many `ClockSteps` are required to get from `StartingRate`
|
|
27
|
+
* to `LowestRate` changing by `DiscountStep` each time.
|
|
28
28
|
*
|
|
29
|
-
* Therefore, the duration is `(StartingRate - LowestRate) / DiscountStep *
|
|
29
|
+
* Therefore, the duration is `(StartingRate - LowestRate) / DiscountStep *
|
|
30
|
+
* ClockStep`.
|
|
30
31
|
*
|
|
31
|
-
* Note that this is what's
|
|
32
|
+
* Note that this is what's _scheduled_. More than one auction can be running
|
|
32
33
|
* simultaneously, and some conditions can cause some of the auctions to stop
|
|
33
34
|
* selling early (e.g. reaching their target debt to raise or selling all of
|
|
34
35
|
* their collateral).
|
|
@@ -108,10 +109,10 @@ export const computeRoundTiming = (params, baseTime) => {
|
|
|
108
109
|
harden(computeRoundTiming);
|
|
109
110
|
|
|
110
111
|
/**
|
|
111
|
-
* Calculate when the next descending step will start. If we're between
|
|
112
|
-
*
|
|
113
|
-
*
|
|
114
|
-
* the
|
|
112
|
+
* Calculate when the next descending step will start. If we're between auctions
|
|
113
|
+
* (i.e. liveSchedule is undefined), or the last step of the current auction has
|
|
114
|
+
* started, then it'll be nextSchedule.startTime. Otherwise, it's the start of
|
|
115
|
+
* the step following the current step.
|
|
115
116
|
*
|
|
116
117
|
* @param {import('./scheduler.js').Schedule | null} liveSchedule
|
|
117
118
|
* @param {import('./scheduler.js').Schedule | null} nextSchedule
|
|
@@ -143,7 +144,6 @@ export const nextDescendingStepTime = (liveSchedule, nextSchedule, now) => {
|
|
|
143
144
|
harden(nextDescendingStepTime);
|
|
144
145
|
|
|
145
146
|
/**
|
|
146
|
-
*
|
|
147
147
|
* @param {Timestamp} time
|
|
148
148
|
* @param {import('./scheduler.js').Schedule} schedule
|
|
149
149
|
* @returns {'before' | 'during' | 'endExactly' | 'after'}
|
|
@@ -19,8 +19,8 @@ export type AuctionDriver = {
|
|
|
19
19
|
};
|
|
20
20
|
export type ScheduleNotification = {
|
|
21
21
|
/**
|
|
22
|
-
* start time of current
|
|
23
|
-
* auction
|
|
22
|
+
* start time of current auction if
|
|
23
|
+
* auction is active
|
|
24
24
|
*/
|
|
25
25
|
activeStartTime: Timestamp | null;
|
|
26
26
|
/**
|
|
@@ -28,8 +28,8 @@ export type ScheduleNotification = {
|
|
|
28
28
|
*/
|
|
29
29
|
nextStartTime: Timestamp | null;
|
|
30
30
|
/**
|
|
31
|
-
* when the next descending
|
|
32
|
-
* will take place
|
|
31
|
+
* when the next descending
|
|
32
|
+
* step will take place
|
|
33
33
|
*/
|
|
34
34
|
nextDescendingStepTime: Timestamp | null;
|
|
35
35
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"scheduler.d.ts","sourceRoot":"","sources":["scheduler.js"],"names":[],"mappings":"AA+EO,6CAPI,aAAa,SACb,OAAO,wBAAwB,EAAE,YAAY,UAC7C,QAAQ,OAAO,aAAa,EAAE,mBAAmB,CAAC,cAClD,OAAO,wBAAwB,EAAE,UAAU,oBAC3C,OAAO,6CAA6C,EAAE,QAAQ,CAAC,oBAAoB,CAAC,2BACpF,mBAAmB,2BAA2B,CAAC;;;;;;;;;;;;IAyQzD;;
|
|
1
|
+
{"version":3,"file":"scheduler.d.ts","sourceRoot":"","sources":["scheduler.js"],"names":[],"mappings":"AA+EO,6CAPI,aAAa,SACb,OAAO,wBAAwB,EAAE,YAAY,UAC7C,QAAQ,OAAO,aAAa,EAAE,mBAAmB,CAAC,cAClD,OAAO,wBAAwB,EAAE,UAAU,oBAC3C,OAAO,6CAA6C,EAAE,QAAQ,CAAC,oBAAoB,CAAC,2BACpF,mBAAmB,2BAA2B,CAAC;;;;;;;;;;;;IAyQzD;;yBA1Sa,MAAM,IAAI;cACV,MAAM,IAAI;gBACV,MAAM,IAAI;mBACV,MAAM,IAAI;;;;;;;qBAKV,SAAS,GAAG,IAAI;;;;mBAEhB,SAAS,GAAG,IAAI;;;;;4BAChB,SAAS,GAAG,IAAI;;;eAmShB,OAAO,wBAAwB,EAAE,eAAe;aAChD,OAAO,wBAAwB,EAAE,eAAe;WAChD,QAAQ;aACR,QAAQ;gBACR,YAAY;eACZ,YAAY;;;;yBAMZ,QAAQ,GAAG,IAAI;yBACf,QAAQ,GAAG,IAAI"}
|
package/src/auction/scheduler.js
CHANGED
|
@@ -20,21 +20,22 @@ const MAX_LATE_TICK = 300n;
|
|
|
20
20
|
|
|
21
21
|
/**
|
|
22
22
|
* @file The scheduler is presumed to be quiescent between auction rounds. Each
|
|
23
|
-
*
|
|
24
|
-
*
|
|
23
|
+
* Auction round consists of a sequence of steps with decreasing prices. There
|
|
24
|
+
* should always be a next schedule, but between rounds, liveSchedule is
|
|
25
|
+
* null.
|
|
25
26
|
*
|
|
26
|
-
*
|
|
27
|
-
*
|
|
28
|
-
*
|
|
29
|
-
*
|
|
30
|
-
*
|
|
31
|
-
*
|
|
32
|
-
* changed.
|
|
27
|
+
* The lock period that the liquidators use might start before the previous
|
|
28
|
+
* round has finished, so we need to schedule the next round each time an
|
|
29
|
+
* auction starts. This means if the scheduling parameters change, it'll be a
|
|
30
|
+
* full cycle before we switch. Otherwise, the vaults wouldn't know when to
|
|
31
|
+
* start their lock period. If the lock period for the next auction hasn't
|
|
32
|
+
* started when each aucion ends, we recalculate it, in case the parameters
|
|
33
|
+
* have changed.
|
|
33
34
|
*
|
|
34
|
-
*
|
|
35
|
-
*
|
|
36
|
-
*
|
|
37
|
-
*
|
|
35
|
+
* If the clock skips forward (because of a chain halt, for instance), the
|
|
36
|
+
* scheduler will try to cleanly and quickly finish any round already in
|
|
37
|
+
* progress. It would take additional work on the manual timer to test this
|
|
38
|
+
* thoroughly.
|
|
38
39
|
*/
|
|
39
40
|
|
|
40
41
|
const makeCancelToken = makeCancelTokenMaker('scheduler');
|
|
@@ -49,12 +50,11 @@ const makeCancelToken = makeCancelTokenMaker('scheduler');
|
|
|
49
50
|
|
|
50
51
|
/**
|
|
51
52
|
* @typedef {object} ScheduleNotification
|
|
52
|
-
*
|
|
53
|
-
*
|
|
54
|
-
* auction if auction is active
|
|
53
|
+
* @property {Timestamp | null} activeStartTime start time of current auction if
|
|
54
|
+
* auction is active
|
|
55
55
|
* @property {Timestamp | null} nextStartTime start time of next auction
|
|
56
|
-
* @property {Timestamp | null} nextDescendingStepTime when the next descending
|
|
57
|
-
*
|
|
56
|
+
* @property {Timestamp | null} nextDescendingStepTime when the next descending
|
|
57
|
+
* step will take place
|
|
58
58
|
*/
|
|
59
59
|
|
|
60
60
|
const safelyComputeRoundTiming = (params, baseTime) => {
|
|
@@ -92,7 +92,7 @@ export const makeScheduler = async (
|
|
|
92
92
|
*/
|
|
93
93
|
let liveSchedule = null;
|
|
94
94
|
|
|
95
|
-
/** @returns {Promise<{ now: Timestamp
|
|
95
|
+
/** @returns {Promise<{ now: Timestamp; nextSchedule: Schedule | null }>} */
|
|
96
96
|
const initializeNextSchedule = async () => {
|
|
97
97
|
return E.when(
|
|
98
98
|
// XXX manualTimer returns a bigint, not a timeRecord.
|
|
@@ -114,7 +114,7 @@ export const makeScheduler = async (
|
|
|
114
114
|
|
|
115
115
|
const stepCancelToken = makeCancelToken();
|
|
116
116
|
|
|
117
|
-
/** @type {typeof AuctionState[keyof typeof AuctionState]} */
|
|
117
|
+
/** @type {(typeof AuctionState)[keyof typeof AuctionState]} */
|
|
118
118
|
let auctionState = AuctionState.WAITING;
|
|
119
119
|
|
|
120
120
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sortedOffers.d.ts","sourceRoot":"","sources":["sortedOffers.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"sortedOffers.d.ts","sourceRoot":"","sources":["sortedOffers.js"],"names":[],"mappings":"AA8BO,8CAFI,KAAK,UAMf;AAUM,4CALI,KAAK,kBACL,MAAM,GACJ,MAAM,CAWlB;AAqCM,uCANI,MAAM,YACN,MAAM,KAAK,CAAC,cACZ,MAAM,KAAK,CAAC,eACZ,MAAM,GACJ,CAAC,eAAe,EAAE,KAAK,EAAE,cAAc,EAAE,MAAM,CAAC,CAQ5D;AAED,sCAAsC;AACtC,4CADkB,KAAK,KAAK,MAAM,CAKhC;AAUK,2CALI,KAAK,kBACL,MAAM,GACJ,MAAM,CAWlB;AAUM,4CALI,MAAM,SACN,KAAK,eACL,MAAM,GACJ,CAAC,eAAe,EAAE,KAAK,EAAE,cAAc,EAAE,MAAM,CAAC,CAQ5D"}
|
|
@@ -13,12 +13,13 @@ const { Fail } = assert;
|
|
|
13
13
|
|
|
14
14
|
/**
|
|
15
15
|
* @file we use a floating point representation of the price or rate as the
|
|
16
|
-
*
|
|
17
|
-
* the bid, but it doesn't matter for sorting. When we retrieve multiple
|
|
18
|
-
* it's only by bid value, so we don't care how the sequence numbers
|
|
16
|
+
* first part of the key in the store. The second part is the sequence number
|
|
17
|
+
* of the bid, but it doesn't matter for sorting. When we retrieve multiple
|
|
18
|
+
* bids, it's only by bid value, so we don't care how the sequence numbers
|
|
19
|
+
* sort.
|
|
19
20
|
*
|
|
20
|
-
*
|
|
21
|
-
*
|
|
21
|
+
* We take advantage of the fact that encodeData takes a passable and turns it
|
|
22
|
+
* into a sort key. Arrays of passable data sort like composite keys.
|
|
22
23
|
*/
|
|
23
24
|
|
|
24
25
|
/**
|
|
@@ -39,7 +40,7 @@ export const toPartialOfferKey = offerPrice => {
|
|
|
39
40
|
* @param {Ratio} offerPrice IST/collateral
|
|
40
41
|
* @param {bigint} sequenceNumber
|
|
41
42
|
* @returns {string} lexically sortable string in which highest price is first,
|
|
42
|
-
*
|
|
43
|
+
* ties will be broken by sequenceNumber of offer
|
|
43
44
|
*/
|
|
44
45
|
export const toPriceOfferKey = (offerPrice, sequenceNumber) => {
|
|
45
46
|
mustMatch(offerPrice, RatioShape);
|
|
@@ -107,7 +108,7 @@ export const toBidScalingComparator = rate => {
|
|
|
107
108
|
* @param {Ratio} rate discount/markup rate expressed as a ratio IST/IST
|
|
108
109
|
* @param {bigint} sequenceNumber
|
|
109
110
|
* @returns {string} lexically sortable string in which highest price is first,
|
|
110
|
-
*
|
|
111
|
+
* ties will be broken by sequenceNumber of offer
|
|
111
112
|
*/
|
|
112
113
|
export const toScaledRateOfferKey = (rate, sequenceNumber) => {
|
|
113
114
|
mustMatch(rate, RatioShape);
|
package/src/auction/util.d.ts
CHANGED
package/src/auction/util.js
CHANGED
|
@@ -10,7 +10,7 @@ import { Far } from '@endo/marshal';
|
|
|
10
10
|
/**
|
|
11
11
|
* Constants for Auction State.
|
|
12
12
|
*
|
|
13
|
-
* @type {{ ACTIVE: 'active'
|
|
13
|
+
* @type {{ ACTIVE: 'active'; WAITING: 'waiting' }}
|
|
14
14
|
*/
|
|
15
15
|
export const AuctionState = {
|
|
16
16
|
ACTIVE: 'active',
|
|
@@ -18,8 +18,8 @@ export const AuctionState = {
|
|
|
18
18
|
};
|
|
19
19
|
|
|
20
20
|
/**
|
|
21
|
-
* @param {{ brand: Brand
|
|
22
|
-
* @param {{ brand: Brand
|
|
21
|
+
* @param {{ brand: Brand; value: Pattern }} numeratorAmountShape
|
|
22
|
+
* @param {{ brand: Brand; value: Pattern }} denominatorAmountShape
|
|
23
23
|
*/
|
|
24
24
|
export const makeBrandedRatioPattern = (
|
|
25
25
|
numeratorAmountShape,
|
|
@@ -36,7 +36,7 @@ export const makeBrandedRatioPattern = (
|
|
|
36
36
|
* @param {Ratio} currentPrice
|
|
37
37
|
* @param {Ratio} oraclePrice
|
|
38
38
|
* @returns {boolean} TRUE iff the discount(/markup) applied to the price is
|
|
39
|
-
*
|
|
39
|
+
* higher than the quote.
|
|
40
40
|
*/
|
|
41
41
|
export const isScaledBidPriceHigher = (bidScaling, currentPrice, oraclePrice) =>
|
|
42
42
|
ratioGTE(multiplyRatios(oraclePrice, bidScaling), currentPrice);
|
package/src/clientSupport.d.ts
CHANGED
|
@@ -20,17 +20,23 @@ export namespace Offers {
|
|
|
20
20
|
}
|
|
21
21
|
}
|
|
22
22
|
/**
|
|
23
|
-
* @param {Pick<
|
|
23
|
+
* @param {Pick<
|
|
24
|
+
* import('@agoric/vats/tools/board-utils.js').AgoricNamesRemotes,
|
|
25
|
+
* 'brand' | 'vbankAsset'
|
|
26
|
+
* >} agoricNames
|
|
24
27
|
* @param {{
|
|
25
|
-
* offerId: string
|
|
26
|
-
* give: string
|
|
27
|
-
* maxBuy: string
|
|
28
|
-
* wantMinimum?: string
|
|
29
|
-
* } & (
|
|
30
|
-
*
|
|
31
|
-
*
|
|
32
|
-
*
|
|
33
|
-
*
|
|
28
|
+
* offerId: string;
|
|
29
|
+
* give: string;
|
|
30
|
+
* maxBuy: string;
|
|
31
|
+
* wantMinimum?: string;
|
|
32
|
+
* } & (
|
|
33
|
+
* | {
|
|
34
|
+
* price: number;
|
|
35
|
+
* }
|
|
36
|
+
* | {
|
|
37
|
+
* discount: number; // -1 to 1. e.g. 0.10 for 10% discount, -0.05 for 5% markup
|
|
38
|
+
* }
|
|
39
|
+
* )} opts
|
|
34
40
|
* @returns {import('@agoric/smart-wallet/src/offers.js').OfferSpec}
|
|
35
41
|
*/
|
|
36
42
|
declare function makeBidOffer(agoricNames: Pick<import('@agoric/vats/tools/board-utils.js').AgoricNamesRemotes, 'brand' | 'vbankAsset'>, opts: {
|
|
@@ -44,12 +50,11 @@ declare function makeBidOffer(agoricNames: Pick<import('@agoric/vats/tools/board
|
|
|
44
50
|
discount: number;
|
|
45
51
|
})): import('@agoric/smart-wallet/src/offers.js').OfferSpec;
|
|
46
52
|
/**
|
|
47
|
-
*
|
|
48
53
|
* @param {unknown} _agoricNames
|
|
49
54
|
* @param {{
|
|
50
|
-
* offerId: string
|
|
51
|
-
* roundId?: bigint
|
|
52
|
-
* unitPrice: bigint
|
|
55
|
+
* offerId: string;
|
|
56
|
+
* roundId?: bigint;
|
|
57
|
+
* unitPrice: bigint;
|
|
53
58
|
* }} opts
|
|
54
59
|
* @param {string} previousOffer
|
|
55
60
|
* @returns {import('@agoric/smart-wallet/src/offers.js').OfferSpec}
|
|
@@ -60,10 +65,15 @@ declare function makePushPriceOffer(_agoricNames: unknown, opts: {
|
|
|
60
65
|
unitPrice: bigint;
|
|
61
66
|
}, previousOffer: string): import('@agoric/smart-wallet/src/offers.js').OfferSpec;
|
|
62
67
|
/**
|
|
63
|
-
* @param {Pick<
|
|
68
|
+
* @param {Pick<
|
|
69
|
+
* import('@agoric/vats/tools/board-utils.js').AgoricNamesRemotes,
|
|
70
|
+
* 'brand'
|
|
71
|
+
* >} agoricNames
|
|
64
72
|
* @param {Instance} instance
|
|
65
|
-
* @param {{ offerId: string
|
|
66
|
-
*
|
|
73
|
+
* @param {{ offerId: string; feePct?: number; pair: [string, string] } & (
|
|
74
|
+
* | { wantMinted: number }
|
|
75
|
+
* | { giveMinted: number }
|
|
76
|
+
* )} opts
|
|
67
77
|
* @returns {import('@agoric/smart-wallet/src/offers.js').OfferSpec}
|
|
68
78
|
*/
|
|
69
79
|
declare function makePsmSwapOffer({ brand }: Pick<import('@agoric/vats/tools/board-utils.js').AgoricNamesRemotes, 'brand'>, instance: Instance, opts: {
|
|
@@ -76,8 +86,16 @@ declare function makePsmSwapOffer({ brand }: Pick<import('@agoric/vats/tools/boa
|
|
|
76
86
|
giveMinted: number;
|
|
77
87
|
})): import('@agoric/smart-wallet/src/offers.js').OfferSpec;
|
|
78
88
|
/**
|
|
79
|
-
* @param {Pick<
|
|
80
|
-
*
|
|
89
|
+
* @param {Pick<
|
|
90
|
+
* import('@agoric/vats/tools/board-utils.js').AgoricNamesRemotes,
|
|
91
|
+
* 'brand'
|
|
92
|
+
* >} agoricNames
|
|
93
|
+
* @param {{
|
|
94
|
+
* offerId: string;
|
|
95
|
+
* wantMinted: number;
|
|
96
|
+
* giveCollateral: number;
|
|
97
|
+
* collateralBrandKey: string;
|
|
98
|
+
* }} opts
|
|
81
99
|
* @returns {import('@agoric/smart-wallet/src/offers.js').OfferSpec}
|
|
82
100
|
*/
|
|
83
101
|
declare function makeOpenOffer({ brand }: Pick<import('@agoric/vats/tools/board-utils.js').AgoricNamesRemotes, 'brand'>, opts: {
|
|
@@ -87,8 +105,18 @@ declare function makeOpenOffer({ brand }: Pick<import('@agoric/vats/tools/board-
|
|
|
87
105
|
collateralBrandKey: string;
|
|
88
106
|
}): import('@agoric/smart-wallet/src/offers.js').OfferSpec;
|
|
89
107
|
/**
|
|
90
|
-
* @param {Pick<
|
|
91
|
-
*
|
|
108
|
+
* @param {Pick<
|
|
109
|
+
* import('@agoric/vats/tools/board-utils.js').AgoricNamesRemotes,
|
|
110
|
+
* 'brand'
|
|
111
|
+
* >} agoricNames
|
|
112
|
+
* @param {{
|
|
113
|
+
* offerId: string;
|
|
114
|
+
* collateralBrandKey?: string;
|
|
115
|
+
* giveCollateral?: number;
|
|
116
|
+
* wantCollateral?: number;
|
|
117
|
+
* giveMinted?: number;
|
|
118
|
+
* wantMinted?: number;
|
|
119
|
+
* }} opts
|
|
92
120
|
* @param {string} previousOffer
|
|
93
121
|
* @returns {import('@agoric/smart-wallet/src/offers.js').OfferSpec}
|
|
94
122
|
*/
|
|
@@ -101,8 +129,15 @@ declare function makeAdjustOffer({ brand }: Pick<import('@agoric/vats/tools/boar
|
|
|
101
129
|
wantMinted?: number;
|
|
102
130
|
}, previousOffer: string): import('@agoric/smart-wallet/src/offers.js').OfferSpec;
|
|
103
131
|
/**
|
|
104
|
-
* @param {Pick<
|
|
105
|
-
*
|
|
132
|
+
* @param {Pick<
|
|
133
|
+
* import('@agoric/vats/tools/board-utils.js').AgoricNamesRemotes,
|
|
134
|
+
* 'brand'
|
|
135
|
+
* >} agoricNames
|
|
136
|
+
* @param {{
|
|
137
|
+
* offerId: string;
|
|
138
|
+
* collateralBrandKey?: string;
|
|
139
|
+
* giveMinted: number;
|
|
140
|
+
* }} opts
|
|
106
141
|
* @param {string} previousOffer
|
|
107
142
|
* @returns {import('@agoric/smart-wallet/src/offers.js').OfferSpec}
|
|
108
143
|
*/
|
|
@@ -112,11 +147,14 @@ declare function makeCloseOffer({ brand }: Pick<import('@agoric/vats/tools/board
|
|
|
112
147
|
giveMinted: number;
|
|
113
148
|
}, previousOffer: string): import('@agoric/smart-wallet/src/offers.js').OfferSpec;
|
|
114
149
|
/**
|
|
115
|
-
* @param {Pick<
|
|
150
|
+
* @param {Pick<
|
|
151
|
+
* import('@agoric/vats/tools/board-utils.js').AgoricNamesRemotes,
|
|
152
|
+
* 'brand'
|
|
153
|
+
* >} agoricNames
|
|
116
154
|
* @param {{
|
|
117
|
-
* offerId: string
|
|
118
|
-
* give: number
|
|
119
|
-
* collateralBrandKey: string
|
|
155
|
+
* offerId: string;
|
|
156
|
+
* give: number;
|
|
157
|
+
* collateralBrandKey: string;
|
|
120
158
|
* }} opts
|
|
121
159
|
* @returns {import('@agoric/smart-wallet/src/offers.js').OfferSpec}
|
|
122
160
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"clientSupport.d.ts","sourceRoot":"","sources":["clientSupport.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"clientSupport.d.ts","sourceRoot":"","sources":["clientSupport.js"],"names":[],"mappings":"AAsKO,+CANI,MAAM,YACN,QACV,OAAW,sCAAsC,EAAE,mBAAmB,CACnE,GACS,QAAQ,MAAM,CAAC,CAW3B;AAmFM,6CAPI,KACV,OAAW,mCAAmC,EAAE,kBAAkB,EAClE,OAAW,GAAG,YAAY,CACvB,oBACa,MAAM,KAAK,KAAK,OAChB,MAAM,KAAK,OAAO,KAAK,CAAC,CAiCtC;;;;;;;;;;;;;;;;;;;;AAEH;;;;;;;;;;;;;;;;;;;GAmBG;AACH,2CAnBW,KACV,OAAW,mCAAmC,EAAE,kBAAkB,EAClE,OAAW,GAAG,YAAY,CACvB;aAEU,MAAM;UACT,MAAM;YACJ,MAAM;;;WAIH,MAAM;;cAGH,MAAM;KAGZ,OAAO,oCAAoC,EAAE,SAAS,CAuDlE;AAqCD;;;;;;;;;GASG;AACH,kDATW,OAAO,QACP;IACV,OAAW,EAAE,MAAM,CAAC;IACpB,OAAW,CAAC,EAAE,MAAM,CAAC;IACrB,SAAa,EAAE,MAAM,CAAC;CACnB,iBACO,MAAM,GACJ,OAAO,oCAAoC,EAAE,SAAS,CAelE;AAtND;;;;;;;;;;;GAWG;AACH,6CAXW,KACV,OAAW,mCAAmC,EAAE,kBAAkB,EAClE,OAAW,CACR,YACO,QAAQ,QACR;IAAE,OAAO,EAAE,MAAM,CAAC;IAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;CAAE,GAAG,CACnE;IAAE,UAAU,EAAE,MAAM,CAAA;CAAE,GACtB;IAAE,UAAU,EAAE,MAAM,CAAA;CAAE,CACzB,GACS,OAAO,oCAAoC,EAAE,SAAS,CA4BlE;AAzLD;;;;;;;;;;;;GAYG;AACH,0CAZW,KACV,OAAW,mCAAmC,EAAE,kBAAkB,EAClE,OAAW,CACR,QACO;IACV,OAAW,EAAE,MAAM,CAAC;IACpB,UAAc,EAAE,MAAM,CAAC;IACvB,cAAkB,EAAE,MAAM,CAAC;IAC3B,kBAAsB,EAAE,MAAM,CAAC;CAC5B,GACS,OAAO,oCAAoC,EAAE,SAAS,CAuBlE;AAED;;;;;;;;;;;;;;;GAeG;AACH,4CAfW,KACV,OAAW,mCAAmC,EAAE,kBAAkB,EAClE,OAAW,CACR,QACO;IACV,OAAW,EAAE,MAAM,CAAC;IACpB,kBAAsB,CAAC,EAAE,MAAM,CAAC;IAChC,cAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,cAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,UAAc,CAAC,EAAE,MAAM,CAAC;IACxB,UAAc,CAAC,EAAE,MAAM,CAAC;CACrB,iBACO,MAAM,GACJ,OAAO,oCAAoC,EAAE,SAAS,CAiBlE;AAED;;;;;;;;;;;;GAYG;AACH,2CAZW,KACV,OAAW,mCAAmC,EAAE,kBAAkB,EAClE,OAAW,CACR,QACO;IACV,OAAW,EAAE,MAAM,CAAC;IACpB,kBAAsB,CAAC,EAAE,MAAM,CAAC;IAChC,UAAc,EAAE,MAAM,CAAC;CACpB,iBACO,MAAM,GACJ,OAAO,oCAAoC,EAAE,SAAS,CAclE;AAiND;;;;;;;;;;;GAWG;AACH,mDAXW,KACV,OAAW,mCAAmC,EAAE,kBAAkB,EAClE,OAAW,CACR;aAEU,MAAM;UACT,MAAM;wBACQ,MAAM;IAElB,OAAO,oCAAoC,EAAE,SAAS,CAuBlE"}
|