@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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@agoric/inter-protocol",
|
|
3
|
-
"version": "0.16.2-dev-
|
|
3
|
+
"version": "0.16.2-dev-fb922d3.0+fb922d3",
|
|
4
4
|
"description": "Core cryptoeconomy contracts",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "src/index.js",
|
|
@@ -32,15 +32,15 @@
|
|
|
32
32
|
},
|
|
33
33
|
"homepage": "https://github.com/Agoric/agoric-sdk#readme",
|
|
34
34
|
"dependencies": {
|
|
35
|
-
"@agoric/assert": "0.6.1-dev-
|
|
36
|
-
"@agoric/ertp": "0.16.3-dev-
|
|
37
|
-
"@agoric/governance": "0.10.4-dev-
|
|
38
|
-
"@agoric/internal": "0.3.3-dev-
|
|
39
|
-
"@agoric/notifier": "0.6.3-dev-
|
|
40
|
-
"@agoric/store": "0.9.3-dev-
|
|
41
|
-
"@agoric/time": "0.3.3-dev-
|
|
42
|
-
"@agoric/vat-data": "0.5.3-dev-
|
|
43
|
-
"@agoric/zoe": "0.26.3-dev-
|
|
35
|
+
"@agoric/assert": "0.6.1-dev-fb922d3.0+fb922d3",
|
|
36
|
+
"@agoric/ertp": "0.16.3-dev-fb922d3.0+fb922d3",
|
|
37
|
+
"@agoric/governance": "0.10.4-dev-fb922d3.0+fb922d3",
|
|
38
|
+
"@agoric/internal": "0.3.3-dev-fb922d3.0+fb922d3",
|
|
39
|
+
"@agoric/notifier": "0.6.3-dev-fb922d3.0+fb922d3",
|
|
40
|
+
"@agoric/store": "0.9.3-dev-fb922d3.0+fb922d3",
|
|
41
|
+
"@agoric/time": "0.3.3-dev-fb922d3.0+fb922d3",
|
|
42
|
+
"@agoric/vat-data": "0.5.3-dev-fb922d3.0+fb922d3",
|
|
43
|
+
"@agoric/zoe": "0.26.3-dev-fb922d3.0+fb922d3",
|
|
44
44
|
"@endo/captp": "^3.1.2",
|
|
45
45
|
"@endo/eventual-send": "^0.17.3",
|
|
46
46
|
"@endo/far": "^0.2.19",
|
|
@@ -49,12 +49,12 @@
|
|
|
49
49
|
"jessie.js": "^0.3.2"
|
|
50
50
|
},
|
|
51
51
|
"devDependencies": {
|
|
52
|
-
"@agoric/deploy-script-support": "0.10.4-dev-
|
|
53
|
-
"@agoric/smart-wallet": "0.5.4-dev-
|
|
54
|
-
"@agoric/swingset-liveslots": "0.10.3-dev-
|
|
55
|
-
"@agoric/swingset-vat": "0.32.3-dev-
|
|
56
|
-
"@agoric/vats": "0.15.2-dev-
|
|
57
|
-
"@agoric/zone": "0.2.3-dev-
|
|
52
|
+
"@agoric/deploy-script-support": "0.10.4-dev-fb922d3.0+fb922d3",
|
|
53
|
+
"@agoric/smart-wallet": "0.5.4-dev-fb922d3.0+fb922d3",
|
|
54
|
+
"@agoric/swingset-liveslots": "0.10.3-dev-fb922d3.0+fb922d3",
|
|
55
|
+
"@agoric/swingset-vat": "0.32.3-dev-fb922d3.0+fb922d3",
|
|
56
|
+
"@agoric/vats": "0.15.2-dev-fb922d3.0+fb922d3",
|
|
57
|
+
"@agoric/zone": "0.2.3-dev-fb922d3.0+fb922d3",
|
|
58
58
|
"@endo/bundle-source": "^2.5.2",
|
|
59
59
|
"@endo/init": "^0.5.57",
|
|
60
60
|
"@endo/promise-kit": "^0.2.57",
|
|
@@ -81,5 +81,5 @@
|
|
|
81
81
|
"publishConfig": {
|
|
82
82
|
"access": "public"
|
|
83
83
|
},
|
|
84
|
-
"gitHead": "
|
|
84
|
+
"gitHead": "fb922d3aeddd390919a015a76d5f4e035e6f0240"
|
|
85
85
|
}
|
|
@@ -43,14 +43,24 @@ export default async (homeP, endowments) => {
|
|
|
43
43
|
});
|
|
44
44
|
|
|
45
45
|
console.log('getting installCache...');
|
|
46
|
-
/**
|
|
46
|
+
/**
|
|
47
|
+
* @type {CopyMap<
|
|
48
|
+
* string,
|
|
49
|
+
* { installation: Installation; boardId: string; path?: string }
|
|
50
|
+
* >}
|
|
51
|
+
*/
|
|
47
52
|
const initial = await provideWhen(scratch, 'installCache', () =>
|
|
48
53
|
makeCopyMap([]),
|
|
49
54
|
);
|
|
50
55
|
console.log('initially:', initial.payload.keys.length, 'entries');
|
|
51
56
|
|
|
52
57
|
// ISSUE: getCopyMapEntries of CopyMap<K, V> loses K, V.
|
|
53
|
-
/**
|
|
58
|
+
/**
|
|
59
|
+
* @type {Map<
|
|
60
|
+
* string,
|
|
61
|
+
* { installation: Installation; boardId: string; path?: string }
|
|
62
|
+
* >}
|
|
63
|
+
*/
|
|
54
64
|
const working = new Map(getCopyMapEntries(initial));
|
|
55
65
|
|
|
56
66
|
let added = 0;
|
package/scripts/init-core.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
/* global process */
|
|
2
2
|
/**
|
|
3
|
-
* @file can be run with `agoric deploy` after a chain is running (depends on
|
|
4
|
-
* Only works with "local" chain and not sim-chain b/c it needs
|
|
3
|
+
* @file can be run with `agoric deploy` after a chain is running (depends on
|
|
4
|
+
* chain state) Only works with "local" chain and not sim-chain b/c it needs
|
|
5
|
+
* governance votes (n/a on sim-chain).
|
|
5
6
|
*/
|
|
6
7
|
import { makeHelpers } from '@agoric/deploy-script-support';
|
|
7
8
|
import { objectMap } from '@agoric/internal';
|
|
@@ -53,9 +54,8 @@ const installKeyGroups = {
|
|
|
53
54
|
* @param {(i: I) => R} opts.publishRef
|
|
54
55
|
* @param {(m: string, b: string, opts?: any) => I} opts.install
|
|
55
56
|
* @param {<T>(f: T) => T} [opts.wrapInstall]
|
|
56
|
-
*
|
|
57
57
|
* @param {object} [options]
|
|
58
|
-
* @param {{ committeeName?: string
|
|
58
|
+
* @param {{ committeeName?: string; committeeSize?: number }} [options.econCommitteeOptions]
|
|
59
59
|
*/
|
|
60
60
|
export const committeeProposalBuilder = async (
|
|
61
61
|
{ publishRef, install: install0, wrapInstall },
|
|
@@ -85,7 +85,6 @@ export const committeeProposalBuilder = async (
|
|
|
85
85
|
/**
|
|
86
86
|
* @template I
|
|
87
87
|
* @template R
|
|
88
|
-
*
|
|
89
88
|
* @param {object} opts
|
|
90
89
|
* @param {(i: I) => R} opts.publishRef
|
|
91
90
|
* @param {(m: string, b: string, opts?: any) => I} opts.install
|
|
@@ -127,7 +126,7 @@ export const defaultProposalBuilder = async (
|
|
|
127
126
|
options = {},
|
|
128
127
|
{ env = process.env } = {},
|
|
129
128
|
) => {
|
|
130
|
-
/** @param {string|undefined} s */
|
|
129
|
+
/** @param {string | undefined} s */
|
|
131
130
|
const optBigInt = s => s && BigInt(s);
|
|
132
131
|
const {
|
|
133
132
|
vaultFactoryControllerAddress = env.VAULT_FACTORY_CONTROLLER_ADDR,
|
|
@@ -8,24 +8,29 @@ import process from 'process';
|
|
|
8
8
|
* After extracting the oracleAdmins to entries in home.scratch, you can use one
|
|
9
9
|
* from the REPL like:
|
|
10
10
|
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
*
|
|
22
|
-
*
|
|
11
|
+
* lookup('agoricNames', 'oracleBrand', 'ATOM').then(brand => atom = brand)
|
|
12
|
+
* -> [Object Alleged: ATOM brand]{}
|
|
13
|
+
* lookup('agoricNames', 'oracleBrand', 'USD').then(brand => usd = brand)
|
|
14
|
+
* -> [Object Alleged: USD brand]{}
|
|
15
|
+
* pa = home.priceAuthority
|
|
16
|
+
* -> [Object Alleged: PriceAuthority]{}
|
|
17
|
+
* qn = E(pa).makeQuoteNotifier({ value: 1n * 10n ** 6n, brand: atom }, usd)
|
|
18
|
+
* -> [Object Alleged: QuoteNotifier]{}
|
|
19
|
+
* oa = E(home.scratch).get("offerResult unknown#1652669688625")
|
|
20
|
+
* -> [Object Alleged: OracleAdmin]{}
|
|
21
|
+
* E(oa).pushResult('19.37')
|
|
22
|
+
* E(qn).getUpdateSince()
|
|
23
23
|
*
|
|
24
|
-
* @typedef {{
|
|
24
|
+
* @typedef {{
|
|
25
|
+
* board: import('@agoric/vats').Board;
|
|
26
|
+
* chainTimerService;
|
|
27
|
+
* scratch;
|
|
28
|
+
* zoe;
|
|
29
|
+
* }} Home
|
|
25
30
|
* @param {Promise<Home>} homePromise
|
|
26
31
|
* @param {object} root0
|
|
27
|
-
* @param {(...path: string[]) => Promise<any>} root0.lookup
|
|
28
|
-
*
|
|
32
|
+
* @param {(...path: string[]) => Promise<any>} root0.lookup A promise for the
|
|
33
|
+
* references available from REPL home
|
|
29
34
|
*/
|
|
30
35
|
export default async function priceAuthorityFromNotifier(
|
|
31
36
|
homePromise,
|
|
@@ -4,10 +4,10 @@ export function prepareAuctionBook(baggage: MapStore<string, unknown>, zcf: ZCF,
|
|
|
4
4
|
* @param {Amount<'nat'>} assetAmount
|
|
5
5
|
* @param {ZCFSeat} sourceSeat
|
|
6
6
|
* @param {Amount<'nat'>} [proceedsGoal] an amount that the depositor
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
7
|
+
* would like to raise. The auction is requested to not sell more
|
|
8
|
+
* collateral than required to raise that much. The auctioneer might
|
|
9
|
+
* sell more if there is more than one supplier of collateral, and
|
|
10
|
+
* they request inconsistent limits.
|
|
11
11
|
*/
|
|
12
12
|
addAssets(assetAmount: Amount<'nat'>, sourceSeat: ZCFSeat, proceedsGoal?: Amount<"nat"> | undefined): void;
|
|
13
13
|
/** @type {(reduction: Ratio) => void} */
|
|
@@ -49,30 +49,33 @@ export type BookDataNotification = {
|
|
|
49
49
|
*/
|
|
50
50
|
startPrice: Ratio | null;
|
|
51
51
|
/**
|
|
52
|
-
* the price at the current auction
|
|
52
|
+
* the price at the current auction
|
|
53
|
+
* tier
|
|
53
54
|
*/
|
|
54
55
|
currentPriceLevel: Ratio | null;
|
|
55
56
|
/**
|
|
56
|
-
* The proceeds the sellers
|
|
57
|
+
* The proceeds the sellers
|
|
58
|
+
* were targeting to raise
|
|
57
59
|
*/
|
|
58
60
|
startProceedsGoal: Amount<'nat'> | null;
|
|
59
61
|
/**
|
|
60
|
-
* The remainder of
|
|
61
|
-
*
|
|
62
|
+
* The remainder of the
|
|
63
|
+
* proceeds the sellers were targeting to raise
|
|
62
64
|
*/
|
|
63
65
|
remainingProceedsGoal: Amount<'nat'> | null;
|
|
64
66
|
/**
|
|
65
|
-
* The proceeds raised so
|
|
67
|
+
* The proceeds raised so
|
|
68
|
+
* far in the auction
|
|
66
69
|
*/
|
|
67
70
|
proceedsRaised: Amount<'nat'> | undefined;
|
|
68
71
|
/**
|
|
69
|
-
* How much collateral was
|
|
70
|
-
*
|
|
71
|
-
* added in.)
|
|
72
|
+
* How much collateral was available
|
|
73
|
+
* for sale at the start. (If more is deposited later, it'll be added in.)
|
|
72
74
|
*/
|
|
73
75
|
startCollateral: Amount<'nat'>;
|
|
74
76
|
/**
|
|
75
|
-
* The amount of collateral
|
|
77
|
+
* The amount of collateral
|
|
78
|
+
* remaining
|
|
76
79
|
*/
|
|
77
80
|
collateralAvailable: Amount<'nat'> | null;
|
|
78
81
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"auctionBook.d.ts","sourceRoot":"","sources":["auctionBook.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"auctionBook.d.ts","sourceRoot":"","sources":["auctionBook.js"],"names":[],"mappings":"AAyEO,6CAHI,MAAM,KAAK,CAAC,mBACZ,MAAM,KAAK,CAAC,oCAiBtB;AA0BM,4EAHI,GAAG,mBACH,OAAO,6CAA6C,EAAE,eAAe;IAwWxE;;;;;;;;OAQG;2BAPQ,OAAO,KAAK,CAAC,cACb,OAAO;IA6ElB,yCAAyC;+BAAlB,KAAK,GAAK,IAAI;;;;;IAmGrC;;;;OAIG;wBAHQ,SAAS,QACT,OAAO,aACP,OAAO;;;;;;;;;;;EAsHzB;wBA3sBY;IACZ,MAAU,EAAE,OAAO,KAAK,CAAC,CAAC;CACvB,GAAG;IACN,YAAgB,CAAC,EAAE,OAAO,CAAC;CACxB,GAAG,CACE;IACR,UAAoB,EAAE,KAAK,CAAC;CACnB,GACD;IACR,eAAyB,EAAE,KAAK,CAAC;CACxB,CACJ;sBAuBQ,OAAO,kBAAkB,EAAE,OAAO;;;;;gBAIlC,KAAK,GAAG,IAAI;;;;;uBACZ,KAAK,GAAG,IAAI;;;;;uBAEZ,OAAO,KAAK,CAAC,GAAG,IAAI;;;;;2BAEpB,OAAO,KAAK,CAAC,GAAG,IAAI;;;;;oBAEpB,OAAO,KAAK,CAAC,GAAG,SAAS;;;;;qBAEzB,OAAO,KAAK,CAAC;;;;;yBAEb,OAAO,KAAK,CAAC,GAAG,IAAI;;0BA6pBpB,WAAW,WAAW,yBAAyB,CAAC,CAAC"}
|
|
@@ -34,34 +34,38 @@ const DEFAULT_DECIMALS = 9;
|
|
|
34
34
|
|
|
35
35
|
/**
|
|
36
36
|
* @file The book represents the collateral-specific state of an ongoing
|
|
37
|
-
*
|
|
38
|
-
* the allocation of assets for sale.
|
|
37
|
+
* auction. It holds the book, the capturedPrice, and the collateralSeat that
|
|
38
|
+
* has the allocation of assets for sale.
|
|
39
|
+
*
|
|
40
|
+
* The book contains orders for the collateral. It holds two kinds of orders:
|
|
39
41
|
*
|
|
40
|
-
* The book contains orders for the collateral. It holds two kinds of
|
|
41
|
-
* orders:
|
|
42
42
|
* - Prices express the bidding offer in terms of a Bid amount
|
|
43
|
-
* - ScaledBids express the offer in terms of a discount (or markup) from the
|
|
44
|
-
*
|
|
43
|
+
* - ScaledBids express the offer in terms of a discount (or markup) from the most
|
|
44
|
+
* recent oracle price.
|
|
45
45
|
*
|
|
46
|
-
*
|
|
47
|
-
*
|
|
48
|
-
*
|
|
49
|
-
*
|
|
50
|
-
*
|
|
46
|
+
* Offers can be added in three ways. 1) When the auction is not active, prices
|
|
47
|
+
* are automatically added to the appropriate collection. When the auction is
|
|
48
|
+
* active, 2) if a new offer is at or above the current price, it will be
|
|
49
|
+
* settled immediately; 2) If the offer is below the current price, it will be
|
|
50
|
+
* added in the appropriate place and settled when the price reaches that
|
|
51
|
+
* level.
|
|
51
52
|
*/
|
|
52
53
|
|
|
53
54
|
const trace = makeTracer('AucBook', true);
|
|
54
55
|
|
|
55
56
|
/**
|
|
56
57
|
* @typedef {{
|
|
57
|
-
* maxBuy: Amount<'nat'
|
|
58
|
+
* maxBuy: Amount<'nat'>;
|
|
58
59
|
* } & {
|
|
59
|
-
* exitAfterBuy?: boolean
|
|
60
|
-
* } & (
|
|
61
|
-
*
|
|
62
|
-
*
|
|
63
|
-
*
|
|
64
|
-
*
|
|
60
|
+
* exitAfterBuy?: boolean;
|
|
61
|
+
* } & (
|
|
62
|
+
* | {
|
|
63
|
+
* offerPrice: Ratio;
|
|
64
|
+
* }
|
|
65
|
+
* | {
|
|
66
|
+
* offerBidScaling: Ratio;
|
|
67
|
+
* }
|
|
68
|
+
* )} OfferSpec
|
|
65
69
|
*/
|
|
66
70
|
/**
|
|
67
71
|
* @param {Brand<'nat'>} bidBrand
|
|
@@ -88,17 +92,19 @@ export const makeOfferSpecShape = (bidBrand, collateralBrand) => {
|
|
|
88
92
|
|
|
89
93
|
/**
|
|
90
94
|
* @typedef {object} BookDataNotification
|
|
91
|
-
*
|
|
92
|
-
* @property {Ratio
|
|
93
|
-
*
|
|
94
|
-
* @property {Amount<'nat'> | null}
|
|
95
|
-
*
|
|
96
|
-
*
|
|
97
|
-
*
|
|
98
|
-
* @property {Amount<'nat'>}
|
|
99
|
-
*
|
|
100
|
-
*
|
|
101
|
-
*
|
|
95
|
+
* @property {Ratio | null} startPrice identifies the priceAuthority and price
|
|
96
|
+
* @property {Ratio | null} currentPriceLevel the price at the current auction
|
|
97
|
+
* tier
|
|
98
|
+
* @property {Amount<'nat'> | null} startProceedsGoal The proceeds the sellers
|
|
99
|
+
* were targeting to raise
|
|
100
|
+
* @property {Amount<'nat'> | null} remainingProceedsGoal The remainder of the
|
|
101
|
+
* proceeds the sellers were targeting to raise
|
|
102
|
+
* @property {Amount<'nat'> | undefined} proceedsRaised The proceeds raised so
|
|
103
|
+
* far in the auction
|
|
104
|
+
* @property {Amount<'nat'>} startCollateral How much collateral was available
|
|
105
|
+
* for sale at the start. (If more is deposited later, it'll be added in.)
|
|
106
|
+
* @property {Amount<'nat'> | null} collateralAvailable The amount of collateral
|
|
107
|
+
* remaining
|
|
102
108
|
*/
|
|
103
109
|
|
|
104
110
|
/**
|
|
@@ -231,8 +237,8 @@ export const prepareAuctionBook = (baggage, zcf, makeRecorderKit) => {
|
|
|
231
237
|
{
|
|
232
238
|
helper: {
|
|
233
239
|
/**
|
|
234
|
-
* remove the key from the appropriate book, indicated by whether the
|
|
235
|
-
* is defined.
|
|
240
|
+
* remove the key from the appropriate book, indicated by whether the
|
|
241
|
+
* price is defined.
|
|
236
242
|
*
|
|
237
243
|
* @param {string} key
|
|
238
244
|
* @param {Ratio | undefined} price
|
|
@@ -247,8 +253,8 @@ export const prepareAuctionBook = (baggage, zcf, makeRecorderKit) => {
|
|
|
247
253
|
},
|
|
248
254
|
|
|
249
255
|
/**
|
|
250
|
-
* Update the entry in the appropriate book, indicated by whether the
|
|
251
|
-
* is defined.
|
|
256
|
+
* Update the entry in the appropriate book, indicated by whether the
|
|
257
|
+
* price is defined.
|
|
252
258
|
*
|
|
253
259
|
* @param {string} key
|
|
254
260
|
* @param {Amount} collateralSold
|
|
@@ -264,7 +270,8 @@ export const prepareAuctionBook = (baggage, zcf, makeRecorderKit) => {
|
|
|
264
270
|
},
|
|
265
271
|
|
|
266
272
|
/**
|
|
267
|
-
* Settle with seat. The caller is responsible for updating the book, if
|
|
273
|
+
* Settle with seat. The caller is responsible for updating the book, if
|
|
274
|
+
* any.
|
|
268
275
|
*
|
|
269
276
|
* @param {ZCFSeat} seat
|
|
270
277
|
* @param {Amount<'nat'>} collateralWanted
|
|
@@ -341,15 +348,16 @@ export const prepareAuctionBook = (baggage, zcf, makeRecorderKit) => {
|
|
|
341
348
|
},
|
|
342
349
|
|
|
343
350
|
/**
|
|
344
|
-
*
|
|
345
|
-
*
|
|
351
|
+
* Accept an offer expressed as a price. If the auction is active,
|
|
352
|
+
* attempt to buy collateral. If any of the offer remains add it to the
|
|
353
|
+
* book.
|
|
346
354
|
*
|
|
347
|
-
*
|
|
348
|
-
*
|
|
349
|
-
*
|
|
350
|
-
*
|
|
351
|
-
*
|
|
352
|
-
*
|
|
355
|
+
* @param {ZCFSeat} seat
|
|
356
|
+
* @param {Ratio} price
|
|
357
|
+
* @param {Amount<'nat'>} maxBuy
|
|
358
|
+
* @param {object} opts
|
|
359
|
+
* @param {boolean} opts.trySettle
|
|
360
|
+
* @param {boolean} [opts.exitAfterBuy]
|
|
353
361
|
*/
|
|
354
362
|
acceptPriceOffer(
|
|
355
363
|
seat,
|
|
@@ -388,16 +396,16 @@ export const prepareAuctionBook = (baggage, zcf, makeRecorderKit) => {
|
|
|
388
396
|
},
|
|
389
397
|
|
|
390
398
|
/**
|
|
391
|
-
*
|
|
392
|
-
*
|
|
393
|
-
*
|
|
399
|
+
* Accept an offer expressed as a discount (or markup). If the auction
|
|
400
|
+
* is active, attempt to buy collateral. If any of the offer remains add
|
|
401
|
+
* it to the book.
|
|
394
402
|
*
|
|
395
|
-
*
|
|
396
|
-
*
|
|
397
|
-
*
|
|
398
|
-
*
|
|
399
|
-
*
|
|
400
|
-
*
|
|
403
|
+
* @param {ZCFSeat} seat
|
|
404
|
+
* @param {Ratio} bidScaling
|
|
405
|
+
* @param {Amount<'nat'>} maxBuy
|
|
406
|
+
* @param {object} opts
|
|
407
|
+
* @param {boolean} opts.trySettle
|
|
408
|
+
* @param {boolean} [opts.exitAfterBuy]
|
|
401
409
|
*/
|
|
402
410
|
acceptScaledBidOffer(
|
|
403
411
|
seat,
|
|
@@ -466,10 +474,10 @@ export const prepareAuctionBook = (baggage, zcf, makeRecorderKit) => {
|
|
|
466
474
|
* @param {Amount<'nat'>} assetAmount
|
|
467
475
|
* @param {ZCFSeat} sourceSeat
|
|
468
476
|
* @param {Amount<'nat'>} [proceedsGoal] an amount that the depositor
|
|
469
|
-
*
|
|
470
|
-
*
|
|
471
|
-
*
|
|
472
|
-
*
|
|
477
|
+
* would like to raise. The auction is requested to not sell more
|
|
478
|
+
* collateral than required to raise that much. The auctioneer might
|
|
479
|
+
* sell more if there is more than one supplier of collateral, and
|
|
480
|
+
* they request inconsistent limits.
|
|
473
481
|
*/
|
|
474
482
|
addAssets(assetAmount, sourceSeat, proceedsGoal) {
|
|
475
483
|
const { state, facets } = this;
|
|
@@ -754,7 +762,11 @@ export const prepareAuctionBook = (baggage, zcf, makeRecorderKit) => {
|
|
|
754
762
|
},
|
|
755
763
|
);
|
|
756
764
|
|
|
757
|
-
/**
|
|
765
|
+
/**
|
|
766
|
+
* @type {(
|
|
767
|
+
* ...args: Parameters<typeof makeAuctionBookKit>
|
|
768
|
+
* ) => ReturnType<typeof makeAuctionBookKit>['self']}
|
|
769
|
+
*/
|
|
758
770
|
const makeAuctionBook = (...args) => makeAuctionBookKit(...args).self;
|
|
759
771
|
return makeAuctionBook;
|
|
760
772
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"auctioneer.d.ts","sourceRoot":"","sources":["auctioneer.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"auctioneer.d.ts","sourceRoot":"","sources":["auctioneer.js"],"names":[],"mappings":"AA8KO,yEAXI,OAAO,KAAK,CAAC,YACb,OAAO,KAAK,CAAC,YACb;IAAE,IAAI,EAAE,OAAO,CAAC;IAAC,MAAM,EAAE,OAAO,KAAK,CAAC,CAAC;IAAC,IAAI,EAAE,OAAO,KAAK,CAAC,CAAA;CAAE,EAAE,kBAC/D,OAAO,kBACP,OAAO,qBAEP,MAAM,eAEN,OAAO,SACP,KAAK,8EAgNf;AAiBM;;;;;;;;;;kBAZc,OAAO,wBAAwB,EAAE,YAAY;wBACvC,uBAAuB;oBAC3B,cAAc;iBAG1B;IACV,sBAA0B,EAAE,UAAU,CAAC;IACvC,WAAe,EAAE,WAAW,CAAC;IAC7B,UAAc,EAAE,UAAU,CAAC;CACxB;;;;;;;;;;QA0OE,4CAA4C;2CAAhC,MAAM,KAAK,CAAC;;;;;;;;;;;;;;;QA+DxB;;;WAGG;yBAFQ,MAAM,OACN,OAAO;QAwBlB,gEAAgE;uBAAlD,QAAQ,OAAO,gBAAgB,EAAE,YAAY,CAAC;;QA1B5D;;;WAGG;yBAFQ,MAAM,OACN,OAAO;QAwBlB,gEAAgE;uBAAlD,QAAQ,OAAO,gBAAgB,EAAE,YAAY,CAAC;;GAQjE;AAED,6DAA6D;AAC7D,yEAAyE;AACzE,2EAA2E;AAE3E,8DAAkE;sBAtrBpD,OAAO,kBAAkB,EAAE,OAAO;iCAkrBlC,WAAW,YAAY,CAAC;oCACxB,kBAAkB,CAAC,aAAa,CAAC;qCACjC,kBAAkB,CAAC,cAAc,CAAC;qCAxrBX,aAAa"}
|
|
@@ -43,11 +43,10 @@ const { add, multiply } = natSafeMath;
|
|
|
43
43
|
const trace = makeTracer('Auction', true);
|
|
44
44
|
|
|
45
45
|
/**
|
|
46
|
-
* @file
|
|
47
|
-
*
|
|
48
|
-
*
|
|
49
|
-
*
|
|
50
|
-
* all those cases.
|
|
46
|
+
* @file In this file, 'Bid' is the name of the ERTP issuer used to purchase
|
|
47
|
+
* collateral from various issuers. It's too confusing to also use Bid as a
|
|
48
|
+
* verb or a description of amounts offered, so we've tried to find
|
|
49
|
+
* alternatives in all those cases.
|
|
51
50
|
*/
|
|
52
51
|
|
|
53
52
|
const MINIMUM_BID_GIVE = 1n;
|
|
@@ -67,17 +66,19 @@ const makeBPRatio = (rate, bidBrand, collateralBrand = bidBrand) =>
|
|
|
67
66
|
* The auction sold some amount of collateral, and raised a certain amount of
|
|
68
67
|
* Bid. The excess collateral was returned as `unsoldCollateral`. The Bid amount
|
|
69
68
|
* collected from the auction participants is `proceeds`.
|
|
69
|
+
*
|
|
70
70
|
* Return a set of transfers for atomicRearrange() that distribute
|
|
71
71
|
* `unsoldCollateral` and `proceeds` proportionally to each seat's deposited
|
|
72
72
|
* amount. Any uneven split should be allocated to the reserve.
|
|
73
73
|
*
|
|
74
74
|
* @param {Amount} unsoldCollateral
|
|
75
75
|
* @param {Amount} proceeds
|
|
76
|
-
* @param {{seat: ZCFSeat
|
|
76
|
+
* @param {{ seat: ZCFSeat; amount: Amount<'nat'>; goal: Amount<'nat'> }[]} deposits
|
|
77
77
|
* @param {ZCFSeat} collateralSeat
|
|
78
|
-
* @param {ZCFSeat} bidHoldingSeat seat with the Bid allocation to be
|
|
78
|
+
* @param {ZCFSeat} bidHoldingSeat seat with the Bid allocation to be
|
|
79
|
+
* distributed
|
|
79
80
|
* @param {string} collateralKeyword The Reserve will hold multiple collaterals,
|
|
80
|
-
*
|
|
81
|
+
* so they need distinct keywords
|
|
81
82
|
* @param {ZCFSeat} reserveSeat
|
|
82
83
|
* @param {Brand} brand
|
|
83
84
|
*/
|
|
@@ -132,6 +133,7 @@ const distributeProportionalShares = (
|
|
|
132
133
|
* The auction sold some amount of collateral, and raised a certain amount of
|
|
133
134
|
* Bid. The excess collateral was returned as `unsoldCollateral`. The Bid amount
|
|
134
135
|
* collected from the auction participants is `proceeds`.
|
|
136
|
+
*
|
|
135
137
|
* Return a set of transfers for atomicRearrange() that distribute
|
|
136
138
|
* `unsoldCollateral` and `proceeds` proportionally to each seat's deposited
|
|
137
139
|
* amount. Any uneven split should be allocated to the reserve.
|
|
@@ -140,32 +142,33 @@ const distributeProportionalShares = (
|
|
|
140
142
|
* outside the contract below.
|
|
141
143
|
*
|
|
142
144
|
* 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.
|
|
145
|
+
*
|
|
146
|
+
* - A if none did, return collateral and Bid prorated to deposits.
|
|
147
|
+
* - B if proceeds < proceedsGoal everyone gets prorated amounts of both.
|
|
148
|
+
* - C if proceeds matches proceedsGoal, everyone gets the Bid they asked for,
|
|
149
|
+
* plus enough collateral to reach the same proportional payout. If any
|
|
150
|
+
* depositor's goal amount exceeded their share of the total, we'll fall back
|
|
151
|
+
* to the first approach.
|
|
152
|
+
* - D if proceeds > proceedsGoal && all depositors specified a limit, all
|
|
153
|
+
* depositors get their goal first, then we distribute the remainder
|
|
154
|
+
* (collateral and Bid) to get the same proportional payout.
|
|
155
|
+
* - E if proceeds > proceedsGoal && some depositors didn't specify a limit,
|
|
156
|
+
* depositors who did will get their goal first, then we distribute the
|
|
157
|
+
* remainder (collateral and Bid) to get the same proportional payout. If any
|
|
158
|
+
* depositor's goal amount exceeded their share of the total, we'll fall back
|
|
159
|
+
* as above. Think of it this way: those who specified a limit want as much
|
|
160
|
+
* collateral back as possible, consistent with raising a certain amount of
|
|
161
|
+
* Bid. Those who didn't specify a limit are trying to sell collateral, and
|
|
162
|
+
* would prefer to have as much as possible converted to Bid.
|
|
161
163
|
*
|
|
162
164
|
* @param {Amount<'nat'>} unsoldCollateral
|
|
163
165
|
* @param {Amount<'nat'>} proceeds
|
|
164
|
-
* @param {{seat: ZCFSeat
|
|
166
|
+
* @param {{ seat: ZCFSeat; amount: Amount<'nat'>; goal: Amount<'nat'> }[]} deposits
|
|
165
167
|
* @param {ZCFSeat} collateralSeat
|
|
166
|
-
* @param {ZCFSeat} bidHoldingSeat seat with the Bid allocation to be
|
|
168
|
+
* @param {ZCFSeat} bidHoldingSeat seat with the Bid allocation to be
|
|
169
|
+
* distributed
|
|
167
170
|
* @param {string} collateralKeyword The Reserve will hold multiple collaterals,
|
|
168
|
-
*
|
|
171
|
+
* so they need distinct keywords
|
|
169
172
|
* @param {ZCFSeat} reserveSeat
|
|
170
173
|
* @param {Brand} brand
|
|
171
174
|
*/
|
|
@@ -378,15 +381,17 @@ export const distributeProportionalSharesWithLimits = (
|
|
|
378
381
|
};
|
|
379
382
|
|
|
380
383
|
/**
|
|
381
|
-
* @param {ZCF<
|
|
382
|
-
*
|
|
383
|
-
*
|
|
384
|
-
*
|
|
385
|
-
*
|
|
384
|
+
* @param {ZCF<
|
|
385
|
+
* GovernanceTerms<typeof auctioneerParamTypes> & {
|
|
386
|
+
* timerService: import('@agoric/time/src/types').TimerService;
|
|
387
|
+
* reservePublicFacet: AssetReservePublicFacet;
|
|
388
|
+
* priceAuthority: PriceAuthority;
|
|
389
|
+
* }
|
|
390
|
+
* >} zcf
|
|
386
391
|
* @param {{
|
|
387
|
-
* initialPoserInvitation: Invitation
|
|
388
|
-
* storageNode: StorageNode
|
|
389
|
-
* marshaller: Marshaller
|
|
392
|
+
* initialPoserInvitation: Invitation;
|
|
393
|
+
* storageNode: StorageNode;
|
|
394
|
+
* marshaller: Marshaller;
|
|
390
395
|
* }} privateArgs
|
|
391
396
|
* @param {Baggage} baggage
|
|
392
397
|
*/
|
|
@@ -399,7 +404,12 @@ export const start = async (zcf, privateArgs, baggage) => {
|
|
|
399
404
|
|
|
400
405
|
/** @type {MapStore<Brand, import('./auctionBook.js').AuctionBook>} */
|
|
401
406
|
const books = provideDurableMapStore(baggage, 'auctionBooks');
|
|
402
|
-
/**
|
|
407
|
+
/**
|
|
408
|
+
* @type {MapStore<
|
|
409
|
+
* Brand,
|
|
410
|
+
* { seat: ZCFSeat; amount: Amount<'nat'>; goal: Amount<'nat'> }[]
|
|
411
|
+
* >}
|
|
412
|
+
*/
|
|
403
413
|
const deposits = provideDurableMapStore(baggage, 'deposits');
|
|
404
414
|
/** @type {MapStore<Brand, Keyword>} */
|
|
405
415
|
const brandToKeyword = provideDurableMapStore(baggage, 'brandToKeyword');
|
|
@@ -427,9 +437,11 @@ export const start = async (zcf, privateArgs, baggage) => {
|
|
|
427
437
|
});
|
|
428
438
|
const scheduleKit = makeERecorderKit(
|
|
429
439
|
E(privateArgs.storageNode).makeChildNode('schedule'),
|
|
430
|
-
/**
|
|
431
|
-
|
|
432
|
-
|
|
440
|
+
/**
|
|
441
|
+
* @type {import('@agoric/zoe/src/contractSupport/recorder.js').TypedMatcher<
|
|
442
|
+
* import('./scheduler.js').ScheduleNotification
|
|
443
|
+
* >}
|
|
444
|
+
*/ (M.any()),
|
|
433
445
|
);
|
|
434
446
|
|
|
435
447
|
/**
|
|
@@ -578,7 +590,7 @@ export const start = async (zcf, privateArgs, baggage) => {
|
|
|
578
590
|
|
|
579
591
|
/**
|
|
580
592
|
* @param {ZCFSeat} zcfSeat
|
|
581
|
-
* @param {{ goal: Amount<'nat'>}} offerArgs
|
|
593
|
+
* @param {{ goal: Amount<'nat'> }} offerArgs
|
|
582
594
|
*/
|
|
583
595
|
const depositOfferHandler = (zcfSeat, offerArgs) => {
|
|
584
596
|
const goalMatcher = M.or(undefined, { goal: bidAmountShape });
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"offerBook.d.ts","sourceRoot":"","sources":["offerBook.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"offerBook.d.ts","sourceRoot":"","sources":["offerBook.js"],"names":[],"mappings":"AAkDO;IAgBD;;;;;OAKG;cAJQ,OAAO,cACP,KAAK,UACL,OAAO,KAAK,CAAC,gBACb,OAAO;IAsBlB,gCAAgC;4BAApB,KAAK;;;;;;IA1BjB;;;;;OAKG;cAJQ,OAAO,cACP,KAAK,UACL,OAAO,KAAK,CAAC,gBACb,OAAO;IAsBlB,gCAAgC;4BAApB,KAAK;;;;;GAqCpB;AAcI;IAgBD;;;;;OAKG;cAJQ,OAAO,SACP,KAAK,UACL,OAAO,KAAK,CAAC,gBACb,OAAO;;;;;;;IAJlB;;;;;OAKG;cAJQ,OAAO,SACP,KAAK,UACL,OAAO,KAAK,CAAC,gBACb,OAAO;;;;;;GA0DrB;sBA/MW,OAAO,kBAAkB,EAAE,OAAO;2BAYnC;IACZ,IAAQ,EAAE,OAAO,CAAC;IAClB,MAAU,EAAE,OAAO,KAAK,CAAC,CAAC;IAC1B,MAAU,EAAE,QAAQ,CAAC;IACrB,QAAY,EAAE,OAAO,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"}
|