@agoric/zoe 0.26.3-dev-fa844b5.0 → 0.26.3-dev-21fe8d9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bundles/bundle-contractFacet-js-meta.json +84 -84
- package/bundles/bundle-contractFacet.d.ts +7 -0
- package/bundles/bundle-contractFacet.d.ts.map +1 -0
- package/package.json +15 -15
- package/src/cleanProposal.d.ts +9 -0
- package/src/cleanProposal.d.ts.map +1 -0
- package/src/contractFacet/allocationMath.d.ts +7 -0
- package/src/contractFacet/allocationMath.d.ts.map +1 -0
- package/src/contractFacet/evalContractCode.d.ts +2 -0
- package/src/contractFacet/evalContractCode.d.ts.map +1 -0
- package/src/contractFacet/exit.d.ts +2 -0
- package/src/contractFacet/exit.d.ts.map +1 -0
- package/src/contractFacet/internal-types.d.ts +8 -0
- package/src/contractFacet/internal-types.d.ts.map +1 -0
- package/src/contractFacet/offerHandlerStorage.d.ts +5 -0
- package/src/contractFacet/offerHandlerStorage.d.ts.map +1 -0
- package/src/contractFacet/offerSafety.d.ts +34 -0
- package/src/contractFacet/offerSafety.d.ts.map +1 -0
- package/src/contractFacet/reallocate.d.ts +3 -0
- package/src/contractFacet/reallocate.d.ts.map +1 -0
- package/src/contractFacet/rightsConservation.d.ts +12 -0
- package/src/contractFacet/rightsConservation.d.ts.map +1 -0
- package/src/contractFacet/vatRoot.d.ts +14 -0
- package/src/contractFacet/vatRoot.d.ts.map +1 -0
- package/src/contractFacet/zcfMint.d.ts +8 -0
- package/src/contractFacet/zcfMint.d.ts.map +1 -0
- package/src/contractFacet/zcfSeat.d.ts +3 -0
- package/src/contractFacet/zcfSeat.d.ts.map +1 -0
- package/src/contractFacet/zcfZygote.d.ts +2 -0
- package/src/contractFacet/zcfZygote.d.ts.map +1 -0
- package/src/contractSupport/atomicTransfer.d.ts +6 -0
- package/src/contractSupport/atomicTransfer.d.ts.map +1 -0
- package/src/contractSupport/bondingCurves.d.ts +6 -0
- package/src/contractSupport/bondingCurves.d.ts.map +1 -0
- package/src/contractSupport/durability.d.ts +5 -0
- package/src/contractSupport/durability.d.ts.map +1 -0
- package/src/contractSupport/index.d.ts +14 -0
- package/src/contractSupport/index.d.ts.map +1 -0
- package/src/contractSupport/prepare-ownable.d.ts +11 -0
- package/src/contractSupport/prepare-ownable.d.ts.map +1 -0
- package/src/contractSupport/priceAuthority.d.ts +27 -0
- package/src/contractSupport/priceAuthority.d.ts.map +1 -0
- package/src/contractSupport/priceAuthorityInitial.d.ts +2 -0
- package/src/contractSupport/priceAuthorityInitial.d.ts.map +1 -0
- package/src/contractSupport/priceAuthorityQuoteMint.d.ts +2 -0
- package/src/contractSupport/priceAuthorityQuoteMint.d.ts.map +1 -0
- package/src/contractSupport/priceAuthorityTransform.d.ts +14 -0
- package/src/contractSupport/priceAuthorityTransform.d.ts.map +1 -0
- package/src/contractSupport/priceQuote.d.ts +7 -0
- package/src/contractSupport/priceQuote.d.ts.map +1 -0
- package/src/contractSupport/ratio.d.ts +28 -0
- package/src/contractSupport/ratio.d.ts.map +1 -0
- package/src/contractSupport/recorder.d.ts +143 -0
- package/src/contractSupport/recorder.d.ts.map +1 -0
- package/src/contractSupport/safeMath.d.ts +11 -0
- package/src/contractSupport/safeMath.d.ts.map +1 -0
- package/src/contractSupport/stateMachine.d.ts +6 -0
- package/src/contractSupport/stateMachine.d.ts.map +1 -0
- package/src/contractSupport/statistics.d.ts +7 -0
- package/src/contractSupport/statistics.d.ts.map +1 -0
- package/src/contractSupport/topics.d.ts +22 -0
- package/src/contractSupport/topics.d.ts.map +1 -0
- package/src/contractSupport/types.d.ts +63 -0
- package/src/contractSupport/types.d.ts.map +1 -0
- package/src/contractSupport/zoeHelpers.d.ts +30 -0
- package/src/contractSupport/zoeHelpers.d.ts.map +1 -0
- package/src/contracts/atomicSwap.d.ts +16 -0
- package/src/contracts/atomicSwap.d.ts.map +1 -0
- package/src/contracts/auction/assertBidSeat.d.ts +2 -0
- package/src/contracts/auction/assertBidSeat.d.ts.map +1 -0
- package/src/contracts/auction/firstPriceLogic.d.ts +2 -0
- package/src/contracts/auction/firstPriceLogic.d.ts.map +1 -0
- package/src/contracts/auction/index.d.ts +78 -0
- package/src/contracts/auction/index.d.ts.map +1 -0
- package/src/contracts/auction/secondPriceLogic.d.ts +2 -0
- package/src/contracts/auction/secondPriceLogic.d.ts.map +1 -0
- package/src/contracts/automaticRefund.d.ts +25 -0
- package/src/contracts/automaticRefund.d.ts.map +1 -0
- package/src/contracts/autoswap.d.ts +43 -0
- package/src/contracts/autoswap.d.ts.map +1 -0
- package/src/contracts/barterExchange.d.ts +22 -0
- package/src/contracts/barterExchange.d.ts.map +1 -0
- package/src/contracts/callSpread/calculateShares.d.ts +2 -0
- package/src/contracts/callSpread/calculateShares.d.ts.map +1 -0
- package/src/contracts/callSpread/fundedCallSpread.d.ts +60 -0
- package/src/contracts/callSpread/fundedCallSpread.d.ts.map +1 -0
- package/src/contracts/callSpread/payoffHandler.d.ts +11 -0
- package/src/contracts/callSpread/payoffHandler.d.ts.map +1 -0
- package/src/contracts/callSpread/percent.d.ts +3 -0
- package/src/contracts/callSpread/percent.d.ts.map +1 -0
- package/src/contracts/callSpread/position.d.ts +10 -0
- package/src/contracts/callSpread/position.d.ts.map +1 -0
- package/src/contracts/callSpread/pricedCallSpread.d.ts +66 -0
- package/src/contracts/callSpread/pricedCallSpread.d.ts.map +1 -0
- package/src/contracts/callSpread/types.d.ts +30 -0
- package/src/contracts/callSpread/types.d.ts.map +1 -0
- package/src/contracts/coveredCall-durable.d.ts +21 -0
- package/src/contracts/coveredCall-durable.d.ts.map +1 -0
- package/src/contracts/coveredCall.d.ts +64 -0
- package/src/contracts/coveredCall.d.ts.map +1 -0
- package/src/contracts/exported.d.ts +2 -0
- package/src/contracts/exported.d.ts.map +1 -0
- package/src/contracts/loan/addCollateral.d.ts +3 -0
- package/src/contracts/loan/addCollateral.d.ts.map +1 -0
- package/src/contracts/loan/borrow.d.ts +3 -0
- package/src/contracts/loan/borrow.d.ts.map +1 -0
- package/src/contracts/loan/close.d.ts +3 -0
- package/src/contracts/loan/close.d.ts.map +1 -0
- package/src/contracts/loan/index.d.ts +64 -0
- package/src/contracts/loan/index.d.ts.map +1 -0
- package/src/contracts/loan/lend.d.ts +3 -0
- package/src/contracts/loan/lend.d.ts.map +1 -0
- package/src/contracts/loan/liquidate.d.ts +3 -0
- package/src/contracts/loan/liquidate.d.ts.map +1 -0
- package/src/contracts/loan/scheduleLiquidation.d.ts +3 -0
- package/src/contracts/loan/scheduleLiquidation.d.ts.map +1 -0
- package/src/contracts/loan/types.d.ts +161 -0
- package/src/contracts/loan/types.d.ts.map +1 -0
- package/src/contracts/loan/updateDebt.d.ts +11 -0
- package/src/contracts/loan/updateDebt.d.ts.map +1 -0
- package/src/contracts/mintAndSellNFT.d.ts +28 -0
- package/src/contracts/mintAndSellNFT.d.ts.map +1 -0
- package/src/contracts/mintPayments.d.ts +30 -0
- package/src/contracts/mintPayments.d.ts.map +1 -0
- package/src/contracts/oracle.d.ts +26 -0
- package/src/contracts/oracle.d.ts.map +1 -0
- package/src/contracts/otcDesk.d.ts +79 -0
- package/src/contracts/otcDesk.d.ts.map +1 -0
- package/src/contracts/priceAggregator.d.ts +107 -0
- package/src/contracts/priceAggregator.d.ts.map +1 -0
- package/src/contracts/priceAggregator.js +0 -1
- package/src/contracts/priceAggregatorTypes.d.ts +77 -0
- package/src/contracts/priceAggregatorTypes.d.ts.map +1 -0
- package/src/contracts/scaledPriceAuthority.d.ts +21 -0
- package/src/contracts/scaledPriceAuthority.d.ts.map +1 -0
- package/src/contracts/sellItems.d.ts +30 -0
- package/src/contracts/sellItems.d.ts.map +1 -0
- package/src/contracts/simpleExchange.d.ts +37 -0
- package/src/contracts/simpleExchange.d.ts.map +1 -0
- package/src/contracts/types.d.ts +80 -0
- package/src/contracts/types.d.ts.map +1 -0
- package/src/handleWarning.d.ts +3 -0
- package/src/handleWarning.d.ts.map +1 -0
- package/src/instanceRecordStorage.d.ts +2 -0
- package/src/instanceRecordStorage.d.ts.map +1 -0
- package/src/internal-types.d.ts +179 -0
- package/src/internal-types.d.ts.map +1 -0
- package/src/issuerRecord.d.ts +3 -0
- package/src/issuerRecord.d.ts.map +1 -0
- package/src/issuerStorage.d.ts +14 -0
- package/src/issuerStorage.d.ts.map +1 -0
- package/src/makeHandle.d.ts +4 -0
- package/src/makeHandle.d.ts.map +1 -0
- package/src/typeGuards.d.ts +169 -0
- package/src/typeGuards.d.ts.map +1 -0
- package/src/types.d.ts +46 -0
- package/src/types.d.ts.map +1 -0
- package/src/zoeService/createZCFVat.d.ts +2 -0
- package/src/zoeService/createZCFVat.d.ts.map +1 -0
- package/src/zoeService/escrowStorage.d.ts +7 -0
- package/src/zoeService/escrowStorage.d.ts.map +1 -0
- package/src/zoeService/feeMint.d.ts +23 -0
- package/src/zoeService/feeMint.d.ts.map +1 -0
- package/src/zoeService/installationStorage.d.ts +20 -0
- package/src/zoeService/installationStorage.d.ts.map +1 -0
- package/src/zoeService/instanceAdminStorage.d.ts +103 -0
- package/src/zoeService/instanceAdminStorage.d.ts.map +1 -0
- package/src/zoeService/internal-types.d.ts +90 -0
- package/src/zoeService/internal-types.d.ts.map +1 -0
- package/src/zoeService/invitationQueries.d.ts +6 -0
- package/src/zoeService/invitationQueries.d.ts.map +1 -0
- package/src/zoeService/makeInvitation.d.ts +5 -0
- package/src/zoeService/makeInvitation.d.ts.map +1 -0
- package/src/zoeService/offer/burnInvitation.d.ts +5 -0
- package/src/zoeService/offer/burnInvitation.d.ts.map +1 -0
- package/src/zoeService/offer/offer.d.ts +2 -0
- package/src/zoeService/offer/offer.d.ts.map +1 -0
- package/src/zoeService/originalZoeSeat.d.ts +34 -0
- package/src/zoeService/originalZoeSeat.d.ts.map +1 -0
- package/src/zoeService/startInstance.d.ts +4 -0
- package/src/zoeService/startInstance.d.ts.map +1 -0
- package/src/zoeService/types.d.ts +224 -0
- package/src/zoeService/types.d.ts.map +1 -0
- package/src/zoeService/utils.test-d.d.ts +2 -0
- package/src/zoeService/utils.test-d.d.ts.map +1 -0
- package/src/zoeService/zoe.d.ts +57 -0
- package/src/zoeService/zoe.d.ts.map +1 -0
- package/src/zoeService/zoe.js +0 -2
- package/src/zoeService/zoeSeat.d.ts +26 -0
- package/src/zoeService/zoeSeat.d.ts.map +1 -0
- package/src/zoeService/zoeStorageManager.d.ts +41 -0
- package/src/zoeService/zoeStorageManager.d.ts.map +1 -0
- package/tools/fakePriceAuthority.d.ts +30 -0
- package/tools/fakePriceAuthority.d.ts.map +1 -0
- package/tools/fakeVatAdmin.d.ts +103 -0
- package/tools/fakeVatAdmin.d.ts.map +1 -0
- package/tools/internal-types.d.ts +12 -0
- package/tools/internal-types.d.ts.map +1 -0
- package/tools/manualPriceAuthority.d.ts +21 -0
- package/tools/manualPriceAuthority.d.ts.map +1 -0
- package/tools/manualTimer.d.ts +44 -0
- package/tools/manualTimer.d.ts.map +1 -0
- package/tools/prepare-test-env-ava.d.ts +2 -0
- package/tools/prepare-test-env-ava.d.ts.map +1 -0
- package/tools/prepare-test-env.d.ts +2 -0
- package/tools/prepare-test-env.d.ts.map +1 -0
- package/tools/scriptedOracle.d.ts +27 -0
- package/tools/scriptedOracle.d.ts.map +1 -0
- package/tools/scriptedPriceAuthority.d.ts +2 -0
- package/tools/scriptedPriceAuthority.d.ts.map +1 -0
- package/tools/setup-zoe.d.ts +33 -0
- package/tools/setup-zoe.d.ts.map +1 -0
- package/tools/types-ambient.d.ts +142 -0
- package/tools/types-ambient.d.ts.map +1 -0
- package/tools/types.d.ts +142 -0
- package/tools/types.d.ts.map +1 -0
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
type SeatGainsLossesRecord = {
|
|
2
|
+
seat: ZCFSeat;
|
|
3
|
+
/**
|
|
4
|
+
* - what the seat will
|
|
5
|
+
* gain as a result of this trade
|
|
6
|
+
*/
|
|
7
|
+
gains: AmountKeywordRecord;
|
|
8
|
+
/**
|
|
9
|
+
* - what the seat [will]
|
|
10
|
+
* give up as a result of this trade. Losses is optional, but can
|
|
11
|
+
* only be omitted if the keywords for both seats are the same.
|
|
12
|
+
* If losses is not defined, the gains of the other seat is
|
|
13
|
+
* subtracted.
|
|
14
|
+
*/
|
|
15
|
+
losses: AmountKeywordRecord;
|
|
16
|
+
};
|
|
17
|
+
/**
|
|
18
|
+
* If two seats can satisfy each other's wants, trade enough to
|
|
19
|
+
* satisfy the wants of both seats and exit both seats.
|
|
20
|
+
*
|
|
21
|
+
* The surplus remains with the original seat. For example if seat A
|
|
22
|
+
* gives 5 moola and seat B only wants 3 moola, seat A retains 2
|
|
23
|
+
* moola.
|
|
24
|
+
*
|
|
25
|
+
* If the swap fails, no assets are transferred, both seats will fail,
|
|
26
|
+
* and the function throws.
|
|
27
|
+
*
|
|
28
|
+
* The keywords for both seats must match.
|
|
29
|
+
*/
|
|
30
|
+
type Swap = (zcf: ZCF, leftSeat: ZCFSeat, rightSeat: ZCFSeat) => string;
|
|
31
|
+
/**
|
|
32
|
+
* Swap such that both seats gain what they want and lose everything
|
|
33
|
+
* that they gave. Only good for exact and entire swaps where each
|
|
34
|
+
* seat wants everything that the other seat has. The benefit of using
|
|
35
|
+
* this method is that the keywords of each seat do not matter.
|
|
36
|
+
*
|
|
37
|
+
* If the swap fails, no assets are transferred, both seats will fail,
|
|
38
|
+
* and the function throws.
|
|
39
|
+
*/
|
|
40
|
+
type SwapExact = (zcf: ZCF, leftSeat: ZCFSeat, rightSeat: ZCFSeat) => string;
|
|
41
|
+
/**
|
|
42
|
+
* A mapping of keywords to keywords.
|
|
43
|
+
*/
|
|
44
|
+
type KeywordKeywordRecord = Record<Keyword, Keyword>;
|
|
45
|
+
/**
|
|
46
|
+
* Given a mapping of keywords to keywords, invert the keys and
|
|
47
|
+
* values. This is used to map the offers made to another contract
|
|
48
|
+
* back to the keywords used in the first contract.
|
|
49
|
+
*/
|
|
50
|
+
type Reverse = (keywordRecord?: KeywordKeywordRecord | undefined) => KeywordKeywordRecord;
|
|
51
|
+
/**
|
|
52
|
+
* Remap the keywords of an amountKeywordRecord, issuerKeywordRecord, or a
|
|
53
|
+
* PaymentPKeywordRecord according to a mapping. This is used to remap
|
|
54
|
+
* from keywords used in contractA to keywords used in contractB and
|
|
55
|
+
* vice versa in `offerTo`
|
|
56
|
+
*/
|
|
57
|
+
type MapKeywords = (keywordRecord: AmountKeywordRecord | PaymentPKeywordRecord | IssuerKeywordRecord | undefined, keywordMapping: KeywordKeywordRecord) => any;
|
|
58
|
+
type Ratio = {
|
|
59
|
+
numerator: Amount<'nat'>;
|
|
60
|
+
denominator: Amount<'nat'>;
|
|
61
|
+
};
|
|
62
|
+
type ScaleAmount = (amount: Amount<'nat'>, ratio: Ratio) => Amount<'nat'>;
|
|
63
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["types.js"],"names":[],"mappings":";UAMc,OAAO;;;;;WACP,mBAAmB;;;;;;;;YAEnB,mBAAmB;;;;;;;;;;;;;;;kBAqBtB,GAAG,YACH,OAAO,aACP,OAAO,KACL,MAAM;;;;;;;;;;uBAcR,GAAG,YACH,OAAO,aACP,OAAO,KACL,MAAM;;;;4BAIN,OAAO,OAAO,EAAC,OAAO,CAAC;;;;;;qEAYvB,oBAAoB;;;;;;;mCAWtB,mBAAmB,GAAG,qBAAqB,GAAG,mBAAmB,GAAG,SAAS,kBAC7E,oBAAoB;;eAKjB,OAAO,KAAK,CAAC;iBACb,OAAO,KAAK,CAAC;;4BAKhB,OAAO,KAAK,CAAC,SACb,KAAK,KACH,OAAO,KAAK,CAAC"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
export const defaultAcceptanceMsg: "The offer has been accepted. Once the contract has been completed, please check your payout";
|
|
2
|
+
export function assertIssuerKeywords(zcf: any, expected: any): void;
|
|
3
|
+
export function satisfies(zcf: ZCF, seat: ZcfSeatPartial, update: AmountKeywordRecord): 0 | 1;
|
|
4
|
+
/** @type {Swap} */
|
|
5
|
+
export const swap: Swap;
|
|
6
|
+
/** @type {SwapExact} */
|
|
7
|
+
export const swapExact: SwapExact;
|
|
8
|
+
export function fitProposalShape(seat: ZCFSeat, proposalShape: Pattern): void;
|
|
9
|
+
export function assertProposalShape(seat: ZCFSeat, expected: ExpectedRecord): void;
|
|
10
|
+
export function assertNatAssetKind(zcf: any, brand: any): void;
|
|
11
|
+
export const depositToSeatSuccessMsg: "Deposit and reallocation successful.";
|
|
12
|
+
export function depositToSeat(zcf: ZCF, recipientSeat: ZCFSeat, amounts: AmountKeywordRecord, payments: PaymentPKeywordRecord): Promise<string>;
|
|
13
|
+
export function withdrawFromSeat(zcf: ZCF, seat: ZCFSeat, amounts: AmountKeywordRecord): Promise<PaymentPKeywordRecord>;
|
|
14
|
+
export function saveAllIssuers(zcf: ZCF, issuerKeywordRecord?: IssuerKeywordRecord): Promise<(IssuerRecord<any> | undefined)[]>;
|
|
15
|
+
/** @type {MapKeywords} */
|
|
16
|
+
export const mapKeywords: MapKeywords;
|
|
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
|
+
userSeatPromise: Promise<UserSeat<Result>>;
|
|
19
|
+
deposited: Promise<AmountKeywordRecord>;
|
|
20
|
+
}>;
|
|
21
|
+
export type ZcfSeatPartial = {
|
|
22
|
+
getProposal: () => ProposalRecord;
|
|
23
|
+
getCurrentAllocation: () => Allocation;
|
|
24
|
+
};
|
|
25
|
+
export type ExpectedRecord = {
|
|
26
|
+
want?: Record<string, null> | undefined;
|
|
27
|
+
give?: Record<string, null> | undefined;
|
|
28
|
+
exit?: Partial<Record<never, null>> | undefined;
|
|
29
|
+
};
|
|
30
|
+
//# sourceMappingURL=zoeHelpers.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"zoeHelpers.d.ts","sourceRoot":"","sources":["zoeHelpers.js"],"names":[],"mappings":"AASA,iIAAkI;AAM3H,oEAON;AAuBM,+BALI,GAAG,QACH,cAAc,UACd,mBAAmB,GACjB,CAAC,GAAC,CAAC,CAOf;AAED,mBAAmB;AACnB,mBADW,IAAI,CAkBb;AAEF,wBAAwB;AACxB,wBADW,SAAS,CAqBlB;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;;iBAzVa,MAAM,cAAc;0BACpB,MAAM,UAAU"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Trade one item for another.
|
|
3
|
+
* https://agoric.com/documentation/zoe/guide/contracts/atomic-swap.html
|
|
4
|
+
*
|
|
5
|
+
* The initial offer is { give: { Asset: A }, want: { Price: B } }.
|
|
6
|
+
* The outcome from the first offer is an invitation for the second party,
|
|
7
|
+
* who should offer { give: { Price: B }, want: { Asset: A } }, with a want
|
|
8
|
+
* amount no greater than the original's give, and a give amount at least as
|
|
9
|
+
* large as the original's want.
|
|
10
|
+
*
|
|
11
|
+
* @param {ZCF} zcf
|
|
12
|
+
*/
|
|
13
|
+
export function start(zcf: ZCF): {
|
|
14
|
+
creatorInvitation: Promise<Invitation<unknown, never>>;
|
|
15
|
+
};
|
|
16
|
+
//# sourceMappingURL=atomicSwap.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"atomicSwap.d.ts","sourceRoot":"","sources":["atomicSwap.js"],"names":[],"mappings":"AAOA;;;;;;;;;;;GAWG;AACH,2BAFW,GAAG;;EAqCb"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"assertBidSeat.d.ts","sourceRoot":"","sources":["assertBidSeat.js"],"names":[],"mappings":"AAGO,2EASN"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"firstPriceLogic.d.ts","sourceRoot":"","sources":["firstPriceLogic.js"],"names":[],"mappings":"AAOO,wCAJI,GAAG,YACH,OAAO,YACP,MAAM,OAAO,CAAC,QAmDxB"}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* NOT TO BE USED IN PRODUCTION CODE. BIDS ARE PUBLIC. An auction
|
|
3
|
+
* contract in which the seller offers an Asset for sale, and states a
|
|
4
|
+
* minimum price. The auction closes at the deadline specified by the
|
|
5
|
+
* timeAuthority, bidDuration, winnerPriceOption parameters in the terms provided by
|
|
6
|
+
* the creator of the contract instance.
|
|
7
|
+
* Winner price option can be `first-price` or `second-price`, default to `second-price`.
|
|
8
|
+
*
|
|
9
|
+
* startInstance() specifies the issuers and the terms. An invitation
|
|
10
|
+
* for the seller is returned as the creatorInvitation. The seller's
|
|
11
|
+
* offer should look like { give: { Asset: asset }, want: { Ask:
|
|
12
|
+
* minimumBidAmount}} The asset can be non-fungible, but the Ask
|
|
13
|
+
* amount should be of a fungible brand. The bidder invitations can be
|
|
14
|
+
* made by calling makeBidInvitation on the object returned from the
|
|
15
|
+
* seller's offer. Each bidder can submit an offer: { give: { Bid:
|
|
16
|
+
* null } want: { Asset: null } }.
|
|
17
|
+
*
|
|
18
|
+
* @param {ZCF<{
|
|
19
|
+
* timeAuthority: import('@agoric/time').TimerService,
|
|
20
|
+
* winnerPriceOption?: FIRST_PRICE | SECOND_PRICE,
|
|
21
|
+
* bidDuration: bigint,
|
|
22
|
+
* }>} zcf
|
|
23
|
+
*/
|
|
24
|
+
export function start(zcf: ZCF<{
|
|
25
|
+
timeAuthority: import('@agoric/time').TimerService;
|
|
26
|
+
winnerPriceOption?: "first-price" | "second-price";
|
|
27
|
+
bidDuration: bigint;
|
|
28
|
+
}>): {
|
|
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").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").TimerService;
|
|
49
|
+
bids: string | any[];
|
|
50
|
+
};
|
|
51
|
+
}>, undefined>>;
|
|
52
|
+
publicFacet: {
|
|
53
|
+
getCurrentBids: () => any[] | "Bids are hidden for \"second price\" auctions";
|
|
54
|
+
getSessionDetails: () => {
|
|
55
|
+
auctionedAssets: any;
|
|
56
|
+
minimumBid: any;
|
|
57
|
+
winnerPriceOption: string;
|
|
58
|
+
closesAfter: any;
|
|
59
|
+
bidDuration: bigint;
|
|
60
|
+
timeAuthority: import("@agoric/time").TimerService;
|
|
61
|
+
bids: string | any[];
|
|
62
|
+
};
|
|
63
|
+
} & import("@endo/eventual-send").RemotableBrand<{}, {
|
|
64
|
+
getCurrentBids: () => any[] | "Bids are hidden for \"second price\" auctions";
|
|
65
|
+
getSessionDetails: () => {
|
|
66
|
+
auctionedAssets: any;
|
|
67
|
+
minimumBid: any;
|
|
68
|
+
winnerPriceOption: string;
|
|
69
|
+
closesAfter: any;
|
|
70
|
+
bidDuration: bigint;
|
|
71
|
+
timeAuthority: import("@agoric/time").TimerService;
|
|
72
|
+
bids: string | any[];
|
|
73
|
+
};
|
|
74
|
+
}>;
|
|
75
|
+
};
|
|
76
|
+
export const FIRST_PRICE: "first-price";
|
|
77
|
+
export const SECOND_PRICE: "second-price";
|
|
78
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.js"],"names":[],"mappings":"AAqBA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,2BANW,IAAI;IACd,aAAe,EAAE,OAAO,cAAc,EAAE,YAAY,CAAC;IACrD,iBAAmB,CAAC,EAAE,8BAA0B,CAAC;IACjD,WAAa,EAAE,MAAM,CAAC;CACnB,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA0HJ;AAlJD,wCAAkC;AAClC,0CAAoC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"secondPriceLogic.d.ts","sourceRoot":"","sources":["secondPriceLogic.js"],"names":[],"mappings":"AAOO,wCAJI,GAAG,YACH,OAAO,YACP,MAAM,OAAO,CAAC,QA8DxB"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This is a very trivial contract to explain and test Zoe.
|
|
3
|
+
* AutomaticRefund just gives you back what you put in.
|
|
4
|
+
* AutomaticRefund tells Zoe to complete the
|
|
5
|
+
* offer, which gives the user their payout through Zoe. Other
|
|
6
|
+
* contracts will use these same steps, but they will have more
|
|
7
|
+
* sophisticated logic and interfaces.
|
|
8
|
+
*
|
|
9
|
+
* Since the contract doesn't attempt any reallocation, the offer can contain
|
|
10
|
+
* anything in `give` and `want`. The amount in `give` will be returned, and
|
|
11
|
+
* `want` will be ignored.
|
|
12
|
+
*
|
|
13
|
+
* @param {ZCF<{}>} zcf
|
|
14
|
+
*/
|
|
15
|
+
export function start(zcf: ZCF<{}>): {
|
|
16
|
+
creatorInvitation: Promise<Invitation<unknown, never>>;
|
|
17
|
+
publicFacet: {
|
|
18
|
+
getOffersCount: () => bigint;
|
|
19
|
+
makeInvitation: () => Promise<Invitation<unknown, never>>;
|
|
20
|
+
} & import("@endo/eventual-send").RemotableBrand<{}, {
|
|
21
|
+
getOffersCount: () => bigint;
|
|
22
|
+
makeInvitation: () => Promise<Invitation<unknown, never>>;
|
|
23
|
+
}>;
|
|
24
|
+
};
|
|
25
|
+
//# sourceMappingURL=automaticRefund.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"automaticRefund.d.ts","sourceRoot":"","sources":["automaticRefund.js"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;GAaG;AACH,2BAFW,IAAI,EAAE,CAAC;;;;;;;;;EAqBjB"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Autoswap is a rewrite of Uniswap. Please see the documentation for
|
|
3
|
+
* more https://agoric.com/documentation/zoe/guide/contracts/autoswap.html
|
|
4
|
+
*
|
|
5
|
+
* When the contract is instantiated, the two tokens (Central and Secondary) are
|
|
6
|
+
* specified in the issuerKeywordRecord. There is no behavioral difference
|
|
7
|
+
* between the two when trading; the names were chosen for consistency with our
|
|
8
|
+
* constant product AMM. When trading, use the keywords In and Out to specify
|
|
9
|
+
* the amount to be paid in, and the amount to be received.
|
|
10
|
+
*
|
|
11
|
+
* When adding or removing liquidity, the amounts deposited must be in
|
|
12
|
+
* proportion to the current balances in the pool. The amount of the Central
|
|
13
|
+
* asset is used as the basis. The Secondary assets must be added in proportion.
|
|
14
|
+
* If less Secondary is provided than required, we refuse the offer. If more is
|
|
15
|
+
* provided than is required, we return the excess.
|
|
16
|
+
*
|
|
17
|
+
* Before trading can take place, it is necessary to add liquidity using
|
|
18
|
+
* makeAddLiquidityInvitation(). Separate invitations are available for adding
|
|
19
|
+
* and removing liquidity, and for doing swaps. Other API operations support
|
|
20
|
+
* price checks and checking the size of the liquidity pool.
|
|
21
|
+
*
|
|
22
|
+
* The swap operation requires either the input amount or the output amount to
|
|
23
|
+
* be specified. makeSwapInInvitation treats the give amount as definitive,
|
|
24
|
+
* while makeSwapOutInvitation honors the want amount. With swapIn, a want
|
|
25
|
+
* amount can be specified, and if the offer can't be satisfied, the offer will
|
|
26
|
+
* be refunded. Similarly with swapOut, the want amount will be satisfied if
|
|
27
|
+
* possible. If more is provided as the give amount than necessary, the excess
|
|
28
|
+
* will be refunded. If not enough is provided, the offer will be refunded.
|
|
29
|
+
*
|
|
30
|
+
* The publicFacet can make new invitations (makeSwapInInvitation,
|
|
31
|
+
* makeSwapOutInvitation, makeAddLiquidityInvitation, and
|
|
32
|
+
* makeRemoveLiquidityInvitation), tell how much would be paid for a given input
|
|
33
|
+
* (getInputPrice), or how much would be earned by depositing a specified amount
|
|
34
|
+
* (getOutputPrice). In addition, there are requests for the LiquidityIssuer
|
|
35
|
+
* (getLiquidityIssuer), the current outstanding liquidity (getLiquiditySupply),
|
|
36
|
+
* and the current balances in the pool (getPoolAllocation).
|
|
37
|
+
*
|
|
38
|
+
* @param {ZCF} zcf
|
|
39
|
+
*/
|
|
40
|
+
export function start(zcf: ZCF): Promise<{
|
|
41
|
+
publicFacet: AutoswapPublicFacet;
|
|
42
|
+
}>;
|
|
43
|
+
//# sourceMappingURL=autoswap.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"autoswap.d.ts","sourceRoot":"","sources":["autoswap.js"],"names":[],"mappings":"AAeA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsCG;AACH,2BAFW,GAAG;;GAoVb"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This Barter Exchange accepts offers to trade arbitrary goods for other
|
|
3
|
+
* things. It doesn't require registration of Issuers. If two offers satisfy
|
|
4
|
+
* each other, it exchanges the specified amounts in each side's want clause.
|
|
5
|
+
* https://agoric.com/documentation/zoe/guide/contracts/barter-exchange.html
|
|
6
|
+
*
|
|
7
|
+
* The Barter Exchange only accepts offers that look like
|
|
8
|
+
* { give: { In: amount }, want: { Out: amount} }
|
|
9
|
+
* The want amount will be matched, while the give amount is a maximum. Each
|
|
10
|
+
* successful trader gets their `want` and may trade with counter-parties who
|
|
11
|
+
* specify any amount up to their specified `give`.
|
|
12
|
+
*
|
|
13
|
+
* @param {ZCF} zcf
|
|
14
|
+
*/
|
|
15
|
+
export function start(zcf: ZCF): {
|
|
16
|
+
publicFacet: {
|
|
17
|
+
makeInvitation: () => Promise<Invitation<unknown, never>>;
|
|
18
|
+
} & import("@endo/eventual-send").RemotableBrand<{}, {
|
|
19
|
+
makeInvitation: () => Promise<Invitation<unknown, never>>;
|
|
20
|
+
}>;
|
|
21
|
+
};
|
|
22
|
+
//# sourceMappingURL=barterExchange.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"barterExchange.d.ts","sourceRoot":"","sources":["barterExchange.js"],"names":[],"mappings":"AAKA;;;;;;;;;;;;;GAaG;AACH,2BAFW,GAAG;;;;;;EA+Gb"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"calculateShares.d.ts","sourceRoot":"","sources":["calculateShares.js"],"names":[],"mappings":"AAeM,2MAyBN"}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This contract implements a fully collateralized call spread. This is a
|
|
3
|
+
* combination of a call option bought at one strike price and a second call
|
|
4
|
+
* option sold at a higher price. The invitations are produced in pairs, and the
|
|
5
|
+
* instance creator escrows upfront all collateral that will be paid out. The
|
|
6
|
+
* individual options are ERTP invitations that are suitable for resale.
|
|
7
|
+
*
|
|
8
|
+
* This option contract is settled financially. There is no requirement that the
|
|
9
|
+
* creator have ownership of the underlying asset at the start, and
|
|
10
|
+
* the beneficiaries shouldn't expect to take delivery at closing.
|
|
11
|
+
*
|
|
12
|
+
* The issuerKeywordRecord specifies the issuers for three keywords: Underlying,
|
|
13
|
+
* Strike, and Collateral. The payout is in Collateral. Strike amounts are used
|
|
14
|
+
* for the price oracle's quotes as to the value of the Underlying, as well as
|
|
15
|
+
* the strike prices in the terms.
|
|
16
|
+
*
|
|
17
|
+
* The creatorInvitation has customDetails that include the amounts of the
|
|
18
|
+
* two options as longAmount and shortAmount. When the creatorInvitation is
|
|
19
|
+
* exercised, the payout includes the two option positions, which are themselves
|
|
20
|
+
* invitations which can be exercised for free, and provide the option payouts
|
|
21
|
+
* with the keyword Collateral.
|
|
22
|
+
*
|
|
23
|
+
* terms include:
|
|
24
|
+
* `timer` is a timer, and must be recognized by `priceAuthority`.
|
|
25
|
+
* `expiration` is a time recognized by the `timer`.
|
|
26
|
+
* `underlyingAmount` is passed to `priceAuthority`. It could be an NFT or a
|
|
27
|
+
* fungible amount.
|
|
28
|
+
* `strikePrice2` must be greater than `strikePrice1`.
|
|
29
|
+
* `settlementAmount` is the amount deposited by the funder and split between
|
|
30
|
+
* the holders of the options. It uses Collateral.
|
|
31
|
+
* `priceAuthority` is an oracle that has a timer so it can respond to requests
|
|
32
|
+
* for prices as of a stated time. After the deadline, it will issue a
|
|
33
|
+
* PriceQuote giving the value of the underlying asset in the strike currency.
|
|
34
|
+
*
|
|
35
|
+
* Future enhancements:
|
|
36
|
+
* + issue multiple option pairs with the same expiration from a single instance
|
|
37
|
+
* + increase the precision of the calculations. (use Ratios with
|
|
38
|
+
* denominator.value=10000)
|
|
39
|
+
*/
|
|
40
|
+
/**
|
|
41
|
+
* @param {ZCF<{
|
|
42
|
+
* strikePrice1: Amount,
|
|
43
|
+
* strikePrice2: Amount,
|
|
44
|
+
* settlementAmount: Amount,
|
|
45
|
+
* priceAuthority: PriceAuthority,
|
|
46
|
+
* expiration: bigint,
|
|
47
|
+
* underlyingAmount: Amount,
|
|
48
|
+
* }>} zcf
|
|
49
|
+
*/
|
|
50
|
+
export function start(zcf: ZCF<{
|
|
51
|
+
strikePrice1: Amount;
|
|
52
|
+
strikePrice2: Amount;
|
|
53
|
+
settlementAmount: Amount;
|
|
54
|
+
priceAuthority: PriceAuthority;
|
|
55
|
+
expiration: bigint;
|
|
56
|
+
underlyingAmount: Amount;
|
|
57
|
+
}>): Promise<{
|
|
58
|
+
creatorInvitation: Promise<Invitation<unknown, never>>;
|
|
59
|
+
}>;
|
|
60
|
+
//# sourceMappingURL=fundedCallSpread.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fundedCallSpread.d.ts","sourceRoot":"","sources":["fundedCallSpread.js"],"names":[],"mappings":"AAaA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsCG;AAEH;;;;;;;;;GASG;AACH,2BATW,IAAI;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"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* makePayoffHandler returns an object with methods that are useful for
|
|
3
|
+
* callSpread contracts.
|
|
4
|
+
*
|
|
5
|
+
* @param {ZCF<Record<string, any>>} zcf
|
|
6
|
+
* @param {Record<PositionKind,PromiseRecord<ZCFSeat>>} seatPromiseKits
|
|
7
|
+
* @param {ZCFSeat} collateralSeat
|
|
8
|
+
* @returns {PayoffHandler}
|
|
9
|
+
*/
|
|
10
|
+
export function makePayoffHandler(zcf: ZCF<Record<string, any>>, seatPromiseKits: Record<PositionKind, PromiseRecord<ZCFSeat>>, collateralSeat: ZCFSeat): PayoffHandler;
|
|
11
|
+
//# sourceMappingURL=payoffHandler.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"payoffHandler.d.ts","sourceRoot":"","sources":["payoffHandler.js"],"names":[],"mappings":"AAaA;;;;;;;;GAQG;AACH,uCALW,IAAI,OAAO,MAAM,EAAE,GAAG,CAAC,CAAC,iFAExB,OAAO,GACL,aAAa,CAgEzB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"percent.d.ts","sourceRoot":"","sources":["percent.js"],"names":[],"mappings":"AAe+9B,+DAAsE;AAAW,6DAAoE"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"position.d.ts","sourceRoot":"","sources":["position.js"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,uBAFU;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,OAAO,CAAA;CAAE,CAKxC"}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This contract implements a fully collateralized call spread. This is a
|
|
3
|
+
* combination of a call option bought at one strike price and a second call
|
|
4
|
+
* option sold at a higher price. The invitations are produced in pairs. The
|
|
5
|
+
* creatorFacet has a method makeInvitationPair(longCollateralShare) whose
|
|
6
|
+
* argument must be a number between 0 and 100. makeInvitationPair() returns two
|
|
7
|
+
* invitations which require depositing amounts summing to the settlement amount
|
|
8
|
+
* in the proportions longCollateralShare and (100 - longCollateralShare) to
|
|
9
|
+
* redeem the respective options/invitations. (They are returned under the
|
|
10
|
+
* Keyword 'Option'.) The options are ERTP invitations that are suitable for
|
|
11
|
+
* resale.
|
|
12
|
+
*
|
|
13
|
+
* This option contract is settled financially. There is no requirement that the
|
|
14
|
+
* creator have ownership of the underlying asset at the start, and
|
|
15
|
+
* the beneficiaries shouldn't expect to take delivery at closing.
|
|
16
|
+
*
|
|
17
|
+
* The issuerKeywordRecord specifies the issuers for three keywords: Underlying,
|
|
18
|
+
* Strike, and Collateral. The payout is in Collateral. Strike amounts are used
|
|
19
|
+
* for the price oracle's quotes as to the value of the Underlying, as well as
|
|
20
|
+
* the strike prices in the terms.
|
|
21
|
+
*
|
|
22
|
+
* terms include:
|
|
23
|
+
* `timer` is a timer, and must be recognized by `priceAuthority`.
|
|
24
|
+
* `expiration` is a time recognized by the `timer`.
|
|
25
|
+
* `underlyingAmount` is passed to `priceAuthority`. It could be an NFT or a
|
|
26
|
+
* fungible amount.
|
|
27
|
+
* `strikePrice2` must be greater than `strikePrice1`.
|
|
28
|
+
* `settlementAmount` is the amount deposited by the funder and split between
|
|
29
|
+
* the holders of the options. It uses Collateral.
|
|
30
|
+
* `priceAuthority` is an oracle that has a timer so it can respond to requests
|
|
31
|
+
* for prices as of a stated time. After the deadline, it will issue a
|
|
32
|
+
* PriceQuote giving the value of the underlying asset in the strike currency.
|
|
33
|
+
*
|
|
34
|
+
* Future enhancements:
|
|
35
|
+
* + issue multiple option pairs with the same expiration from a single instance
|
|
36
|
+
*
|
|
37
|
+
* @param {ZCF<{
|
|
38
|
+
* strikePrice1: Amount<'nat'>,
|
|
39
|
+
* strikePrice2: Amount<'nat'>,
|
|
40
|
+
* settlementAmount: Amount<'nat'>,
|
|
41
|
+
* priceAuthority: PriceAuthority,
|
|
42
|
+
* expiration: bigint,
|
|
43
|
+
* underlyingAmount: Amount<'nat'>,
|
|
44
|
+
* }>} zcf
|
|
45
|
+
*/
|
|
46
|
+
export function start(zcf: ZCF<{
|
|
47
|
+
strikePrice1: Amount<'nat'>;
|
|
48
|
+
strikePrice2: Amount<'nat'>;
|
|
49
|
+
settlementAmount: Amount<'nat'>;
|
|
50
|
+
priceAuthority: PriceAuthority;
|
|
51
|
+
expiration: bigint;
|
|
52
|
+
underlyingAmount: Amount<'nat'>;
|
|
53
|
+
}>): {
|
|
54
|
+
creatorFacet: {
|
|
55
|
+
makeInvitationPair: (longCollateralShare: any) => {
|
|
56
|
+
longInvitation: Promise<Invitation<unknown, never>>;
|
|
57
|
+
shortInvitation: Promise<Invitation<unknown, never>>;
|
|
58
|
+
};
|
|
59
|
+
} & import("@endo/eventual-send").RemotableBrand<{}, {
|
|
60
|
+
makeInvitationPair: (longCollateralShare: any) => {
|
|
61
|
+
longInvitation: Promise<Invitation<unknown, never>>;
|
|
62
|
+
shortInvitation: Promise<Invitation<unknown, never>>;
|
|
63
|
+
};
|
|
64
|
+
}>;
|
|
65
|
+
};
|
|
66
|
+
//# sourceMappingURL=pricedCallSpread.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pricedCallSpread.d.ts","sourceRoot":"","sources":["pricedCallSpread.js"],"names":[],"mappings":"AAsBA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4CG;AACH,2BATW,IAAI;IACd,YAAc,EAAE,OAAO,KAAK,CAAC,CAAC;IAC9B,YAAc,EAAE,OAAO,KAAK,CAAC,CAAC;IAC9B,gBAAkB,EAAE,OAAO,KAAK,CAAC,CAAC;IAClC,cAAgB,EAAE,cAAc,CAAC;IACjC,UAAY,EAAE,MAAM,CAAC;IACrB,gBAAkB,EAAE,OAAO,KAAK,CAAC,CAAC;CAC/B,CAAC;;;;;;;;;;;;EAyGJ"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
type PositionKind = 'long' | 'short';
|
|
2
|
+
type MakeOptionInvitation = (positionKind: PositionKind) => Promise<Invitation>;
|
|
3
|
+
type PayoffHandler = {
|
|
4
|
+
schedulePayoffs: () => void;
|
|
5
|
+
makeOptionInvitation: MakeOptionInvitation;
|
|
6
|
+
};
|
|
7
|
+
/**
|
|
8
|
+
* Return value from calculateShares, which represents the portions assigned to
|
|
9
|
+
* the long and short side of a transaction. These will be two non-negative
|
|
10
|
+
* integers that sum to 100.
|
|
11
|
+
*/
|
|
12
|
+
type CalculateSharesReturn = {
|
|
13
|
+
longShare: Ratio;
|
|
14
|
+
shortShare: Ratio;
|
|
15
|
+
};
|
|
16
|
+
/**
|
|
17
|
+
* calculate the portion (as a percentage) of the collateral that should be
|
|
18
|
+
* allocated to the long side of a call spread contract. price gives the value
|
|
19
|
+
* of the underlying asset at closing that determines the payouts to the parties
|
|
20
|
+
*
|
|
21
|
+
* if price <= strikePrice1, return Ratio representing 0
|
|
22
|
+
* if price >= strikePrice2, return Ratio representing 1.
|
|
23
|
+
* Otherwise return longShare and shortShare representing ratios between 0% and
|
|
24
|
+
* 100% reflecting the position of the price in the range from strikePrice1 to
|
|
25
|
+
* strikePrice2.
|
|
26
|
+
*/
|
|
27
|
+
type CalculateShares = (collateralBrand: Brand, price: Amount<'nat'>, strikePrice1: Amount<'nat'>, strikePrice2: Amount<'nat'>) => CalculateSharesReturn;
|
|
28
|
+
type Make100Percent = (brand: Brand) => Ratio;
|
|
29
|
+
type Make0Percent = (brand: Brand) => Ratio;
|
|
30
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["types.js"],"names":[],"mappings":"oBACa,MAAM,GAAG,OAAO;2CAKlB,YAAY,KACV,QAAQ,UAAU,CAAC;;qBAKlB,MAAM,IAAI;0BACT,oBAAoB;;;;;;;;eAQrB,KAAK;gBACL,KAAK;;;;;;;;;;;;;yCAcR,KAAK,SACL,OAAO,KAAK,CAAC,gBACb,OAAO,KAAK,CAAC,gBACb,OAAO,KAAK,CAAC,KACX,qBAAqB;8BAKvB,KAAK,KACH,KAAK;4BAKP,KAAK,KACH,KAAK"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @see comment on functionality in ./coveredCall.js.
|
|
3
|
+
*
|
|
4
|
+
* This variant has been made durable and upgradeable. The exerciser survives
|
|
5
|
+
* upgrade so the exerciseOption invitation will continue to work after upgrade.
|
|
6
|
+
*
|
|
7
|
+
* The version in
|
|
8
|
+
* zoe/test/swingsetTests/upgradeCoveredCall/coveredCall-durable-V3.js
|
|
9
|
+
* has some minor changes so tests can verify that upgrading from this to that
|
|
10
|
+
* preserves usefulness of the invitation.
|
|
11
|
+
*
|
|
12
|
+
* @param {ZCF} zcf
|
|
13
|
+
* @param {unknown} _privateArgs
|
|
14
|
+
* @param {import('@agoric/vat-data').Baggage} instanceBaggage
|
|
15
|
+
*/
|
|
16
|
+
export function start(zcf: ZCF, _privateArgs: unknown, instanceBaggage: import('@agoric/vat-data').Baggage): Promise<{
|
|
17
|
+
creatorFacet: import("@endo/exo").Guarded<{
|
|
18
|
+
makeInvitation(): Promise<Invitation<unknown, never>>;
|
|
19
|
+
}>;
|
|
20
|
+
}>;
|
|
21
|
+
//# sourceMappingURL=coveredCall-durable.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
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"}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A call option is the right (but not the obligation) to buy digital
|
|
3
|
+
* assets at a pre-determined price, called the strike price. This
|
|
4
|
+
* call option is "covered," meaning that the owner of the digital
|
|
5
|
+
* assets must put the assets in escrow. This guarantees that the
|
|
6
|
+
* assets can be transferred without relying on the owner of the
|
|
7
|
+
* digital assets to keep their promise.
|
|
8
|
+
*
|
|
9
|
+
* https://agoric.com/documentation/zoe/guide/contracts/covered-call.html
|
|
10
|
+
*
|
|
11
|
+
* The call option has an expiration date, when the opportunity is
|
|
12
|
+
* cancelled. The owner of the digital assets cannot remove the assets
|
|
13
|
+
* from escrow before the expiration date.
|
|
14
|
+
*
|
|
15
|
+
* The `creatorInvitation` of this contract is an invitation to escrow
|
|
16
|
+
* the underlying assets. The proposal to escrow assets can have any
|
|
17
|
+
* `give` and `want` with any keywords. Any number of assets of
|
|
18
|
+
* different brands can be escrowed under different keywords. The
|
|
19
|
+
* proposal must have an exit record with the key "afterDeadline":
|
|
20
|
+
* {
|
|
21
|
+
* give: { ... },
|
|
22
|
+
* want: { ... },
|
|
23
|
+
* exit: {
|
|
24
|
+
* afterDeadline: { deadline: time, timer: myTimer }
|
|
25
|
+
* },
|
|
26
|
+
* }
|
|
27
|
+
*
|
|
28
|
+
* This deadline serves as the expiration date for the covered call
|
|
29
|
+
* option. After this deadline, if the option has not been exercised,
|
|
30
|
+
* the underlying assets are automatically paid out to the creator of
|
|
31
|
+
* the contract as a refund.
|
|
32
|
+
*
|
|
33
|
+
* After the owner of the digital assets escrows the assets in the
|
|
34
|
+
* initial offer, they receive a seat. The payout for this seat will
|
|
35
|
+
* either be a refund of the underlying assets (as mentioned above) or
|
|
36
|
+
* payments in the amount of the strike price. Zoe's enforcement of
|
|
37
|
+
* offer safety guarantees that the payout is either a refund or
|
|
38
|
+
* payments in the amount of the strike price, regardless of whether
|
|
39
|
+
* this contract is buggy.
|
|
40
|
+
*
|
|
41
|
+
* The offerResult of this initial seat resolves to the call option
|
|
42
|
+
* itself: an inspectable invitation to buy the underlying assets. The
|
|
43
|
+
* call option invitation has this additional information in the
|
|
44
|
+
* value: {expirationDate, timeAuthority, underlyingAssets,
|
|
45
|
+
* strikePrice }
|
|
46
|
+
*
|
|
47
|
+
* The invitation itself can be traded as a valuable digital asset: a
|
|
48
|
+
* covered call option.
|
|
49
|
+
*
|
|
50
|
+
* The recipient of a covered call option (buying it on some other
|
|
51
|
+
* exchange or through some other trading contract) can exercise the
|
|
52
|
+
* option before the deadline by using the option as an invitation to
|
|
53
|
+
* this contract, paying the strike price and receiving the underlying
|
|
54
|
+
* assets. The recipient of a covered call option can use whatever
|
|
55
|
+
* keywords they wish, as long as they give the strike price as
|
|
56
|
+
* specified in the invitation value, and want the underlying assets
|
|
57
|
+
* exactly.
|
|
58
|
+
*
|
|
59
|
+
* @param {ZCF} zcf
|
|
60
|
+
*/
|
|
61
|
+
export function start(zcf: ZCF): {
|
|
62
|
+
creatorInvitation: Promise<Invitation<unknown, never>>;
|
|
63
|
+
};
|
|
64
|
+
//# sourceMappingURL=coveredCall.d.ts.map
|