@agoric/zoe 0.28.0-u23.0 → 0.28.0-u23.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/package.json +10 -10
- package/source-spec-registry.d.ts +25 -0
- package/source-spec-registry.d.ts.map +1 -0
- package/src/cleanProposal.d.ts +13 -0
- package/src/cleanProposal.d.ts.map +1 -0
- package/src/contractFacet/allocationMath.d.ts +11 -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/offerHandlerStorage.d.ts +14 -0
- package/src/contractFacet/offerHandlerStorage.d.ts.map +1 -0
- package/src/contractFacet/offerSafety.d.ts +36 -0
- package/src/contractFacet/offerSafety.d.ts.map +1 -0
- package/src/contractFacet/reallocate.d.ts +6 -0
- package/src/contractFacet/reallocate.d.ts.map +1 -0
- package/src/contractFacet/rightsConservation.d.ts +13 -0
- package/src/contractFacet/rightsConservation.d.ts.map +1 -0
- package/src/contractFacet/typeGuards.d.ts +8 -0
- package/src/contractFacet/typeGuards.d.ts.map +1 -0
- package/src/contractFacet/types.d.ts +182 -0
- package/src/contractFacet/types.d.ts.map +1 -0
- package/src/contractFacet/vatRoot.d.ts +30 -0
- package/src/contractFacet/vatRoot.d.ts.map +1 -0
- package/src/contractFacet/zcfMint.d.ts +18 -0
- package/src/contractFacet/zcfMint.d.ts.map +1 -0
- package/src/contractFacet/zcfSeat.d.ts +12 -0
- package/src/contractFacet/zcfSeat.d.ts.map +1 -0
- package/src/contractFacet/zcfZygote.d.ts +19 -0
- package/src/contractFacet/zcfZygote.d.ts.map +1 -0
- package/src/contractSupport/atomicTransfer.d.ts +13 -0
- package/src/contractSupport/atomicTransfer.d.ts.map +1 -0
- package/src/contractSupport/bondingCurves.d.ts +7 -0
- package/src/contractSupport/bondingCurves.d.ts.map +1 -0
- package/src/contractSupport/durability.d.ts +10 -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 +14 -0
- package/src/contractSupport/prepare-ownable.d.ts.map +1 -0
- package/src/contractSupport/priceAuthority.d.ts +36 -0
- package/src/contractSupport/priceAuthority.d.ts.map +1 -0
- package/src/contractSupport/priceAuthorityInitial.d.ts +8 -0
- package/src/contractSupport/priceAuthorityInitial.d.ts.map +1 -0
- package/src/contractSupport/priceAuthorityQuoteMint.d.ts +6 -0
- package/src/contractSupport/priceAuthorityQuoteMint.d.ts.map +1 -0
- package/src/contractSupport/priceAuthorityTransform.d.ts +23 -0
- package/src/contractSupport/priceAuthorityTransform.d.ts.map +1 -0
- package/src/contractSupport/priceQuote.d.ts +13 -0
- package/src/contractSupport/priceQuote.d.ts.map +1 -0
- package/src/contractSupport/recorder.d.ts +91 -0
- package/src/contractSupport/recorder.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/testJigHelpers.d.ts +7 -0
- package/src/contractSupport/testJigHelpers.d.ts.map +1 -0
- package/src/contractSupport/topics.d.ts +52 -0
- package/src/contractSupport/topics.d.ts.map +1 -0
- package/src/contractSupport/types.d.ts +70 -0
- package/src/contractSupport/types.d.ts.map +1 -0
- package/src/contractSupport/zoeHelpers.d.ts +53 -0
- package/src/contractSupport/zoeHelpers.d.ts.map +1 -0
- package/src/contracts/atomicSwap.d.ts +20 -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 +4 -0
- package/src/contracts/auction/firstPriceLogic.d.ts.map +1 -0
- package/src/contracts/auction/index.d.ts +84 -0
- package/src/contracts/auction/index.d.ts.map +1 -0
- package/src/contracts/auction/secondPriceLogic.d.ts +4 -0
- package/src/contracts/auction/secondPriceLogic.d.ts.map +1 -0
- package/src/contracts/automaticRefund.d.ts +29 -0
- package/src/contracts/automaticRefund.d.ts.map +1 -0
- package/src/contracts/autoswap.d.ts +51 -0
- package/src/contracts/autoswap.d.ts.map +1 -0
- package/src/contracts/barterExchange.d.ts +26 -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 +71 -0
- package/src/contracts/callSpread/fundedCallSpread.d.ts.map +1 -0
- package/src/contracts/callSpread/payoffHandler.d.ts +23 -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 +69 -0
- package/src/contracts/callSpread/pricedCallSpread.d.ts.map +1 -0
- package/src/contracts/callSpread/types.d.ts +34 -0
- package/src/contracts/callSpread/types.d.ts.map +1 -0
- package/src/contracts/coveredCall-durable.d.ts +23 -0
- package/src/contracts/coveredCall-durable.d.ts.map +1 -0
- package/src/contracts/coveredCall.d.ts +68 -0
- package/src/contracts/coveredCall.d.ts.map +1 -0
- package/src/contracts/loan/addCollateral.d.ts +8 -0
- package/src/contracts/loan/addCollateral.d.ts.map +1 -0
- package/src/contracts/loan/borrow.d.ts +12 -0
- package/src/contracts/loan/borrow.d.ts.map +1 -0
- package/src/contracts/loan/close.d.ts +8 -0
- package/src/contracts/loan/close.d.ts.map +1 -0
- package/src/contracts/loan/index.d.ts +75 -0
- package/src/contracts/loan/index.d.ts.map +1 -0
- package/src/contracts/loan/lend.d.ts +8 -0
- package/src/contracts/loan/lend.d.ts.map +1 -0
- package/src/contracts/loan/liquidate.d.ts +5 -0
- package/src/contracts/loan/liquidate.d.ts.map +1 -0
- package/src/contracts/loan/scheduleLiquidation.d.ts +7 -0
- package/src/contracts/loan/scheduleLiquidation.d.ts.map +1 -0
- package/src/contracts/loan/types.d.ts +176 -0
- package/src/contracts/loan/types.d.ts.map +1 -0
- package/src/contracts/loan/updateDebt.d.ts +17 -0
- package/src/contracts/loan/updateDebt.d.ts.map +1 -0
- package/src/contracts/mintAndSellNFT.d.ts +35 -0
- package/src/contracts/mintAndSellNFT.d.ts.map +1 -0
- package/src/contracts/mintPayments.d.ts +34 -0
- package/src/contracts/mintPayments.d.ts.map +1 -0
- package/src/contracts/oracle.d.ts +38 -0
- package/src/contracts/oracle.d.ts.map +1 -0
- package/src/contracts/otcDesk.d.ts +90 -0
- package/src/contracts/otcDesk.d.ts.map +1 -0
- package/src/contracts/priceAggregator.d.ts +125 -0
- package/src/contracts/priceAggregator.d.ts.map +1 -0
- package/src/contracts/priceAggregatorTypes.d.ts +83 -0
- package/src/contracts/priceAggregatorTypes.d.ts.map +1 -0
- package/src/contracts/scaledPriceAuthority.d.ts +26 -0
- package/src/contracts/scaledPriceAuthority.d.ts.map +1 -0
- package/src/contracts/sellItems.d.ts +40 -0
- package/src/contracts/sellItems.d.ts.map +1 -0
- package/src/contracts/simpleExchange.d.ts +42 -0
- package/src/contracts/simpleExchange.d.ts.map +1 -0
- package/src/contracts/types.d.ts +87 -0
- package/src/contracts/types.d.ts.map +1 -0
- package/src/contracts/valueVow.contract.d.ts +20 -0
- package/src/contracts/valueVow.contract.d.ts.map +1 -0
- package/src/handleWarning.d.ts +4 -0
- package/src/handleWarning.d.ts.map +1 -0
- package/src/instanceRecordStorage.d.ts +5 -0
- package/src/instanceRecordStorage.d.ts.map +1 -0
- package/src/internal-types.d.ts +196 -0
- package/src/internal-types.d.ts.map +1 -0
- package/src/issuerRecord.d.ts +9 -0
- package/src/issuerRecord.d.ts.map +1 -0
- package/src/issuerStorage.d.ts +24 -0
- package/src/issuerStorage.d.ts.map +1 -0
- package/src/makeHandle.d.ts +6 -0
- package/src/makeHandle.d.ts.map +1 -0
- package/src/typeGuards.d.ts +185 -0
- package/src/typeGuards.d.ts.map +1 -0
- package/src/types.d.ts +29 -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 +12 -0
- package/src/zoeService/escrowStorage.d.ts.map +1 -0
- package/src/zoeService/feeMint.d.ts +27 -0
- package/src/zoeService/feeMint.d.ts.map +1 -0
- package/src/zoeService/installationStorage.d.ts +21 -0
- package/src/zoeService/installationStorage.d.ts.map +1 -0
- package/src/zoeService/instanceAdminStorage.d.ts +107 -0
- package/src/zoeService/instanceAdminStorage.d.ts.map +1 -0
- package/src/zoeService/internal-types.d.ts +125 -0
- package/src/zoeService/internal-types.d.ts.map +1 -0
- package/src/zoeService/invitationQueries.d.ts +9 -0
- package/src/zoeService/invitationQueries.d.ts.map +1 -0
- package/src/zoeService/makeInvitation.d.ts +9 -0
- package/src/zoeService/makeInvitation.d.ts.map +1 -0
- package/src/zoeService/offer/burnInvitation.d.ts +11 -0
- package/src/zoeService/offer/burnInvitation.d.ts.map +1 -0
- package/src/zoeService/offer/offer.d.ts +3 -0
- package/src/zoeService/offer/offer.d.ts.map +1 -0
- package/src/zoeService/originalZoeSeat.d.ts +36 -0
- package/src/zoeService/originalZoeSeat.d.ts.map +1 -0
- package/src/zoeService/startInstance.d.ts +7 -0
- package/src/zoeService/startInstance.d.ts.map +1 -0
- package/src/zoeService/types.d.ts +238 -0
- package/src/zoeService/types.d.ts.map +1 -0
- package/src/zoeService/zoe.d.ts +70 -0
- package/src/zoeService/zoe.d.ts.map +1 -0
- package/src/zoeService/zoeSeat.d.ts +31 -0
- package/src/zoeService/zoeSeat.d.ts.map +1 -0
- package/src/zoeService/zoeStorageManager.d.ts +47 -0
- package/src/zoeService/zoeStorageManager.d.ts.map +1 -0
- package/tools/fakePriceAuthority.d.ts +37 -0
- package/tools/fakePriceAuthority.d.ts.map +1 -0
- package/tools/fakeVatAdmin.d.ts +118 -0
- package/tools/fakeVatAdmin.d.ts.map +1 -0
- package/tools/manualPriceAuthority.d.ts +33 -0
- package/tools/manualPriceAuthority.d.ts.map +1 -0
- package/tools/manualTimer.d.ts +23 -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 +39 -0
- package/tools/scriptedOracle.d.ts.map +1 -0
- package/tools/scriptedPriceAuthority.d.ts +37 -0
- package/tools/scriptedPriceAuthority.d.ts.map +1 -0
- package/tools/setup-zoe.d.ts +43 -0
- package/tools/setup-zoe.d.ts.map +1 -0
- package/tools/test-utils.d.ts +24 -0
- package/tools/test-utils.d.ts.map +1 -0
- package/tools/types.d.ts +152 -0
- package/tools/types.d.ts.map +1 -0
- package/bundles/bundle-contractFacet-js-meta.json +0 -1075
- package/bundles/bundle-contractFacet.d.ts +0 -7
- package/bundles/bundle-contractFacet.d.ts.map +0 -1
- package/bundles/bundle-contractFacet.js +0 -1
- package/bundles/bundle-valueVow.contract-esbuild.js +0 -1
- package/bundles/bundle-valueVow.contract-js-meta.json +0 -560
- package/bundles/bundle-valueVow.contract.js +0 -1
- package/bundles/esbuild-bundle-20251113T203237.423Z.js +0 -1
- package/bundles/esbuild-bundle-20251113T203238.037Z.js +0 -1
- package/bundles/esbuild-bundle-20251113T203238.695Z.js +0 -1
- package/bundles/esbuild-bundle-20251113T203327.010Z.js +0 -1
- package/bundles/esbuild-bundle-20251113T203330.583Z.js +0 -1
- package/bundles/esbuild-bundle-20251113T232226.026Z.js +0 -1
- package/bundles/esbuild-bundle-20251113T232229.459Z.js +0 -1
- package/bundles/esbuild-bundle-20251114T162409.358Z.js +0 -1
- package/bundles/esbuild-bundle-20251114T162409.367Z.js +0 -1
- package/bundles/esbuild-bundle-20251114T162417.875Z.js +0 -1
- package/bundles/esbuild-bundle-20251114T162419.685Z.js +0 -1
- package/bundles/esbuild-bundle-20251114T162420.279Z.js +0 -1
- package/bundles/esbuild-bundle-20251114T162421.865Z.js +0 -1
- package/bundles/esbuild-bundle-20251114T162422.353Z.js +0 -1
- package/bundles/esbuild-bundle-20251114T162423.173Z.js +0 -1
- package/bundles/esbuild-bundle-20251114T162427.670Z.js +0 -1
- package/bundles/esbuild-bundle-20251114T162429.725Z.js +0 -1
- package/bundles/esbuild-bundle-20251114T162429.727Z.js +0 -1
- package/bundles/esbuild-bundle-20251114T162430.603Z.js +0 -1
- package/bundles/esbuild-bundle-20251114T162431.414Z.js +0 -1
- package/bundles/esbuild-bundle-20251114T162433.433Z.js +0 -1
- package/bundles/esbuild-bundle-20251114T162435.370Z.js +0 -1
- package/bundles/esbuild-bundle-20251114T162437.257Z.js +0 -1
- package/bundles/esbuild-bundle-20251114T162438.372Z.js +0 -1
- package/bundles/esbuild-bundle-20251114T162438.596Z.js +0 -1
- package/bundles/esbuild-bundle-20251114T162439.399Z.js +0 -1
- package/bundles/esbuild-bundle-20251114T162439.647Z.js +0 -1
- package/bundles/esbuild-bundle-20251114T162441.758Z.js +0 -1
- package/bundles/esbuild-bundle-20251114T162441.816Z.js +0 -1
- package/bundles/esbuild-bundle-20251114T162442.916Z.js +0 -1
- package/bundles/esbuild-bundle-20251114T162443.223Z.js +0 -1
- package/bundles/esbuild-bundle-20251114T162443.627Z.js +0 -1
- package/bundles/esbuild-bundle-20251114T162444.919Z.js +0 -1
- package/bundles/esbuild-bundle-20251114T162445.277Z.js +0 -1
- package/bundles/esbuild-bundle-20251114T162446.456Z.js +0 -1
- package/bundles/esbuild-bundle-20251114T162446.985Z.js +0 -1
- package/bundles/esbuild-bundle-20251114T162447.123Z.js +0 -1
- package/bundles/esbuild-bundle-20251114T162448.243Z.js +0 -1
- package/bundles/esbuild-bundle-20251114T162448.612Z.js +0 -1
- package/bundles/esbuild-bundle-20251114T162448.908Z.js +0 -1
- package/bundles/esbuild-bundle-20251114T162449.945Z.js +0 -1
- package/bundles/esbuild-bundle-20251114T162450.616Z.js +0 -1
- package/bundles/esbuild-bundle-20251114T162451.429Z.js +0 -1
- package/bundles/esbuild-bundle-20251114T162451.929Z.js +0 -1
- package/bundles/esbuild-bundle-20251114T162452.191Z.js +0 -1
- package/bundles/esbuild-bundle-20251114T162452.687Z.js +0 -1
- package/bundles/esbuild-bundle-20251114T162453.614Z.js +0 -1
- package/bundles/esbuild-bundle-20251114T162454.028Z.js +0 -1
- package/bundles/esbuild-bundle-20251114T162454.171Z.js +0 -1
- package/bundles/esbuild-bundle-20251114T162455.073Z.js +0 -1
- package/bundles/esbuild-bundle-20251114T162455.907Z.js +0 -1
- package/bundles/esbuild-bundle-20251114T162500.300Z.js +0 -1
- package/bundles/esbuild-bundle-20251114T162501.073Z.js +0 -1
- package/bundles/esbuild-bundle-20251114T162502.359Z.js +0 -1
- package/bundles/esbuild-bundle-20251114T162502.366Z.js +0 -1
- package/bundles/esbuild-bundle-20251114T162503.345Z.js +0 -1
- package/bundles/esbuild-bundle-20251114T162503.433Z.js +0 -1
- package/bundles/esbuild-bundle-20251114T162504.445Z.js +0 -1
- package/bundles/esbuild-bundle-20251114T162505.137Z.js +0 -1
- package/bundles/esbuild-bundle-20251114T162505.167Z.js +0 -1
- package/bundles/esbuild-bundle-20251114T162505.419Z.js +0 -1
- package/bundles/esbuild-bundle-20251114T162515.878Z.js +0 -1
- package/bundles/esbuild-bundle-20251114T162516.428Z.js +0 -1
- package/bundles/esbuild-bundle-20251114T162518.796Z.js +0 -1
- package/bundles/esbuild-bundle-20251114T162521.136Z.js +0 -1
- package/bundles/esbuild-bundle-20251114T162521.391Z.js +0 -1
- package/bundles/esbuild-bundle-20251114T162522.786Z.js +0 -1
- package/bundles/esbuild-bundle-20251114T162523.313Z.js +0 -1
- package/bundles/esbuild-bundle-20251114T162524.174Z.js +0 -1
- package/bundles/esbuild-bundle-20251114T162526.066Z.js +0 -1
- package/bundles/esbuild-bundle-20251114T162527.972Z.js +0 -1
- package/bundles/esbuild-bundle-20251114T162533.153Z.js +0 -1
- package/bundles/esbuild-bundle-20251114T162537.633Z.js +0 -1
- package/bundles/esbuild-bundle-20251114T162603.943Z.js +0 -1
- package/bundles/esbuild-bundle-20251114T162604.799Z.js +0 -1
- package/bundles/esbuild-bundle-20251114T162605.605Z.js +0 -1
- package/bundles/esbuild-bundle-20251114T162606.399Z.js +0 -1
- package/bundles/esbuild-bundle-20251114T162607.115Z.js +0 -1
- package/bundles/esbuild-bundle-20251114T162607.943Z.js +0 -1
- package/bundles/esbuild-bundle-20251114T162608.705Z.js +0 -1
- package/bundles/esbuild-bundle-20251114T162609.486Z.js +0 -1
- package/bundles/esbuild-bundle-20251114T162610.269Z.js +0 -1
- package/bundles/esbuild-bundle-20251114T162611.045Z.js +0 -1
- package/bundles/esbuild-bundle-20251114T162611.814Z.js +0 -1
- package/bundles/esbuild-bundle-20251114T162612.650Z.js +0 -1
- package/bundles/esbuild-bundle-20251114T162613.429Z.js +0 -1
- package/bundles/esbuild-bundle-20251114T162614.233Z.js +0 -1
- package/bundles/esbuild-bundle-20251114T162640.495Z.js +0 -1
- package/bundles/esbuild-bundle-20251114T162950.705Z.js +0 -1
- package/bundles/zcf.b64 +0 -1
- package/bundles/zcf.zip +0 -0
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @import {Keyword, OfferHandler, ZCF} from '@agoric/zoe';
|
|
3
|
+
* @import {AutoswapPublicFacet} from './types.js';
|
|
4
|
+
* @import {Brand} from '@agoric/ertp';
|
|
5
|
+
* @import {Amount} from '@agoric/ertp';
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* Autoswap is a rewrite of Uniswap. Please see the documentation for
|
|
9
|
+
* more https://agoric.com/documentation/zoe/guide/contracts/autoswap.html
|
|
10
|
+
*
|
|
11
|
+
* When the contract is instantiated, the two tokens (Central and Secondary) are
|
|
12
|
+
* specified in the issuerKeywordRecord. There is no behavioral difference
|
|
13
|
+
* between the two when trading; the names were chosen for consistency with our
|
|
14
|
+
* constant product AMM. When trading, use the keywords In and Out to specify
|
|
15
|
+
* the amount to be paid in, and the amount to be received.
|
|
16
|
+
*
|
|
17
|
+
* When adding or removing liquidity, the amounts deposited must be in
|
|
18
|
+
* proportion to the current balances in the pool. The amount of the Central
|
|
19
|
+
* asset is used as the basis. The Secondary assets must be added in proportion.
|
|
20
|
+
* If less Secondary is provided than required, we refuse the offer. If more is
|
|
21
|
+
* provided than is required, we return the excess.
|
|
22
|
+
*
|
|
23
|
+
* Before trading can take place, it is necessary to add liquidity using
|
|
24
|
+
* makeAddLiquidityInvitation(). Separate invitations are available for adding
|
|
25
|
+
* and removing liquidity, and for doing swaps. Other API operations support
|
|
26
|
+
* price checks and checking the size of the liquidity pool.
|
|
27
|
+
*
|
|
28
|
+
* The swap operation requires either the input amount or the output amount to
|
|
29
|
+
* be specified. makeSwapInInvitation treats the give amount as definitive,
|
|
30
|
+
* while makeSwapOutInvitation honors the want amount. With swapIn, a want
|
|
31
|
+
* amount can be specified, and if the offer can't be satisfied, the offer will
|
|
32
|
+
* be refunded. Similarly with swapOut, the want amount will be satisfied if
|
|
33
|
+
* possible. If more is provided as the give amount than necessary, the excess
|
|
34
|
+
* will be refunded. If not enough is provided, the offer will be refunded.
|
|
35
|
+
*
|
|
36
|
+
* The publicFacet can make new invitations (makeSwapInInvitation,
|
|
37
|
+
* makeSwapOutInvitation, makeAddLiquidityInvitation, and
|
|
38
|
+
* makeRemoveLiquidityInvitation), tell how much would be paid for a given input
|
|
39
|
+
* (getInputPrice), or how much would be earned by depositing a specified amount
|
|
40
|
+
* (getOutputPrice). In addition, there are requests for the LiquidityIssuer
|
|
41
|
+
* (getLiquidityIssuer), the current outstanding liquidity (getLiquiditySupply),
|
|
42
|
+
* and the current balances in the pool (getPoolAllocation).
|
|
43
|
+
*
|
|
44
|
+
* @param {ZCF} zcf
|
|
45
|
+
*/
|
|
46
|
+
export function start(zcf: ZCF): Promise<{
|
|
47
|
+
publicFacet: AutoswapPublicFacet;
|
|
48
|
+
}>;
|
|
49
|
+
import type { ZCF } from '@agoric/zoe';
|
|
50
|
+
import type { AutoswapPublicFacet } from './types.js';
|
|
51
|
+
//# sourceMappingURL=autoswap.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"autoswap.d.ts","sourceRoot":"","sources":["autoswap.js"],"names":[],"mappings":"AAeA;;;;;GAKG;AAEH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsCG;AACH,2BAFW,GAAG;;GAwVb;yBAnY4C,aAAa;yCACpB,YAAY"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @import {OfferHandler, ZCF} from '@agoric/zoe';
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* This Barter Exchange accepts offers to trade arbitrary goods for other
|
|
6
|
+
* things. It doesn't require registration of Issuers. If two offers satisfy
|
|
7
|
+
* each other, it exchanges the specified amounts in each side's want clause.
|
|
8
|
+
* https://agoric.com/documentation/zoe/guide/contracts/barter-exchange.html
|
|
9
|
+
*
|
|
10
|
+
* The Barter Exchange only accepts offers that look like
|
|
11
|
+
* { give: { In: amount }, want: { Out: amount} }
|
|
12
|
+
* The want amount will be matched, while the give amount is a maximum. Each
|
|
13
|
+
* successful trader gets their `want` and may trade with counter-parties who
|
|
14
|
+
* specify any amount up to their specified `give`.
|
|
15
|
+
*
|
|
16
|
+
* @param {ZCF} zcf
|
|
17
|
+
*/
|
|
18
|
+
export function start(zcf: ZCF): {
|
|
19
|
+
publicFacet: {
|
|
20
|
+
makeInvitation: () => Promise<import("@agoric/zoe").Invitation<unknown, never>>;
|
|
21
|
+
} & import("@endo/marshal").RemotableObject<`Alleged: ${string}`> & import("@endo/eventual-send").RemotableBrand<{}, {
|
|
22
|
+
makeInvitation: () => Promise<import("@agoric/zoe").Invitation<unknown, never>>;
|
|
23
|
+
}>;
|
|
24
|
+
};
|
|
25
|
+
import type { ZCF } from '@agoric/zoe';
|
|
26
|
+
//# sourceMappingURL=barterExchange.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"barterExchange.d.ts","sourceRoot":"","sources":["barterExchange.js"],"names":[],"mappings":"AAKA;;GAEG;AAEH;;;;;;;;;;;;;GAaG;AACH,2BAFW,GAAG;;;;;;EA+Gb;yBA9HmC,aAAa"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
export function calculateShares(collateralBrand: import("@agoric/ertp").Brand, price: import("@agoric/ertp").Amount<"nat">, strikePrice1: import("@agoric/ertp").Amount<"nat">, strikePrice2: import("@agoric/ertp").Amount<"nat">): import("./types.js").CalculateSharesReturn;
|
|
2
|
+
//# sourceMappingURL=calculateShares.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"calculateShares.d.ts","sourceRoot":"","sources":["calculateShares.js"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @import {PriceAuthority} from '@agoric/zoe/tools/types.js';
|
|
3
|
+
* @import {OfferHandler, ZCF, ZCFSeat} from '@agoric/zoe';
|
|
4
|
+
* @import {PositionKind} from './types.js';
|
|
5
|
+
* @import {PayoffHandler} from './types.js';
|
|
6
|
+
* @import {Amount} from '@agoric/ertp';
|
|
7
|
+
* @import {PromiseRecord} from '@endo/promise-kit';
|
|
8
|
+
*/
|
|
9
|
+
/**
|
|
10
|
+
* This contract implements a fully collateralized call spread. This is a
|
|
11
|
+
* combination of a call option bought at one strike price and a second call
|
|
12
|
+
* option sold at a higher price. The invitations are produced in pairs, and the
|
|
13
|
+
* instance creator escrows upfront all collateral that will be paid out. The
|
|
14
|
+
* individual options are ERTP invitations that are suitable for resale.
|
|
15
|
+
*
|
|
16
|
+
* This option contract is settled financially. There is no requirement that the
|
|
17
|
+
* creator have ownership of the underlying asset at the start, and
|
|
18
|
+
* the beneficiaries shouldn't expect to take delivery at closing.
|
|
19
|
+
*
|
|
20
|
+
* The issuerKeywordRecord specifies the issuers for three keywords: Underlying,
|
|
21
|
+
* Strike, and Collateral. The payout is in Collateral. Strike amounts are used
|
|
22
|
+
* for the price oracle's quotes as to the value of the Underlying, as well as
|
|
23
|
+
* the strike prices in the terms.
|
|
24
|
+
*
|
|
25
|
+
* The creatorInvitation has customDetails that include the amounts of the
|
|
26
|
+
* two options as longAmount and shortAmount. When the creatorInvitation is
|
|
27
|
+
* exercised, the payout includes the two option positions, which are themselves
|
|
28
|
+
* invitations which can be exercised for free, and provide the option payouts
|
|
29
|
+
* with the keyword Collateral.
|
|
30
|
+
*
|
|
31
|
+
* terms include:
|
|
32
|
+
* `timer` is a timer, and must be recognized by `priceAuthority`.
|
|
33
|
+
* `expiration` is a time recognized by the `timer`.
|
|
34
|
+
* `underlyingAmount` is passed to `priceAuthority`. It could be an NFT or a
|
|
35
|
+
* fungible amount.
|
|
36
|
+
* `strikePrice2` must be greater than `strikePrice1`.
|
|
37
|
+
* `settlementAmount` is the amount deposited by the funder and split between
|
|
38
|
+
* the holders of the options. It uses Collateral.
|
|
39
|
+
* `priceAuthority` is an oracle that has a timer so it can respond to requests
|
|
40
|
+
* for prices as of a stated time. After the deadline, it will issue a
|
|
41
|
+
* PriceQuote giving the value of the underlying asset in the strike currency.
|
|
42
|
+
*
|
|
43
|
+
* Future enhancements:
|
|
44
|
+
* + issue multiple option pairs with the same expiration from a single instance
|
|
45
|
+
* + increase the precision of the calculations. (use Ratios with
|
|
46
|
+
* denominator.value=10000)
|
|
47
|
+
*/
|
|
48
|
+
/**
|
|
49
|
+
* @param {ZCF<{
|
|
50
|
+
* strikePrice1: Amount,
|
|
51
|
+
* strikePrice2: Amount,
|
|
52
|
+
* settlementAmount: Amount,
|
|
53
|
+
* priceAuthority: PriceAuthority,
|
|
54
|
+
* expiration: bigint,
|
|
55
|
+
* underlyingAmount: Amount,
|
|
56
|
+
* }>} zcf
|
|
57
|
+
*/
|
|
58
|
+
export function start(zcf: ZCF<{
|
|
59
|
+
strikePrice1: Amount;
|
|
60
|
+
strikePrice2: Amount;
|
|
61
|
+
settlementAmount: Amount;
|
|
62
|
+
priceAuthority: PriceAuthority;
|
|
63
|
+
expiration: bigint;
|
|
64
|
+
underlyingAmount: Amount;
|
|
65
|
+
}>): Promise<{
|
|
66
|
+
creatorInvitation: Promise<import("@agoric/zoe").Invitation<unknown, never>>;
|
|
67
|
+
}>;
|
|
68
|
+
import type { Amount } from '@agoric/ertp';
|
|
69
|
+
import type { PriceAuthority } from '@agoric/zoe/tools/types.js';
|
|
70
|
+
import type { ZCF } from '@agoric/zoe';
|
|
71
|
+
//# sourceMappingURL=fundedCallSpread.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fundedCallSpread.d.ts","sourceRoot":"","sources":["fundedCallSpread.js"],"names":[],"mappings":"AAaA;;;;;;;GAOG;AAEH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsCG;AAEH;;;;;;;;;GASG;AACH,2BATW,IAAI;IACZ,YAAY,EAAE,MAAM,CAAC;IACrB,YAAY,EAAE,MAAM,CAAC;IACrB,gBAAgB,EAAE,MAAM,CAAC;IACzB,cAAc,EAAE,cAAc,CAAC;IAC/B,UAAU,EAAE,MAAM,CAAC;IACnB,gBAAgB,EAAE,MAAM,CAAC;CACxB,CAAC;;GA6EJ;4BAjIwB,cAAc;oCAJN,4BAA4B;yBAChB,aAAa"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @import {ZCF, ZCFSeat} from '@agoric/zoe';
|
|
3
|
+
* @import {PositionKind} from './types.js';
|
|
4
|
+
* @import {PayoffHandler} from './types.js';
|
|
5
|
+
* @import {MakeOptionInvitation} from './types.js';
|
|
6
|
+
* @import {PromiseRecord} from '@endo/promise-kit';
|
|
7
|
+
*/
|
|
8
|
+
/**
|
|
9
|
+
* makePayoffHandler returns an object with methods that are useful for
|
|
10
|
+
* callSpread contracts.
|
|
11
|
+
*
|
|
12
|
+
* @param {ZCF<Record<string, any>>} zcf
|
|
13
|
+
* @param {Record<PositionKind,PromiseRecord<ZCFSeat>>} seatPromiseKits
|
|
14
|
+
* @param {ZCFSeat} collateralSeat
|
|
15
|
+
* @returns {PayoffHandler}
|
|
16
|
+
*/
|
|
17
|
+
export function makePayoffHandler(zcf: ZCF<Record<string, any>>, seatPromiseKits: Record<PositionKind, PromiseRecord<ZCFSeat>>, collateralSeat: ZCFSeat): PayoffHandler;
|
|
18
|
+
import type { ZCF } from '@agoric/zoe';
|
|
19
|
+
import type { PositionKind } from './types.js';
|
|
20
|
+
import type { ZCFSeat } from '@agoric/zoe';
|
|
21
|
+
import type { PromiseRecord } from '@endo/promise-kit';
|
|
22
|
+
import type { PayoffHandler } from './types.js';
|
|
23
|
+
//# sourceMappingURL=payoffHandler.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"payoffHandler.d.ts","sourceRoot":"","sources":["payoffHandler.js"],"names":[],"mappings":"AAYA;;;;;;GAMG;AAEH;;;;;;;;GAQG;AACH,uCALW,IAAI,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC,mBACxB,MAAM,CAAC,YAAY,EAAC,cAAc,OAAO,CAAC,CAAC,kBAC3C,OAAO,GACL,aAAa,CAgEzB;yBA9E8B,aAAa;kCACb,YAAY;6BADZ,aAAa;mCAIZ,mBAAmB;mCAFnB,YAAY"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"percent.d.ts","sourceRoot":"","sources":["percent.js"],"names":[],"mappings":""}
|
|
@@ -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,69 @@
|
|
|
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<import("@agoric/zoe").Invitation<unknown, never>>;
|
|
57
|
+
shortInvitation: Promise<import("@agoric/zoe").Invitation<unknown, never>>;
|
|
58
|
+
};
|
|
59
|
+
} & import("@endo/marshal").RemotableObject<`Alleged: ${string}`> & import("@endo/eventual-send").RemotableBrand<{}, {
|
|
60
|
+
makeInvitationPair: (longCollateralShare: any) => {
|
|
61
|
+
longInvitation: Promise<import("@agoric/zoe").Invitation<unknown, never>>;
|
|
62
|
+
shortInvitation: Promise<import("@agoric/zoe").Invitation<unknown, never>>;
|
|
63
|
+
};
|
|
64
|
+
}>;
|
|
65
|
+
};
|
|
66
|
+
import type { Amount } from '@agoric/ertp';
|
|
67
|
+
import type { PriceAuthority } from '@agoric/zoe/tools/types.js';
|
|
68
|
+
import type { ZCF } from '@agoric/zoe';
|
|
69
|
+
//# sourceMappingURL=pricedCallSpread.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pricedCallSpread.d.ts","sourceRoot":"","sources":["pricedCallSpread.js"],"names":[],"mappings":"AA6BA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4CG;AACH,2BATW,IAAI;IACZ,YAAY,EAAE,OAAO,KAAK,CAAC,CAAC;IAC5B,YAAY,EAAE,OAAO,KAAK,CAAC,CAAC;IAC5B,gBAAgB,EAAE,OAAO,KAAK,CAAC,CAAC;IAChC,cAAc,EAAE,cAAc,CAAC;IAC/B,UAAU,EAAE,MAAM,CAAC;IACnB,gBAAgB,EAAE,OAAO,KAAK,CAAC,CAAC;CAC/B,CAAC;;;;;;;;;;;;EA0GJ;4BA5JwB,cAAc;oCAJsD,4BAA4B;yBAC5E,aAAa"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
export type PositionKind = "long" | "short";
|
|
2
|
+
export type MakeOptionInvitation = (positionKind: PositionKind) => Promise<Invitation>;
|
|
3
|
+
export 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
|
+
export 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
|
+
export type CalculateShares = (collateralBrand: Brand, price: Amount<"nat">, strikePrice1: Amount<"nat">, strikePrice2: Amount<"nat">) => CalculateSharesReturn;
|
|
28
|
+
export type Make100Percent = (brand: Brand) => Ratio;
|
|
29
|
+
export type Make0Percent = (brand: Brand) => Ratio;
|
|
30
|
+
import type { Invitation } from '@agoric/zoe';
|
|
31
|
+
import type { Ratio } from '@agoric/ertp';
|
|
32
|
+
import type { Brand } from '@agoric/ertp';
|
|
33
|
+
import type { Amount } from '@agoric/ertp';
|
|
34
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["types.js"],"names":[],"mappings":"2BAEa,MAAM,GAAG,OAAO;kDAUlB,YAAY,KACV,OAAO,CAAC,UAAU,CAAC;;qBAKlB,MAAM,IAAI;0BACT,oBAAoB;;;;;;;;eAQrB,KAAK;gBACL,KAAK;;;;;;;;;;;;;gDAcR,KAAK,SACL,OAAO,KAAK,CAAC,gBACb,OAAO,KAAK,CAAC,gBACb,OAAO,KAAK,CAAC,KACX,qBAAqB;qCAKvB,KAAK,KACH,KAAK;mCAKP,KAAK,KACH,KAAK;gCAnDW,aAAa;2BADH,cAAc;2BAAd,cAAc;4BAAd,cAAc"}
|
|
@@ -0,0 +1,23 @@
|
|
|
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 {Baggage} instanceBaggage
|
|
15
|
+
*/
|
|
16
|
+
export function start(zcf: ZCF, _privateArgs: unknown, instanceBaggage: Baggage): Promise<{
|
|
17
|
+
creatorFacet: import("@endo/exo").Guarded<{
|
|
18
|
+
makeInvitation(): Promise<import("@agoric/zoe").Invitation<unknown, never>>;
|
|
19
|
+
}>;
|
|
20
|
+
}>;
|
|
21
|
+
import type { ZCF } from '@agoric/zoe';
|
|
22
|
+
import type { Baggage } from '@agoric/vat-data';
|
|
23
|
+
//# sourceMappingURL=coveredCall-durable.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"coveredCall-durable.d.ts","sourceRoot":"","sources":["coveredCall-durable.js"],"names":[],"mappings":"AAaA;;;;;;;;;;;;;;GAcG;AACH,2BAJW,GAAG,gBACH,OAAO,mBACP,OAAO;;;;GA6EjB;yBA/FmC,aAAa;6BADvB,kBAAkB"}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @import {OfferHandler, ZCF} from '@agoric/zoe';
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* A call option is the right (but not the obligation) to buy digital
|
|
6
|
+
* assets at a pre-determined price, called the strike price. This
|
|
7
|
+
* call option is "covered," meaning that the owner of the digital
|
|
8
|
+
* assets must put the assets in escrow. This guarantees that the
|
|
9
|
+
* assets can be transferred without relying on the owner of the
|
|
10
|
+
* digital assets to keep their promise.
|
|
11
|
+
*
|
|
12
|
+
* https://agoric.com/documentation/zoe/guide/contracts/covered-call.html
|
|
13
|
+
*
|
|
14
|
+
* The call option has an expiration date, when the opportunity is
|
|
15
|
+
* cancelled. The owner of the digital assets cannot remove the assets
|
|
16
|
+
* from escrow before the expiration date.
|
|
17
|
+
*
|
|
18
|
+
* The `creatorInvitation` of this contract is an invitation to escrow
|
|
19
|
+
* the underlying assets. The proposal to escrow assets can have any
|
|
20
|
+
* `give` and `want` with any keywords. Any number of assets of
|
|
21
|
+
* different brands can be escrowed under different keywords. The
|
|
22
|
+
* proposal must have an exit record with the key "afterDeadline":
|
|
23
|
+
* {
|
|
24
|
+
* give: { ... },
|
|
25
|
+
* want: { ... },
|
|
26
|
+
* exit: {
|
|
27
|
+
* afterDeadline: { deadline: time, timer: myTimer }
|
|
28
|
+
* },
|
|
29
|
+
* }
|
|
30
|
+
*
|
|
31
|
+
* This deadline serves as the expiration date for the covered call
|
|
32
|
+
* option. After this deadline, if the option has not been exercised,
|
|
33
|
+
* the underlying assets are automatically paid out to the creator of
|
|
34
|
+
* the contract as a refund.
|
|
35
|
+
*
|
|
36
|
+
* After the owner of the digital assets escrows the assets in the
|
|
37
|
+
* initial offer, they receive a seat. The payout for this seat will
|
|
38
|
+
* either be a refund of the underlying assets (as mentioned above) or
|
|
39
|
+
* payments in the amount of the strike price. Zoe's enforcement of
|
|
40
|
+
* offer safety guarantees that the payout is either a refund or
|
|
41
|
+
* payments in the amount of the strike price, regardless of whether
|
|
42
|
+
* this contract is buggy.
|
|
43
|
+
*
|
|
44
|
+
* The offerResult of this initial seat resolves to the call option
|
|
45
|
+
* itself: an inspectable invitation to buy the underlying assets. The
|
|
46
|
+
* call option invitation has this additional information in the
|
|
47
|
+
* value: {expirationDate, timeAuthority, underlyingAssets,
|
|
48
|
+
* strikePrice }
|
|
49
|
+
*
|
|
50
|
+
* The invitation itself can be traded as a valuable digital asset: a
|
|
51
|
+
* covered call option.
|
|
52
|
+
*
|
|
53
|
+
* The recipient of a covered call option (buying it on some other
|
|
54
|
+
* exchange or through some other trading contract) can exercise the
|
|
55
|
+
* option before the deadline by using the option as an invitation to
|
|
56
|
+
* this contract, paying the strike price and receiving the underlying
|
|
57
|
+
* assets. The recipient of a covered call option can use whatever
|
|
58
|
+
* keywords they wish, as long as they give the strike price as
|
|
59
|
+
* specified in the invitation value, and want the underlying assets
|
|
60
|
+
* exactly.
|
|
61
|
+
*
|
|
62
|
+
* @param {ZCF} zcf
|
|
63
|
+
*/
|
|
64
|
+
export function start(zcf: ZCF): {
|
|
65
|
+
creatorInvitation: Promise<import("@agoric/zoe").Invitation<unknown, never>>;
|
|
66
|
+
};
|
|
67
|
+
import type { ZCF } from '@agoric/zoe';
|
|
68
|
+
//# sourceMappingURL=coveredCall.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"coveredCall.d.ts","sourceRoot":"","sources":["coveredCall.js"],"names":[],"mappings":"AAMA;;GAEG;AAEH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2DG;AACH,2BAFW,GAAG;;EAwCb;yBArGmC,aAAa"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @import {OfferHandler} from '@agoric/zoe';
|
|
3
|
+
* @import {MakeAddCollateralInvitation} from './types.js';
|
|
4
|
+
*/
|
|
5
|
+
/** @type {MakeAddCollateralInvitation} */
|
|
6
|
+
export const makeAddCollateralInvitation: MakeAddCollateralInvitation;
|
|
7
|
+
import type { MakeAddCollateralInvitation } from './types.js';
|
|
8
|
+
//# sourceMappingURL=addCollateral.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"addCollateral.d.ts","sourceRoot":"","sources":["addCollateral.js"],"names":[],"mappings":"AAOA;;;GAGG;AAKH,0CAA0C;AAC1C,0CADW,2BAA2B,CAwBpC;iDA9B4C,YAAY"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @import {OfferHandler} from '@agoric/zoe';
|
|
3
|
+
* @import {MakeBorrowInvitation} from './types.js';
|
|
4
|
+
* @import {DebtCalculatorConfig} from './types.js';
|
|
5
|
+
* @import {LoanConfigWithBorrower} from './types.js';
|
|
6
|
+
* @import {BorrowFacet} from './types.js';
|
|
7
|
+
* @import {Brand} from '@agoric/ertp';
|
|
8
|
+
*/
|
|
9
|
+
/** @type {MakeBorrowInvitation} */
|
|
10
|
+
export const makeBorrowInvitation: MakeBorrowInvitation;
|
|
11
|
+
import type { MakeBorrowInvitation } from './types.js';
|
|
12
|
+
//# sourceMappingURL=borrow.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"borrow.d.ts","sourceRoot":"","sources":["borrow.js"],"names":[],"mappings":"AAkBA;;;;;;;GAOG;AAEH,mCAAmC;AACnC,mCADW,oBAAoB,CAsI7B;0CA7IqC,YAAY"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @import {OfferHandler} from '@agoric/zoe';
|
|
3
|
+
* @import {MakeCloseLoanInvitation} from './types.js';
|
|
4
|
+
*/
|
|
5
|
+
/** @type {MakeCloseLoanInvitation} */
|
|
6
|
+
export const makeCloseLoanInvitation: MakeCloseLoanInvitation;
|
|
7
|
+
import type { MakeCloseLoanInvitation } from './types.js';
|
|
8
|
+
//# sourceMappingURL=close.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"close.d.ts","sourceRoot":"","sources":["close.js"],"names":[],"mappings":"AAOA;;;GAGG;AAOH,sCAAsC;AACtC,sCADW,uBAAuB,CAiDhC;6CAzDwC,YAAY"}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @import {PriceAuthority, PriceDescription, PriceQuote, PriceQuoteValue, PriceQuery,} from '@agoric/zoe/tools/types.js';
|
|
3
|
+
* @import {Ratio} from '@agoric/ertp';
|
|
4
|
+
* @import {Instance, ZCF} from '@agoric/zoe';
|
|
5
|
+
* @import {LoanTerms, PeriodNotifier} from './types.js';
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* Add collateral of a particular brand and get a loan of another
|
|
9
|
+
* brand. Collateral (also known as margin) must be greater than the
|
|
10
|
+
* loan value, at an amount set by the Maintenance Margin Requirement
|
|
11
|
+
* (mmr) in the terms of the contract. The loan does not have a
|
|
12
|
+
* distinct end time. Rather, if the value of the collateral changes
|
|
13
|
+
* such that insufficient margin is provided, the collateral is
|
|
14
|
+
* liquidated, and the loan is closed. At any time, the borrower can
|
|
15
|
+
* add collateral or repay the loan with interest, closing the loan.
|
|
16
|
+
* The borrower can set up their own margin calls by getting the
|
|
17
|
+
* `priceAuthority` from the terms and calling
|
|
18
|
+
* `E(priceAuthority).quoteWhenLT(allCollateral, x)` where x is the
|
|
19
|
+
* value of the collateral in the Loan brand at which they want a
|
|
20
|
+
* reminder to addCollateral.
|
|
21
|
+
*
|
|
22
|
+
* Note that all collateral must be of the same brand and all of the
|
|
23
|
+
* loaned amount and interest must be of the same (separate) brand.
|
|
24
|
+
*
|
|
25
|
+
* Terms:
|
|
26
|
+
* * mmr (default = 150/100) - the Maintenance Margin Requirement, as a
|
|
27
|
+
* ratio. The default is 150/100, meaning that collateral should be
|
|
28
|
+
* worth at least 150% of the loan. If the value of the collateral
|
|
29
|
+
* drops below mmr, liquidation occurs.
|
|
30
|
+
* * priceAuthority - will be used for getting the current value of
|
|
31
|
+
* collateral and setting liquidation triggers.
|
|
32
|
+
* * autoswapInstance - The running contract instance for an Autoswap
|
|
33
|
+
* installation. The publicFacet of the
|
|
34
|
+
* instance is used for producing an invitation to sell the
|
|
35
|
+
* collateral on liquidation.
|
|
36
|
+
* * periodNotifier - the Notifier that provides notifications that
|
|
37
|
+
* periods have passed, on which compound interest will be
|
|
38
|
+
* calculated using the interestRate. Notifiers don't guarantee
|
|
39
|
+
* that clients will see all the changes, so the contract must
|
|
40
|
+
* track when interest last accrued.
|
|
41
|
+
* * interestRate - the rate in basis points that will be multiplied
|
|
42
|
+
* with the debt on every period to compound interest.
|
|
43
|
+
* * interestPeriod - the period at which interest compounds.
|
|
44
|
+
*
|
|
45
|
+
* IssuerKeywordRecord:
|
|
46
|
+
* * Keyword: 'Collateral' - The issuer for the digital assets to be
|
|
47
|
+
* escrowed as collateral.
|
|
48
|
+
* * Keyword: 'Loan' - The issuer for the digital assets to be loaned
|
|
49
|
+
* out.
|
|
50
|
+
*
|
|
51
|
+
* @param {ZCF<{
|
|
52
|
+
* mmr: Ratio,
|
|
53
|
+
* autoswapInstance: Instance,
|
|
54
|
+
* priceAuthority: PriceAuthority,
|
|
55
|
+
* periodNotifier: PeriodNotifier,
|
|
56
|
+
* interestRate: Ratio,
|
|
57
|
+
* interestPeriod: bigint,
|
|
58
|
+
* }>} zcf
|
|
59
|
+
*/
|
|
60
|
+
export function start(zcf: ZCF<{
|
|
61
|
+
mmr: Ratio;
|
|
62
|
+
autoswapInstance: Instance;
|
|
63
|
+
priceAuthority: PriceAuthority;
|
|
64
|
+
periodNotifier: PeriodNotifier;
|
|
65
|
+
interestRate: Ratio;
|
|
66
|
+
interestPeriod: bigint;
|
|
67
|
+
}>): Promise<{
|
|
68
|
+
creatorInvitation: Promise<import("@agoric/zoe").Invitation>;
|
|
69
|
+
}>;
|
|
70
|
+
import type { Ratio } from '@agoric/ertp';
|
|
71
|
+
import type { Instance } from '@agoric/zoe';
|
|
72
|
+
import type { PriceAuthority } from '@agoric/zoe/tools/types.js';
|
|
73
|
+
import type { PeriodNotifier } from './types.js';
|
|
74
|
+
import type { ZCF } from '@agoric/zoe';
|
|
75
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.js"],"names":[],"mappings":"AAQA;;;;;GAKG;AAEH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoDG;AACH,2BATW,IAAI;IACV,GAAG,EAAE,KAAK,CAAC;IACX,gBAAgB,EAAE,QAAQ,CAAC;IAC3B,cAAc,EAAE,cAAc,CAAC;IAC/B,cAAc,EAAE,cAAc,CAAC;IAC/B,YAAY,EAAE,KAAK,CAAC;IACpB,cAAc,EAAE,MAAM,CAAC;CACxB,CAAC;;GAsCJ;2BA9FuB,cAAc;8BACN,aAAa;oCAFgD,4BAA4B;oCAG7E,YAAY;yBADxB,aAAa"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @import {OfferHandler} from '@agoric/zoe';
|
|
3
|
+
* @import {MakeLendInvitation} from './types.js';
|
|
4
|
+
*/
|
|
5
|
+
/** @type {MakeLendInvitation} */
|
|
6
|
+
export const makeLendInvitation: MakeLendInvitation;
|
|
7
|
+
import type { MakeLendInvitation } from './types.js';
|
|
8
|
+
//# sourceMappingURL=lend.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lend.d.ts","sourceRoot":"","sources":["lend.js"],"names":[],"mappings":"AAGA;;;GAGG;AAYH,iCAAiC;AACjC,iCADW,kBAAkB,CA4B3B;wCAzCmC,YAAY"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export function doLiquidation(zcf: any, collateralSeat: any, autoswapPublicFacetP: any, lenderSeat: any, loanBrand: any): Promise<void>;
|
|
2
|
+
export function liquidate(zcf: ZCF, config: LoanConfigWithBorrower): Promise<void>;
|
|
3
|
+
import type { ZCF } from '@agoric/zoe';
|
|
4
|
+
import type { LoanConfigWithBorrower } from './types.js';
|
|
5
|
+
//# sourceMappingURL=liquidate.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"liquidate.d.ts","sourceRoot":"","sources":["liquidate.js"],"names":[],"mappings":"AAWO,wIA6CN;AAeM,+BAJI,GAAG,UACH,sBAAsB,GACpB,OAAO,CAAC,IAAI,CAAC,CAiBzB;yBA/EqB,aAAa;4CACM,YAAY"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"scheduleLiquidation.d.ts","sourceRoot":"","sources":["scheduleLiquidation.js"],"names":[],"mappings":"AAUA;;GAEG;AAEH,kCAAkC;AAClC,kCADW,mBAAmB,CAsD5B;yCAzDoC,YAAY"}
|