@agoric/inter-protocol 0.13.2-dev-68094ec.0 → 0.13.2-dev-834679c.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-meta.js +135 -131
- package/bundles/bundle-auctioneer.js +1 -1
- package/bundles/bundle-econCommitteeCharter-meta.js +79 -79
- package/bundles/bundle-feeDistributor-meta.js +67 -67
- package/bundles/bundle-fluxAggregator-meta.js +178 -178
- package/bundles/bundle-psm-meta.js +112 -112
- package/bundles/bundle-psm.js +1 -1
- package/bundles/bundle-reserve-meta.js +110 -110
- package/bundles/bundle-reserve.js +1 -1
- package/bundles/bundle-scaledPriceAuthority-meta.js +88 -88
- package/bundles/bundle-stakeFactory-meta.js +118 -118
- package/bundles/bundle-stakeFactory.js +1 -1
- package/bundles/bundle-vaultFactory-meta.js +134 -134
- package/bundles/bundle-vaultFactory.js +1 -1
- package/package.json +16 -16
- package/src/auction/auctionBook.js +3 -2
- package/src/auction/auctioneer.js +2 -1
- package/src/contractSupport.js +5 -0
- package/src/vaultFactory/vault.js +47 -7
- package/src/vaultFactory/vaultManager.js +15 -11
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@agoric/inter-protocol",
|
|
3
|
-
"version": "0.13.2-dev-
|
|
3
|
+
"version": "0.13.2-dev-834679c.0+834679c",
|
|
4
4
|
"description": "Core cryptoeconomy contracts",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "src/index.js",
|
|
@@ -29,16 +29,16 @@
|
|
|
29
29
|
},
|
|
30
30
|
"homepage": "https://github.com/Agoric/agoric-sdk#readme",
|
|
31
31
|
"dependencies": {
|
|
32
|
-
"@agoric/assert": "0.5.2-dev-
|
|
33
|
-
"@agoric/ertp": "0.15.4-dev-
|
|
34
|
-
"@agoric/governance": "0.9.2-dev-
|
|
35
|
-
"@agoric/internal": "0.2.2-dev-
|
|
36
|
-
"@agoric/notifier": "0.5.2-dev-
|
|
37
|
-
"@agoric/store": "0.8.4-dev-
|
|
38
|
-
"@agoric/time": "0.2.2-dev-
|
|
39
|
-
"@agoric/vat-data": "0.4.4-dev-
|
|
40
|
-
"@agoric/vats": "0.13.1-dev-
|
|
41
|
-
"@agoric/zoe": "0.25.4-dev-
|
|
32
|
+
"@agoric/assert": "0.5.2-dev-834679c.0+834679c",
|
|
33
|
+
"@agoric/ertp": "0.15.4-dev-834679c.0+834679c",
|
|
34
|
+
"@agoric/governance": "0.9.2-dev-834679c.0+834679c",
|
|
35
|
+
"@agoric/internal": "0.2.2-dev-834679c.0+834679c",
|
|
36
|
+
"@agoric/notifier": "0.5.2-dev-834679c.0+834679c",
|
|
37
|
+
"@agoric/store": "0.8.4-dev-834679c.0+834679c",
|
|
38
|
+
"@agoric/time": "0.2.2-dev-834679c.0+834679c",
|
|
39
|
+
"@agoric/vat-data": "0.4.4-dev-834679c.0+834679c",
|
|
40
|
+
"@agoric/vats": "0.13.1-dev-834679c.0+834679c",
|
|
41
|
+
"@agoric/zoe": "0.25.4-dev-834679c.0+834679c",
|
|
42
42
|
"@endo/captp": "^2.0.18",
|
|
43
43
|
"@endo/eventual-send": "^0.16.8",
|
|
44
44
|
"@endo/far": "^0.2.14",
|
|
@@ -46,10 +46,10 @@
|
|
|
46
46
|
"@endo/nat": "^4.1.23"
|
|
47
47
|
},
|
|
48
48
|
"devDependencies": {
|
|
49
|
-
"@agoric/deploy-script-support": "0.9.5-dev-
|
|
50
|
-
"@agoric/smart-wallet": "0.4.3-dev-
|
|
51
|
-
"@agoric/swingset-liveslots": "0.9.1-dev-
|
|
52
|
-
"@agoric/swingset-vat": "0.30.3-dev-
|
|
49
|
+
"@agoric/deploy-script-support": "0.9.5-dev-834679c.0+834679c",
|
|
50
|
+
"@agoric/smart-wallet": "0.4.3-dev-834679c.0+834679c",
|
|
51
|
+
"@agoric/swingset-liveslots": "0.9.1-dev-834679c.0+834679c",
|
|
52
|
+
"@agoric/swingset-vat": "0.30.3-dev-834679c.0+834679c",
|
|
53
53
|
"@endo/bundle-source": "^2.4.2",
|
|
54
54
|
"@endo/init": "^0.5.52",
|
|
55
55
|
"@endo/promise-kit": "^0.2.52",
|
|
@@ -78,5 +78,5 @@
|
|
|
78
78
|
"publishConfig": {
|
|
79
79
|
"access": "public"
|
|
80
80
|
},
|
|
81
|
-
"gitHead": "
|
|
81
|
+
"gitHead": "834679c92c9185122314963cd16cfa8efd5f929f"
|
|
82
82
|
}
|
|
@@ -25,6 +25,7 @@ import {
|
|
|
25
25
|
makeBrandedRatioPattern,
|
|
26
26
|
priceFrom,
|
|
27
27
|
} from './util.js';
|
|
28
|
+
import { makeNatAmountShape } from '../contractSupport.js';
|
|
28
29
|
|
|
29
30
|
const { Fail } = assert;
|
|
30
31
|
|
|
@@ -65,8 +66,8 @@ const trace = makeTracer('AucBook', false);
|
|
|
65
66
|
* @param {Brand<'nat'>} collateralBrand
|
|
66
67
|
*/
|
|
67
68
|
export const makeBidSpecShape = (currencyBrand, collateralBrand) => {
|
|
68
|
-
const currencyAmountShape =
|
|
69
|
-
const collateralAmountShape =
|
|
69
|
+
const currencyAmountShape = makeNatAmountShape(currencyBrand);
|
|
70
|
+
const collateralAmountShape = makeNatAmountShape(collateralBrand);
|
|
70
71
|
return M.splitRecord(
|
|
71
72
|
{ want: collateralAmountShape },
|
|
72
73
|
{
|
|
@@ -27,6 +27,7 @@ import { makeAuctionBook, makeBidSpecShape } from './auctionBook.js';
|
|
|
27
27
|
import { AuctionState } from './util.js';
|
|
28
28
|
import { makeScheduler } from './scheduler.js';
|
|
29
29
|
import { auctioneerParamTypes } from './params.js';
|
|
30
|
+
import { makeNatAmountShape } from '../contractSupport.js';
|
|
30
31
|
|
|
31
32
|
/** @typedef {import('@agoric/vat-data').Baggage} Baggage */
|
|
32
33
|
|
|
@@ -270,7 +271,7 @@ export const start = async (zcf, privateArgs, baggage) => {
|
|
|
270
271
|
|
|
271
272
|
const bidProposalShape = M.splitRecord(
|
|
272
273
|
{
|
|
273
|
-
give: { Currency:
|
|
274
|
+
give: { Currency: makeNatAmountShape(brands.Currency) },
|
|
274
275
|
},
|
|
275
276
|
{
|
|
276
277
|
want: M.or({ Collateral: AmountShape }, {}),
|
package/src/contractSupport.js
CHANGED
|
@@ -119,3 +119,8 @@ export const makeMetricsPublishKit = (storageNode, marshaller) => {
|
|
|
119
119
|
};
|
|
120
120
|
};
|
|
121
121
|
harden(makeMetricsPublishKit);
|
|
122
|
+
|
|
123
|
+
/**
|
|
124
|
+
* @param {Brand} brand must be a 'nat' brand, not checked
|
|
125
|
+
*/
|
|
126
|
+
export const makeNatAmountShape = brand => harden({ brand, value: M.nat() });
|
|
@@ -2,13 +2,16 @@ import { AmountMath, AmountShape } from '@agoric/ertp';
|
|
|
2
2
|
import { makeTracer, makeTypeGuards } from '@agoric/internal';
|
|
3
3
|
import { M, prepareExoClassKit } from '@agoric/vat-data';
|
|
4
4
|
import {
|
|
5
|
-
assertProposalShape,
|
|
6
5
|
atomicTransfer,
|
|
7
6
|
floorMultiplyBy,
|
|
8
7
|
makeRatioFromAmounts,
|
|
9
8
|
} from '@agoric/zoe/src/contractSupport/index.js';
|
|
10
9
|
import { SeatShape } from '@agoric/zoe/src/typeGuards.js';
|
|
11
|
-
import {
|
|
10
|
+
import {
|
|
11
|
+
addSubtract,
|
|
12
|
+
allEmpty,
|
|
13
|
+
makeNatAmountShape,
|
|
14
|
+
} from '../contractSupport.js';
|
|
12
15
|
import { calculateCurrentDebt, reverseInterest } from '../interest-math.js';
|
|
13
16
|
import { UnguardedHelperI } from '../typeGuards.js';
|
|
14
17
|
import { prepareVaultKit } from './vaultKit.js';
|
|
@@ -237,7 +240,6 @@ export const prepareVault = (baggage, marshaller, zcf) => {
|
|
|
237
240
|
* @returns {FullProposal}
|
|
238
241
|
*/
|
|
239
242
|
fullProposal(partial) {
|
|
240
|
-
assertOnlyKeys(partial, ['Collateral', 'Minted']);
|
|
241
243
|
return {
|
|
242
244
|
give: {
|
|
243
245
|
Collateral:
|
|
@@ -418,15 +420,12 @@ export const prepareVault = (baggage, marshaller, zcf) => {
|
|
|
418
420
|
const oldCollateral = self.getCollateralAmount();
|
|
419
421
|
|
|
420
422
|
if (phase === Phase.ACTIVE) {
|
|
421
|
-
assertProposalShape(seat, {
|
|
422
|
-
give: { Minted: null },
|
|
423
|
-
});
|
|
424
|
-
|
|
425
423
|
// you're paying off the debt, you get everything back.
|
|
426
424
|
const debt = self.getCurrentDebt();
|
|
427
425
|
const {
|
|
428
426
|
give: { Minted: given },
|
|
429
427
|
} = seat.getProposal();
|
|
428
|
+
given || Fail`closing an active vault requires a give`;
|
|
430
429
|
|
|
431
430
|
// you must pay off the entire remainder but if you offer too much, we won't
|
|
432
431
|
// take more than you owe
|
|
@@ -792,9 +791,33 @@ export const prepareVault = (baggage, marshaller, zcf) => {
|
|
|
792
791
|
const { state, facets } = this;
|
|
793
792
|
const { helper } = facets;
|
|
794
793
|
helper.assertActive();
|
|
794
|
+
|
|
795
795
|
return zcf.makeInvitation(
|
|
796
796
|
seat => helper.adjustBalancesHook(seat),
|
|
797
797
|
state.manager.scopeDescription('AdjustBalances'),
|
|
798
|
+
undefined,
|
|
799
|
+
M.splitRecord({
|
|
800
|
+
give: M.splitRecord(
|
|
801
|
+
{},
|
|
802
|
+
{
|
|
803
|
+
// It may seem odd to give both at once but there is use case:
|
|
804
|
+
// To rescue a vault that's on the verge of being liquidated
|
|
805
|
+
// when you have limited resources, you might add collateral
|
|
806
|
+
// at the same time that you're repaying IST.
|
|
807
|
+
Collateral: makeNatAmountShape(helper.collateralBrand()),
|
|
808
|
+
Minted: makeNatAmountShape(helper.debtBrand()),
|
|
809
|
+
},
|
|
810
|
+
{},
|
|
811
|
+
),
|
|
812
|
+
want: M.splitRecord(
|
|
813
|
+
{},
|
|
814
|
+
{
|
|
815
|
+
Collateral: makeNatAmountShape(helper.collateralBrand()),
|
|
816
|
+
Minted: makeNatAmountShape(helper.debtBrand()),
|
|
817
|
+
},
|
|
818
|
+
{},
|
|
819
|
+
),
|
|
820
|
+
}),
|
|
798
821
|
);
|
|
799
822
|
},
|
|
800
823
|
|
|
@@ -805,6 +828,23 @@ export const prepareVault = (baggage, marshaller, zcf) => {
|
|
|
805
828
|
return zcf.makeInvitation(
|
|
806
829
|
seat => helper.closeHook(seat),
|
|
807
830
|
state.manager.scopeDescription('CloseVault'),
|
|
831
|
+
undefined,
|
|
832
|
+
M.splitRecord({
|
|
833
|
+
give: M.splitRecord(
|
|
834
|
+
{},
|
|
835
|
+
{
|
|
836
|
+
Minted: makeNatAmountShape(helper.debtBrand()),
|
|
837
|
+
},
|
|
838
|
+
{},
|
|
839
|
+
),
|
|
840
|
+
want: M.splitRecord(
|
|
841
|
+
{},
|
|
842
|
+
{
|
|
843
|
+
Collateral: makeNatAmountShape(helper.collateralBrand()),
|
|
844
|
+
},
|
|
845
|
+
{},
|
|
846
|
+
),
|
|
847
|
+
}),
|
|
808
848
|
);
|
|
809
849
|
},
|
|
810
850
|
|
|
@@ -26,8 +26,8 @@ import {
|
|
|
26
26
|
} from '@agoric/ertp';
|
|
27
27
|
import { makeTracer } from '@agoric/internal';
|
|
28
28
|
import {
|
|
29
|
-
makeStoredNotifier,
|
|
30
29
|
makePublicTopic,
|
|
30
|
+
makeStoredNotifier,
|
|
31
31
|
observeNotifier,
|
|
32
32
|
pipeTopicToStorage,
|
|
33
33
|
prepareDurablePublishKit,
|
|
@@ -40,8 +40,8 @@ import {
|
|
|
40
40
|
provideDurableMapStore,
|
|
41
41
|
provideDurableSetStore,
|
|
42
42
|
} from '@agoric/vat-data';
|
|
43
|
+
import { TransferPartShape } from '@agoric/zoe/src/contractSupport/atomicTransfer.js';
|
|
43
44
|
import {
|
|
44
|
-
assertProposalShape,
|
|
45
45
|
atomicRearrange,
|
|
46
46
|
ceilMultiplyBy,
|
|
47
47
|
floorMultiplyBy,
|
|
@@ -55,15 +55,14 @@ import {
|
|
|
55
55
|
} from '@agoric/zoe/src/contractSupport/index.js';
|
|
56
56
|
import { SeatShape } from '@agoric/zoe/src/typeGuards.js';
|
|
57
57
|
import { E } from '@endo/eventual-send';
|
|
58
|
-
import {
|
|
59
|
-
import { checkDebtLimit } from '../contractSupport.js';
|
|
58
|
+
import { AuctionPFShape } from '../auction/auctioneer.js';
|
|
59
|
+
import { checkDebtLimit, makeNatAmountShape } from '../contractSupport.js';
|
|
60
60
|
import { chargeInterest } from '../interest.js';
|
|
61
|
+
import { getLiquidatableVaults, liquidationResults } from './liquidation.js';
|
|
61
62
|
import { maxDebtForVault } from './math.js';
|
|
62
63
|
import { makePrioritizedVaults } from './prioritizedVaults.js';
|
|
63
|
-
import { Phase, prepareVault } from './vault.js';
|
|
64
64
|
import { normalizedCollRatio, normalizedCollRatioKey } from './storeUtils.js';
|
|
65
|
-
import {
|
|
66
|
-
import { AuctionPFShape } from '../auction/auctioneer.js';
|
|
65
|
+
import { Phase, prepareVault } from './vault.js';
|
|
67
66
|
|
|
68
67
|
const { details: X, Fail } = assert;
|
|
69
68
|
|
|
@@ -322,6 +321,15 @@ export const prepareVaultManagerKit = (
|
|
|
322
321
|
return zcf.makeInvitation(
|
|
323
322
|
seat => this.facets.self.makeVaultKit(seat),
|
|
324
323
|
facets.manager.scopeDescription('MakeVault'),
|
|
324
|
+
undefined,
|
|
325
|
+
M.splitRecord({
|
|
326
|
+
give: {
|
|
327
|
+
Collateral: makeNatAmountShape(collateralBrand),
|
|
328
|
+
},
|
|
329
|
+
want: {
|
|
330
|
+
Minted: makeNatAmountShape(debtBrand),
|
|
331
|
+
},
|
|
332
|
+
}),
|
|
325
333
|
);
|
|
326
334
|
},
|
|
327
335
|
/** @deprecated use getPublicTopics */
|
|
@@ -711,10 +719,6 @@ export const prepareVaultManagerKit = (
|
|
|
711
719
|
assert(marshaller, 'makeVaultKit missing marshaller');
|
|
712
720
|
assert(storageNode, 'makeVaultKit missing storageNode');
|
|
713
721
|
assert(zcf, 'makeVaultKit missing zcf');
|
|
714
|
-
assertProposalShape(seat, {
|
|
715
|
-
give: { Collateral: null },
|
|
716
|
-
want: { Minted: null },
|
|
717
|
-
});
|
|
718
722
|
|
|
719
723
|
const vaultId = String(state.vaultCounter);
|
|
720
724
|
|