@agoric/zoe 0.26.3-u15.0 → 0.26.3-u16.1
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/README.md +7 -7
- package/bundles/bundle-contractFacet-js-meta.json +620 -311
- package/bundles/bundle-contractFacet.d.ts +3 -3
- package/bundles/bundle-contractFacet.js +1 -1
- package/exported.js +1 -12
- package/package.json +75 -60
- package/src/cleanProposal.d.ts +2 -2
- package/src/cleanProposal.d.ts.map +1 -1
- package/src/cleanProposal.js +15 -12
- package/src/contractFacet/evalContractCode.d.ts.map +1 -1
- package/src/contractFacet/evalContractCode.js +2 -2
- package/src/contractFacet/exit.d.ts.map +1 -1
- package/src/contractFacet/exit.js +1 -0
- package/src/contractFacet/internal-types.d.ts +2 -2
- package/src/contractFacet/internal-types.d.ts.map +1 -1
- package/src/contractFacet/internal-types.js +1 -1
- package/src/contractFacet/offerHandlerStorage.d.ts +4 -1
- package/src/contractFacet/offerHandlerStorage.d.ts.map +1 -1
- package/src/contractFacet/offerHandlerStorage.js +11 -3
- package/src/contractFacet/reallocate.d.ts +3 -0
- package/src/contractFacet/reallocate.d.ts.map +1 -0
- package/src/contractFacet/reallocate.js +94 -0
- package/src/contractFacet/rightsConservation.d.ts.map +1 -1
- package/src/contractFacet/rightsConservation.js +3 -0
- package/src/contractFacet/types-ambient.d.ts +271 -0
- package/src/contractFacet/types-ambient.js +1 -0
- package/src/contractFacet/vatRoot.d.ts +3 -3
- package/src/contractFacet/vatRoot.d.ts.map +1 -1
- package/src/contractFacet/zcfMint.d.ts +4 -2
- package/src/contractFacet/zcfMint.d.ts.map +1 -1
- package/src/contractFacet/zcfMint.js +6 -6
- package/src/contractFacet/zcfSeat.d.ts +4 -2
- package/src/contractFacet/zcfSeat.d.ts.map +1 -1
- package/src/contractFacet/zcfSeat.js +130 -7
- package/src/contractFacet/zcfZygote.d.ts +1 -2
- package/src/contractFacet/zcfZygote.d.ts.map +1 -1
- package/src/contractFacet/zcfZygote.js +92 -43
- package/src/contractSupport/atomicTransfer.d.ts +0 -6
- package/src/contractSupport/atomicTransfer.d.ts.map +1 -1
- package/src/contractSupport/atomicTransfer.js +5 -90
- package/src/contractSupport/bondingCurves.js +2 -2
- package/src/contractSupport/durability.d.ts +3 -3
- package/src/contractSupport/durability.d.ts.map +1 -1
- package/src/contractSupport/durability.js +5 -5
- package/src/contractSupport/index.d.ts +1 -0
- package/src/contractSupport/index.js +1 -0
- package/src/contractSupport/prepare-ownable.d.ts +11 -0
- package/src/contractSupport/prepare-ownable.d.ts.map +1 -0
- package/src/contractSupport/prepare-ownable.js +100 -0
- package/src/contractSupport/priceAuthority.d.ts +23 -15
- package/src/contractSupport/priceAuthority.d.ts.map +1 -1
- package/src/contractSupport/priceAuthority.js +33 -18
- package/src/contractSupport/priceAuthorityInitial.d.ts +3 -2
- package/src/contractSupport/priceAuthorityInitial.d.ts.map +1 -1
- package/src/contractSupport/priceAuthorityInitial.js +6 -3
- package/src/contractSupport/priceAuthorityQuoteMint.d.ts +2 -1
- package/src/contractSupport/priceAuthorityQuoteMint.d.ts.map +1 -1
- package/src/contractSupport/priceAuthorityQuoteMint.js +23 -27
- package/src/contractSupport/priceAuthorityTransform.d.ts +13 -11
- package/src/contractSupport/priceAuthorityTransform.d.ts.map +1 -1
- package/src/contractSupport/priceAuthorityTransform.js +10 -8
- package/src/contractSupport/priceQuote.d.ts +7 -5
- package/src/contractSupport/priceQuote.d.ts.map +1 -1
- package/src/contractSupport/priceQuote.js +5 -1
- package/src/contractSupport/ratio.d.ts +2 -2
- package/src/contractSupport/ratio.d.ts.map +1 -1
- package/src/contractSupport/ratio.js +19 -15
- package/src/contractSupport/recorder.d.ts +33 -119
- package/src/contractSupport/recorder.d.ts.map +1 -1
- package/src/contractSupport/recorder.js +21 -10
- package/src/contractSupport/safeMath.d.ts +7 -7
- package/src/contractSupport/safeMath.d.ts.map +1 -1
- package/src/contractSupport/statistics.d.ts +1 -1
- package/src/contractSupport/statistics.d.ts.map +1 -1
- package/src/contractSupport/topics.d.ts +1 -1
- package/src/contractSupport/topics.d.ts.map +1 -1
- package/src/contractSupport/{types.d.ts → types-ambient.d.ts} +4 -4
- package/src/contractSupport/types-ambient.d.ts.map +1 -0
- package/src/contractSupport/{types.js → types-ambient.js} +1 -1
- package/src/contractSupport/zoeHelpers.d.ts +1 -1
- package/src/contractSupport/zoeHelpers.d.ts.map +1 -1
- package/src/contractSupport/zoeHelpers.js +6 -12
- package/src/contracts/auction/firstPriceLogic.d.ts.map +1 -1
- package/src/contracts/auction/firstPriceLogic.js +5 -8
- package/src/contracts/auction/index.d.ts +10 -10
- package/src/contracts/auction/index.d.ts.map +1 -1
- package/src/contracts/auction/index.js +3 -3
- package/src/contracts/auction/secondPriceLogic.d.ts.map +1 -1
- package/src/contracts/auction/secondPriceLogic.js +1 -4
- package/src/contracts/automaticRefund.d.ts +1 -1
- package/src/contracts/automaticRefund.d.ts.map +1 -1
- package/src/contracts/autoswap.d.ts.map +1 -1
- package/src/contracts/autoswap.js +8 -9
- package/src/contracts/barterExchange.d.ts +1 -1
- package/src/contracts/barterExchange.d.ts.map +1 -1
- package/src/contracts/barterExchange.js +2 -3
- package/src/contracts/callSpread/calculateShares.d.ts +1 -8
- package/src/contracts/callSpread/calculateShares.d.ts.map +1 -1
- package/src/contracts/callSpread/calculateShares.js +1 -1
- package/src/contracts/callSpread/fundedCallSpread.d.ts +4 -0
- package/src/contracts/callSpread/fundedCallSpread.d.ts.map +1 -1
- package/src/contracts/callSpread/fundedCallSpread.js +6 -4
- package/src/contracts/callSpread/payoffHandler.d.ts.map +1 -1
- package/src/contracts/callSpread/payoffHandler.js +3 -2
- package/src/contracts/callSpread/percent.d.ts +2 -4
- package/src/contracts/callSpread/percent.d.ts.map +1 -1
- package/src/contracts/callSpread/position.d.ts +2 -2
- package/src/contracts/callSpread/pricedCallSpread.d.ts +6 -5
- package/src/contracts/callSpread/pricedCallSpread.d.ts.map +1 -1
- package/src/contracts/callSpread/pricedCallSpread.js +9 -5
- package/src/contracts/callSpread/{types.d.ts → types-ambient.d.ts} +3 -3
- package/src/contracts/callSpread/types-ambient.d.ts.map +1 -0
- package/src/contracts/coveredCall-durable.d.ts +2 -4
- package/src/contracts/coveredCall-durable.d.ts.map +1 -1
- package/src/contracts/exported.js +3 -3
- package/src/contracts/loan/borrow.d.ts.map +1 -1
- package/src/contracts/loan/borrow.js +7 -4
- package/src/contracts/loan/close.d.ts.map +1 -1
- package/src/contracts/loan/close.js +3 -7
- package/src/contracts/loan/index.d.ts +5 -1
- package/src/contracts/loan/index.d.ts.map +1 -1
- package/src/contracts/loan/index.js +4 -0
- package/src/contracts/loan/liquidate.d.ts +1 -12
- package/src/contracts/loan/liquidate.d.ts.map +1 -1
- package/src/contracts/loan/liquidate.js +4 -2
- package/src/contracts/loan/scheduleLiquidation.d.ts.map +1 -1
- package/src/contracts/loan/scheduleLiquidation.js +2 -1
- package/src/contracts/loan/{types.d.ts → types-ambient.d.ts} +16 -17
- package/src/contracts/loan/types-ambient.d.ts.map +1 -0
- package/src/contracts/loan/{types.js → types-ambient.js} +11 -18
- package/src/contracts/loan/updateDebt.js +1 -1
- package/src/contracts/mintAndSellNFT.d.ts.map +1 -1
- package/src/contracts/mintPayments.d.ts +14 -6
- package/src/contracts/mintPayments.d.ts.map +1 -1
- package/src/contracts/mintPayments.js +1 -1
- package/src/contracts/oracle.d.ts +6 -2
- package/src/contracts/oracle.d.ts.map +1 -1
- package/src/contracts/oracle.js +10 -3
- package/src/contracts/otcDesk.d.ts +3 -3
- package/src/contracts/otcDesk.d.ts.map +1 -1
- package/src/contracts/otcDesk.js +1 -1
- package/src/contracts/priceAggregator.d.ts +25 -17
- package/src/contracts/priceAggregator.d.ts.map +1 -1
- package/src/contracts/priceAggregator.js +33 -32
- package/src/contracts/priceAggregatorTypes.d.ts +2 -2
- package/src/contracts/priceAggregatorTypes.d.ts.map +1 -1
- package/src/contracts/scaledPriceAuthority.d.ts +3 -4
- package/src/contracts/scaledPriceAuthority.d.ts.map +1 -1
- package/src/contracts/scaledPriceAuthority.js +6 -0
- package/src/contracts/sellItems.d.ts +2 -2
- package/src/contracts/sellItems.d.ts.map +1 -1
- package/src/contracts/sellItems.js +3 -4
- package/src/contracts/simpleExchange.d.ts +3 -3
- package/src/contracts/{types.d.ts → types-ambient.d.ts} +1 -1
- package/src/contracts/types-ambient.d.ts.map +1 -0
- package/src/handleWarning.d.ts.map +1 -1
- package/src/instanceRecordStorage.d.ts +1 -1
- package/src/instanceRecordStorage.d.ts.map +1 -1
- package/src/internal-types.d.ts +20 -32
- package/src/internal-types.d.ts.map +1 -1
- package/src/internal-types.js +18 -58
- package/src/issuerRecord.d.ts +1 -1
- package/src/issuerRecord.d.ts.map +1 -1
- package/src/issuerStorage.d.ts +3 -3
- package/src/issuerStorage.d.ts.map +1 -1
- package/src/issuerStorage.js +12 -28
- package/src/makeHandle.d.ts +2 -2
- package/src/makeHandle.d.ts.map +1 -1
- package/src/makeHandle.js +1 -1
- package/src/typeGuards.d.ts +119 -20
- package/src/typeGuards.d.ts.map +1 -1
- package/src/typeGuards.js +18 -9
- package/src/types-ambient.d.ts +41 -0
- package/src/types-ambient.d.ts.map +1 -0
- package/src/{types.js → types-ambient.js} +7 -15
- package/src/zoeService/escrowStorage.d.ts +1 -1
- package/src/zoeService/escrowStorage.d.ts.map +1 -1
- package/src/zoeService/escrowStorage.js +20 -27
- package/src/zoeService/feeMint.d.ts +9 -16
- package/src/zoeService/feeMint.d.ts.map +1 -1
- package/src/zoeService/feeMint.js +21 -15
- package/src/zoeService/installationStorage.d.ts +5 -20
- package/src/zoeService/installationStorage.d.ts.map +1 -1
- package/src/zoeService/installationStorage.js +11 -7
- package/src/zoeService/instanceAdminStorage.d.ts +22 -42
- package/src/zoeService/instanceAdminStorage.d.ts.map +1 -1
- package/src/zoeService/instanceAdminStorage.js +2 -1
- package/src/zoeService/internal-types.d.ts +12 -12
- package/src/zoeService/internal-types.d.ts.map +1 -1
- package/src/zoeService/internal-types.js +6 -6
- package/src/zoeService/invitationQueries.d.ts.map +1 -1
- package/src/zoeService/invitationQueries.js +7 -5
- package/src/zoeService/makeInvitation.d.ts +3 -3
- package/src/zoeService/makeInvitation.d.ts.map +1 -1
- package/src/zoeService/makeInvitation.js +25 -21
- package/src/zoeService/offer/burnInvitation.d.ts.map +1 -1
- package/src/zoeService/offer/offer.d.ts.map +1 -1
- package/src/zoeService/offer/offer.js +2 -5
- package/src/zoeService/originalZoeSeat.d.ts +34 -0
- package/src/zoeService/originalZoeSeat.d.ts.map +1 -0
- package/src/zoeService/originalZoeSeat.js +353 -0
- package/src/zoeService/startInstance.d.ts +3 -3
- package/src/zoeService/startInstance.d.ts.map +1 -1
- package/src/zoeService/startInstance.js +17 -11
- package/src/zoeService/{types.d.ts → types-ambient.d.ts} +23 -28
- package/src/zoeService/types-ambient.d.ts.map +1 -0
- package/src/zoeService/{types.js → types-ambient.js} +19 -32
- package/src/zoeService/utils.d.ts +57 -58
- package/src/zoeService/utils.test-d.d.ts +2 -0
- package/src/zoeService/utils.test-d.d.ts.map +1 -0
- package/src/zoeService/utils.test-d.ts +33 -0
- package/src/zoeService/zoe.d.ts +9 -13
- package/src/zoeService/zoe.d.ts.map +1 -1
- package/src/zoeService/zoe.js +7 -7
- package/src/zoeService/zoeSeat.d.ts +15 -45
- package/src/zoeService/zoeSeat.d.ts.map +1 -1
- package/src/zoeService/zoeSeat.js +215 -115
- package/src/zoeService/zoeStorageManager.d.ts +13 -47
- package/src/zoeService/zoeStorageManager.d.ts.map +1 -1
- package/src/zoeService/zoeStorageManager.js +8 -6
- package/tools/fakePriceAuthority.d.ts +9 -8
- package/tools/fakePriceAuthority.d.ts.map +1 -1
- package/tools/fakePriceAuthority.js +21 -17
- package/tools/fakeVatAdmin.d.ts +10 -10
- package/tools/manualPriceAuthority.d.ts +11 -6
- package/tools/manualPriceAuthority.d.ts.map +1 -1
- package/tools/manualPriceAuthority.js +16 -3
- package/tools/manualTimer.d.ts +17 -40
- package/tools/manualTimer.d.ts.map +1 -1
- package/tools/manualTimer.js +30 -16
- package/tools/prepare-test-env.js +1 -1
- package/tools/scriptedOracle.d.ts +3 -3
- package/tools/scriptedOracle.d.ts.map +1 -1
- package/tools/scriptedOracle.js +1 -1
- package/tools/scriptedPriceAuthority.d.ts +4 -0
- package/tools/scriptedPriceAuthority.d.ts.map +1 -1
- package/tools/scriptedPriceAuthority.js +8 -3
- package/tools/setup-zoe.d.ts +8 -9
- package/tools/setup-zoe.d.ts.map +1 -1
- package/tools/setup-zoe.js +16 -1
- package/tools/test-utils.d.ts +20 -0
- package/tools/test-utils.d.ts.map +1 -0
- package/tools/test-utils.js +26 -0
- package/tools/types.d.ts +21 -21
- package/tools/types.d.ts.map +1 -1
- package/tools/types.js +10 -10
- package/CHANGELOG.md +0 -1227
- package/src/contractFacet/types.d.ts +0 -191
- package/src/contractFacet/types.d.ts.map +0 -1
- package/src/contractFacet/types.js +0 -256
- package/src/contractSupport/types.d.ts.map +0 -1
- package/src/contracts/callSpread/types.d.ts.map +0 -1
- package/src/contracts/loan/types.d.ts.map +0 -1
- package/src/contracts/types.d.ts.map +0 -1
- package/src/objArrayConversion.d.ts +0 -5
- package/src/objArrayConversion.d.ts.map +0 -1
- package/src/objArrayConversion.js +0 -35
- package/src/types.d.ts +0 -45
- package/src/types.d.ts.map +0 -1
- package/src/zoeService/types.d.ts.map +0 -1
- package/tools/internal-types.d.ts +0 -12
- package/tools/internal-types.d.ts.map +0 -1
- package/tools/internal-types.js +0 -14
- package/tools/priceAuthorityRegistry.d.ts +0 -20
- package/tools/priceAuthorityRegistry.d.ts.map +0 -1
- package/tools/priceAuthorityRegistry.js +0 -209
- package/tools/types-ambient.d.ts +0 -142
- package/tools/types-ambient.d.ts.map +0 -1
- package/tools/types-ambient.js +0 -160
- /package/src/contracts/callSpread/{types.js → types-ambient.js} +0 -0
- /package/src/contracts/{types.js → types-ambient.js} +0 -0
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
/* eslint @typescript-eslint/no-floating-promises: "warn" */
|
|
1
2
|
import { E } from '@endo/eventual-send';
|
|
2
3
|
import { mustMatch } from '@endo/patterns';
|
|
3
4
|
import { Far } from '@endo/marshal';
|
|
@@ -36,7 +37,7 @@ const SECOND_PRICE = 'second-price';
|
|
|
36
37
|
* null } want: { Asset: null } }.
|
|
37
38
|
*
|
|
38
39
|
* @param {ZCF<{
|
|
39
|
-
* timeAuthority: import('@agoric/time
|
|
40
|
+
* timeAuthority: import('@agoric/time').TimerService,
|
|
40
41
|
* winnerPriceOption?: FIRST_PRICE | SECOND_PRICE,
|
|
41
42
|
* bidDuration: bigint,
|
|
42
43
|
* }>} zcf
|
|
@@ -126,8 +127,7 @@ const start = zcf => {
|
|
|
126
127
|
});
|
|
127
128
|
assertBidSeat(zcf, sellSeat, seat);
|
|
128
129
|
|
|
129
|
-
|
|
130
|
-
startWakeupTimerIfNeeded();
|
|
130
|
+
void startWakeupTimerIfNeeded();
|
|
131
131
|
|
|
132
132
|
bidSeats.push(seat);
|
|
133
133
|
return defaultAcceptanceMsg;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"secondPriceLogic.d.ts","sourceRoot":"","sources":["secondPriceLogic.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"secondPriceLogic.d.ts","sourceRoot":"","sources":["secondPriceLogic.js"],"names":[],"mappings":"AAOO,wCAJI,GAAG,YACH,OAAO,YACP,KAAK,CAAC,OAAO,CAAC,QA8DxB"}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { AmountMath } from '@agoric/ertp';
|
|
2
|
-
import { atomicRearrange } from '../../contractSupport/index.js';
|
|
3
2
|
|
|
4
3
|
/**
|
|
5
4
|
* @param {ZCF} zcf
|
|
@@ -24,7 +23,6 @@ export const calcWinnerAndClose = (zcf, sellSeat, bidSeats) => {
|
|
|
24
23
|
bidSeats.forEach(bidSeat => {
|
|
25
24
|
if (!bidSeat.hasExited()) {
|
|
26
25
|
activeBidsCount += 1n;
|
|
27
|
-
/** @type {Amount<'nat'>} */
|
|
28
26
|
const bid = bidSeat.getAmountAllocated('Bid', bidBrand);
|
|
29
27
|
// If the bid is greater than the highestBid, it's the new highestBid
|
|
30
28
|
if (AmountMath.isGTE(bid, highestBid, bidBrand)) {
|
|
@@ -48,8 +46,7 @@ export const calcWinnerAndClose = (zcf, sellSeat, bidSeats) => {
|
|
|
48
46
|
}
|
|
49
47
|
|
|
50
48
|
// Everyone else gets a refund so their values remain the same.
|
|
51
|
-
atomicRearrange(
|
|
52
|
-
zcf,
|
|
49
|
+
zcf.atomicRearrange(
|
|
53
50
|
harden([
|
|
54
51
|
[
|
|
55
52
|
highestBidSeat,
|
|
@@ -17,7 +17,7 @@ export function start(zcf: ZCF<{}>): {
|
|
|
17
17
|
publicFacet: {
|
|
18
18
|
getOffersCount: () => bigint;
|
|
19
19
|
makeInvitation: () => Promise<Invitation<unknown, never>>;
|
|
20
|
-
} & import("@endo/eventual-send").RemotableBrand<{}, {
|
|
20
|
+
} & import("@endo/marshal").RemotableObject<`Alleged: ${string}`> & import("@endo/eventual-send").RemotableBrand<{}, {
|
|
21
21
|
getOffersCount: () => bigint;
|
|
22
22
|
makeInvitation: () => Promise<Invitation<unknown, never>>;
|
|
23
23
|
}>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"automaticRefund.d.ts","sourceRoot":"","sources":["automaticRefund.js"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;GAaG;AACH,2BAFW,
|
|
1
|
+
{"version":3,"file":"automaticRefund.d.ts","sourceRoot":"","sources":["automaticRefund.js"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;GAaG;AACH,2BAFW,GAAG,CAAC,EAAE,CAAC;;;;;;;;;EAqBjB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"autoswap.d.ts","sourceRoot":"","sources":["autoswap.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"autoswap.d.ts","sourceRoot":"","sources":["autoswap.js"],"names":[],"mappings":"AAeA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsCG;AACH,2BAFW,GAAG;;GAsVb"}
|
|
@@ -11,7 +11,6 @@ import {
|
|
|
11
11
|
assertProposalShape,
|
|
12
12
|
assertNatAssetKind,
|
|
13
13
|
calcSecondaryRequired,
|
|
14
|
-
atomicRearrange,
|
|
15
14
|
} from '../contractSupport/index.js';
|
|
16
15
|
|
|
17
16
|
/**
|
|
@@ -88,8 +87,7 @@ const start = async zcf => {
|
|
|
88
87
|
};
|
|
89
88
|
|
|
90
89
|
function consummate(tradeAmountIn, tradeAmountOut, swapSeat) {
|
|
91
|
-
atomicRearrange(
|
|
92
|
-
zcf,
|
|
90
|
+
zcf.atomicRearrange(
|
|
93
91
|
harden([
|
|
94
92
|
[
|
|
95
93
|
swapSeat,
|
|
@@ -167,6 +165,7 @@ const start = async zcf => {
|
|
|
167
165
|
} = swapSeat.getProposal();
|
|
168
166
|
|
|
169
167
|
assert(isNatValue(wantedAmountOut.value));
|
|
168
|
+
assert.typeof(amountIn.value, 'bigint');
|
|
170
169
|
|
|
171
170
|
const tradePrice = getOutputPrice(
|
|
172
171
|
wantedAmountOut.value,
|
|
@@ -204,8 +203,7 @@ const start = async zcf => {
|
|
|
204
203
|
Central: AmountMath.make(brands.Central, centralIn),
|
|
205
204
|
Secondary: secondaryAmount,
|
|
206
205
|
};
|
|
207
|
-
atomicRearrange(
|
|
208
|
-
zcf,
|
|
206
|
+
zcf.atomicRearrange(
|
|
209
207
|
harden([
|
|
210
208
|
[seat, poolSeat, liquidityDeposited],
|
|
211
209
|
[poolSeat, seat, { Liquidity: liquidityAmountOut }],
|
|
@@ -276,8 +274,10 @@ const start = async zcf => {
|
|
|
276
274
|
});
|
|
277
275
|
|
|
278
276
|
// TODO (hibbert) should we burn tokens?
|
|
279
|
-
|
|
280
|
-
/** @type {Amount<'nat'>} */
|
|
277
|
+
|
|
278
|
+
const userAllocation = /** @type {{Liquidity: Amount<'nat'>}} */ (
|
|
279
|
+
removeLiqSeat.getCurrentAllocation()
|
|
280
|
+
);
|
|
281
281
|
const liquidityIn = userAllocation.Liquidity;
|
|
282
282
|
assert(!AmountMath.isEmpty(liquidityIn), 'Pool is empty');
|
|
283
283
|
const liquidityValueIn = liquidityIn.value;
|
|
@@ -307,8 +307,7 @@ const start = async zcf => {
|
|
|
307
307
|
Secondary: newUserSecondaryAmount,
|
|
308
308
|
};
|
|
309
309
|
|
|
310
|
-
atomicRearrange(
|
|
311
|
-
zcf,
|
|
310
|
+
zcf.atomicRearrange(
|
|
312
311
|
harden([
|
|
313
312
|
[removeLiqSeat, poolSeat, { Liquidity: userAllocation.Liquidity }],
|
|
314
313
|
[poolSeat, removeLiqSeat, liquidityRemoved],
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
export function start(zcf: ZCF): {
|
|
16
16
|
publicFacet: {
|
|
17
17
|
makeInvitation: () => Promise<Invitation<unknown, never>>;
|
|
18
|
-
} & import("@endo/eventual-send").RemotableBrand<{}, {
|
|
18
|
+
} & import("@endo/marshal").RemotableObject<`Alleged: ${string}`> & import("@endo/eventual-send").RemotableBrand<{}, {
|
|
19
19
|
makeInvitation: () => Promise<Invitation<unknown, never>>;
|
|
20
20
|
}>;
|
|
21
21
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"barterExchange.d.ts","sourceRoot":"","sources":["barterExchange.js"],"names":[],"mappings":"AAKA;;;;;;;;;;;;;GAaG;AACH,2BAFW,GAAG;;;;;;
|
|
1
|
+
{"version":3,"file":"barterExchange.d.ts","sourceRoot":"","sources":["barterExchange.js"],"names":[],"mappings":"AAKA;;;;;;;;;;;;;GAaG;AACH,2BAFW,GAAG;;;;;;EA+Gb"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Far } from '@endo/marshal';
|
|
2
2
|
import { makeLegacyMap } from '@agoric/store';
|
|
3
3
|
// Eventually will be importable from '@agoric/zoe-contract-support'
|
|
4
|
-
import { satisfies
|
|
4
|
+
import { satisfies } from '../contractSupport/index.js';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* This Barter Exchange accepts offers to trade arbitrary goods for other
|
|
@@ -63,8 +63,7 @@ const start = zcf => {
|
|
|
63
63
|
const matchingTrade = findMatchingTrade(offerDetails, orders);
|
|
64
64
|
if (matchingTrade) {
|
|
65
65
|
// reallocate by giving each side what it wants
|
|
66
|
-
atomicRearrange(
|
|
67
|
-
zcf,
|
|
66
|
+
zcf.atomicRearrange(
|
|
68
67
|
harden([
|
|
69
68
|
[
|
|
70
69
|
offerDetails.seat,
|
|
@@ -1,9 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
* Calculate the portion (as a Ratio) of the collateral that should be
|
|
3
|
-
* allocated to the long side of a call spread contract. price gives the value
|
|
4
|
-
* of the underlying asset at closing that determines the payouts to the parties
|
|
5
|
-
*
|
|
6
|
-
* @type {CalculateShares}
|
|
7
|
-
*/
|
|
8
|
-
export function calculateShares(collateralBrand: Brand<AssetKind>, price: Amount<"nat">, strikePrice1: Amount<"nat">, strikePrice2: Amount<"nat">): CalculateSharesReturn;
|
|
1
|
+
export function calculateShares(collateralBrand: Brand, price: Amount<"nat">, strikePrice1: Amount<"nat">, strikePrice2: Amount<"nat">): CalculateSharesReturn;
|
|
9
2
|
//# sourceMappingURL=calculateShares.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"calculateShares.d.ts","sourceRoot":"","sources":["calculateShares.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"calculateShares.d.ts","sourceRoot":"","sources":["calculateShares.js"],"names":[],"mappings":""}
|
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @import {PriceAuthority} from '@agoric/zoe/tools/types.js';
|
|
3
|
+
*/
|
|
1
4
|
/**
|
|
2
5
|
* This contract implements a fully collateralized call spread. This is a
|
|
3
6
|
* combination of a call option bought at one strike price and a second call
|
|
@@ -57,4 +60,5 @@ export function start(zcf: ZCF<{
|
|
|
57
60
|
}>): Promise<{
|
|
58
61
|
creatorInvitation: Promise<Invitation<unknown, never>>;
|
|
59
62
|
}>;
|
|
63
|
+
import type { PriceAuthority } from '@agoric/zoe/tools/types.js';
|
|
60
64
|
//# sourceMappingURL=fundedCallSpread.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fundedCallSpread.d.ts","sourceRoot":"","sources":["fundedCallSpread.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"fundedCallSpread.d.ts","sourceRoot":"","sources":["fundedCallSpread.js"],"names":[],"mappings":"AAaA;;GAEG;AAEH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsCG;AAEH;;;;;;;;;GASG;AACH,2BATW,GAAG,CAAC;IACd,YAAc,EAAE,MAAM,CAAC;IACvB,YAAc,EAAE,MAAM,CAAC;IACvB,gBAAkB,EAAE,MAAM,CAAC;IAC3B,cAAgB,EAAE,cAAc,CAAC;IACjC,UAAY,EAAE,MAAM,CAAC;IACrB,gBAAkB,EAAE,MAAM,CAAC;CACxB,CAAC;;GA6EJ;oCAhIgC,4BAA4B"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
/// <reference path="./types-ambient.js" />
|
|
2
2
|
|
|
3
3
|
import { makePromiseKit } from '@endo/promise-kit';
|
|
4
4
|
import { E } from '@endo/eventual-send';
|
|
@@ -7,11 +7,14 @@ import {
|
|
|
7
7
|
assertProposalShape,
|
|
8
8
|
depositToSeat,
|
|
9
9
|
assertNatAssetKind,
|
|
10
|
-
atomicRearrange,
|
|
11
10
|
} from '../../contractSupport/index.js';
|
|
12
11
|
import { makePayoffHandler } from './payoffHandler.js';
|
|
13
12
|
import { Position } from './position.js';
|
|
14
13
|
|
|
14
|
+
/**
|
|
15
|
+
* @import {PriceAuthority} from '@agoric/zoe/tools/types.js';
|
|
16
|
+
*/
|
|
17
|
+
|
|
15
18
|
/**
|
|
16
19
|
* This contract implements a fully collateralized call spread. This is a
|
|
17
20
|
* combination of a call option bought at one strike price and a second call
|
|
@@ -112,8 +115,7 @@ const start = async zcf => {
|
|
|
112
115
|
give: { Collateral: null },
|
|
113
116
|
want: { LongOption: null, ShortOption: null },
|
|
114
117
|
});
|
|
115
|
-
atomicRearrange(
|
|
116
|
-
zcf,
|
|
118
|
+
zcf.atomicRearrange(
|
|
117
119
|
harden([
|
|
118
120
|
[creatorSeat, collateralSeat, { Collateral: settlementAmount }],
|
|
119
121
|
[
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"payoffHandler.d.ts","sourceRoot":"","sources":["payoffHandler.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"payoffHandler.d.ts","sourceRoot":"","sources":["payoffHandler.js"],"names":[],"mappings":"AAaA;;;;;;;;GAQG;AACH,uCALW,GAAG,CAAC,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC,mBACxB,MAAM,CAAC,YAAY,EAAC,aAAa,CAAC,OAAO,CAAC,CAAC,kBAC3C,OAAO,GACL,aAAa,CAgEzB"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
|
|
1
|
+
/* eslint @typescript-eslint/no-floating-promises: "warn" */
|
|
2
|
+
/// <reference path="./types-ambient.js" />
|
|
2
3
|
|
|
3
4
|
import { E } from '@endo/eventual-send';
|
|
4
5
|
import { AmountMath } from '@agoric/ertp';
|
|
@@ -39,7 +40,7 @@ function makePayoffHandler(zcf, seatPromiseKits, collateralSeat) {
|
|
|
39
40
|
}
|
|
40
41
|
|
|
41
42
|
function reallocateToSeat(seatPromise, seatPortion) {
|
|
42
|
-
E.when(seatPromise, seat => {
|
|
43
|
+
void E.when(seatPromise, seat => {
|
|
43
44
|
atomicTransfer(zcf, collateralSeat, seat, { Collateral: seatPortion });
|
|
44
45
|
seat.exit();
|
|
45
46
|
seatsExited += 1;
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
export function
|
|
3
|
-
/** @type {Make0Percent} */
|
|
4
|
-
export function make0Percent(brand: Brand<AssetKind>): Ratio;
|
|
1
|
+
export function make100Percent(brand: Brand): Ratio;
|
|
2
|
+
export function make0Percent(brand: Brand): Ratio;
|
|
5
3
|
//# sourceMappingURL=percent.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"percent.d.ts","sourceRoot":"","sources":["percent.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"percent.d.ts","sourceRoot":"","sources":["percent.js"],"names":[],"mappings":""}
|
|
@@ -44,23 +44,24 @@
|
|
|
44
44
|
* }>} zcf
|
|
45
45
|
*/
|
|
46
46
|
export function start(zcf: ZCF<{
|
|
47
|
-
strikePrice1: Amount<
|
|
48
|
-
strikePrice2: Amount<
|
|
49
|
-
settlementAmount: Amount<
|
|
47
|
+
strikePrice1: Amount<"nat">;
|
|
48
|
+
strikePrice2: Amount<"nat">;
|
|
49
|
+
settlementAmount: Amount<"nat">;
|
|
50
50
|
priceAuthority: PriceAuthority;
|
|
51
51
|
expiration: bigint;
|
|
52
|
-
underlyingAmount: Amount<
|
|
52
|
+
underlyingAmount: Amount<"nat">;
|
|
53
53
|
}>): {
|
|
54
54
|
creatorFacet: {
|
|
55
55
|
makeInvitationPair: (longCollateralShare: any) => {
|
|
56
56
|
longInvitation: Promise<Invitation<unknown, never>>;
|
|
57
57
|
shortInvitation: Promise<Invitation<unknown, never>>;
|
|
58
58
|
};
|
|
59
|
-
} & import("@endo/eventual-send").RemotableBrand<{}, {
|
|
59
|
+
} & import("@endo/marshal").RemotableObject<`Alleged: ${string}`> & import("@endo/eventual-send").RemotableBrand<{}, {
|
|
60
60
|
makeInvitationPair: (longCollateralShare: any) => {
|
|
61
61
|
longInvitation: Promise<Invitation<unknown, never>>;
|
|
62
62
|
shortInvitation: Promise<Invitation<unknown, never>>;
|
|
63
63
|
};
|
|
64
64
|
}>;
|
|
65
65
|
};
|
|
66
|
+
import type { PriceAuthority } from '@agoric/zoe/tools/types.js';
|
|
66
67
|
//# sourceMappingURL=pricedCallSpread.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pricedCallSpread.d.ts","sourceRoot":"","sources":["pricedCallSpread.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"pricedCallSpread.d.ts","sourceRoot":"","sources":["pricedCallSpread.js"],"names":[],"mappings":"AA0BA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4CG;AACH,2BATW,GAAG,CAAC;IACd,YAAc,EAAE,MAAM,CAAC,KAAK,CAAC,CAAC;IAC9B,YAAc,EAAE,MAAM,CAAC,KAAK,CAAC,CAAC;IAC9B,gBAAkB,EAAE,MAAM,CAAC,KAAK,CAAC,CAAC;IAClC,cAAgB,EAAE,cAAc,CAAC;IACjC,UAAY,EAAE,MAAM,CAAC;IACrB,gBAAkB,EAAE,MAAM,CAAC,KAAK,CAAC,CAAC;CAC/B,CAAC;;;;;;;;;;;;EA0GJ;oCA7J4F,4BAA4B"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
|
|
1
|
+
/* eslint @typescript-eslint/no-floating-promises: "warn" */
|
|
2
|
+
/// <reference path="./types-ambient.js" />
|
|
2
3
|
|
|
3
4
|
import { makePromiseKit } from '@endo/promise-kit';
|
|
4
5
|
import { E } from '@endo/eventual-send';
|
|
@@ -10,11 +11,14 @@ import {
|
|
|
10
11
|
assertNatAssetKind,
|
|
11
12
|
makeRatio,
|
|
12
13
|
ceilMultiplyBy,
|
|
13
|
-
atomicRearrange,
|
|
14
14
|
} from '../../contractSupport/index.js';
|
|
15
15
|
import { makePayoffHandler } from './payoffHandler.js';
|
|
16
16
|
import { Position } from './position.js';
|
|
17
17
|
|
|
18
|
+
/**
|
|
19
|
+
* @import {PriceAuthority, PriceDescription, PriceQuote, PriceQuoteValue, PriceQuery,} from '@agoric/zoe/tools/types.js';
|
|
20
|
+
*/
|
|
21
|
+
|
|
18
22
|
const { Fail } = assert;
|
|
19
23
|
|
|
20
24
|
const PERCENT_BASE = 100n;
|
|
@@ -77,7 +81,7 @@ const start = zcf => {
|
|
|
77
81
|
'strikePrice2 must be greater than strikePrice1',
|
|
78
82
|
);
|
|
79
83
|
|
|
80
|
-
zcf.saveIssuer(zcf.getInvitationIssuer(), 'Options');
|
|
84
|
+
void zcf.saveIssuer(zcf.getInvitationIssuer(), 'Options');
|
|
81
85
|
|
|
82
86
|
// We will create the two options early and allocate them to this seat.
|
|
83
87
|
const { zcfSeat: collateralSeat } = zcf.makeEmptySeatKit();
|
|
@@ -100,6 +104,7 @@ const start = zcf => {
|
|
|
100
104
|
const invitationIssuer = zcf.getInvitationIssuer();
|
|
101
105
|
const payment = harden({ Option: option });
|
|
102
106
|
const Option = await E(invitationIssuer).getAmountOf(option);
|
|
107
|
+
/** @type {any} */
|
|
103
108
|
const spreadAmount = harden({
|
|
104
109
|
Option,
|
|
105
110
|
});
|
|
@@ -132,8 +137,7 @@ const start = zcf => {
|
|
|
132
137
|
'wanted option not a match',
|
|
133
138
|
);
|
|
134
139
|
|
|
135
|
-
atomicRearrange(
|
|
136
|
-
zcf,
|
|
140
|
+
zcf.atomicRearrange(
|
|
137
141
|
harden([
|
|
138
142
|
[collateralSeat, depositSeat, spreadAmount],
|
|
139
143
|
[depositSeat, collateralSeat, { Collateral: newCollateral }],
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
type PositionKind =
|
|
1
|
+
type PositionKind = "long" | "short";
|
|
2
2
|
type MakeOptionInvitation = (positionKind: PositionKind) => Promise<Invitation>;
|
|
3
3
|
type PayoffHandler = {
|
|
4
4
|
schedulePayoffs: () => void;
|
|
@@ -24,7 +24,7 @@ type CalculateSharesReturn = {
|
|
|
24
24
|
* 100% reflecting the position of the price in the range from strikePrice1 to
|
|
25
25
|
* strikePrice2.
|
|
26
26
|
*/
|
|
27
|
-
type CalculateShares = (collateralBrand: Brand, price: Amount<
|
|
27
|
+
type CalculateShares = (collateralBrand: Brand, price: Amount<"nat">, strikePrice1: Amount<"nat">, strikePrice2: Amount<"nat">) => CalculateSharesReturn;
|
|
28
28
|
type Make100Percent = (brand: Brand) => Ratio;
|
|
29
29
|
type Make0Percent = (brand: Brand) => Ratio;
|
|
30
|
-
//# sourceMappingURL=types.d.ts.map
|
|
30
|
+
//# sourceMappingURL=types-ambient.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types-ambient.d.ts","sourceRoot":"","sources":["types-ambient.js"],"names":[],"mappings":"oBACa,MAAM,GAAG,OAAO;2CAKlB,YAAY,KACV,OAAO,CAAC,UAAU,CAAC;;qBAKlB,MAAM,IAAI;0BACT,oBAAoB;;;;;;;;eAQrB,KAAK;gBACL,KAAK;;;;;;;;;;;;;yCAcR,KAAK,SACL,MAAM,CAAC,KAAK,CAAC,gBACb,MAAM,CAAC,KAAK,CAAC,gBACb,MAAM,CAAC,KAAK,CAAC,KACX,qBAAqB;8BAKvB,KAAK,KACH,KAAK;4BAKP,KAAK,KACH,KAAK"}
|
|
@@ -13,10 +13,8 @@
|
|
|
13
13
|
* @param {unknown} _privateArgs
|
|
14
14
|
* @param {import('@agoric/vat-data').Baggage} instanceBaggage
|
|
15
15
|
*/
|
|
16
|
-
export function start(zcf: ZCF, _privateArgs: unknown, instanceBaggage:
|
|
17
|
-
creatorFacet: {
|
|
18
|
-
makeInvitation(): Promise<Invitation<unknown, never>>;
|
|
19
|
-
} & import("@endo/eventual-send").RemotableBrand<{}, {
|
|
16
|
+
export function start(zcf: ZCF, _privateArgs: unknown, instanceBaggage: import("@agoric/vat-data").Baggage): Promise<{
|
|
17
|
+
creatorFacet: import("@endo/exo").Guarded<{
|
|
20
18
|
makeInvitation(): Promise<Invitation<unknown, never>>;
|
|
21
19
|
}>;
|
|
22
20
|
}>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"coveredCall-durable.d.ts","sourceRoot":"","sources":["coveredCall-durable.js"],"names":[],"mappings":"AASA;;;;;;;;;;;;;;GAcG;AACH,2BAJW,GAAG,gBACH,OAAO
|
|
1
|
+
{"version":3,"file":"coveredCall-durable.d.ts","sourceRoot":"","sources":["coveredCall-durable.js"],"names":[],"mappings":"AASA;;;;;;;;;;;;;;GAcG;AACH,2BAJW,GAAG,gBACH,OAAO,mBACP,OAAO,kBAAkB,EAAE,OAAO;;;;GA6E5C"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
/// <reference path="./types-ambient.js" />
|
|
2
2
|
// eslint-disable-next-line no-restricted-syntax
|
|
3
|
-
import './loan/types.js';
|
|
4
|
-
import './callSpread/types.js';
|
|
3
|
+
import './loan/types-ambient.js';
|
|
4
|
+
import './callSpread/types-ambient.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"borrow.d.ts","sourceRoot":"","sources":["borrow.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"borrow.d.ts","sourceRoot":"","sources":["borrow.js"],"names":[],"mappings":"AAkBA,mCAAmC;AACnC,mCADW,oBAAoB,CAsI7B"}
|
|
@@ -9,7 +9,6 @@ import {
|
|
|
9
9
|
getAmountOut,
|
|
10
10
|
ceilMultiplyBy,
|
|
11
11
|
getTimestamp,
|
|
12
|
-
atomicRearrange,
|
|
13
12
|
} from '../../contractSupport/index.js';
|
|
14
13
|
|
|
15
14
|
import { scheduleLiquidation } from './scheduleLiquidation.js';
|
|
@@ -38,7 +37,12 @@ export const makeBorrowInvitation = (zcf, config) => {
|
|
|
38
37
|
want: { Loan: null },
|
|
39
38
|
});
|
|
40
39
|
|
|
41
|
-
const collateralGiven = borrowerSeat.getAmountAllocated(
|
|
40
|
+
const collateralGiven = borrowerSeat.getAmountAllocated(
|
|
41
|
+
'Collateral',
|
|
42
|
+
/** @type {Brand<'nat'>} */ (
|
|
43
|
+
borrowerSeat.getProposal().give.Collateral.brand
|
|
44
|
+
),
|
|
45
|
+
);
|
|
42
46
|
const loanWanted = borrowerSeat.getProposal().want.Loan;
|
|
43
47
|
const loanBrand = zcf.getTerms().brands.Loan;
|
|
44
48
|
|
|
@@ -72,8 +76,7 @@ export const makeBorrowInvitation = (zcf, config) => {
|
|
|
72
76
|
|
|
73
77
|
const { zcfSeat: collateralSeat } = zcf.makeEmptySeatKit();
|
|
74
78
|
|
|
75
|
-
atomicRearrange(
|
|
76
|
-
zcf,
|
|
79
|
+
zcf.atomicRearrange(
|
|
77
80
|
harden([
|
|
78
81
|
// Transfer the wanted Loan amount to the borrower
|
|
79
82
|
[lenderSeat, borrowerSeat, { Loan: loanWanted }],
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"close.d.ts","sourceRoot":"","sources":["close.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"close.d.ts","sourceRoot":"","sources":["close.js"],"names":[],"mappings":"AAYA,sCAAsC;AACtC,sCADW,uBAAuB,CAiDhC"}
|
|
@@ -1,12 +1,9 @@
|
|
|
1
|
-
|
|
1
|
+
/// <reference path="./types-ambient.js" />
|
|
2
2
|
|
|
3
3
|
import { Fail } from '@agoric/assert';
|
|
4
4
|
import { AmountMath } from '@agoric/ertp';
|
|
5
5
|
|
|
6
|
-
import {
|
|
7
|
-
assertProposalShape,
|
|
8
|
-
atomicRearrange,
|
|
9
|
-
} from '../../contractSupport/index.js';
|
|
6
|
+
import { assertProposalShape } from '../../contractSupport/index.js';
|
|
10
7
|
|
|
11
8
|
// The debt, the amount which must be repaid, is just the amount
|
|
12
9
|
// loaned plus interest (aka stability fee). All debt must be repaid
|
|
@@ -44,8 +41,7 @@ export const makeCloseLoanInvitation = (zcf, config) => {
|
|
|
44
41
|
'Collateral',
|
|
45
42
|
collateralBrand,
|
|
46
43
|
);
|
|
47
|
-
atomicRearrange(
|
|
48
|
-
zcf,
|
|
44
|
+
zcf.atomicRearrange(
|
|
49
45
|
harden([
|
|
50
46
|
[collateralSeat, repaySeat, { Collateral: collateralAmount }],
|
|
51
47
|
[repaySeat, lenderSeat, { Loan: debt }],
|
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @import {PriceAuthority, PriceDescription, PriceQuote, PriceQuoteValue, PriceQuery,} from '@agoric/zoe/tools/types.js';
|
|
3
|
+
*/
|
|
1
4
|
/**
|
|
2
5
|
* Add collateral of a particular brand and get a loan of another
|
|
3
6
|
* brand. Collateral (also known as margin) must be greater than the
|
|
@@ -59,6 +62,7 @@ export function start(zcf: ZCF<{
|
|
|
59
62
|
interestRate: Ratio;
|
|
60
63
|
interestPeriod: bigint;
|
|
61
64
|
}>): Promise<{
|
|
62
|
-
creatorInvitation: Promise<Invitation<unknown,
|
|
65
|
+
creatorInvitation: Promise<Invitation<unknown, undefined>>;
|
|
63
66
|
}>;
|
|
67
|
+
import type { PriceAuthority } from '@agoric/zoe/tools/types.js';
|
|
64
68
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.js"],"names":[],"mappings":"AAQA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoDG;AACH;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.js"],"names":[],"mappings":"AAQA;;GAEG;AAEH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoDG;AACH,2BATW,GAAG,CAAC;IACd,GAAO,EAAE,KAAK,CAAC;IACf,gBAAoB,EAAE,QAAQ,CAAC;IAC/B,cAAkB,EAAE,cAAc,CAAC;IACnC,cAAkB,EAAE,cAAc,CAAC;IACnC,YAAgB,EAAE,KAAK,CAAC;IACxB,cAAkB,EAAE,MAAM,CAAC;CACxB,CAAC;;GAsCJ;oCA5F4F,4BAA4B"}
|
|
@@ -6,6 +6,10 @@ import {
|
|
|
6
6
|
} from '../../contractSupport/index.js';
|
|
7
7
|
import { makeLendInvitation } from './lend.js';
|
|
8
8
|
|
|
9
|
+
/**
|
|
10
|
+
* @import {PriceAuthority, PriceDescription, PriceQuote, PriceQuoteValue, PriceQuery,} from '@agoric/zoe/tools/types.js';
|
|
11
|
+
*/
|
|
12
|
+
|
|
9
13
|
/**
|
|
10
14
|
* Add collateral of a particular brand and get a loan of another
|
|
11
15
|
* brand. Collateral (also known as margin) must be greater than the
|
|
@@ -1,14 +1,3 @@
|
|
|
1
1
|
export function doLiquidation(zcf: any, collateralSeat: any, autoswapPublicFacetP: any, lenderSeat: any, loanBrand: any): Promise<void>;
|
|
2
|
-
|
|
3
|
-
* This function is triggered by the priceAuthority when the value of the
|
|
4
|
-
* collateral is below the mmr. The function performs the
|
|
5
|
-
* liquidation and then shuts down the contract. Note that if a
|
|
6
|
-
* liquidation occurs, the borrower gets nothing and they can take no
|
|
7
|
-
* further action.
|
|
8
|
-
*
|
|
9
|
-
* For simplicity, we will sell all collateral.
|
|
10
|
-
*
|
|
11
|
-
* @type {Liquidate}
|
|
12
|
-
*/
|
|
13
|
-
export const liquidate: Liquidate;
|
|
2
|
+
export function liquidate(zcf: ZCF, config: LoanConfigWithBorrower): Promise<void>;
|
|
14
3
|
//# sourceMappingURL=liquidate.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"liquidate.d.ts","sourceRoot":"","sources":["liquidate.js"],"names":[],"mappings":"AAKO,wIA6CN;
|
|
1
|
+
{"version":3,"file":"liquidate.d.ts","sourceRoot":"","sources":["liquidate.js"],"names":[],"mappings":"AAKO,wIA6CN;AAeM,+BAJI,GAAG,UACH,sBAAsB,GACpB,OAAO,CAAC,IAAI,CAAC,CAiBzB"}
|
|
@@ -37,7 +37,7 @@ export const doLiquidation = async (
|
|
|
37
37
|
zcf.shutdown('your loan had to be liquidated');
|
|
38
38
|
};
|
|
39
39
|
|
|
40
|
-
/** @type {ShutdownWithFailure} */
|
|
40
|
+
/** @type {import('@agoric/swingset-vat').ShutdownWithFailure} */
|
|
41
41
|
const closeWithFailure = err => {
|
|
42
42
|
lenderSeat.fail(err);
|
|
43
43
|
collateralSeat.fail(err);
|
|
@@ -59,7 +59,9 @@ export const doLiquidation = async (
|
|
|
59
59
|
*
|
|
60
60
|
* For simplicity, we will sell all collateral.
|
|
61
61
|
*
|
|
62
|
-
* @
|
|
62
|
+
* @param {ZCF} zcf
|
|
63
|
+
* @param {LoanConfigWithBorrower} config
|
|
64
|
+
* @returns {Promise<void>}
|
|
63
65
|
*/
|
|
64
66
|
export const liquidate = async (zcf, config) => {
|
|
65
67
|
const { collateralSeat, autoswapInstance, lenderSeat, loanBrand } = config;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"scheduleLiquidation.d.ts","sourceRoot":"","sources":["scheduleLiquidation.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"scheduleLiquidation.d.ts","sourceRoot":"","sources":["scheduleLiquidation.js"],"names":[],"mappings":"AAWA,kCAAkC;AAClC,kCADW,mBAAmB,CAsD5B"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
/* eslint @typescript-eslint/no-floating-promises: "warn" */
|
|
1
2
|
import { E } from '@endo/eventual-send';
|
|
2
3
|
import { AmountMath } from '@agoric/ertp';
|
|
3
4
|
|
|
@@ -43,7 +44,7 @@ export const scheduleLiquidation = (zcf, configWithBorrower) => {
|
|
|
43
44
|
const currentCollateral = collateralSeat.getAmountAllocated('Collateral');
|
|
44
45
|
if (AmountMath.isEqual(amountIn, currentCollateral)) {
|
|
45
46
|
liquidationPromiseKit.resolve(priceQuote);
|
|
46
|
-
liquidate(zcf, configWithBorrower);
|
|
47
|
+
void liquidate(zcf, configWithBorrower);
|
|
47
48
|
}
|
|
48
49
|
})
|
|
49
50
|
.catch(err => {
|