@agoric/zoe 0.26.3-dev-ecf2d8e.0 → 0.26.3-other-dev-70beeb7.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/CHANGELOG.md +1179 -0
- package/README.md +7 -7
- package/bundles/bundle-contractFacet-js-meta.json +319 -543
- package/bundles/bundle-contractFacet.d.ts +3 -3
- package/bundles/bundle-contractFacet.js +1 -1
- package/exported.js +1 -1
- package/package.json +23 -30
- package/src/cleanProposal.js +2 -2
- 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/types.d.ts +191 -0
- package/src/contractFacet/types.d.ts.map +1 -0
- package/src/contractFacet/types.js +256 -0
- package/src/contractFacet/vatRoot.d.ts +1 -1
- package/src/contractFacet/vatRoot.d.ts.map +1 -1
- package/src/contractFacet/zcfMint.d.ts +1 -1
- package/src/contractFacet/zcfMint.d.ts.map +1 -1
- package/src/contractFacet/zcfMint.js +1 -2
- package/src/contractFacet/zcfSeat.d.ts.map +1 -1
- package/src/contractFacet/zcfSeat.js +3 -105
- package/src/contractFacet/zcfZygote.d.ts +1 -1
- package/src/contractFacet/zcfZygote.d.ts.map +1 -1
- package/src/contractFacet/zcfZygote.js +33 -78
- package/src/contractSupport/atomicTransfer.d.ts +6 -0
- package/src/contractSupport/atomicTransfer.d.ts.map +1 -1
- package/src/contractSupport/atomicTransfer.js +90 -5
- package/src/contractSupport/bondingCurves.js +2 -2
- package/src/contractSupport/durability.d.ts +2 -2
- package/src/contractSupport/durability.d.ts.map +1 -1
- package/src/contractSupport/durability.js +3 -3
- package/src/contractSupport/priceAuthority.d.ts +1 -16
- package/src/contractSupport/priceAuthority.d.ts.map +1 -1
- package/src/contractSupport/priceAuthority.js +1 -3
- package/src/contractSupport/priceAuthorityInitial.d.ts.map +1 -1
- package/src/contractSupport/priceAuthorityInitial.js +0 -1
- package/src/contractSupport/priceAuthorityQuoteMint.d.ts +1 -1
- package/src/contractSupport/priceAuthorityQuoteMint.d.ts.map +1 -1
- package/src/contractSupport/priceAuthorityTransform.d.ts.map +1 -1
- package/src/contractSupport/priceAuthorityTransform.js +3 -2
- package/src/contractSupport/recorder.d.ts +4 -4
- package/src/contractSupport/recorder.d.ts.map +1 -1
- package/src/contractSupport/safeMath.d.ts +7 -7
- package/src/contractSupport/safeMath.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/zoeHelpers.d.ts +1 -1
- package/src/contractSupport/zoeHelpers.d.ts.map +1 -1
- package/src/contractSupport/zoeHelpers.js +11 -5
- package/src/contracts/atomicSwap.d.ts +1 -1
- package/src/contracts/auction/firstPriceLogic.d.ts.map +1 -1
- package/src/contracts/auction/firstPriceLogic.js +7 -5
- package/src/contracts/auction/index.d.ts +23 -1
- package/src/contracts/auction/index.d.ts.map +1 -1
- package/src/contracts/auction/index.js +0 -1
- package/src/contracts/auction/secondPriceLogic.d.ts.map +1 -1
- package/src/contracts/auction/secondPriceLogic.js +3 -1
- package/src/contracts/automaticRefund.d.ts +3 -3
- package/src/contracts/autoswap.d.ts.map +1 -1
- package/src/contracts/autoswap.js +7 -4
- package/src/contracts/barterExchange.d.ts +2 -2
- package/src/contracts/barterExchange.d.ts.map +1 -1
- package/src/contracts/barterExchange.js +3 -2
- package/src/contracts/callSpread/calculateShares.d.ts +7 -0
- package/src/contracts/callSpread/calculateShares.d.ts.map +1 -1
- package/src/contracts/callSpread/fundedCallSpread.d.ts +1 -1
- package/src/contracts/callSpread/fundedCallSpread.d.ts.map +1 -1
- package/src/contracts/callSpread/fundedCallSpread.js +3 -1
- package/src/contracts/callSpread/payoffHandler.d.ts.map +1 -1
- package/src/contracts/callSpread/payoffHandler.js +0 -1
- package/src/contracts/callSpread/percent.d.ts +2 -0
- package/src/contracts/callSpread/percent.d.ts.map +1 -1
- package/src/contracts/callSpread/pricedCallSpread.d.ts +4 -4
- package/src/contracts/callSpread/pricedCallSpread.d.ts.map +1 -1
- package/src/contracts/callSpread/pricedCallSpread.js +3 -2
- package/src/contracts/coveredCall-durable.d.ts +3 -3
- package/src/contracts/coveredCall.d.ts +1 -1
- package/src/contracts/loan/borrow.d.ts.map +1 -1
- package/src/contracts/loan/borrow.js +3 -1
- package/src/contracts/loan/close.d.ts.map +1 -1
- package/src/contracts/loan/close.js +6 -2
- package/src/contracts/loan/index.d.ts +1 -1
- package/src/contracts/loan/liquidate.d.ts +12 -1
- package/src/contracts/loan/liquidate.d.ts.map +1 -1
- package/src/contracts/loan/liquidate.js +1 -3
- package/src/contracts/loan/scheduleLiquidation.d.ts.map +1 -1
- package/src/contracts/loan/scheduleLiquidation.js +0 -1
- package/src/contracts/loan/types.d.ts +1 -0
- package/src/contracts/loan/types.d.ts.map +1 -1
- package/src/contracts/loan/types.js +7 -0
- package/src/contracts/mintPayments.d.ts +6 -14
- package/src/contracts/mintPayments.d.ts.map +1 -1
- package/src/contracts/mintPayments.js +1 -1
- package/src/contracts/oracle.d.ts +2 -2
- package/src/contracts/oracle.d.ts.map +1 -1
- package/src/contracts/oracle.js +0 -3
- package/src/contracts/priceAggregator.d.ts +12 -2
- package/src/contracts/priceAggregator.d.ts.map +1 -1
- package/src/contracts/priceAggregator.js +2 -3
- package/src/contracts/scaledPriceAuthority.d.ts +1 -1
- package/src/contracts/scaledPriceAuthority.d.ts.map +1 -1
- package/src/contracts/scaledPriceAuthority.js +0 -2
- package/src/contracts/sellItems.d.ts +1 -1
- package/src/contracts/sellItems.d.ts.map +1 -1
- package/src/contracts/sellItems.js +3 -2
- package/src/contracts/simpleExchange.d.ts +2 -2
- package/src/instanceRecordStorage.d.ts +1 -1
- package/src/instanceRecordStorage.d.ts.map +1 -1
- package/src/internal-types.d.ts +3 -3
- package/src/internal-types.d.ts.map +1 -1
- package/src/internal-types.js +1 -1
- package/src/issuerStorage.d.ts +1 -1
- package/src/makeHandle.d.ts +1 -1
- package/src/makeHandle.d.ts.map +1 -1
- package/src/typeGuards.d.ts +20 -118
- package/src/typeGuards.d.ts.map +1 -1
- package/src/typeGuards.js +1 -7
- package/src/zoeService/escrowStorage.d.ts +1 -1
- package/src/zoeService/feeMint.d.ts +5 -5
- package/src/zoeService/feeMint.d.ts.map +1 -1
- package/src/zoeService/installationStorage.d.ts +1 -1
- package/src/zoeService/instanceAdminStorage.d.ts +2 -2
- package/src/zoeService/instanceAdminStorage.d.ts.map +1 -1
- package/src/zoeService/instanceAdminStorage.js +0 -1
- package/src/zoeService/internal-types.d.ts +2 -2
- package/src/zoeService/internal-types.d.ts.map +1 -1
- package/src/zoeService/internal-types.js +1 -1
- package/src/zoeService/makeInvitation.d.ts +1 -1
- package/src/zoeService/makeInvitation.d.ts.map +1 -1
- package/src/zoeService/offer/offer.d.ts.map +1 -1
- package/src/zoeService/offer/offer.js +3 -2
- package/src/zoeService/startInstance.d.ts +1 -1
- package/src/zoeService/startInstance.d.ts.map +1 -1
- package/src/zoeService/startInstance.js +23 -20
- package/src/zoeService/types.d.ts +1 -1
- package/src/zoeService/types.d.ts.map +1 -1
- package/src/zoeService/utils.d.ts +2 -2
- package/src/zoeService/zoe.d.ts +1 -11
- package/src/zoeService/zoe.d.ts.map +1 -1
- package/src/zoeService/zoe.js +1 -24
- package/src/zoeService/zoeSeat.d.ts +1 -1
- package/src/zoeService/zoeSeat.d.ts.map +1 -1
- package/src/zoeService/zoeSeat.js +0 -1
- package/src/zoeService/zoeStorageManager.d.ts +1 -1
- package/src/zoeService/zoeStorageManager.d.ts.map +1 -1
- package/src/zoeService/zoeStorageManager.js +2 -7
- package/tools/fakePriceAuthority.d.ts.map +1 -1
- package/tools/fakePriceAuthority.js +2 -0
- package/tools/manualPriceAuthority.d.ts.map +1 -1
- package/tools/manualPriceAuthority.js +0 -1
- package/tools/manualTimer.js +1 -1
- package/tools/prepare-test-env.js +1 -1
- package/tools/priceAuthorityRegistry.d.ts +1 -1
- package/tools/priceAuthorityRegistry.d.ts.map +1 -1
- package/tools/scriptedOracle.d.ts +2 -2
- package/tools/scriptedPriceAuthority.d.ts.map +1 -1
- package/tools/scriptedPriceAuthority.js +0 -1
- package/tools/setup-zoe.d.ts +0 -5
- package/tools/setup-zoe.d.ts.map +1 -1
- package/src/contractFacet/reallocate.d.ts +0 -3
- package/src/contractFacet/reallocate.d.ts.map +0 -1
- package/src/contractFacet/reallocate.js +0 -94
- package/src/contractFacet/types-ambient.d.ts +0 -247
- package/src/contractFacet/types-ambient.js +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export function prepareRecorder(baggage: MapStore<string,
|
|
1
|
+
export function prepareRecorder(baggage: MapStore<string, unknown>, marshaller: ERef<Marshaller>): (publisher: Publisher<unknown>, storageNode: StorageNode, valueShape?: TypedMatcher<unknown> | undefined) => {
|
|
2
2
|
getStorageNode(): StorageNode;
|
|
3
3
|
/**
|
|
4
4
|
* Memoizes the remote call to the storage node
|
|
@@ -51,8 +51,8 @@ export function defineERecorderKit({ makeRecorder, makeDurablePublishKit }: {
|
|
|
51
51
|
makeRecorder: MakeRecorder;
|
|
52
52
|
makeDurablePublishKit: ReturnType<typeof prepareDurablePublishKit>;
|
|
53
53
|
}): <T>(storageNodeP: ERef<StorageNode>, valueShape?: TypedMatcher<T> | undefined) => EventualRecorderKit<T>;
|
|
54
|
-
export function prepareRecorderKit(baggage: MapStore<string,
|
|
55
|
-
export function prepareRecorderKitMakers(baggage: MapStore<string,
|
|
54
|
+
export function prepareRecorderKit(baggage: MapStore<string, unknown>, marshaller: ERef<Marshaller>): <T>(storageNode: StorageNode, valueShape?: TypedMatcher<T> | undefined) => RecorderKit<T>;
|
|
55
|
+
export function prepareRecorderKitMakers(baggage: MapStore<string, unknown>, marshaller: ERef<Marshaller>): {
|
|
56
56
|
makeDurablePublishKit: (options?: {
|
|
57
57
|
valueDurability?: "mandatory" | undefined;
|
|
58
58
|
} | undefined) => {
|
|
@@ -225,5 +225,5 @@ export type TypedMatcher<T> = {
|
|
|
225
225
|
validatedType?: T;
|
|
226
226
|
};
|
|
227
227
|
export type MatchedType<TM extends TypedMatcher<any>> = TM extends TypedMatcher<infer T> ? T : never;
|
|
228
|
-
import { prepareDurablePublishKit } from
|
|
228
|
+
import { prepareDurablePublishKit } from "@agoric/notifier";
|
|
229
229
|
//# sourceMappingURL=recorder.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"recorder.d.ts","sourceRoot":"","sources":["recorder.js"],"names":[],"mappings":"AA4CO,
|
|
1
|
+
{"version":3,"file":"recorder.d.ts","sourceRoot":"","sources":["recorder.js"],"names":[],"mappings":"AA4CO,gFAFI,KAAK,UAAU,CAAC;;IAmCrB;;;;OAIG;sBADU,QAAQ,MAAM,CAAC;IAa5B;;;;;OAKG;iBAFQ,OAAO,GACL,QAAQ,IAAI,CAAC;IAa1B;;;;;OAKG;sBAFQ,OAAO,GACL,QAAQ,IAAI,CAAC;;;IArC1B;;;;OAIG;sBADU,QAAQ,MAAM,CAAC;IAa5B;;;;;OAKG;iBAFQ,OAAO,GACL,QAAQ,IAAI,CAAC;IAa1B;;;;;OAKG;sBAFQ,OAAO,GACL,QAAQ,IAAI,CAAC;GAkB/B;AAWM,2EAFI;IAAC,YAAY,EAAE,YAAY,CAAC;IAAC,qBAAqB,EAAE,WAAW,+BAA+B,CAAC,CAAA;CAAC,oBAK9F,WAAW,8DAUvB;AAUM,4EAFI;IAAC,YAAY,EAAE,YAAY,CAAC;IAAC,qBAAqB,EAAE,WAAW,+BAA+B,CAAC,CAAA;CAAC,qBAK9F,KAAK,WAAW,CAAC,sEAY7B;AAaM,mFAFI,KAAK,UAAU,CAAC,oBA9Cd,WAAW,8DAuDvB;AAaM,yFAFI,KAAK,UAAU,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;QAvIrB;;;;WAIG;0BADU,QAAQ,MAAM,CAAC;QAa5B;;;;;WAKG;qBAFQ,OAAO,GACL,QAAQ,IAAI,CAAC;QAa1B;;;;;WAKG;0BAFQ,OAAO,GACL,QAAQ,IAAI,CAAC;;;QArC1B;;;;WAIG;0BADU,QAAQ,MAAM,CAAC;QAa5B;;;;;WAKG;qBAFQ,OAAO,GACL,QAAQ,IAAI,CAAC;QAa1B;;;;;WAKG;0BAFQ,OAAO,GACL,QAAQ,IAAI,CAAC;;sCAgCnB,WAAW;0CAuBX,KAAK,WAAW,CAAC;EAmE7B;AAKM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;QApKD;;;;WAIG;0BADU,QAAQ,MAAM,CAAC;QAa5B;;;;;WAKG;qBAFQ,OAAO,GACL,QAAQ,IAAI,CAAC;QAa1B;;;;;WAKG;0BAFQ,OAAO,GACL,QAAQ,IAAI,CAAC;;;QArC1B;;;;WAIG;0BADU,QAAQ,MAAM,CAAC;QAa5B;;;;;WAKG;qBAFQ,OAAO,GACL,QAAQ,IAAI,CAAC;QAa1B;;;;;WAKG;0BAFQ,OAAO,GACL,QAAQ,IAAI,CAAC;;sCAgCnB,WAAW;0CAuBX,KAAK,WAAW,CAAC;EA+E7B;;sBA/NgC,WAAW;sBAAoB,QAAQ,MAAM,CAAC;iBAAe,CAAC,GAAG,QAAQ,IAAI,CAAC;sBAAoB,CAAC,GAAG,QAAQ,IAAI,CAAC;;6BAKvI,KAAK,WAAW,CAAC,CAAC,EAAE,YAAY,CAAC,GAAG;IAAE,QAAQ,EAAE,SAAS,CAAC,CAAC,CAAA;CAAE;qCAK7D,KAAK,WAAW,CAAC,CAAC,EAAE,YAAY,CAAC,GAAG;IAAE,SAAS,EAAE,KAAK,SAAS,CAAC,CAAC,CAAC,CAAA;CAAE;2BAmGnE,WAAW,sBAAsB,CAAC;8BAuBlC,WAAW,wBAAwB,CAAC;+BA0BpC,WAAW,yBAAyB,CAAC;;;;;;;;8BA2EtC;IAAE,aAAa,CAAC,EAAE,CAAC,CAAA;CAAE"}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
export namespace natSafeMath {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
2
|
+
const add: NatOp;
|
|
3
|
+
const subtract: NatOp;
|
|
4
|
+
const multiply: NatOp;
|
|
5
|
+
const floorDivide: NatOp;
|
|
6
|
+
const ceilDivide: NatOp;
|
|
7
|
+
const bankersDivide: NatOp;
|
|
8
|
+
const isGTE: (x: number | bigint, y: number | bigint) => boolean;
|
|
9
9
|
}
|
|
10
10
|
export type NatOp = (x: number | bigint, y: number | bigint) => NatValue;
|
|
11
11
|
//# sourceMappingURL=safeMath.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"safeMath.d.ts","sourceRoot":"","sources":["safeMath.js"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"safeMath.d.ts","sourceRoot":"","sources":["safeMath.js"],"names":[],"mappings":";eAYa,KAAK;oBAGL,KAAK;oBAEL,KAAK;uBAEL,KAAK;sBAEL,KAAK;yBAQN,KAAK;;;wBA3BC,MAAM,GAAG,MAAM,KAAK,MAAM,GAAG,MAAM,KAAK,QAAQ"}
|
|
@@ -18,5 +18,5 @@ export type PublicTopic<T extends unknown> = {
|
|
|
18
18
|
export type TopicsRecord = {
|
|
19
19
|
[topicName: string]: PublicTopic<unknown>;
|
|
20
20
|
};
|
|
21
|
-
import { SubscriberShape } from
|
|
21
|
+
import { SubscriberShape } from "@agoric/notifier";
|
|
22
22
|
//# sourceMappingURL=topics.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"topics.d.ts","sourceRoot":"","sources":["topics.js"],"names":[],"mappings":";AAMA,gEAME;AAEF;;;;;;;GAOG;AAEH,iEAA0E;AAcnE,kDAJI,MAAM,wHAYhB;6CA7BY;IACZ,WAAe,CAAC,EAAE,MAAM,CAAC;IACzB,UAAc,EAAE,WAAW,CAAC,CAAC,CAAC;IAC9B,WAAe,EAAE,KAAK,MAAM,CAAC,CAAC;CAC3B
|
|
1
|
+
{"version":3,"file":"topics.d.ts","sourceRoot":"","sources":["topics.js"],"names":[],"mappings":";AAMA,gEAME;AAEF;;;;;;;GAOG;AAEH,iEAA0E;AAcnE,kDAJI,MAAM,wHAYhB;6CA7BY;IACZ,WAAe,CAAC,EAAE,MAAM,CAAC;IACzB,UAAc,EAAE,WAAW,CAAC,CAAC,CAAC;IAC9B,WAAe,EAAE,KAAK,MAAM,CAAC,CAAC;CAC3B"}
|
|
@@ -14,7 +14,7 @@ export function withdrawFromSeat(zcf: ZCF, seat: ZCFSeat, amounts: AmountKeyword
|
|
|
14
14
|
export function saveAllIssuers(zcf: ZCF, issuerKeywordRecord?: IssuerKeywordRecord): Promise<(IssuerRecord<any> | undefined)[]>;
|
|
15
15
|
/** @type {MapKeywords} */
|
|
16
16
|
export const mapKeywords: MapKeywords;
|
|
17
|
-
export function offerTo<Args extends unknown, Result extends unknown>(zcf: ZCF, invitation: ERef<Invitation<
|
|
17
|
+
export function offerTo<Args extends unknown, Result extends unknown>(zcf: ZCF, invitation: ERef<Invitation<Result, Args>>, keywordMapping: KeywordKeywordRecord | undefined, proposal: Proposal, fromSeat: ZCFSeat, toSeat?: ZCFSeat | undefined, offerArgs?: Args | undefined): Promise<{
|
|
18
18
|
userSeatPromise: Promise<UserSeat<Result>>;
|
|
19
19
|
deposited: Promise<AmountKeywordRecord>;
|
|
20
20
|
}>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"zoeHelpers.d.ts","sourceRoot":"","sources":["zoeHelpers.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"zoeHelpers.d.ts","sourceRoot":"","sources":["zoeHelpers.js"],"names":[],"mappings":"AAaA,iIAAkI;AAM3H,oEAON;AAuBM,+BALI,GAAG,QACH,cAAc,UACd,mBAAmB,GACjB,CAAC,GAAC,CAAC,CAOf;AAED,mBAAmB;AACnB,mBADW,IAAI,CAmBb;AAEF,wBAAwB;AACxB,wBADW,SAAS,CAsBlB;AAiBK,uCAHI,OAAO,iBACP,OAAO,QAIgD;AAsB3D,0CAHI,OAAO,YACP,cAAc,QA+BxB;AAGM,+DAGN;AAED,6EAA8E;AAavE,mCANI,GAAG,iBACH,OAAO,WACP,mBAAmB,YACnB,qBAAqB,GACnB,QAAQ,MAAM,CAAC,CA8B3B;AAYM,sCALI,GAAG,QACH,OAAO,WACP,mBAAmB,GACjB,QAAQ,qBAAqB,CAAC,CAQ1C;AAWM,oCAJI,GAAG,wBACH,mBAAmB,8CAgB7B;AAED,0BAA0B;AAC1B,0BADW,WAAW,CAYpB;AAiDK,2EAjCI,GAAG,8DAMH,oBAAoB,GAAG,SAAS,YAKhC,QAAQ,YAGR,OAAO;;eAU2D,QAAQ,mBAAmB,CAAC;GA+DxG;;iBA3Va,MAAM,cAAc;0BACpB,MAAM,UAAU"}
|
|
@@ -1,11 +1,15 @@
|
|
|
1
|
-
/* eslint @typescript-eslint/no-floating-promises: "warn" */
|
|
2
1
|
import { mustMatch, keyEQ } from '@agoric/store';
|
|
3
2
|
import { E } from '@endo/eventual-send';
|
|
4
3
|
import { makePromiseKit } from '@endo/promise-kit';
|
|
5
4
|
import { AssetKind } from '@agoric/ertp';
|
|
6
5
|
import { fromUniqueEntries } from '@agoric/internal';
|
|
7
6
|
import { satisfiesWant } from '../contractFacet/offerSafety.js';
|
|
8
|
-
import {
|
|
7
|
+
import {
|
|
8
|
+
atomicRearrange,
|
|
9
|
+
atomicTransfer,
|
|
10
|
+
fromOnly,
|
|
11
|
+
toOnly,
|
|
12
|
+
} from './atomicTransfer.js';
|
|
9
13
|
|
|
10
14
|
export const defaultAcceptanceMsg = `The offer has been accepted. Once the contract has been completed, please check your payout`;
|
|
11
15
|
|
|
@@ -53,7 +57,8 @@ export const satisfies = (zcf, seat, update) => {
|
|
|
53
57
|
/** @type {Swap} */
|
|
54
58
|
export const swap = (zcf, leftSeat, rightSeat) => {
|
|
55
59
|
try {
|
|
56
|
-
|
|
60
|
+
atomicRearrange(
|
|
61
|
+
zcf,
|
|
57
62
|
harden([
|
|
58
63
|
[rightSeat, leftSeat, leftSeat.getProposal().want],
|
|
59
64
|
[leftSeat, rightSeat, rightSeat.getProposal().want],
|
|
@@ -73,7 +78,8 @@ export const swap = (zcf, leftSeat, rightSeat) => {
|
|
|
73
78
|
/** @type {SwapExact} */
|
|
74
79
|
export const swapExact = (zcf, leftSeat, rightSeat) => {
|
|
75
80
|
try {
|
|
76
|
-
|
|
81
|
+
atomicRearrange(
|
|
82
|
+
zcf,
|
|
77
83
|
harden([
|
|
78
84
|
fromOnly(rightSeat, rightSeat.getProposal().give),
|
|
79
85
|
fromOnly(leftSeat, leftSeat.getProposal().give),
|
|
@@ -299,7 +305,7 @@ const reverse = (keywordRecord = {}) => {
|
|
|
299
305
|
* @param {ZCFSeat} fromSeat
|
|
300
306
|
* The seat in contractA to take the offer payments from.
|
|
301
307
|
*
|
|
302
|
-
* @param {ZCFSeat} [toSeat]
|
|
308
|
+
* @param {ZCFSeat} [toSeat=fromSeat]
|
|
303
309
|
* The seat in contractA to deposit the payout of the offer to.
|
|
304
310
|
* If `toSeat` is not provided, this defaults to the `fromSeat`.
|
|
305
311
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"firstPriceLogic.d.ts","sourceRoot":"","sources":["firstPriceLogic.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"firstPriceLogic.d.ts","sourceRoot":"","sources":["firstPriceLogic.js"],"names":[],"mappings":"AAQO,wCAJI,GAAG,YACH,OAAO,YACP,MAAM,OAAO,CAAC,QAqDxB"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { AmountMath } from '@agoric/ertp';
|
|
2
|
+
import { atomicRearrange } from '../../contractSupport/index.js';
|
|
2
3
|
|
|
3
4
|
/**
|
|
4
5
|
* @param {ZCF} zcf
|
|
@@ -19,7 +20,7 @@ export const calcWinnerAndClose = (zcf, sellSeat, bidSeats) => {
|
|
|
19
20
|
let highestBidSeat = bidSeats[0];
|
|
20
21
|
let activeBidsCount = 0n;
|
|
21
22
|
|
|
22
|
-
|
|
23
|
+
bidSeats.forEach(bidSeat => {
|
|
23
24
|
if (!bidSeat.hasExited()) {
|
|
24
25
|
activeBidsCount += 1n;
|
|
25
26
|
/** @type {Amount<'nat'>} */
|
|
@@ -34,14 +35,15 @@ export const calcWinnerAndClose = (zcf, sellSeat, bidSeats) => {
|
|
|
34
35
|
highestBidSeat = bidSeat;
|
|
35
36
|
}
|
|
36
37
|
}
|
|
37
|
-
}
|
|
38
|
+
});
|
|
38
39
|
|
|
39
40
|
if (activeBidsCount === 0n) {
|
|
40
41
|
throw sellSeat.fail(Error(`Could not close auction. No bids were active`));
|
|
41
42
|
}
|
|
42
43
|
|
|
43
44
|
// Everyone else gets a refund so their values remain the same.
|
|
44
|
-
|
|
45
|
+
atomicRearrange(
|
|
46
|
+
zcf,
|
|
45
47
|
harden([
|
|
46
48
|
[highestBidSeat, sellSeat, { Bid: highestBid }, { Ask: highestBid }],
|
|
47
49
|
[sellSeat, highestBidSeat, { Asset: assetAmount }],
|
|
@@ -49,10 +51,10 @@ export const calcWinnerAndClose = (zcf, sellSeat, bidSeats) => {
|
|
|
49
51
|
);
|
|
50
52
|
|
|
51
53
|
sellSeat.exit();
|
|
52
|
-
|
|
54
|
+
bidSeats.forEach(bidSeat => {
|
|
53
55
|
if (!bidSeat.hasExited()) {
|
|
54
56
|
bidSeat.exit();
|
|
55
57
|
}
|
|
56
|
-
}
|
|
58
|
+
});
|
|
57
59
|
zcf.shutdown('Auction closed.');
|
|
58
60
|
};
|
|
@@ -26,7 +26,29 @@ export function start(zcf: ZCF<{
|
|
|
26
26
|
winnerPriceOption?: "first-price" | "second-price" | undefined;
|
|
27
27
|
bidDuration: bigint;
|
|
28
28
|
}>): {
|
|
29
|
-
creatorInvitation: Promise<Invitation<
|
|
29
|
+
creatorInvitation: Promise<Invitation<{
|
|
30
|
+
makeBidInvitation: () => Promise<Invitation<unknown, never>>;
|
|
31
|
+
getSessionDetails: () => {
|
|
32
|
+
auctionedAssets: any;
|
|
33
|
+
minimumBid: any;
|
|
34
|
+
winnerPriceOption: string;
|
|
35
|
+
closesAfter: any;
|
|
36
|
+
bidDuration: bigint;
|
|
37
|
+
timeAuthority: import("@agoric/time/src/types").TimerService;
|
|
38
|
+
bids: string | any[];
|
|
39
|
+
};
|
|
40
|
+
} & import("@endo/eventual-send").RemotableBrand<{}, {
|
|
41
|
+
makeBidInvitation: () => Promise<Invitation<unknown, never>>;
|
|
42
|
+
getSessionDetails: () => {
|
|
43
|
+
auctionedAssets: any;
|
|
44
|
+
minimumBid: any;
|
|
45
|
+
winnerPriceOption: string;
|
|
46
|
+
closesAfter: any;
|
|
47
|
+
bidDuration: bigint;
|
|
48
|
+
timeAuthority: import("@agoric/time/src/types").TimerService;
|
|
49
|
+
bids: string | any[];
|
|
50
|
+
};
|
|
51
|
+
}>, never>>;
|
|
30
52
|
publicFacet: {
|
|
31
53
|
getCurrentBids: () => any[] | "Bids are hidden for \"second price\" auctions";
|
|
32
54
|
getSessionDetails: () => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.js"],"names":[],"mappings":"AAoBA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH;mBALkB,OAAO,wBAAwB,EAAE,YAAY;;iBAE/C,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA2HrB;AAlJD,wCAAkC;AAClC,0CAAoC"}
|
|
@@ -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":"AAQO,wCAJI,GAAG,YACH,OAAO,YACP,MAAM,OAAO,CAAC,QAgExB"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { AmountMath } from '@agoric/ertp';
|
|
2
|
+
import { atomicRearrange } from '../../contractSupport/index.js';
|
|
2
3
|
|
|
3
4
|
/**
|
|
4
5
|
* @param {ZCF} zcf
|
|
@@ -47,7 +48,8 @@ export const calcWinnerAndClose = (zcf, sellSeat, bidSeats) => {
|
|
|
47
48
|
}
|
|
48
49
|
|
|
49
50
|
// Everyone else gets a refund so their values remain the same.
|
|
50
|
-
|
|
51
|
+
atomicRearrange(
|
|
52
|
+
zcf,
|
|
51
53
|
harden([
|
|
52
54
|
[
|
|
53
55
|
highestBidSeat,
|
|
@@ -13,13 +13,13 @@
|
|
|
13
13
|
* @param {ZCF<{}>} zcf
|
|
14
14
|
*/
|
|
15
15
|
export function start(zcf: ZCF<{}>): {
|
|
16
|
-
creatorInvitation: Promise<Invitation<
|
|
16
|
+
creatorInvitation: Promise<Invitation<unknown, never>>;
|
|
17
17
|
publicFacet: {
|
|
18
18
|
getOffersCount: () => bigint;
|
|
19
|
-
makeInvitation: () => Promise<Invitation<
|
|
19
|
+
makeInvitation: () => Promise<Invitation<unknown, never>>;
|
|
20
20
|
} & import("@endo/eventual-send").RemotableBrand<{}, {
|
|
21
21
|
getOffersCount: () => bigint;
|
|
22
|
-
makeInvitation: () => Promise<Invitation<
|
|
22
|
+
makeInvitation: () => Promise<Invitation<unknown, never>>;
|
|
23
23
|
}>;
|
|
24
24
|
};
|
|
25
25
|
//# sourceMappingURL=automaticRefund.d.ts.map
|
|
@@ -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":"AAgBA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsCG;AACH,2BAFW,GAAG;;GAsVb"}
|
|
@@ -11,6 +11,7 @@ import {
|
|
|
11
11
|
assertProposalShape,
|
|
12
12
|
assertNatAssetKind,
|
|
13
13
|
calcSecondaryRequired,
|
|
14
|
+
atomicRearrange,
|
|
14
15
|
} from '../contractSupport/index.js';
|
|
15
16
|
|
|
16
17
|
/**
|
|
@@ -87,7 +88,8 @@ const start = async zcf => {
|
|
|
87
88
|
};
|
|
88
89
|
|
|
89
90
|
function consummate(tradeAmountIn, tradeAmountOut, swapSeat) {
|
|
90
|
-
|
|
91
|
+
atomicRearrange(
|
|
92
|
+
zcf,
|
|
91
93
|
harden([
|
|
92
94
|
[
|
|
93
95
|
swapSeat,
|
|
@@ -165,7 +167,6 @@ const start = async zcf => {
|
|
|
165
167
|
} = swapSeat.getProposal();
|
|
166
168
|
|
|
167
169
|
assert(isNatValue(wantedAmountOut.value));
|
|
168
|
-
assert.typeof(amountIn.value, 'bigint');
|
|
169
170
|
|
|
170
171
|
const tradePrice = getOutputPrice(
|
|
171
172
|
wantedAmountOut.value,
|
|
@@ -203,7 +204,8 @@ const start = async zcf => {
|
|
|
203
204
|
Central: AmountMath.make(brands.Central, centralIn),
|
|
204
205
|
Secondary: secondaryAmount,
|
|
205
206
|
};
|
|
206
|
-
|
|
207
|
+
atomicRearrange(
|
|
208
|
+
zcf,
|
|
207
209
|
harden([
|
|
208
210
|
[seat, poolSeat, liquidityDeposited],
|
|
209
211
|
[poolSeat, seat, { Liquidity: liquidityAmountOut }],
|
|
@@ -305,7 +307,8 @@ const start = async zcf => {
|
|
|
305
307
|
Secondary: newUserSecondaryAmount,
|
|
306
308
|
};
|
|
307
309
|
|
|
308
|
-
|
|
310
|
+
atomicRearrange(
|
|
311
|
+
zcf,
|
|
309
312
|
harden([
|
|
310
313
|
[removeLiqSeat, poolSeat, { Liquidity: userAllocation.Liquidity }],
|
|
311
314
|
[poolSeat, removeLiqSeat, liquidityRemoved],
|
|
@@ -14,9 +14,9 @@
|
|
|
14
14
|
*/
|
|
15
15
|
export function start(zcf: ZCF): {
|
|
16
16
|
publicFacet: {
|
|
17
|
-
makeInvitation: () => Promise<Invitation<
|
|
17
|
+
makeInvitation: () => Promise<Invitation<unknown, never>>;
|
|
18
18
|
} & import("@endo/eventual-send").RemotableBrand<{}, {
|
|
19
|
-
makeInvitation: () => Promise<Invitation<
|
|
19
|
+
makeInvitation: () => Promise<Invitation<unknown, never>>;
|
|
20
20
|
}>;
|
|
21
21
|
};
|
|
22
22
|
//# sourceMappingURL=barterExchange.d.ts.map
|
|
@@ -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;;;;;;EAgHb"}
|
|
@@ -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 } from '../contractSupport/index.js';
|
|
4
|
+
import { satisfies, atomicRearrange } from '../contractSupport/index.js';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* This Barter Exchange accepts offers to trade arbitrary goods for other
|
|
@@ -63,7 +63,8 @@ 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
|
-
|
|
66
|
+
atomicRearrange(
|
|
67
|
+
zcf,
|
|
67
68
|
harden([
|
|
68
69
|
[
|
|
69
70
|
offerDetails.seat,
|
|
@@ -1,2 +1,9 @@
|
|
|
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
|
+
*/
|
|
1
8
|
export function calculateShares(collateralBrand: Brand<AssetKind>, price: Amount<"nat">, strikePrice1: Amount<"nat">, strikePrice2: Amount<"nat">): CalculateSharesReturn;
|
|
2
9
|
//# 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":"AAOA;;;;;;GAMG;AACH,0KAuBC"}
|
|
@@ -55,6 +55,6 @@ export function start(zcf: ZCF<{
|
|
|
55
55
|
expiration: bigint;
|
|
56
56
|
underlyingAmount: Amount;
|
|
57
57
|
}>): Promise<{
|
|
58
|
-
creatorInvitation: Promise<Invitation<
|
|
58
|
+
creatorInvitation: Promise<Invitation<unknown, never>>;
|
|
59
59
|
}>;
|
|
60
60
|
//# 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":"AAcA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsCG;AAEH;;;;;;;;;GASG;AACH;kBARiB,MAAM;kBACN,MAAM;sBACF,MAAM;oBACR,cAAc;gBAClB,MAAM;sBACA,MAAM;;;GA+E1B"}
|
|
@@ -7,6 +7,7 @@ import {
|
|
|
7
7
|
assertProposalShape,
|
|
8
8
|
depositToSeat,
|
|
9
9
|
assertNatAssetKind,
|
|
10
|
+
atomicRearrange,
|
|
10
11
|
} from '../../contractSupport/index.js';
|
|
11
12
|
import { makePayoffHandler } from './payoffHandler.js';
|
|
12
13
|
import { Position } from './position.js';
|
|
@@ -111,7 +112,8 @@ const start = async zcf => {
|
|
|
111
112
|
give: { Collateral: null },
|
|
112
113
|
want: { LongOption: null, ShortOption: null },
|
|
113
114
|
});
|
|
114
|
-
|
|
115
|
+
atomicRearrange(
|
|
116
|
+
zcf,
|
|
115
117
|
harden([
|
|
116
118
|
[creatorSeat, collateralSeat, { Collateral: settlementAmount }],
|
|
117
119
|
[
|
|
@@ -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":"AAYA;;;;;;;;GAQG;AACH,uCALW,IAAI,OAAO,MAAM,EAAE,GAAG,CAAC,CAAC,mBACxB,OAAO,YAAY,EAAC,cAAc,OAAO,CAAC,CAAC,kBAC3C,OAAO,GACL,aAAa,CAgEzB"}
|
|
@@ -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":"AAMA,6BAA6B;AAC7B,+DAEC;AAED,2BAA2B;AAC3B,6DAEC"}
|
|
@@ -53,13 +53,13 @@ export function start(zcf: ZCF<{
|
|
|
53
53
|
}>): {
|
|
54
54
|
creatorFacet: {
|
|
55
55
|
makeInvitationPair: (longCollateralShare: any) => {
|
|
56
|
-
longInvitation: Promise<Invitation<
|
|
57
|
-
shortInvitation: Promise<Invitation<
|
|
56
|
+
longInvitation: Promise<Invitation<unknown, never>>;
|
|
57
|
+
shortInvitation: Promise<Invitation<unknown, never>>;
|
|
58
58
|
};
|
|
59
59
|
} & import("@endo/eventual-send").RemotableBrand<{}, {
|
|
60
60
|
makeInvitationPair: (longCollateralShare: any) => {
|
|
61
|
-
longInvitation: Promise<Invitation<
|
|
62
|
-
shortInvitation: Promise<Invitation<
|
|
61
|
+
longInvitation: Promise<Invitation<unknown, never>>;
|
|
62
|
+
shortInvitation: Promise<Invitation<unknown, never>>;
|
|
63
63
|
};
|
|
64
64
|
}>;
|
|
65
65
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pricedCallSpread.d.ts","sourceRoot":"","sources":["pricedCallSpread.js"],"names":[],"mappings":"AAsBA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4CG;AACH;kBARiB,OAAO,KAAK,CAAC;kBACb,OAAO,KAAK,CAAC;sBACT,OAAO,KAAK,CAAC;oBACf,cAAc;gBAClB,MAAM;sBACA,OAAO,KAAK,CAAC;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"pricedCallSpread.d.ts","sourceRoot":"","sources":["pricedCallSpread.js"],"names":[],"mappings":"AAsBA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4CG;AACH;kBARiB,OAAO,KAAK,CAAC;kBACb,OAAO,KAAK,CAAC;sBACT,OAAO,KAAK,CAAC;oBACf,cAAc;gBAClB,MAAM;sBACA,OAAO,KAAK,CAAC;;;;;;;;;;;;;EA2GjC"}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
/* eslint @typescript-eslint/no-floating-promises: "warn" */
|
|
2
1
|
import './types.js';
|
|
3
2
|
|
|
4
3
|
import { makePromiseKit } from '@endo/promise-kit';
|
|
@@ -11,6 +10,7 @@ import {
|
|
|
11
10
|
assertNatAssetKind,
|
|
12
11
|
makeRatio,
|
|
13
12
|
ceilMultiplyBy,
|
|
13
|
+
atomicRearrange,
|
|
14
14
|
} from '../../contractSupport/index.js';
|
|
15
15
|
import { makePayoffHandler } from './payoffHandler.js';
|
|
16
16
|
import { Position } from './position.js';
|
|
@@ -132,7 +132,8 @@ const start = zcf => {
|
|
|
132
132
|
'wanted option not a match',
|
|
133
133
|
);
|
|
134
134
|
|
|
135
|
-
|
|
135
|
+
atomicRearrange(
|
|
136
|
+
zcf,
|
|
136
137
|
harden([
|
|
137
138
|
[collateralSeat, depositSeat, spreadAmount],
|
|
138
139
|
[depositSeat, collateralSeat, { Collateral: newCollateral }],
|
|
@@ -13,11 +13,11 @@
|
|
|
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: MapStore<string,
|
|
16
|
+
export function start(zcf: ZCF, _privateArgs: unknown, instanceBaggage: MapStore<string, unknown>): Promise<{
|
|
17
17
|
creatorFacet: {
|
|
18
|
-
makeInvitation(): Promise<Invitation<
|
|
18
|
+
makeInvitation(): Promise<Invitation<unknown, never>>;
|
|
19
19
|
} & import("@endo/eventual-send").RemotableBrand<{}, {
|
|
20
|
-
makeInvitation(): Promise<Invitation<
|
|
20
|
+
makeInvitation(): Promise<Invitation<unknown, never>>;
|
|
21
21
|
}>;
|
|
22
22
|
}>;
|
|
23
23
|
//# sourceMappingURL=coveredCall-durable.d.ts.map
|
|
@@ -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":"AAmBA,mCAAmC;AACnC,mCADW,oBAAoB,CAkI7B"}
|
|
@@ -9,6 +9,7 @@ import {
|
|
|
9
9
|
getAmountOut,
|
|
10
10
|
ceilMultiplyBy,
|
|
11
11
|
getTimestamp,
|
|
12
|
+
atomicRearrange,
|
|
12
13
|
} from '../../contractSupport/index.js';
|
|
13
14
|
|
|
14
15
|
import { scheduleLiquidation } from './scheduleLiquidation.js';
|
|
@@ -71,7 +72,8 @@ export const makeBorrowInvitation = (zcf, config) => {
|
|
|
71
72
|
|
|
72
73
|
const { zcfSeat: collateralSeat } = zcf.makeEmptySeatKit();
|
|
73
74
|
|
|
74
|
-
|
|
75
|
+
atomicRearrange(
|
|
76
|
+
zcf,
|
|
75
77
|
harden([
|
|
76
78
|
// Transfer the wanted Loan amount to the borrower
|
|
77
79
|
[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":"AAeA,sCAAsC;AACtC,sCADW,uBAAuB,CAkDhC"}
|
|
@@ -3,7 +3,10 @@ import './types.js';
|
|
|
3
3
|
import { Fail } from '@agoric/assert';
|
|
4
4
|
import { AmountMath } from '@agoric/ertp';
|
|
5
5
|
|
|
6
|
-
import {
|
|
6
|
+
import {
|
|
7
|
+
assertProposalShape,
|
|
8
|
+
atomicRearrange,
|
|
9
|
+
} from '../../contractSupport/index.js';
|
|
7
10
|
|
|
8
11
|
// The debt, the amount which must be repaid, is just the amount
|
|
9
12
|
// loaned plus interest (aka stability fee). All debt must be repaid
|
|
@@ -41,7 +44,8 @@ export const makeCloseLoanInvitation = (zcf, config) => {
|
|
|
41
44
|
'Collateral',
|
|
42
45
|
collateralBrand,
|
|
43
46
|
);
|
|
44
|
-
|
|
47
|
+
atomicRearrange(
|
|
48
|
+
zcf,
|
|
45
49
|
harden([
|
|
46
50
|
[collateralSeat, repaySeat, { Collateral: collateralAmount }],
|
|
47
51
|
[repaySeat, lenderSeat, { Loan: debt }],
|
|
@@ -1,3 +1,14 @@
|
|
|
1
1
|
export function doLiquidation(zcf: any, collateralSeat: any, autoswapPublicFacetP: any, lenderSeat: any, loanBrand: any): Promise<void>;
|
|
2
|
-
|
|
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;
|
|
3
14
|
//# 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;AAED;;;;;;;;;;GAUG;AACH,wBAFU,SAAS,CAiBjB"}
|
|
@@ -59,9 +59,7 @@ export const doLiquidation = async (
|
|
|
59
59
|
*
|
|
60
60
|
* For simplicity, we will sell all collateral.
|
|
61
61
|
*
|
|
62
|
-
* @
|
|
63
|
-
* @param {LoanConfigWithBorrower} config
|
|
64
|
-
* @returns {Promise<void>}
|
|
62
|
+
* @type {Liquidate}
|
|
65
63
|
*/
|
|
66
64
|
export const liquidate = async (zcf, config) => {
|
|
67
65
|
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":"AAUA,kCAAkC;AAClC,kCADW,mBAAmB,CAsD5B"}
|