@agoric/inter-protocol 0.16.2-dev-6ad0038.0.6ad0038 → 0.16.2-dev-b95c1c8.0.b95c1c8
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 +16 -16
- package/src/index.js +1 -0
- package/src/proposals/addAssetToVault.js +3 -97
- package/src/proposals/committee-proposal.js +3 -9
- package/src/proposals/core-proposal.js +1 -32
- package/src/proposals/econ-behaviors.js +1 -140
- package/src/vaultFactory/params.d.ts.map +1 -1
- package/src/vaultFactory/params.js +1 -0
- package/src/vaultFactory/types-ambient.d.ts +0 -2
- package/src/vaultFactory/types-ambient.d.ts.map +1 -1
- package/src/vaultFactory/types-ambient.js +0 -3
- package/src/vaultFactory/vaultDirector.d.ts +5 -40
- package/src/vaultFactory/vaultDirector.d.ts.map +1 -1
- package/src/vaultFactory/vaultDirector.js +3 -58
- package/src/vaultFactory/vaultFactory.d.ts +4 -22
- package/src/vaultFactory/vaultFactory.d.ts.map +1 -1
- package/src/vaultFactory/vaultFactory.js +2 -9
- package/src/vaultFactory/vaultManager.d.ts +2 -180
- package/src/vaultFactory/vaultManager.d.ts.map +1 -1
- package/src/vaultFactory/vaultManager.js +3 -300
- package/src/auction/auctionBook.d.ts +0 -150
- package/src/auction/auctionBook.d.ts.map +0 -1
- package/src/auction/auctionBook.js +0 -796
- package/src/auction/auctionMath.d.ts +0 -18
- package/src/auction/auctionMath.d.ts.map +0 -1
- package/src/auction/auctionMath.js +0 -82
- package/src/auction/auctioneer.d.ts +0 -76
- package/src/auction/auctioneer.d.ts.map +0 -1
- package/src/auction/auctioneer.js +0 -745
- package/src/auction/offerBook.d.ts +0 -47
- package/src/auction/offerBook.d.ts.map +0 -1
- package/src/auction/offerBook.js +0 -227
- package/src/auction/params.d.ts +0 -156
- package/src/auction/params.d.ts.map +0 -1
- package/src/auction/params.js +0 -184
- package/src/auction/scheduleMath.d.ts +0 -8
- package/src/auction/scheduleMath.d.ts.map +0 -1
- package/src/auction/scheduleMath.js +0 -174
- package/src/auction/scheduler.d.ts +0 -57
- package/src/auction/scheduler.d.ts.map +0 -1
- package/src/auction/scheduler.js +0 -391
- package/src/auction/sortedOffers.d.ts +0 -9
- package/src/auction/sortedOffers.d.ts.map +0 -1
- package/src/auction/sortedOffers.js +0 -141
- package/src/proposals/add-auction.js +0 -290
- package/src/proposals/upgrade-vaults.js +0 -212
- package/src/vaultFactory/liquidation.d.ts +0 -29
- package/src/vaultFactory/liquidation.d.ts.map +0 -1
- package/src/vaultFactory/liquidation.js +0 -313
- package/src/vaultFactory/proceeds.d.ts +0 -36
- package/src/vaultFactory/proceeds.d.ts.map +0 -1
- package/src/vaultFactory/proceeds.js +0 -285
|
@@ -18,8 +18,6 @@
|
|
|
18
18
|
*/
|
|
19
19
|
/// <reference types="@agoric/zoe/exported.js" />
|
|
20
20
|
|
|
21
|
-
import { X, Fail, q, makeError } from '@endo/errors';
|
|
22
|
-
import { E } from '@endo/eventual-send';
|
|
23
21
|
import {
|
|
24
22
|
AmountMath,
|
|
25
23
|
AmountShape,
|
|
@@ -27,6 +25,7 @@ import {
|
|
|
27
25
|
NotifierShape,
|
|
28
26
|
RatioShape,
|
|
29
27
|
} from '@agoric/ertp';
|
|
28
|
+
import { multiplyBy } from '@agoric/ertp/src/ratio.js';
|
|
30
29
|
import { makeTracer } from '@agoric/internal';
|
|
31
30
|
import { makeStoredNotifier, observeNotifier } from '@agoric/notifier';
|
|
32
31
|
import { appendToStoredArray } from '@agoric/store/src/stores/store-utils.js';
|
|
@@ -51,19 +50,17 @@ import {
|
|
|
51
50
|
TopicsRecordShape,
|
|
52
51
|
} from '@agoric/zoe/src/contractSupport/index.js';
|
|
53
52
|
import { PriceQuoteShape, SeatShape } from '@agoric/zoe/src/typeGuards.js';
|
|
54
|
-
import {
|
|
53
|
+
import { Fail, makeError, X } from '@endo/errors';
|
|
54
|
+
import { E } from '@endo/eventual-send';
|
|
55
55
|
import {
|
|
56
56
|
checkDebtLimit,
|
|
57
57
|
makeNatAmountShape,
|
|
58
58
|
quoteAsRatio,
|
|
59
59
|
} from '../contractSupport.js';
|
|
60
60
|
import { chargeInterest } from '../interest.js';
|
|
61
|
-
import { getLiquidatableVaults } from './liquidation.js';
|
|
62
61
|
import { calculateMinimumCollateralization, minimumPrice } from './math.js';
|
|
63
62
|
import { makePrioritizedVaults } from './prioritizedVaults.js';
|
|
64
63
|
import { Phase, prepareVault } from './vault.js';
|
|
65
|
-
import { calculateDistributionPlan } from './proceeds.js';
|
|
66
|
-
import { AuctionPFShape } from '../auction/auctioneer.js';
|
|
67
64
|
|
|
68
65
|
/**
|
|
69
66
|
* @import {ERemote, Remote} from '@agoric/internal';
|
|
@@ -360,7 +357,6 @@ export const prepareVaultManagerKit = (
|
|
|
360
357
|
getCollateralQuote: M.call().returns(PriceQuoteShape),
|
|
361
358
|
getPublicFacet: M.call().returns(M.remotable('publicFacet')),
|
|
362
359
|
lockOraclePrices: M.call().returns(PriceQuoteShape),
|
|
363
|
-
liquidateVaults: M.call(M.eref(AuctionPFShape)).returns(M.promise()),
|
|
364
360
|
}),
|
|
365
361
|
},
|
|
366
362
|
initState,
|
|
@@ -692,172 +688,6 @@ export const prepareVaultManagerKit = (
|
|
|
692
688
|
|
|
693
689
|
return E(metricsTopicKit.recorder).write(payload);
|
|
694
690
|
},
|
|
695
|
-
|
|
696
|
-
/**
|
|
697
|
-
* This is designed to tolerate an incomplete plan, in case
|
|
698
|
-
* calculateDistributionPlan encounters an error during its calculation.
|
|
699
|
-
* We don't have a way to induce such errors in CI so we've done so
|
|
700
|
-
* manually in dev and verified this function recovers as expected.
|
|
701
|
-
*
|
|
702
|
-
* @param {AmountKeywordRecord} proceeds
|
|
703
|
-
* @param {Amount<'nat'>} totalDebt
|
|
704
|
-
* @param {Pick<PriceQuote, 'quoteAmount'>} oraclePriceAtStart
|
|
705
|
-
* @param {MapStore<
|
|
706
|
-
* Vault,
|
|
707
|
-
* { collateralAmount: Amount<'nat'>; debtAmount: Amount<'nat'> }
|
|
708
|
-
* >} vaultData
|
|
709
|
-
* @param {Amount<'nat'>} totalCollateral
|
|
710
|
-
*/
|
|
711
|
-
planProceedsDistribution(
|
|
712
|
-
proceeds,
|
|
713
|
-
totalDebt,
|
|
714
|
-
oraclePriceAtStart,
|
|
715
|
-
vaultData,
|
|
716
|
-
totalCollateral,
|
|
717
|
-
) {
|
|
718
|
-
const { state, facets } = this;
|
|
719
|
-
|
|
720
|
-
const { Collateral: collateralProceeds } = proceeds;
|
|
721
|
-
/** @type {Amount<'nat'>} */
|
|
722
|
-
const collateralSold = AmountMath.subtract(
|
|
723
|
-
totalCollateral,
|
|
724
|
-
collateralProceeds,
|
|
725
|
-
);
|
|
726
|
-
state.totalCollateralSold = AmountMath.add(
|
|
727
|
-
state.totalCollateralSold,
|
|
728
|
-
collateralSold,
|
|
729
|
-
);
|
|
730
|
-
|
|
731
|
-
const penaltyRate = facets.self
|
|
732
|
-
.getGovernedParams()
|
|
733
|
-
.getLiquidationPenalty();
|
|
734
|
-
const bestToWorst = [...vaultData.entries()].reverse();
|
|
735
|
-
|
|
736
|
-
// unzip the entry tuples
|
|
737
|
-
const vaultsInPlan = /** @type {Vault[]} */ ([]);
|
|
738
|
-
const vaultsBalances = /** @type {VaultBalances[]} */ ([]);
|
|
739
|
-
for (const [vault, balances] of bestToWorst) {
|
|
740
|
-
vaultsInPlan.push(vault);
|
|
741
|
-
vaultsBalances.push({
|
|
742
|
-
collateral: balances.collateralAmount,
|
|
743
|
-
// if interest accrued during sale, the current debt will be higher
|
|
744
|
-
presaleDebt: balances.debtAmount,
|
|
745
|
-
currentDebt: vault.getCurrentDebt(),
|
|
746
|
-
});
|
|
747
|
-
}
|
|
748
|
-
harden(vaultsInPlan);
|
|
749
|
-
harden(vaultsBalances);
|
|
750
|
-
|
|
751
|
-
const plan = calculateDistributionPlan({
|
|
752
|
-
proceeds,
|
|
753
|
-
totalDebt,
|
|
754
|
-
totalCollateral,
|
|
755
|
-
oraclePriceAtStart: oraclePriceAtStart.quoteAmount.value[0],
|
|
756
|
-
vaultsBalances,
|
|
757
|
-
penaltyRate,
|
|
758
|
-
});
|
|
759
|
-
return { plan, vaultsInPlan };
|
|
760
|
-
},
|
|
761
|
-
|
|
762
|
-
/**
|
|
763
|
-
* This is designed to tolerate an incomplete plan, in case
|
|
764
|
-
* calculateDistributionPlan encounters an error during its calculation.
|
|
765
|
-
* We don't have a way to induce such errors in CI so we've done so
|
|
766
|
-
* manually in dev and verified this function recovers as expected.
|
|
767
|
-
*
|
|
768
|
-
* @param {object} obj
|
|
769
|
-
* @param {DistributionPlan} obj.plan
|
|
770
|
-
* @param {Vault[]} obj.vaultsInPlan
|
|
771
|
-
* @param {ZCFSeat} obj.liqSeat
|
|
772
|
-
* @param {Amount<'nat'>} obj.totalCollateral
|
|
773
|
-
* @param {Amount<'nat'>} obj.totalDebt
|
|
774
|
-
* @returns {void}
|
|
775
|
-
*/
|
|
776
|
-
distributeProceeds({
|
|
777
|
-
plan,
|
|
778
|
-
vaultsInPlan,
|
|
779
|
-
liqSeat,
|
|
780
|
-
totalCollateral,
|
|
781
|
-
totalDebt,
|
|
782
|
-
}) {
|
|
783
|
-
const { state, facets } = this;
|
|
784
|
-
// Putting all the rearrangements after the loop ensures that errors
|
|
785
|
-
// in the calculations don't result in paying back some vaults and
|
|
786
|
-
// leaving others hanging.
|
|
787
|
-
if (plan.transfersToVault.length > 0) {
|
|
788
|
-
const transfers = plan.transfersToVault.map(
|
|
789
|
-
([vaultIndex, amounts]) =>
|
|
790
|
-
/** @type {TransferPart} */ ([
|
|
791
|
-
liqSeat,
|
|
792
|
-
vaultsInPlan[vaultIndex].getVaultSeat(),
|
|
793
|
-
amounts,
|
|
794
|
-
]),
|
|
795
|
-
);
|
|
796
|
-
zcf.atomicRearrange(harden(transfers));
|
|
797
|
-
}
|
|
798
|
-
|
|
799
|
-
const { prioritizedVaults } = collateralEphemera(
|
|
800
|
-
totalCollateral.brand,
|
|
801
|
-
);
|
|
802
|
-
state.numLiquidationsAborted += plan.vaultsToReinstate.length;
|
|
803
|
-
for (const vaultIndex of plan.vaultsToReinstate) {
|
|
804
|
-
const vault = vaultsInPlan[vaultIndex];
|
|
805
|
-
const vaultId = vault.abortLiquidation();
|
|
806
|
-
prioritizedVaults.addVault(vaultId, vault);
|
|
807
|
-
state.liquidatingVaults.delete(vault);
|
|
808
|
-
}
|
|
809
|
-
|
|
810
|
-
if (!AmountMath.isEmpty(plan.phantomDebt)) {
|
|
811
|
-
state.totalDebt = AmountMath.subtract(
|
|
812
|
-
state.totalDebt,
|
|
813
|
-
plan.phantomDebt,
|
|
814
|
-
);
|
|
815
|
-
}
|
|
816
|
-
|
|
817
|
-
facets.helper.burnToCoverDebt(
|
|
818
|
-
plan.debtToBurn,
|
|
819
|
-
plan.mintedProceeds,
|
|
820
|
-
liqSeat,
|
|
821
|
-
);
|
|
822
|
-
if (!AmountMath.isEmpty(plan.mintedForReserve)) {
|
|
823
|
-
facets.helper.sendToReserve(
|
|
824
|
-
plan.mintedForReserve,
|
|
825
|
-
liqSeat,
|
|
826
|
-
'Minted',
|
|
827
|
-
);
|
|
828
|
-
}
|
|
829
|
-
|
|
830
|
-
// send all that's left in the seat
|
|
831
|
-
const collateralInLiqSeat = liqSeat.getCurrentAllocation().Collateral;
|
|
832
|
-
if (!AmountMath.isEmpty(collateralInLiqSeat)) {
|
|
833
|
-
facets.helper.sendToReserve(collateralInLiqSeat, liqSeat);
|
|
834
|
-
}
|
|
835
|
-
// if it didn't match what was expected, report
|
|
836
|
-
if (!AmountMath.isEqual(collateralInLiqSeat, plan.collatRemaining)) {
|
|
837
|
-
console.error(
|
|
838
|
-
`⚠️ Excess collateral remaining sent to reserve. Expected ${q(
|
|
839
|
-
plan.collatRemaining,
|
|
840
|
-
)}, sent ${q(collateralInLiqSeat)}`,
|
|
841
|
-
);
|
|
842
|
-
}
|
|
843
|
-
|
|
844
|
-
// 'totalCollateralSold' is only for this liquidation event
|
|
845
|
-
// 'state.totalCollateralSold' represents all active vaults
|
|
846
|
-
const actualCollateralSold = plan.actualCollateralSold;
|
|
847
|
-
state.totalCollateral = AmountMath.isEmpty(actualCollateralSold)
|
|
848
|
-
? AmountMath.subtract(state.totalCollateral, totalCollateral)
|
|
849
|
-
: AmountMath.subtract(state.totalCollateral, actualCollateralSold);
|
|
850
|
-
|
|
851
|
-
facets.helper.markDoneLiquidating(
|
|
852
|
-
totalDebt,
|
|
853
|
-
totalCollateral,
|
|
854
|
-
plan.overage,
|
|
855
|
-
plan.shortfallToReserve,
|
|
856
|
-
);
|
|
857
|
-
|
|
858
|
-
// liqSeat should be empty at this point, except that funds are sent
|
|
859
|
-
// asynchronously to the reserve.
|
|
860
|
-
},
|
|
861
691
|
},
|
|
862
692
|
|
|
863
693
|
manager: {
|
|
@@ -1160,133 +990,6 @@ export const prepareVaultManagerKit = (
|
|
|
1160
990
|
void facets.helper.writeMetrics();
|
|
1161
991
|
return storedCollateralQuote;
|
|
1162
992
|
},
|
|
1163
|
-
/**
|
|
1164
|
-
* @param {ERef<AuctioneerPublicFacet>} auctionPF
|
|
1165
|
-
*/
|
|
1166
|
-
async liquidateVaults(auctionPF) {
|
|
1167
|
-
const { state, facets } = this;
|
|
1168
|
-
const { self, helper } = facets;
|
|
1169
|
-
const {
|
|
1170
|
-
collateralBrand,
|
|
1171
|
-
compoundedInterest,
|
|
1172
|
-
debtBrand,
|
|
1173
|
-
liquidatingVaults,
|
|
1174
|
-
lockedQuote,
|
|
1175
|
-
} = state;
|
|
1176
|
-
trace(collateralBrand, 'considering liquidation');
|
|
1177
|
-
|
|
1178
|
-
if (!lockedQuote) {
|
|
1179
|
-
// By design, the first cycle of auction may call this before a quote is locked
|
|
1180
|
-
// because the schedule is global at the vaultDirector level, and if a manager
|
|
1181
|
-
// starts after the price lock time there's nothing to be done.
|
|
1182
|
-
// NB: this message should not log repeatedly.
|
|
1183
|
-
console.error(
|
|
1184
|
-
'Skipping liquidation because no quote is locked yet (may happen with new manager)',
|
|
1185
|
-
);
|
|
1186
|
-
return;
|
|
1187
|
-
}
|
|
1188
|
-
|
|
1189
|
-
const { storedCollateralQuote: collateralQuoteBefore } =
|
|
1190
|
-
collateralEphemera(this.state.collateralBrand);
|
|
1191
|
-
if (!collateralQuoteBefore) {
|
|
1192
|
-
console.error(
|
|
1193
|
-
'Skipping liquidation because collateralQuote is missing',
|
|
1194
|
-
);
|
|
1195
|
-
return;
|
|
1196
|
-
}
|
|
1197
|
-
|
|
1198
|
-
const { prioritizedVaults } = collateralEphemera(collateralBrand);
|
|
1199
|
-
prioritizedVaults || Fail`prioritizedVaults missing from ephemera`;
|
|
1200
|
-
|
|
1201
|
-
const liqMargin = self.getGovernedParams().getLiquidationMargin();
|
|
1202
|
-
|
|
1203
|
-
// totals *among* vaults being liquidated
|
|
1204
|
-
const { totalDebt, totalCollateral, vaultData, liqSeat } =
|
|
1205
|
-
getLiquidatableVaults(
|
|
1206
|
-
zcf,
|
|
1207
|
-
{
|
|
1208
|
-
quote: lockedQuote,
|
|
1209
|
-
interest: compoundedInterest,
|
|
1210
|
-
margin: liqMargin,
|
|
1211
|
-
},
|
|
1212
|
-
prioritizedVaults,
|
|
1213
|
-
liquidatingVaults,
|
|
1214
|
-
debtBrand,
|
|
1215
|
-
collateralBrand,
|
|
1216
|
-
);
|
|
1217
|
-
// reset lockedQuote after we've used it for the liquidation decision
|
|
1218
|
-
state.lockedQuote = undefined;
|
|
1219
|
-
|
|
1220
|
-
if (vaultData.getSize() === 0) {
|
|
1221
|
-
void helper.writeMetrics();
|
|
1222
|
-
return;
|
|
1223
|
-
}
|
|
1224
|
-
trace(
|
|
1225
|
-
' Found vaults to liquidate',
|
|
1226
|
-
liquidatingVaults.getSize(),
|
|
1227
|
-
totalCollateral,
|
|
1228
|
-
);
|
|
1229
|
-
|
|
1230
|
-
helper.markLiquidating(totalDebt, totalCollateral);
|
|
1231
|
-
void helper.writeMetrics();
|
|
1232
|
-
|
|
1233
|
-
const { userSeatPromise, deposited } = await E.when(
|
|
1234
|
-
E(auctionPF).makeDepositInvitation(),
|
|
1235
|
-
depositInvitation =>
|
|
1236
|
-
offerTo(
|
|
1237
|
-
zcf,
|
|
1238
|
-
depositInvitation,
|
|
1239
|
-
harden({ Minted: 'Bid' }),
|
|
1240
|
-
harden({ give: { Collateral: totalCollateral } }),
|
|
1241
|
-
liqSeat,
|
|
1242
|
-
liqSeat,
|
|
1243
|
-
{ goal: totalDebt },
|
|
1244
|
-
),
|
|
1245
|
-
);
|
|
1246
|
-
|
|
1247
|
-
// This is expected to wait for the duration of the auction, which
|
|
1248
|
-
// is controlled by the auction parameters startFrequency, clockStep,
|
|
1249
|
-
// and the difference between startingRate and lowestRate.
|
|
1250
|
-
const [proceeds] = await Promise.all([deposited, userSeatPromise]);
|
|
1251
|
-
|
|
1252
|
-
const { storedCollateralQuote } = collateralEphemera(
|
|
1253
|
-
this.state.collateralBrand,
|
|
1254
|
-
);
|
|
1255
|
-
|
|
1256
|
-
trace(`LiqV after long wait`, proceeds);
|
|
1257
|
-
try {
|
|
1258
|
-
const { plan, vaultsInPlan } = helper.planProceedsDistribution(
|
|
1259
|
-
proceeds,
|
|
1260
|
-
totalDebt,
|
|
1261
|
-
// If a quote was available at the start of liquidation, but is no
|
|
1262
|
-
// longer, using the earlier price is better than failing to
|
|
1263
|
-
// distribute proceeds
|
|
1264
|
-
storedCollateralQuote || collateralQuoteBefore,
|
|
1265
|
-
vaultData,
|
|
1266
|
-
totalCollateral,
|
|
1267
|
-
);
|
|
1268
|
-
trace('PLAN', plan);
|
|
1269
|
-
// distributeProceeds may reconstitute vaults, removing them from liquidatingVaults
|
|
1270
|
-
helper.distributeProceeds({
|
|
1271
|
-
liqSeat,
|
|
1272
|
-
plan,
|
|
1273
|
-
totalCollateral,
|
|
1274
|
-
totalDebt,
|
|
1275
|
-
vaultsInPlan,
|
|
1276
|
-
});
|
|
1277
|
-
} catch (err) {
|
|
1278
|
-
console.error('🚨 Error distributing proceeds:', err);
|
|
1279
|
-
}
|
|
1280
|
-
|
|
1281
|
-
// for all non-reconstituted vaults, transition to 'liquidated' state
|
|
1282
|
-
state.numLiquidationsCompleted += liquidatingVaults.getSize();
|
|
1283
|
-
for (const vault of liquidatingVaults.values()) {
|
|
1284
|
-
vault.liquidated();
|
|
1285
|
-
liquidatingVaults.delete(vault);
|
|
1286
|
-
}
|
|
1287
|
-
|
|
1288
|
-
void helper.writeMetrics();
|
|
1289
|
-
},
|
|
1290
993
|
},
|
|
1291
994
|
},
|
|
1292
995
|
|
|
@@ -1,150 +0,0 @@
|
|
|
1
|
-
export function makeOfferSpecShape(bidBrand: Brand<"nat">, collateralBrand: Brand<"nat">): import("@endo/patterns").Matcher;
|
|
2
|
-
export function prepareAuctionBook(baggage: Baggage, zcf: ZCF, makeRecorderKit: MakeRecorderKit): (bidBrand: globalThis.Brand<"nat">, collateralBrand: globalThis.Brand<"nat">, pAuthority: PriceAuthority, node: Remote<globalThis.StorageNode>) => ReturnType<(bidBrand: globalThis.Brand<"nat">, collateralBrand: globalThis.Brand<"nat">, pAuthority: PriceAuthority, node: Remote<globalThis.StorageNode>) => import("@endo/exo").GuardedKit<{
|
|
3
|
-
helper: {
|
|
4
|
-
/**
|
|
5
|
-
* remove the key from the appropriate book, indicated by whether the
|
|
6
|
-
* price is defined.
|
|
7
|
-
*
|
|
8
|
-
* @param {string} key
|
|
9
|
-
* @param {Ratio | undefined} price
|
|
10
|
-
*/
|
|
11
|
-
removeFromItsBook(key: string, price: Ratio | undefined): void;
|
|
12
|
-
/**
|
|
13
|
-
* Update the entry in the appropriate book, indicated by whether the
|
|
14
|
-
* price is defined.
|
|
15
|
-
*
|
|
16
|
-
* @param {string} key
|
|
17
|
-
* @param {Amount} collateralSold
|
|
18
|
-
* @param {Ratio | undefined} price
|
|
19
|
-
*/
|
|
20
|
-
updateItsBook(key: string, collateralSold: Amount, price: Ratio | undefined): void;
|
|
21
|
-
/**
|
|
22
|
-
* Settle with seat. The caller is responsible for updating the book, if
|
|
23
|
-
* any.
|
|
24
|
-
*
|
|
25
|
-
* @param {ZCFSeat} seat
|
|
26
|
-
* @param {Amount<'nat'>} collateralWanted
|
|
27
|
-
*/
|
|
28
|
-
settle(seat: ZCFSeat, collateralWanted: Amount<"nat">): import("@agoric/ertp").NatAmount;
|
|
29
|
-
/**
|
|
30
|
-
* Accept an offer expressed as a price. If the auction is active,
|
|
31
|
-
* attempt to buy collateral. If any of the offer remains add it to the
|
|
32
|
-
* book.
|
|
33
|
-
*
|
|
34
|
-
* @param {ZCFSeat} seat
|
|
35
|
-
* @param {Ratio} price
|
|
36
|
-
* @param {Amount<'nat'>} maxBuy
|
|
37
|
-
* @param {object} opts
|
|
38
|
-
* @param {boolean} opts.trySettle
|
|
39
|
-
* @param {boolean} [opts.exitAfterBuy]
|
|
40
|
-
*/
|
|
41
|
-
acceptPriceOffer(seat: ZCFSeat, price: Ratio, maxBuy: Amount<"nat">, { trySettle, exitAfterBuy }: {
|
|
42
|
-
trySettle: boolean;
|
|
43
|
-
exitAfterBuy?: boolean | undefined;
|
|
44
|
-
}): void;
|
|
45
|
-
/**
|
|
46
|
-
* Accept an offer expressed as a discount (or markup). If the auction
|
|
47
|
-
* is active, attempt to buy collateral. If any of the offer remains add
|
|
48
|
-
* it to the book.
|
|
49
|
-
*
|
|
50
|
-
* @param {ZCFSeat} seat
|
|
51
|
-
* @param {Ratio} bidScaling
|
|
52
|
-
* @param {Amount<'nat'>} maxBuy
|
|
53
|
-
* @param {object} opts
|
|
54
|
-
* @param {boolean} opts.trySettle
|
|
55
|
-
* @param {boolean} [opts.exitAfterBuy]
|
|
56
|
-
*/
|
|
57
|
-
acceptScaledBidOffer(seat: ZCFSeat, bidScaling: Ratio, maxBuy: Amount<"nat">, { trySettle, exitAfterBuy }: {
|
|
58
|
-
trySettle: boolean;
|
|
59
|
-
exitAfterBuy?: boolean | undefined;
|
|
60
|
-
}): void;
|
|
61
|
-
publishBookData(): Promise<void>;
|
|
62
|
-
ensureQuoteNotifierObserved(): void;
|
|
63
|
-
};
|
|
64
|
-
self: {
|
|
65
|
-
/**
|
|
66
|
-
* @param {Amount<'nat'>} assetAmount
|
|
67
|
-
* @param {ZCFSeat} sourceSeat
|
|
68
|
-
* @param {Amount<'nat'>} [proceedsGoal] an amount that the depositor
|
|
69
|
-
* would like to raise. The auction is requested to not sell more
|
|
70
|
-
* collateral than required to raise that much. The auctioneer might
|
|
71
|
-
* sell more if there is more than one supplier of collateral, and
|
|
72
|
-
* they request inconsistent limits.
|
|
73
|
-
*/
|
|
74
|
-
addAssets(assetAmount: Amount<"nat">, sourceSeat: ZCFSeat, proceedsGoal?: Amount<"nat">): void;
|
|
75
|
-
settleAtNewRate(reduction: Ratio): void;
|
|
76
|
-
getCurrentPrice(): Ratio | null;
|
|
77
|
-
hasOrders(): boolean;
|
|
78
|
-
captureOraclePriceForRound(): void;
|
|
79
|
-
setStartingRate(rate: any): void;
|
|
80
|
-
/**
|
|
81
|
-
* @param {OfferSpec} offerSpec
|
|
82
|
-
* @param {ZCFSeat} seat
|
|
83
|
-
* @param {boolean} trySettle
|
|
84
|
-
*/
|
|
85
|
-
addOffer(offerSpec: OfferSpec, seat: ZCFSeat, trySettle: boolean): void;
|
|
86
|
-
getSeats(): {
|
|
87
|
-
collateralSeat: globalThis.ZCFSeat;
|
|
88
|
-
bidHoldingSeat: globalThis.ZCFSeat;
|
|
89
|
-
};
|
|
90
|
-
exitAllSeats(): void;
|
|
91
|
-
endAuction(): void;
|
|
92
|
-
getDataUpdates(): globalThis.Subscriber<BookDataNotification>;
|
|
93
|
-
getPublicTopics(): {
|
|
94
|
-
bookData: import("@agoric/zoe/src/contractSupport/topics.js").PublicTopic<BookDataNotification>;
|
|
95
|
-
};
|
|
96
|
-
};
|
|
97
|
-
}>>["self"];
|
|
98
|
-
export type OfferSpec = {
|
|
99
|
-
maxBuy: Amount<"nat">;
|
|
100
|
-
} & {
|
|
101
|
-
exitAfterBuy?: boolean;
|
|
102
|
-
} & ({
|
|
103
|
-
offerPrice: Ratio;
|
|
104
|
-
} | {
|
|
105
|
-
offerBidScaling: Ratio;
|
|
106
|
-
});
|
|
107
|
-
export type BookDataNotification = {
|
|
108
|
-
/**
|
|
109
|
-
* identifies the priceAuthority and price
|
|
110
|
-
*/
|
|
111
|
-
startPrice: Ratio | null;
|
|
112
|
-
/**
|
|
113
|
-
* the price at the current auction
|
|
114
|
-
* tier
|
|
115
|
-
*/
|
|
116
|
-
currentPriceLevel: Ratio | null;
|
|
117
|
-
/**
|
|
118
|
-
* The proceeds the sellers
|
|
119
|
-
* were targeting to raise
|
|
120
|
-
*/
|
|
121
|
-
startProceedsGoal: Amount<"nat"> | null;
|
|
122
|
-
/**
|
|
123
|
-
* The remainder of the
|
|
124
|
-
* proceeds the sellers were targeting to raise
|
|
125
|
-
*/
|
|
126
|
-
remainingProceedsGoal: Amount<"nat"> | null;
|
|
127
|
-
/**
|
|
128
|
-
* The proceeds raised so
|
|
129
|
-
* far in the auction
|
|
130
|
-
*/
|
|
131
|
-
proceedsRaised: Amount<"nat"> | undefined;
|
|
132
|
-
/**
|
|
133
|
-
* How much collateral was available
|
|
134
|
-
* for sale at the start. (If more is deposited later, it'll be added in.)
|
|
135
|
-
*/
|
|
136
|
-
startCollateral: Amount<"nat">;
|
|
137
|
-
/**
|
|
138
|
-
* The amount of collateral
|
|
139
|
-
* remaining
|
|
140
|
-
*/
|
|
141
|
-
collateralAvailable: Amount<"nat"> | null;
|
|
142
|
-
};
|
|
143
|
-
export type AuctionBook = EReturn<EReturn<typeof prepareAuctionBook>>;
|
|
144
|
-
import type { Baggage } from '@agoric/vat-data';
|
|
145
|
-
import type { MakeRecorderKit } from '@agoric/zoe/src/contractSupport/recorder.js';
|
|
146
|
-
import type { PriceAuthority } from '@agoric/zoe/tools/types.js';
|
|
147
|
-
import type { Remote } from '@agoric/internal';
|
|
148
|
-
import type { Ratio } from '@agoric/ertp';
|
|
149
|
-
import type { EReturn } from '@endo/far';
|
|
150
|
-
//# sourceMappingURL=auctionBook.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"auctionBook.d.ts","sourceRoot":"","sources":["auctionBook.js"],"names":[],"mappings":"AAiFO,6CAHI,KAAK,CAAC,KAAK,CAAC,mBACZ,KAAK,CAAC,KAAK,CAAC,oCAiBtB;AAwBM,4CAJI,OAAO,OACP,GAAG,mBACH,eAAe,sJA8pBhB,UAAU;;QAriBZ;;;;;;WAMG;+BAFQ,MAAM,SACN,KAAK,GAAG,SAAS;QAW5B;;;;;;;WAOG;2BAHQ,MAAM,kBACN,MAAM,SACN,KAAK,GAAG,SAAS;QAW5B;;;;;;WAMG;qBAFQ,OAAO,oBACP,MAAM,CAAC,KAAK,CAAC;QA+DxB;;;;;;;;;;;WAWG;+BANQ,OAAO,SACP,KAAK,UACL,MAAM,CAAC,KAAK,CAAC,+BAErB;YAAsB,SAAS,EAAvB,OAAO;YACQ,YAAY;SAAC;QAsCvC;;;;;;;;;;;WAWG;mCANQ,OAAO,cACP,KAAK,UACL,MAAM,CAAC,KAAK,CAAC,+BAErB;YAAsB,SAAS,EAAvB,OAAO;YACQ,YAAY;SAAC;;;;;QAyHvC;;;;;;;;WAQG;+BAPQ,MAAM,CAAC,KAAK,CAAC,cACb,OAAO,iBACP,MAAM,CAAC,KAAK,CAAC;mCA2ED,KAAK,GAAK,IAAI;;;;;QAuGrC;;;;WAIG;4BAHQ,SAAS,QACT,OAAO,aACP,OAAO;;;;;;;;;;;;GAqFqB,CAAC,MAAM,CAAC,CAItD;wBAxtBY;IACR,MAAM,EAAE,MAAM,CAAC,KAAK,CAAC,CAAC;CACvB,GAAG;IACF,YAAY,CAAC,EAAE,OAAO,CAAC;CACxB,GAAG,CACE;IACE,UAAU,EAAE,KAAK,CAAC;CACnB,GACD;IACE,eAAe,EAAE,KAAK,CAAC;CACxB,CACJ;;;;;gBAyBQ,KAAK,GAAG,IAAI;;;;;uBACZ,KAAK,GAAG,IAAI;;;;;uBAEZ,MAAM,CAAC,KAAK,CAAC,GAAG,IAAI;;;;;2BAEpB,MAAM,CAAC,KAAK,CAAC,GAAG,IAAI;;;;;oBAEpB,MAAM,CAAC,KAAK,CAAC,GAAG,SAAS;;;;;qBAEzB,MAAM,CAAC,KAAK,CAAC;;;;;yBAEb,MAAM,CAAC,KAAK,CAAC,GAAG,IAAI;;0BA4qBpB,QAAQ,QAAQ,OAAO,kBAAkB,CAAC,CAAC;6BA5vB/B,kBAAkB;qCAGV,6CAA6C;oCAF9C,4BAA4B;4BACtB,kBAAkB;2BAEjC,cAAc;6BALZ,WAAW"}
|