@agoric/inter-protocol 0.16.2-upgrade-14-dev-0169c7e.0 → 0.16.2-upgrade-16-dev-8879538.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +41 -34
- package/scripts/build-bundles.js +5 -21
- package/src/auction/auctionBook.d.ts +84 -0
- package/src/auction/auctionBook.d.ts.map +1 -0
- package/src/auction/auctionBook.js +135 -103
- package/src/auction/auctioneer.d.ts +83 -0
- package/src/auction/auctioneer.d.ts.map +1 -0
- package/src/auction/auctioneer.js +63 -49
- package/src/auction/offerBook.d.ts +45 -0
- package/src/auction/offerBook.d.ts.map +1 -0
- package/src/auction/offerBook.js +13 -12
- package/src/auction/params.d.ts +149 -0
- package/src/auction/params.d.ts.map +1 -0
- package/src/auction/params.js +10 -9
- package/src/auction/scheduleMath.d.ts +5 -0
- package/src/auction/scheduleMath.d.ts.map +1 -0
- package/src/auction/scheduleMath.js +17 -15
- package/src/auction/scheduler.d.ts +49 -0
- package/src/auction/scheduler.d.ts.map +1 -0
- package/src/auction/scheduler.js +51 -43
- package/src/auction/sortedOffers.d.ts +8 -0
- package/src/auction/sortedOffers.d.ts.map +1 -0
- package/src/auction/sortedOffers.js +9 -7
- package/src/auction/util.d.ts +32 -0
- package/src/auction/util.d.ts.map +1 -0
- package/src/auction/util.js +6 -4
- package/src/clientSupport.d.ts +167 -0
- package/src/clientSupport.d.ts.map +1 -0
- package/src/clientSupport.js +97 -40
- package/src/collectFees.d.ts +2 -0
- package/src/collectFees.d.ts.map +1 -0
- package/src/contractSupport.d.ts +28 -0
- package/src/contractSupport.d.ts.map +1 -0
- package/src/contractSupport.js +14 -12
- package/src/econCommitteeCharter.d.ts +39 -0
- package/src/econCommitteeCharter.d.ts.map +1 -0
- package/src/econCommitteeCharter.js +21 -20
- package/src/feeDistributor.d.ts +224 -0
- package/src/feeDistributor.d.ts.map +1 -0
- package/src/feeDistributor.js +37 -33
- package/src/index.d.ts +2 -0
- package/src/index.d.ts.map +1 -0
- package/src/index.js +1 -0
- package/src/interest-math.d.ts +3 -0
- package/src/interest-math.d.ts.map +1 -0
- package/src/interest.d.ts +28 -0
- package/src/interest.d.ts.map +1 -0
- package/src/interest.js +21 -16
- package/src/price/README.md +13 -0
- package/src/price/fluxAggregatorContract.d.ts +70 -0
- package/src/price/fluxAggregatorContract.d.ts.map +1 -0
- package/src/price/fluxAggregatorContract.js +62 -55
- package/src/price/fluxAggregatorKit.d.ts +103 -0
- package/src/price/fluxAggregatorKit.d.ts.map +1 -0
- package/src/price/fluxAggregatorKit.js +50 -37
- package/src/price/priceOracleKit.d.ts +38 -0
- package/src/price/priceOracleKit.d.ts.map +1 -0
- package/src/price/priceOracleKit.js +11 -13
- package/src/price/roundsManager.d.ts +238 -0
- package/src/price/roundsManager.d.ts.map +1 -0
- package/src/price/roundsManager.js +77 -82
- package/src/proposals/README.md +2 -3
- package/src/proposals/add-auction.d.ts +69 -0
- package/src/proposals/add-auction.d.ts.map +1 -0
- package/src/proposals/add-auction.js +181 -0
- package/src/proposals/addAssetToVault.d.ts +160 -0
- package/src/proposals/addAssetToVault.d.ts.map +1 -0
- package/src/proposals/addAssetToVault.js +172 -38
- package/src/proposals/committee-proposal.d.ts +113 -0
- package/src/proposals/committee-proposal.d.ts.map +1 -0
- package/src/proposals/committee-proposal.js +25 -31
- package/src/proposals/core-proposal.d.ts +149 -0
- package/src/proposals/core-proposal.d.ts.map +1 -0
- package/src/proposals/core-proposal.js +9 -11
- package/src/proposals/econ-behaviors.d.ts +1169 -0
- package/src/proposals/econ-behaviors.d.ts.map +1 -0
- package/src/proposals/econ-behaviors.js +66 -45
- package/src/proposals/price-feed-proposal.d.ts +84 -0
- package/src/proposals/price-feed-proposal.d.ts.map +1 -0
- package/src/proposals/price-feed-proposal.js +108 -51
- package/src/proposals/startEconCommittee.d.ts +34 -0
- package/src/proposals/startEconCommittee.d.ts.map +1 -0
- package/src/proposals/startEconCommittee.js +2 -2
- package/src/proposals/startPSM.d.ts +59 -0
- package/src/proposals/startPSM.d.ts.map +1 -0
- package/src/proposals/startPSM.js +38 -27
- package/src/proposals/upgrade-scaledPriceAuthorities.d.ts +24 -0
- package/src/proposals/upgrade-scaledPriceAuthorities.d.ts.map +1 -0
- package/src/proposals/upgrade-scaledPriceAuthorities.js +78 -0
- package/src/proposals/upgrade-vaults.d.ts +35 -0
- package/src/proposals/upgrade-vaults.d.ts.map +1 -0
- package/src/proposals/upgrade-vaults.js +202 -0
- package/src/proposals/utils.d.ts +17 -0
- package/src/proposals/utils.d.ts.map +1 -0
- package/src/proposals/utils.js +34 -7
- package/src/provisionPool.d.ts +167 -0
- package/src/provisionPool.d.ts.map +1 -0
- package/src/provisionPool.js +122 -0
- package/src/provisionPoolKit.d.ts +770 -0
- package/src/provisionPoolKit.d.ts.map +1 -0
- package/src/provisionPoolKit.js +463 -0
- package/src/psm/psm.d.ts +122 -0
- package/src/psm/psm.d.ts.map +1 -0
- package/src/psm/psm.js +73 -69
- package/src/psm/types-ambient.d.ts +2 -0
- package/src/psm/types-ambient.d.ts.map +1 -0
- package/src/psm/types-ambient.js +3 -0
- package/src/reserve/assetReserve.d.ts +47 -0
- package/src/reserve/assetReserve.d.ts.map +1 -0
- package/src/reserve/assetReserve.js +28 -19
- package/src/reserve/assetReserveKit.d.ts +74 -0
- package/src/reserve/assetReserveKit.d.ts.map +1 -0
- package/src/reserve/assetReserveKit.js +18 -24
- package/src/reserve/params.d.ts +10 -0
- package/src/reserve/params.d.ts.map +1 -0
- package/src/tokens.d.ts +3 -0
- package/src/tokens.d.ts.map +1 -0
- package/src/tokens.js +5 -0
- package/src/vaultFactory/burn.d.ts +2 -0
- package/src/vaultFactory/burn.d.ts.map +1 -0
- package/src/vaultFactory/burn.js +1 -1
- package/src/vaultFactory/liquidation.d.ts +163 -0
- package/src/vaultFactory/liquidation.d.ts.map +1 -0
- package/src/vaultFactory/liquidation.js +36 -22
- package/src/vaultFactory/math.d.ts +11 -0
- package/src/vaultFactory/math.d.ts.map +1 -0
- package/src/vaultFactory/math.js +10 -9
- package/src/vaultFactory/orderedVaultStore.d.ts +360 -0
- package/src/vaultFactory/orderedVaultStore.d.ts.map +1 -0
- package/src/vaultFactory/orderedVaultStore.js +8 -11
- package/src/vaultFactory/params.d.ts +145 -0
- package/src/vaultFactory/params.d.ts.map +1 -0
- package/src/vaultFactory/params.js +52 -24
- package/src/vaultFactory/prioritizedVaults.d.ts +992 -0
- package/src/vaultFactory/prioritizedVaults.d.ts.map +1 -0
- package/src/vaultFactory/prioritizedVaults.js +4 -4
- package/src/vaultFactory/proceeds.d.ts +35 -0
- package/src/vaultFactory/proceeds.d.ts.map +1 -0
- package/src/vaultFactory/proceeds.js +26 -18
- package/src/vaultFactory/storeUtils.d.ts +25 -0
- package/src/vaultFactory/storeUtils.d.ts.map +1 -0
- package/src/vaultFactory/storeUtils.js +10 -12
- package/src/vaultFactory/types-ambient.d.ts +234 -0
- package/src/vaultFactory/types-ambient.d.ts.map +1 -0
- package/src/vaultFactory/{types.js → types-ambient.js} +42 -42
- package/src/vaultFactory/vault.d.ts +402 -0
- package/src/vaultFactory/vault.d.ts.map +1 -0
- package/src/vaultFactory/vault.js +99 -93
- package/src/vaultFactory/vaultDirector.d.ts +388 -0
- package/src/vaultFactory/vaultDirector.d.ts.map +1 -0
- package/src/vaultFactory/vaultDirector.js +61 -50
- package/src/vaultFactory/vaultFactory.d.ts +277 -0
- package/src/vaultFactory/vaultFactory.d.ts.map +1 -0
- package/src/vaultFactory/vaultFactory.js +49 -32
- package/src/vaultFactory/vaultHolder.d.ts +270 -0
- package/src/vaultFactory/vaultHolder.d.ts.map +1 -0
- package/src/vaultFactory/vaultHolder.js +10 -14
- package/src/vaultFactory/vaultKit.d.ts +102 -0
- package/src/vaultFactory/vaultKit.d.ts.map +1 -0
- package/src/vaultFactory/vaultKit.js +5 -4
- package/src/vaultFactory/vaultManager.d.ts +819 -0
- package/src/vaultFactory/vaultManager.d.ts.map +1 -0
- package/src/vaultFactory/vaultManager.js +248 -151
- package/CHANGELOG.md +0 -1066
- package/exported.js +0 -2
- package/scripts/add-collateral-core.js +0 -113
- package/scripts/deploy-contracts.js +0 -100
- package/scripts/init-core.js +0 -200
- package/scripts/invite-committee-core.js +0 -42
- package/scripts/manual-price-feed.js +0 -117
- package/scripts/price-feed-core.js +0 -104
- package/scripts/start-local-chain.sh +0 -84
- package/src/psm/types.js +0 -3
- package/src/typeGuards.js +0 -13
- package/src/vaultFactory/type-imports.js +0 -4
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
export function distributeProportionalSharesWithLimits(unsoldCollateral: Amount<"nat">, proceeds: Amount<"nat">, deposits: {
|
|
2
|
+
seat: ZCFSeat;
|
|
3
|
+
amount: Amount<"nat">;
|
|
4
|
+
goal: Amount<"nat">;
|
|
5
|
+
}[], collateralSeat: ZCFSeat, bidHoldingSeat: ZCFSeat, collateralKeyword: string, reserveSeat: ZCFSeat, brand: Brand): TransferPart[];
|
|
6
|
+
export function start(zcf: ZCF<globalThis.GovernanceTerms<{
|
|
7
|
+
Electorate: "invitation";
|
|
8
|
+
StartFrequency: "relativeTime";
|
|
9
|
+
ClockStep: "relativeTime";
|
|
10
|
+
StartingRate: "nat";
|
|
11
|
+
LowestRate: "nat";
|
|
12
|
+
DiscountStep: "nat";
|
|
13
|
+
AuctionStartDelay: "relativeTime";
|
|
14
|
+
PriceLockPeriod: "relativeTime";
|
|
15
|
+
}> & {
|
|
16
|
+
timerService: import("@agoric/time").TimerService;
|
|
17
|
+
reservePublicFacet: globalThis.GovernedPublicFacet<import("@endo/exo").Guarded<{
|
|
18
|
+
makeAddCollateralInvitation(): Promise<Invitation<string, never>>;
|
|
19
|
+
getPublicTopics(): {
|
|
20
|
+
metrics: import("@agoric/zoe/src/contractSupport/topics.js").PublicTopic<import("../reserve/assetReserveKit.js").MetricsNotification>;
|
|
21
|
+
};
|
|
22
|
+
}>>;
|
|
23
|
+
priceAuthority: PriceAuthority;
|
|
24
|
+
}>, privateArgs: {
|
|
25
|
+
initialPoserInvitation: Invitation;
|
|
26
|
+
storageNode: StorageNode;
|
|
27
|
+
marshaller: Marshaller;
|
|
28
|
+
}, baggage: Baggage): Promise<{
|
|
29
|
+
publicFacet: globalThis.GovernedPublicFacet<{
|
|
30
|
+
getElectorate: () => import("@agoric/ertp/src/types.js").SetAmount<import("@endo/patterns").Key>;
|
|
31
|
+
getStartFrequency: () => RelativeTime;
|
|
32
|
+
getClockStep: () => RelativeTime;
|
|
33
|
+
getStartingRate: () => bigint;
|
|
34
|
+
getLowestRate: () => bigint;
|
|
35
|
+
getDiscountStep: () => bigint;
|
|
36
|
+
getAuctionStartDelay: () => RelativeTime;
|
|
37
|
+
getPriceLockPeriod: () => RelativeTime;
|
|
38
|
+
/** @param {Brand<'nat'>} collateralBrand */
|
|
39
|
+
makeBidInvitation(collateralBrand: Brand<"nat">): Promise<Invitation<string, import("./auctionBook.js").OfferSpec>>;
|
|
40
|
+
getSchedules(): {
|
|
41
|
+
liveAuctionSchedule: import("./scheduler.js").Schedule | null;
|
|
42
|
+
nextAuctionSchedule: import("./scheduler.js").Schedule | null;
|
|
43
|
+
};
|
|
44
|
+
getScheduleUpdates(): globalThis.Subscriber<import("./scheduler.js").ScheduleNotification>;
|
|
45
|
+
getBookDataUpdates(brand: any): globalThis.Subscriber<import("./auctionBook.js").BookDataNotification>;
|
|
46
|
+
getPublicTopics(brand: any): {
|
|
47
|
+
bookData: import("@agoric/zoe/src/contractSupport/topics.js").PublicTopic<import("./auctionBook.js").BookDataNotification>;
|
|
48
|
+
} | {
|
|
49
|
+
schedule: import("@agoric/zoe/src/contractSupport/topics.js").PublicTopic<import("./scheduler.js").ScheduleNotification>;
|
|
50
|
+
};
|
|
51
|
+
makeDepositInvitation: () => Promise<Invitation<string, {
|
|
52
|
+
goal: Amount<"nat">;
|
|
53
|
+
}>>;
|
|
54
|
+
}>;
|
|
55
|
+
creatorFacet: globalThis.GovernedCreatorFacet<{
|
|
56
|
+
/**
|
|
57
|
+
* @param {Issuer<'nat'>} issuer
|
|
58
|
+
* @param {Keyword} kwd
|
|
59
|
+
*/
|
|
60
|
+
addBrand(issuer: Issuer<"nat">, kwd: Keyword): Promise<void>;
|
|
61
|
+
/** @returns {Promise<import('./scheduler.js').FullSchedule>} */
|
|
62
|
+
getSchedule(): Promise<import("./scheduler.js").FullSchedule>;
|
|
63
|
+
} & import("@endo/marshal").RemotableObject<`Alleged: ${string}`> & import("@endo/eventual-send").RemotableBrand<{}, {
|
|
64
|
+
/**
|
|
65
|
+
* @param {Issuer<'nat'>} issuer
|
|
66
|
+
* @param {Keyword} kwd
|
|
67
|
+
*/
|
|
68
|
+
addBrand(issuer: Issuer<"nat">, kwd: Keyword): Promise<void>;
|
|
69
|
+
/** @returns {Promise<import('./scheduler.js').FullSchedule>} */
|
|
70
|
+
getSchedule(): Promise<import("./scheduler.js").FullSchedule>;
|
|
71
|
+
}>>;
|
|
72
|
+
}>;
|
|
73
|
+
/** @typedef {ContractOf<typeof start>} AuctioneerContract */
|
|
74
|
+
/** @typedef {AuctioneerContract['publicFacet']} AuctioneerPublicFacet */
|
|
75
|
+
/** @typedef {AuctioneerContract['creatorFacet']} AuctioneerCreatorFacet */
|
|
76
|
+
export const AuctionPFShape: import("@endo/patterns").Matcher;
|
|
77
|
+
export type AuctioneerContract = ContractOf<typeof start>;
|
|
78
|
+
export type AuctioneerPublicFacet = AuctioneerContract["publicFacet"];
|
|
79
|
+
export type AuctioneerCreatorFacet = AuctioneerContract["creatorFacet"];
|
|
80
|
+
import { auctioneerParamTypes } from './params.js';
|
|
81
|
+
import type { PriceAuthority } from '@agoric/zoe/tools/types.js';
|
|
82
|
+
import type { Baggage } from '@agoric/vat-data';
|
|
83
|
+
//# sourceMappingURL=auctioneer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"auctioneer.d.ts","sourceRoot":"","sources":["auctioneer.js"],"names":[],"mappings":"AAgLO,yEAXI,MAAM,CAAC,KAAK,CAAC,YACb,MAAM,CAAC,KAAK,CAAC,YACb;IAAE,IAAI,EAAE,OAAO,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC,KAAK,CAAC,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC,KAAK,CAAC,CAAA;CAAE,EAAE,kBAC/D,OAAO,kBACP,OAAO,qBAEP,MAAM,eAEN,OAAO,SACP,KAAK,kBAgNf;AAiBM;;;;;;;;;;kBAZc,OAAO,cAAc,EAAE,YAAY;;;;;;;;iBAK7C;IACV,sBAA0B,EAAE,UAAU,CAAC;IACvC,WAAe,EAAE,WAAW,CAAC;IAC7B,UAAc,EAAE,UAAU,CAAC;CACxB;;;;;;;;;;QA0OE,4CAA4C;2CAAhC,KAAK,CAAC,KAAK,CAAC;;;;;;;;;;;;;kBApCT,MAAM,CAAC,KAAK,CAAC;;;;QAmG5B;;;WAGG;yBAFQ,MAAM,CAAC,KAAK,CAAC,OACb,OAAO;QAwBlB,gEAAgE;uBAAlD,OAAO,CAAC,OAAO,gBAAgB,EAAE,YAAY,CAAC;;QA1B5D;;;WAGG;yBAFQ,MAAM,CAAC,KAAK,CAAC,OACb,OAAO;QAwBlB,gEAAgE;uBAAlD,OAAO,CAAC,OAAO,gBAAgB,EAAE,YAAY,CAAC;;GAQjE;AAED,6DAA6D;AAC7D,yEAAyE;AACzE,2EAA2E;AAE3E,8DAAkE;iCAJpD,UAAU,CAAC,OAAO,KAAK,CAAC;oCACxB,kBAAkB,CAAC,aAAa,CAAC;qCACjC,kBAAkB,CAAC,cAAc,CAAC;qCA3rBX,aAAa;oCAM2C,4BAA4B;6BAD/F,kBAAkB"}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
import '@agoric/zoe/src/contracts/exported.js';
|
|
1
|
+
/// <reference types="@agoric/governance/exported" />
|
|
2
|
+
/// <reference types="@agoric/zoe/exported" />
|
|
4
3
|
|
|
5
4
|
import { AmountMath, AmountShape, BrandShape } from '@agoric/ertp';
|
|
6
5
|
import { handleParamGovernance } from '@agoric/governance';
|
|
@@ -35,7 +34,10 @@ import { auctioneerParamTypes } from './params.js';
|
|
|
35
34
|
import { makeScheduler } from './scheduler.js';
|
|
36
35
|
import { AuctionState } from './util.js';
|
|
37
36
|
|
|
38
|
-
/**
|
|
37
|
+
/**
|
|
38
|
+
* @import {Baggage} from '@agoric/vat-data';
|
|
39
|
+
* @import {PriceAuthority, PriceDescription, PriceQuote, PriceQuoteValue, PriceQuery,} from '@agoric/zoe/tools/types.js';
|
|
40
|
+
*/
|
|
39
41
|
|
|
40
42
|
const { Fail, quote: q } = assert;
|
|
41
43
|
const { add, multiply } = natSafeMath;
|
|
@@ -43,11 +45,10 @@ const { add, multiply } = natSafeMath;
|
|
|
43
45
|
const trace = makeTracer('Auction', true);
|
|
44
46
|
|
|
45
47
|
/**
|
|
46
|
-
* @file
|
|
47
|
-
*
|
|
48
|
-
*
|
|
49
|
-
*
|
|
50
|
-
* all those cases.
|
|
48
|
+
* @file In this file, 'Bid' is the name of the ERTP issuer used to purchase
|
|
49
|
+
* collateral from various issuers. It's too confusing to also use Bid as a
|
|
50
|
+
* verb or a description of amounts offered, so we've tried to find
|
|
51
|
+
* alternatives in all those cases.
|
|
51
52
|
*/
|
|
52
53
|
|
|
53
54
|
const MINIMUM_BID_GIVE = 1n;
|
|
@@ -67,17 +68,19 @@ const makeBPRatio = (rate, bidBrand, collateralBrand = bidBrand) =>
|
|
|
67
68
|
* The auction sold some amount of collateral, and raised a certain amount of
|
|
68
69
|
* Bid. The excess collateral was returned as `unsoldCollateral`. The Bid amount
|
|
69
70
|
* collected from the auction participants is `proceeds`.
|
|
71
|
+
*
|
|
70
72
|
* Return a set of transfers for atomicRearrange() that distribute
|
|
71
73
|
* `unsoldCollateral` and `proceeds` proportionally to each seat's deposited
|
|
72
74
|
* amount. Any uneven split should be allocated to the reserve.
|
|
73
75
|
*
|
|
74
76
|
* @param {Amount} unsoldCollateral
|
|
75
77
|
* @param {Amount} proceeds
|
|
76
|
-
* @param {{seat: ZCFSeat
|
|
78
|
+
* @param {{ seat: ZCFSeat; amount: Amount<'nat'>; goal: Amount<'nat'> }[]} deposits
|
|
77
79
|
* @param {ZCFSeat} collateralSeat
|
|
78
|
-
* @param {ZCFSeat} bidHoldingSeat seat with the Bid allocation to be
|
|
80
|
+
* @param {ZCFSeat} bidHoldingSeat seat with the Bid allocation to be
|
|
81
|
+
* distributed
|
|
79
82
|
* @param {string} collateralKeyword The Reserve will hold multiple collaterals,
|
|
80
|
-
*
|
|
83
|
+
* so they need distinct keywords
|
|
81
84
|
* @param {ZCFSeat} reserveSeat
|
|
82
85
|
* @param {Brand} brand
|
|
83
86
|
*/
|
|
@@ -97,7 +100,7 @@ const distributeProportionalShares = (
|
|
|
97
100
|
|
|
98
101
|
const collShare = makeRatioFromAmounts(unsoldCollateral, totalCollDeposited);
|
|
99
102
|
const currShare = makeRatioFromAmounts(proceeds, totalCollDeposited);
|
|
100
|
-
/** @type {
|
|
103
|
+
/** @type {TransferPart[]} */
|
|
101
104
|
const transfers = [];
|
|
102
105
|
let proceedsLeft = proceeds;
|
|
103
106
|
let collateralLeft = unsoldCollateral;
|
|
@@ -132,6 +135,7 @@ const distributeProportionalShares = (
|
|
|
132
135
|
* The auction sold some amount of collateral, and raised a certain amount of
|
|
133
136
|
* Bid. The excess collateral was returned as `unsoldCollateral`. The Bid amount
|
|
134
137
|
* collected from the auction participants is `proceeds`.
|
|
138
|
+
*
|
|
135
139
|
* Return a set of transfers for atomicRearrange() that distribute
|
|
136
140
|
* `unsoldCollateral` and `proceeds` proportionally to each seat's deposited
|
|
137
141
|
* amount. Any uneven split should be allocated to the reserve.
|
|
@@ -140,32 +144,33 @@ const distributeProportionalShares = (
|
|
|
140
144
|
* outside the contract below.
|
|
141
145
|
*
|
|
142
146
|
* Some or all of the depositors may have specified a goal amount.
|
|
143
|
-
*
|
|
144
|
-
*
|
|
145
|
-
*
|
|
146
|
-
*
|
|
147
|
-
*
|
|
148
|
-
*
|
|
149
|
-
*
|
|
150
|
-
*
|
|
151
|
-
*
|
|
152
|
-
*
|
|
153
|
-
*
|
|
154
|
-
*
|
|
155
|
-
*
|
|
156
|
-
*
|
|
157
|
-
* Think of it this way: those who specified a limit want as much
|
|
158
|
-
* back as possible, consistent with raising a certain amount of
|
|
159
|
-
* who didn't specify a limit are trying to sell collateral, and
|
|
160
|
-
* have as much as possible converted to Bid.
|
|
147
|
+
*
|
|
148
|
+
* - A if none did, return collateral and Bid prorated to deposits.
|
|
149
|
+
* - B if proceeds < proceedsGoal everyone gets prorated amounts of both.
|
|
150
|
+
* - C if proceeds matches proceedsGoal, everyone gets the Bid they asked for,
|
|
151
|
+
* plus enough collateral to reach the same proportional payout. If any
|
|
152
|
+
* depositor's goal amount exceeded their share of the total, we'll fall back
|
|
153
|
+
* to the first approach.
|
|
154
|
+
* - D if proceeds > proceedsGoal && all depositors specified a limit, all
|
|
155
|
+
* depositors get their goal first, then we distribute the remainder
|
|
156
|
+
* (collateral and Bid) to get the same proportional payout.
|
|
157
|
+
* - E if proceeds > proceedsGoal && some depositors didn't specify a limit,
|
|
158
|
+
* depositors who did will get their goal first, then we distribute the
|
|
159
|
+
* remainder (collateral and Bid) to get the same proportional payout. If any
|
|
160
|
+
* depositor's goal amount exceeded their share of the total, we'll fall back
|
|
161
|
+
* as above. Think of it this way: those who specified a limit want as much
|
|
162
|
+
* collateral back as possible, consistent with raising a certain amount of
|
|
163
|
+
* Bid. Those who didn't specify a limit are trying to sell collateral, and
|
|
164
|
+
* would prefer to have as much as possible converted to Bid.
|
|
161
165
|
*
|
|
162
166
|
* @param {Amount<'nat'>} unsoldCollateral
|
|
163
167
|
* @param {Amount<'nat'>} proceeds
|
|
164
|
-
* @param {{seat: ZCFSeat
|
|
168
|
+
* @param {{ seat: ZCFSeat; amount: Amount<'nat'>; goal: Amount<'nat'> }[]} deposits
|
|
165
169
|
* @param {ZCFSeat} collateralSeat
|
|
166
|
-
* @param {ZCFSeat} bidHoldingSeat seat with the Bid allocation to be
|
|
170
|
+
* @param {ZCFSeat} bidHoldingSeat seat with the Bid allocation to be
|
|
171
|
+
* distributed
|
|
167
172
|
* @param {string} collateralKeyword The Reserve will hold multiple collaterals,
|
|
168
|
-
*
|
|
173
|
+
* so they need distinct keywords
|
|
169
174
|
* @param {ZCFSeat} reserveSeat
|
|
170
175
|
* @param {Brand} brand
|
|
171
176
|
*/
|
|
@@ -255,7 +260,7 @@ export const distributeProportionalSharesWithLimits = (
|
|
|
255
260
|
// collateral to reach their share. Then see what's left, and allocate it
|
|
256
261
|
// among the remaining depositors. Escape to distributeProportionalShares if
|
|
257
262
|
// anything doesn't work.
|
|
258
|
-
/** @type {
|
|
263
|
+
/** @type {TransferPart[]} */
|
|
259
264
|
const transfers = [];
|
|
260
265
|
let proceedsLeft = proceeds;
|
|
261
266
|
let collateralLeft = unsoldCollateral;
|
|
@@ -378,15 +383,17 @@ export const distributeProportionalSharesWithLimits = (
|
|
|
378
383
|
};
|
|
379
384
|
|
|
380
385
|
/**
|
|
381
|
-
* @param {ZCF<
|
|
382
|
-
*
|
|
383
|
-
*
|
|
384
|
-
*
|
|
385
|
-
*
|
|
386
|
+
* @param {ZCF<
|
|
387
|
+
* GovernanceTerms<typeof auctioneerParamTypes> & {
|
|
388
|
+
* timerService: import('@agoric/time').TimerService;
|
|
389
|
+
* reservePublicFacet: AssetReservePublicFacet;
|
|
390
|
+
* priceAuthority: PriceAuthority;
|
|
391
|
+
* }
|
|
392
|
+
* >} zcf
|
|
386
393
|
* @param {{
|
|
387
|
-
* initialPoserInvitation: Invitation
|
|
388
|
-
* storageNode: StorageNode
|
|
389
|
-
* marshaller: Marshaller
|
|
394
|
+
* initialPoserInvitation: Invitation;
|
|
395
|
+
* storageNode: StorageNode;
|
|
396
|
+
* marshaller: Marshaller;
|
|
390
397
|
* }} privateArgs
|
|
391
398
|
* @param {Baggage} baggage
|
|
392
399
|
*/
|
|
@@ -399,7 +406,12 @@ export const start = async (zcf, privateArgs, baggage) => {
|
|
|
399
406
|
|
|
400
407
|
/** @type {MapStore<Brand, import('./auctionBook.js').AuctionBook>} */
|
|
401
408
|
const books = provideDurableMapStore(baggage, 'auctionBooks');
|
|
402
|
-
/**
|
|
409
|
+
/**
|
|
410
|
+
* @type {MapStore<
|
|
411
|
+
* Brand,
|
|
412
|
+
* { seat: ZCFSeat; amount: Amount<'nat'>; goal: Amount<'nat'> }[]
|
|
413
|
+
* >}
|
|
414
|
+
*/
|
|
403
415
|
const deposits = provideDurableMapStore(baggage, 'deposits');
|
|
404
416
|
/** @type {MapStore<Brand, Keyword>} */
|
|
405
417
|
const brandToKeyword = provideDurableMapStore(baggage, 'brandToKeyword');
|
|
@@ -427,9 +439,11 @@ export const start = async (zcf, privateArgs, baggage) => {
|
|
|
427
439
|
});
|
|
428
440
|
const scheduleKit = makeERecorderKit(
|
|
429
441
|
E(privateArgs.storageNode).makeChildNode('schedule'),
|
|
430
|
-
/**
|
|
431
|
-
|
|
432
|
-
|
|
442
|
+
/**
|
|
443
|
+
* @type {import('@agoric/zoe/src/contractSupport/recorder.js').TypedMatcher<
|
|
444
|
+
* import('./scheduler.js').ScheduleNotification
|
|
445
|
+
* >}
|
|
446
|
+
*/ (M.any()),
|
|
433
447
|
);
|
|
434
448
|
|
|
435
449
|
/**
|
|
@@ -578,7 +592,7 @@ export const start = async (zcf, privateArgs, baggage) => {
|
|
|
578
592
|
|
|
579
593
|
/**
|
|
580
594
|
* @param {ZCFSeat} zcfSeat
|
|
581
|
-
* @param {{ goal: Amount<'nat'>}} offerArgs
|
|
595
|
+
* @param {{ goal: Amount<'nat'> }} offerArgs
|
|
582
596
|
*/
|
|
583
597
|
const depositOfferHandler = (zcfSeat, offerArgs) => {
|
|
584
598
|
const goalMatcher = M.or(undefined, { goal: bidAmountShape });
|
|
@@ -678,7 +692,7 @@ export const start = async (zcf, privateArgs, baggage) => {
|
|
|
678
692
|
const creatorFacet = makeFarGovernorFacet(
|
|
679
693
|
Far('Auctioneer creatorFacet', {
|
|
680
694
|
/**
|
|
681
|
-
* @param {Issuer} issuer
|
|
695
|
+
* @param {Issuer<'nat'>} issuer
|
|
682
696
|
* @param {Keyword} kwd
|
|
683
697
|
*/
|
|
684
698
|
async addBrand(issuer, kwd) {
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
export function prepareScaledBidBook(baggage: Baggage): (bidScalingPattern: globalThis.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: globalThis.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
|
+
//# sourceMappingURL=offerBook.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"offerBook.d.ts","sourceRoot":"","sources":["offerBook.js"],"names":[],"mappings":"AAkDO;IAgBD;;;;;OAKG;cAJQ,OAAO,cACP,KAAK,UACL,MAAM,CAAC,KAAK,CAAC,gBACb,OAAO;IAsBlB,gCAAgC;4BAApB,KAAK;;;;;GAqCpB;AAcI;IAgBD;;;;;OAKG;cAJQ,OAAO,SACP,KAAK,UACL,MAAM,CAAC,KAAK,CAAC,gBACb,OAAO;;;;;;GA0DrB;2BAnMU;IACZ,IAAQ,EAAE,OAAO,CAAC;IAClB,MAAU,EAAE,MAAM,CAAC,KAAK,CAAC,CAAC;IAC1B,MAAU,EAAE,QAAQ,CAAC;IACrB,QAAY,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;6BApBqB,kBAAkB"}
|
package/src/auction/offerBook.js
CHANGED
|
@@ -12,7 +12,7 @@ import {
|
|
|
12
12
|
toScaledRateOfferKey,
|
|
13
13
|
} from './sortedOffers.js';
|
|
14
14
|
|
|
15
|
-
/** @
|
|
15
|
+
/** @import {Baggage} from '@agoric/vat-data' */
|
|
16
16
|
|
|
17
17
|
// multiple offers might be provided at the same time (since the time
|
|
18
18
|
// granularity is limited to blocks), so we increment a sequenceNumber with each
|
|
@@ -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
|
*/
|
|
@@ -0,0 +1,149 @@
|
|
|
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/src/types.js").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: globalThis.ERef<PriceAuthority>, reservePublicFacet: globalThis.ERef<globalThis.GovernedPublicFacet<import("@endo/exo").Guarded<{
|
|
88
|
+
makeAddCollateralInvitation(): Promise<Invitation<string, never>>;
|
|
89
|
+
getPublicTopics(): {
|
|
90
|
+
metrics: import("@agoric/zoe/src/contractSupport/topics.js").PublicTopic<import("../reserve/assetReserveKit.js").MetricsNotification>;
|
|
91
|
+
};
|
|
92
|
+
}>>>, params: AuctionParams): {
|
|
93
|
+
priceAuthority: globalThis.ERef<PriceAuthority>;
|
|
94
|
+
reservePublicFacet: globalThis.ERef<globalThis.GovernedPublicFacet<import("@endo/exo").Guarded<{
|
|
95
|
+
makeAddCollateralInvitation(): Promise<Invitation<string, never>>;
|
|
96
|
+
getPublicTopics(): {
|
|
97
|
+
metrics: import("@agoric/zoe/src/contractSupport/topics.js").PublicTopic<import("../reserve/assetReserveKit.js").MetricsNotification>;
|
|
98
|
+
};
|
|
99
|
+
}>>>;
|
|
100
|
+
timerService: globalThis.ERef<import("@agoric/time").TimerService>;
|
|
101
|
+
governedParams: {
|
|
102
|
+
Electorate: {
|
|
103
|
+
type: "invitation";
|
|
104
|
+
value: import("@agoric/ertp/src/types.js").SetAmount<import("@endo/patterns").Key>;
|
|
105
|
+
};
|
|
106
|
+
StartFrequency: {
|
|
107
|
+
type: "relativeTime";
|
|
108
|
+
value: import("@agoric/time").RelativeTimeRecord;
|
|
109
|
+
};
|
|
110
|
+
ClockStep: {
|
|
111
|
+
type: "relativeTime";
|
|
112
|
+
value: import("@agoric/time").RelativeTimeRecord;
|
|
113
|
+
};
|
|
114
|
+
AuctionStartDelay: {
|
|
115
|
+
type: "relativeTime";
|
|
116
|
+
value: import("@agoric/time").RelativeTimeRecord;
|
|
117
|
+
};
|
|
118
|
+
PriceLockPeriod: {
|
|
119
|
+
type: "relativeTime";
|
|
120
|
+
value: import("@agoric/time").RelativeTimeRecord;
|
|
121
|
+
};
|
|
122
|
+
StartingRate: {
|
|
123
|
+
type: "nat";
|
|
124
|
+
value: bigint;
|
|
125
|
+
};
|
|
126
|
+
LowestRate: {
|
|
127
|
+
type: "nat";
|
|
128
|
+
value: bigint;
|
|
129
|
+
};
|
|
130
|
+
DiscountStep: {
|
|
131
|
+
type: "nat";
|
|
132
|
+
value: bigint;
|
|
133
|
+
};
|
|
134
|
+
};
|
|
135
|
+
};
|
|
136
|
+
export type AuctionParams = {
|
|
137
|
+
ElectorateInvitationAmount: Amount<"set">;
|
|
138
|
+
StartFrequency: RelativeTime;
|
|
139
|
+
ClockStep: RelativeTime;
|
|
140
|
+
StartingRate: bigint;
|
|
141
|
+
LowestRate: bigint;
|
|
142
|
+
DiscountStep: bigint;
|
|
143
|
+
AuctionStartDelay: RelativeTime;
|
|
144
|
+
PriceLockPeriod: RelativeTime;
|
|
145
|
+
TimerBrand: import("@agoric/time").TimerBrand;
|
|
146
|
+
};
|
|
147
|
+
export type AuctionParamManager = ReturnType<typeof makeAuctioneerParamManager>;
|
|
148
|
+
import type { PriceAuthority } from '@agoric/zoe/tools/types.js';
|
|
149
|
+
//# sourceMappingURL=params.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"params.d.ts","sourceRoot":"","sources":["params.js"],"names":[],"mappings":"AAQA;;;;GAIG;AAGH,+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,IAAI,CAAC,WAAW,CAAC,CAAC;IAAC,UAAU,EAAE,IAAI,CAAC,UAAU,CAAC,CAAA;CAAE,SAChE,IAAI,CAAC,OAAO,cAAc,EAAE,YAAY,CAAC;;;;;cAGzC,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAgBvB;;gCAxGa,MAAM,CAAC,KAAK,CAAC;;;kBAGb,MAAM;gBACN,MAAM;kBACN,MAAM;;;gBAGN,OAAO,cAAc,EAAE,UAAU;;kCAmGjC,UAAU,CAAC,OAAO,0BAA0B,CAAC;oCAnKkC,4BAA4B"}
|
package/src/auction/params.js
CHANGED
|
@@ -6,14 +6,17 @@ import {
|
|
|
6
6
|
import { TimeMath, RelativeTimeRecordShape } from '@agoric/time';
|
|
7
7
|
import { M } from '@agoric/store';
|
|
8
8
|
|
|
9
|
-
/**
|
|
10
|
-
|
|
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
|
+
*/
|
|
11
14
|
|
|
12
15
|
// TODO duplicated with zoe/src/TypeGuards.js
|
|
13
16
|
export const InvitationShape = M.remotable('Invitation');
|
|
14
17
|
|
|
15
18
|
/**
|
|
16
|
-
* In seconds, how often to start an auction.
|
|
19
|
+
* In seconds, how often to start an auction. The auction will start at
|
|
17
20
|
* AUCTION_START_DELAY seconds after a multiple of START_FREQUENCY, with the
|
|
18
21
|
* price at STARTING_RATE_BP. Every CLOCK_STEP, the price will be reduced by
|
|
19
22
|
* DISCOUNT_STEP_BP, as long as the rate is at or above LOWEST_RATE_BP, or until
|
|
@@ -70,12 +73,10 @@ export const auctioneerParamTypes = harden({
|
|
|
70
73
|
* @property {bigint} DiscountStep
|
|
71
74
|
* @property {RelativeTime} AuctionStartDelay
|
|
72
75
|
* @property {RelativeTime} PriceLockPeriod
|
|
73
|
-
* @property {import('@agoric/time
|
|
76
|
+
* @property {import('@agoric/time').TimerBrand} TimerBrand
|
|
74
77
|
*/
|
|
75
78
|
|
|
76
|
-
/**
|
|
77
|
-
* @param {AuctionParams} initial
|
|
78
|
-
*/
|
|
79
|
+
/** @param {AuctionParams} initial */
|
|
79
80
|
export const makeAuctioneerParams = ({
|
|
80
81
|
ElectorateInvitationAmount,
|
|
81
82
|
StartFrequency,
|
|
@@ -148,8 +149,8 @@ export const makeAuctioneerParamManager = (publisherKit, zcf, initial) => {
|
|
|
148
149
|
harden(makeAuctioneerParamManager);
|
|
149
150
|
|
|
150
151
|
/**
|
|
151
|
-
* @param {{storageNode: ERef<StorageNode
|
|
152
|
-
* @param {ERef<
|
|
152
|
+
* @param {{ storageNode: ERef<StorageNode>; marshaller: ERef<Marshaller> }} caps
|
|
153
|
+
* @param {ERef<import('@agoric/time').TimerService>} timer
|
|
153
154
|
* @param {ERef<PriceAuthority>} priceAuthority
|
|
154
155
|
* @param {ERef<AssetReservePublicFacet>} reservePublicFacet
|
|
155
156
|
* @param {AuctionParams} params
|
|
@@ -0,0 +1,5 @@
|
|
|
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
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"scheduleMath.d.ts","sourceRoot":"","sources":["scheduleMath.js"],"names":[],"mappings":"AA0CO,2CAJI,OAAO,CAAC,OAAO,aAAa,EAAE,mBAAmB,CAAC,8BAEhD,OAAO,gBAAgB,EAAE,QAAQ,CAqE7C;AAcM,qDALI,OAAO,gBAAgB,EAAE,QAAQ,GAAG,IAAI,gBACxC,OAAO,gBAAgB,EAAE,QAAQ,GAAG,IAAI,oCAyBlD;AAQM,0DAHI,OAAO,gBAAgB,EAAE,QAAQ,GAC/B,QAAQ,GAAG,QAAQ,GAAG,YAAY,GAAG,OAAO,CAiBxD;qCAjKkC,cAAc"}
|