@agoric/zoe 0.26.3-dev-f1638f9.0 → 0.26.3-dev-a477bee.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.
Files changed (223) hide show
  1. package/bundles/bundle-contractFacet-js-meta.json +217 -357
  2. package/bundles/bundle-contractFacet.d.ts +7 -0
  3. package/bundles/bundle-contractFacet.d.ts.map +1 -0
  4. package/bundles/bundle-contractFacet.js +1 -1
  5. package/package.json +15 -15
  6. package/src/cleanProposal.d.ts +9 -0
  7. package/src/cleanProposal.d.ts.map +1 -0
  8. package/src/contractFacet/allocationMath.d.ts +7 -0
  9. package/src/contractFacet/allocationMath.d.ts.map +1 -0
  10. package/src/contractFacet/evalContractCode.d.ts +2 -0
  11. package/src/contractFacet/evalContractCode.d.ts.map +1 -0
  12. package/src/contractFacet/exit.d.ts +2 -0
  13. package/src/contractFacet/exit.d.ts.map +1 -0
  14. package/src/contractFacet/internal-types.d.ts +8 -0
  15. package/src/contractFacet/internal-types.d.ts.map +1 -0
  16. package/src/contractFacet/offerHandlerStorage.d.ts +5 -0
  17. package/src/contractFacet/offerHandlerStorage.d.ts.map +1 -0
  18. package/src/contractFacet/offerSafety.d.ts +34 -0
  19. package/src/contractFacet/offerSafety.d.ts.map +1 -0
  20. package/src/contractFacet/reallocate.d.ts +3 -0
  21. package/src/contractFacet/reallocate.d.ts.map +1 -0
  22. package/src/contractFacet/rightsConservation.d.ts +12 -0
  23. package/src/contractFacet/rightsConservation.d.ts.map +1 -0
  24. package/src/contractFacet/vatRoot.d.ts +14 -0
  25. package/src/contractFacet/vatRoot.d.ts.map +1 -0
  26. package/src/contractFacet/zcfMint.d.ts +8 -0
  27. package/src/contractFacet/zcfMint.d.ts.map +1 -0
  28. package/src/contractFacet/zcfSeat.d.ts +3 -0
  29. package/src/contractFacet/zcfSeat.d.ts.map +1 -0
  30. package/src/contractFacet/zcfZygote.d.ts +2 -0
  31. package/src/contractFacet/zcfZygote.d.ts.map +1 -0
  32. package/src/contractFacet/zcfZygote.js +1 -1
  33. package/src/contractSupport/atomicTransfer.d.ts +6 -0
  34. package/src/contractSupport/atomicTransfer.d.ts.map +1 -0
  35. package/src/contractSupport/bondingCurves.d.ts +6 -0
  36. package/src/contractSupport/bondingCurves.d.ts.map +1 -0
  37. package/src/contractSupport/durability.d.ts +5 -0
  38. package/src/contractSupport/durability.d.ts.map +1 -0
  39. package/src/contractSupport/index.d.ts +14 -0
  40. package/src/contractSupport/index.d.ts.map +1 -0
  41. package/src/contractSupport/prepare-ownable.d.ts +11 -0
  42. package/src/contractSupport/prepare-ownable.d.ts.map +1 -0
  43. package/src/contractSupport/priceAuthority.d.ts +27 -0
  44. package/src/contractSupport/priceAuthority.d.ts.map +1 -0
  45. package/src/contractSupport/priceAuthorityInitial.d.ts +2 -0
  46. package/src/contractSupport/priceAuthorityInitial.d.ts.map +1 -0
  47. package/src/contractSupport/priceAuthorityQuoteMint.d.ts +2 -0
  48. package/src/contractSupport/priceAuthorityQuoteMint.d.ts.map +1 -0
  49. package/src/contractSupport/priceAuthorityTransform.d.ts +14 -0
  50. package/src/contractSupport/priceAuthorityTransform.d.ts.map +1 -0
  51. package/src/contractSupport/priceQuote.d.ts +7 -0
  52. package/src/contractSupport/priceQuote.d.ts.map +1 -0
  53. package/src/contractSupport/ratio.d.ts +28 -0
  54. package/src/contractSupport/ratio.d.ts.map +1 -0
  55. package/src/contractSupport/recorder.d.ts +143 -0
  56. package/src/contractSupport/recorder.d.ts.map +1 -0
  57. package/src/contractSupport/safeMath.d.ts +11 -0
  58. package/src/contractSupport/safeMath.d.ts.map +1 -0
  59. package/src/contractSupport/stateMachine.d.ts +6 -0
  60. package/src/contractSupport/stateMachine.d.ts.map +1 -0
  61. package/src/contractSupport/statistics.d.ts +7 -0
  62. package/src/contractSupport/statistics.d.ts.map +1 -0
  63. package/src/contractSupport/topics.d.ts +22 -0
  64. package/src/contractSupport/topics.d.ts.map +1 -0
  65. package/src/contractSupport/types.d.ts +63 -0
  66. package/src/contractSupport/types.d.ts.map +1 -0
  67. package/src/contractSupport/zoeHelpers.d.ts +30 -0
  68. package/src/contractSupport/zoeHelpers.d.ts.map +1 -0
  69. package/src/contracts/atomicSwap.d.ts +16 -0
  70. package/src/contracts/atomicSwap.d.ts.map +1 -0
  71. package/src/contracts/auction/assertBidSeat.d.ts +2 -0
  72. package/src/contracts/auction/assertBidSeat.d.ts.map +1 -0
  73. package/src/contracts/auction/firstPriceLogic.d.ts +2 -0
  74. package/src/contracts/auction/firstPriceLogic.d.ts.map +1 -0
  75. package/src/contracts/auction/index.d.ts +78 -0
  76. package/src/contracts/auction/index.d.ts.map +1 -0
  77. package/src/contracts/auction/secondPriceLogic.d.ts +2 -0
  78. package/src/contracts/auction/secondPriceLogic.d.ts.map +1 -0
  79. package/src/contracts/automaticRefund.d.ts +25 -0
  80. package/src/contracts/automaticRefund.d.ts.map +1 -0
  81. package/src/contracts/autoswap.d.ts +43 -0
  82. package/src/contracts/autoswap.d.ts.map +1 -0
  83. package/src/contracts/barterExchange.d.ts +22 -0
  84. package/src/contracts/barterExchange.d.ts.map +1 -0
  85. package/src/contracts/callSpread/calculateShares.d.ts +2 -0
  86. package/src/contracts/callSpread/calculateShares.d.ts.map +1 -0
  87. package/src/contracts/callSpread/fundedCallSpread.d.ts +60 -0
  88. package/src/contracts/callSpread/fundedCallSpread.d.ts.map +1 -0
  89. package/src/contracts/callSpread/payoffHandler.d.ts +11 -0
  90. package/src/contracts/callSpread/payoffHandler.d.ts.map +1 -0
  91. package/src/contracts/callSpread/percent.d.ts +3 -0
  92. package/src/contracts/callSpread/percent.d.ts.map +1 -0
  93. package/src/contracts/callSpread/position.d.ts +10 -0
  94. package/src/contracts/callSpread/position.d.ts.map +1 -0
  95. package/src/contracts/callSpread/pricedCallSpread.d.ts +66 -0
  96. package/src/contracts/callSpread/pricedCallSpread.d.ts.map +1 -0
  97. package/src/contracts/callSpread/types.d.ts +30 -0
  98. package/src/contracts/callSpread/types.d.ts.map +1 -0
  99. package/src/contracts/coveredCall-durable.d.ts +21 -0
  100. package/src/contracts/coveredCall-durable.d.ts.map +1 -0
  101. package/src/contracts/coveredCall.d.ts +64 -0
  102. package/src/contracts/coveredCall.d.ts.map +1 -0
  103. package/src/contracts/exported.d.ts +2 -0
  104. package/src/contracts/exported.d.ts.map +1 -0
  105. package/src/contracts/loan/addCollateral.d.ts +3 -0
  106. package/src/contracts/loan/addCollateral.d.ts.map +1 -0
  107. package/src/contracts/loan/borrow.d.ts +3 -0
  108. package/src/contracts/loan/borrow.d.ts.map +1 -0
  109. package/src/contracts/loan/close.d.ts +3 -0
  110. package/src/contracts/loan/close.d.ts.map +1 -0
  111. package/src/contracts/loan/index.d.ts +64 -0
  112. package/src/contracts/loan/index.d.ts.map +1 -0
  113. package/src/contracts/loan/lend.d.ts +3 -0
  114. package/src/contracts/loan/lend.d.ts.map +1 -0
  115. package/src/contracts/loan/liquidate.d.ts +3 -0
  116. package/src/contracts/loan/liquidate.d.ts.map +1 -0
  117. package/src/contracts/loan/liquidate.js +1 -1
  118. package/src/contracts/loan/scheduleLiquidation.d.ts +3 -0
  119. package/src/contracts/loan/scheduleLiquidation.d.ts.map +1 -0
  120. package/src/contracts/loan/types.d.ts +161 -0
  121. package/src/contracts/loan/types.d.ts.map +1 -0
  122. package/src/contracts/loan/updateDebt.d.ts +11 -0
  123. package/src/contracts/loan/updateDebt.d.ts.map +1 -0
  124. package/src/contracts/mintAndSellNFT.d.ts +28 -0
  125. package/src/contracts/mintAndSellNFT.d.ts.map +1 -0
  126. package/src/contracts/mintPayments.d.ts +30 -0
  127. package/src/contracts/mintPayments.d.ts.map +1 -0
  128. package/src/contracts/oracle.d.ts +26 -0
  129. package/src/contracts/oracle.d.ts.map +1 -0
  130. package/src/contracts/otcDesk.d.ts +79 -0
  131. package/src/contracts/otcDesk.d.ts.map +1 -0
  132. package/src/contracts/priceAggregator.d.ts +107 -0
  133. package/src/contracts/priceAggregator.d.ts.map +1 -0
  134. package/src/contracts/priceAggregator.js +0 -1
  135. package/src/contracts/priceAggregatorTypes.d.ts +77 -0
  136. package/src/contracts/priceAggregatorTypes.d.ts.map +1 -0
  137. package/src/contracts/scaledPriceAuthority.d.ts +21 -0
  138. package/src/contracts/scaledPriceAuthority.d.ts.map +1 -0
  139. package/src/contracts/sellItems.d.ts +30 -0
  140. package/src/contracts/sellItems.d.ts.map +1 -0
  141. package/src/contracts/simpleExchange.d.ts +37 -0
  142. package/src/contracts/simpleExchange.d.ts.map +1 -0
  143. package/src/contracts/types.d.ts +80 -0
  144. package/src/contracts/types.d.ts.map +1 -0
  145. package/src/handleWarning.d.ts +3 -0
  146. package/src/handleWarning.d.ts.map +1 -0
  147. package/src/instanceRecordStorage.d.ts +2 -0
  148. package/src/instanceRecordStorage.d.ts.map +1 -0
  149. package/src/internal-types.d.ts +179 -0
  150. package/src/internal-types.d.ts.map +1 -0
  151. package/src/internal-types.js +4 -4
  152. package/src/issuerRecord.d.ts +3 -0
  153. package/src/issuerRecord.d.ts.map +1 -0
  154. package/src/issuerStorage.d.ts +14 -0
  155. package/src/issuerStorage.d.ts.map +1 -0
  156. package/src/makeHandle.d.ts +4 -0
  157. package/src/makeHandle.d.ts.map +1 -0
  158. package/src/typeGuards.d.ts +169 -0
  159. package/src/typeGuards.d.ts.map +1 -0
  160. package/src/types.d.ts +46 -0
  161. package/src/types.d.ts.map +1 -0
  162. package/src/zoeService/createZCFVat.d.ts +2 -0
  163. package/src/zoeService/createZCFVat.d.ts.map +1 -0
  164. package/src/zoeService/escrowStorage.d.ts +7 -0
  165. package/src/zoeService/escrowStorage.d.ts.map +1 -0
  166. package/src/zoeService/feeMint.d.ts +23 -0
  167. package/src/zoeService/feeMint.d.ts.map +1 -0
  168. package/src/zoeService/feeMint.js +1 -1
  169. package/src/zoeService/installationStorage.d.ts +20 -0
  170. package/src/zoeService/installationStorage.d.ts.map +1 -0
  171. package/src/zoeService/instanceAdminStorage.d.ts +103 -0
  172. package/src/zoeService/instanceAdminStorage.d.ts.map +1 -0
  173. package/src/zoeService/internal-types.d.ts +90 -0
  174. package/src/zoeService/internal-types.d.ts.map +1 -0
  175. package/src/zoeService/invitationQueries.d.ts +6 -0
  176. package/src/zoeService/invitationQueries.d.ts.map +1 -0
  177. package/src/zoeService/makeInvitation.d.ts +5 -0
  178. package/src/zoeService/makeInvitation.d.ts.map +1 -0
  179. package/src/zoeService/makeInvitation.js +1 -1
  180. package/src/zoeService/offer/burnInvitation.d.ts +5 -0
  181. package/src/zoeService/offer/burnInvitation.d.ts.map +1 -0
  182. package/src/zoeService/offer/offer.d.ts +2 -0
  183. package/src/zoeService/offer/offer.d.ts.map +1 -0
  184. package/src/zoeService/originalZoeSeat.d.ts +34 -0
  185. package/src/zoeService/originalZoeSeat.d.ts.map +1 -0
  186. package/src/zoeService/startInstance.d.ts +4 -0
  187. package/src/zoeService/startInstance.d.ts.map +1 -0
  188. package/src/zoeService/types.d.ts +224 -0
  189. package/src/zoeService/types.d.ts.map +1 -0
  190. package/src/zoeService/utils.test-d.d.ts +2 -0
  191. package/src/zoeService/utils.test-d.d.ts.map +1 -0
  192. package/src/zoeService/zoe.d.ts +57 -0
  193. package/src/zoeService/zoe.d.ts.map +1 -0
  194. package/src/zoeService/zoe.js +2 -4
  195. package/src/zoeService/zoeSeat.d.ts +26 -0
  196. package/src/zoeService/zoeSeat.d.ts.map +1 -0
  197. package/src/zoeService/zoeStorageManager.d.ts +41 -0
  198. package/src/zoeService/zoeStorageManager.d.ts.map +1 -0
  199. package/src/zoeService/zoeStorageManager.js +1 -1
  200. package/tools/fakePriceAuthority.d.ts +30 -0
  201. package/tools/fakePriceAuthority.d.ts.map +1 -0
  202. package/tools/fakeVatAdmin.d.ts +103 -0
  203. package/tools/fakeVatAdmin.d.ts.map +1 -0
  204. package/tools/internal-types.d.ts +12 -0
  205. package/tools/internal-types.d.ts.map +1 -0
  206. package/tools/manualPriceAuthority.d.ts +21 -0
  207. package/tools/manualPriceAuthority.d.ts.map +1 -0
  208. package/tools/manualTimer.d.ts +44 -0
  209. package/tools/manualTimer.d.ts.map +1 -0
  210. package/tools/prepare-test-env-ava.d.ts +2 -0
  211. package/tools/prepare-test-env-ava.d.ts.map +1 -0
  212. package/tools/prepare-test-env.d.ts +2 -0
  213. package/tools/prepare-test-env.d.ts.map +1 -0
  214. package/tools/scriptedOracle.d.ts +27 -0
  215. package/tools/scriptedOracle.d.ts.map +1 -0
  216. package/tools/scriptedPriceAuthority.d.ts +2 -0
  217. package/tools/scriptedPriceAuthority.d.ts.map +1 -0
  218. package/tools/setup-zoe.d.ts +33 -0
  219. package/tools/setup-zoe.d.ts.map +1 -0
  220. package/tools/types-ambient.d.ts +142 -0
  221. package/tools/types-ambient.d.ts.map +1 -0
  222. package/tools/types.d.ts +142 -0
  223. package/tools/types.d.ts.map +1 -0
@@ -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
@@ -0,0 +1 @@
1
+ {"version":3,"file":"coveredCall.d.ts","sourceRoot":"","sources":["coveredCall.js"],"names":[],"mappings":"AAOA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2DG;AACH,2BAFW,GAAG;;EA6Cb"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=exported.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"exported.d.ts","sourceRoot":"","sources":["exported.js"],"names":[],"mappings":""}
@@ -0,0 +1,3 @@
1
+ /** @type {MakeAddCollateralInvitation} */
2
+ export const makeAddCollateralInvitation: MakeAddCollateralInvitation;
3
+ //# sourceMappingURL=addCollateral.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"addCollateral.d.ts","sourceRoot":"","sources":["addCollateral.js"],"names":[],"mappings":"AAUA,0CAA0C;AAC1C,0CADW,2BAA2B,CAwBpC"}
@@ -0,0 +1,3 @@
1
+ /** @type {MakeBorrowInvitation} */
2
+ export const makeBorrowInvitation: MakeBorrowInvitation;
3
+ //# sourceMappingURL=borrow.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"borrow.d.ts","sourceRoot":"","sources":["borrow.js"],"names":[],"mappings":"AAkBA,mCAAmC;AACnC,mCADW,oBAAoB,CAoI7B"}
@@ -0,0 +1,3 @@
1
+ /** @type {MakeCloseLoanInvitation} */
2
+ export const makeCloseLoanInvitation: MakeCloseLoanInvitation;
3
+ //# sourceMappingURL=close.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"close.d.ts","sourceRoot":"","sources":["close.js"],"names":[],"mappings":"AAYA,sCAAsC;AACtC,sCADW,uBAAuB,CAiDhC"}
@@ -0,0 +1,64 @@
1
+ /**
2
+ * Add collateral of a particular brand and get a loan of another
3
+ * brand. Collateral (also known as margin) must be greater than the
4
+ * loan value, at an amount set by the Maintenance Margin Requirement
5
+ * (mmr) in the terms of the contract. The loan does not have a
6
+ * distinct end time. Rather, if the value of the collateral changes
7
+ * such that insufficient margin is provided, the collateral is
8
+ * liquidated, and the loan is closed. At any time, the borrower can
9
+ * add collateral or repay the loan with interest, closing the loan.
10
+ * The borrower can set up their own margin calls by getting the
11
+ * `priceAuthority` from the terms and calling
12
+ * `E(priceAuthority).quoteWhenLT(allCollateral, x)` where x is the
13
+ * value of the collateral in the Loan brand at which they want a
14
+ * reminder to addCollateral.
15
+ *
16
+ * Note that all collateral must be of the same brand and all of the
17
+ * loaned amount and interest must be of the same (separate) brand.
18
+ *
19
+ * Terms:
20
+ * * mmr (default = 150/100) - the Maintenance Margin Requirement, as a
21
+ * ratio. The default is 150/100, meaning that collateral should be
22
+ * worth at least 150% of the loan. If the value of the collateral
23
+ * drops below mmr, liquidation occurs.
24
+ * * priceAuthority - will be used for getting the current value of
25
+ * collateral and setting liquidation triggers.
26
+ * * autoswapInstance - The running contract instance for an Autoswap
27
+ * installation. The publicFacet of the
28
+ * instance is used for producing an invitation to sell the
29
+ * collateral on liquidation.
30
+ * * periodNotifier - the Notifier that provides notifications that
31
+ * periods have passed, on which compound interest will be
32
+ * calculated using the interestRate. Notifiers don't guarantee
33
+ * that clients will see all the changes, so the contract must
34
+ * track when interest last accrued.
35
+ * * interestRate - the rate in basis points that will be multiplied
36
+ * with the debt on every period to compound interest.
37
+ * * interestPeriod - the period at which interest compounds.
38
+ *
39
+ * IssuerKeywordRecord:
40
+ * * Keyword: 'Collateral' - The issuer for the digital assets to be
41
+ * escrowed as collateral.
42
+ * * Keyword: 'Loan' - The issuer for the digital assets to be loaned
43
+ * out.
44
+ *
45
+ * @param {ZCF<{
46
+ * mmr: Ratio,
47
+ * autoswapInstance: Instance,
48
+ * priceAuthority: PriceAuthority,
49
+ * periodNotifier: PeriodNotifier,
50
+ * interestRate: Ratio,
51
+ * interestPeriod: bigint,
52
+ * }>} zcf
53
+ */
54
+ export function start(zcf: ZCF<{
55
+ mmr: Ratio;
56
+ autoswapInstance: Instance;
57
+ priceAuthority: PriceAuthority;
58
+ periodNotifier: PeriodNotifier;
59
+ interestRate: Ratio;
60
+ interestPeriod: bigint;
61
+ }>): Promise<{
62
+ creatorInvitation: Promise<Invitation<unknown, undefined>>;
63
+ }>;
64
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.js"],"names":[],"mappings":"AAQA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoDG;AACH,2BATW,IAAI;IACd,GAAO,EAAE,KAAK,CAAC;IACf,gBAAoB,EAAE,QAAQ,CAAC;IAC/B,cAAkB,EAAE,cAAc,CAAC;IACnC,cAAkB,EAAE,cAAc,CAAC;IACnC,YAAgB,EAAE,KAAK,CAAC;IACxB,cAAkB,EAAE,MAAM,CAAC;CACxB,CAAC;;GAsCJ"}
@@ -0,0 +1,3 @@
1
+ /** @type {MakeLendInvitation} */
2
+ export const makeLendInvitation: MakeLendInvitation;
3
+ //# sourceMappingURL=lend.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"lend.d.ts","sourceRoot":"","sources":["lend.js"],"names":[],"mappings":"AAaA,iCAAiC;AACjC,iCADW,kBAAkB,CA4B3B"}
@@ -0,0 +1,3 @@
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
+ //# sourceMappingURL=liquidate.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"liquidate.d.ts","sourceRoot":"","sources":["liquidate.js"],"names":[],"mappings":"AAKO,wIA6CN;AAeM,+BAJI,GAAG,UACH,sBAAsB,GACpB,QAAQ,IAAI,CAAC,CAiBzB"}
@@ -37,7 +37,7 @@ export const doLiquidation = async (
37
37
  zcf.shutdown('your loan had to be liquidated');
38
38
  };
39
39
 
40
- /** @type {ShutdownWithFailure} */
40
+ /** @type {import('@agoric/swingset-vat').ShutdownWithFailure} */
41
41
  const closeWithFailure = err => {
42
42
  lenderSeat.fail(err);
43
43
  collateralSeat.fail(err);
@@ -0,0 +1,3 @@
1
+ /** @type {ScheduleLiquidation} */
2
+ export const scheduleLiquidation: ScheduleLiquidation;
3
+ //# sourceMappingURL=scheduleLiquidation.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"scheduleLiquidation.d.ts","sourceRoot":"","sources":["scheduleLiquidation.js"],"names":[],"mappings":"AAWA,kCAAkC;AAClC,kCADW,mBAAmB,CAsD5B"}
@@ -0,0 +1,161 @@
1
+ /**
2
+ * The Notifier that provides notifications that periods have passed.
3
+ * Since notifiers can't be relied on to produce an output every time
4
+ * they should, we'll track the time of last payment, and catch up if
5
+ * any times have been missed. Compound interest will be calculated
6
+ * using the interestRate.
7
+ */
8
+ type PeriodNotifier = Notifier<import('@agoric/time').TimestampRecord>;
9
+ /**
10
+ * The running contract instance for an Autoswap installation. The
11
+ * publicFacet from the Autoswap
12
+ * instance is used for producing an invitation to sell the
13
+ * collateral on liquidation.
14
+ */
15
+ type AutoswapInstance = Instance;
16
+ type LoanTerms = {
17
+ /**
18
+ * - Maintenance Margin Requirement, a Ratio record.
19
+ * Default is 150%
20
+ */
21
+ mmr: Ratio;
22
+ autoswapInstance: AutoswapInstance;
23
+ /**
24
+ * Used for getting the current value of collateral and setting
25
+ * liquidation triggers.
26
+ */
27
+ priceAuthority: PriceAuthority;
28
+ periodNotifier: PeriodNotifier;
29
+ /**
30
+ * The rate in basis points that will be multiplied with the debt on
31
+ * every period to compound interest.
32
+ */
33
+ interestRate: Ratio;
34
+ interestPeriod: import('@agoric/time').RelativeTime;
35
+ loanBrand: Brand;
36
+ collateralBrand: Brand;
37
+ };
38
+ type LenderSeatProperty = {
39
+ /**
40
+ * The ZCFSeat representing the lender's position in the contract.
41
+ */
42
+ lenderSeat: ZCFSeat;
43
+ };
44
+ /**
45
+ * The loan now has a lenderSeat, which is added to the config.
46
+ */
47
+ type LoanConfigWithLender = LoanTerms & LenderSeatProperty;
48
+ type BorrowerConfigProperties = {
49
+ /**
50
+ * The ZCFSeat holding the collateral in escrow after the borrower
51
+ * escrows it
52
+ */
53
+ collateralSeat: ZCFSeat;
54
+ /**
55
+ * A function to get the current debt
56
+ */
57
+ getDebt: () => Amount<'nat'>;
58
+ /**
59
+ * PromiseKit that includes a promise that resolves to a PriceQuote
60
+ * when liquidation is triggered
61
+ */
62
+ liquidationPromiseKit: PromiseRecord<PriceQuote>;
63
+ };
64
+ type BorrowerConfigPropertiesMinusDebt = {
65
+ /**
66
+ * The ZCFSeat holding the collateral in escrow after the borrower
67
+ * escrows it
68
+ */
69
+ collateralSeat: ZCFSeat;
70
+ /**
71
+ * PromiseKit that includes a promise that resolves to a PriceQuote
72
+ * when liquidation is triggered
73
+ */
74
+ liquidationPromiseKit: PromiseRecord<PriceQuote>;
75
+ };
76
+ /**
77
+ * The loan has a lender, a borrower, and collateral escrowed.
78
+ */
79
+ type LoanConfigWithBorrower = LoanConfigWithLender & BorrowerConfigProperties;
80
+ type LoanConfigWithBorrowerMinusDebt = LoanConfigWithLender & BorrowerConfigPropertiesMinusDebt;
81
+ type ScheduleLiquidation = (zcf: ZCF, config: LoanConfigWithBorrower) => any;
82
+ type MakeLendInvitation = (zcf: ZCF, config: LoanTerms) => Promise<Invitation>;
83
+ type MakeBorrowInvitation = (zcf: ZCF, config: LoanConfigWithLender) => Promise<Invitation>;
84
+ type MakeCloseLoanInvitation = (zcf: ZCF, config: LoanConfigWithBorrower) => Promise<Invitation>;
85
+ /**
86
+ * Allows holder to add collateral to the contract. Exits the seat
87
+ * after adding.
88
+ */
89
+ type MakeAddCollateralInvitation = (zcf: ZCF, config: LoanConfigWithBorrower) => Promise<Invitation>;
90
+ type MakeDebtCalculator = (debtCalculatorConfig: DebtCalculatorConfig) => any;
91
+ type CalcInterestFn = (oldDebt: Amount<'nat'>, interestRate: Ratio) => Amount<'nat'>;
92
+ type DebtCalculatorConfig = {
93
+ /**
94
+ * A function to calculate the interest, given the debt value and an
95
+ * interest rate in basis points.
96
+ */
97
+ calcInterestFn: CalcInterestFn;
98
+ /**
99
+ * The debt at the start of the loan, in Loan brand
100
+ */
101
+ originalDebt: Amount<'nat'>;
102
+ /**
103
+ * The AsyncIterable to notify when a period has occurred
104
+ */
105
+ periodNotifier: PeriodNotifier;
106
+ interestRate: Ratio;
107
+ /**
108
+ * the period at which the outstanding debt increases by the interestRate
109
+ */
110
+ interestPeriod: import('@agoric/time').RelativeTime;
111
+ zcf: ZCF;
112
+ configMinusGetDebt: LoanConfigWithBorrowerMinusDebt;
113
+ /**
114
+ * The starting point from which to calculate
115
+ * interest.
116
+ */
117
+ basetime: import('@agoric/time').Timestamp;
118
+ };
119
+ type ConfigMinusGetDebt = {
120
+ collateralSeat: ZCFSeat;
121
+ liquidationPromiseKit: PromiseRecord<any>;
122
+ mmr?: bigint | undefined;
123
+ autoswapInstance: Handle<'Instance'>;
124
+ priceAuthority: PriceAuthority;
125
+ periodNotifier: PeriodNotifier;
126
+ interestRate: bigint;
127
+ interestPeriod: import('@agoric/time').RelativeTime;
128
+ lenderSeat: ZCFSeat;
129
+ };
130
+ type BorrowFacet = {
131
+ /**
132
+ * Make an invitation to close the loan by repaying the debt
133
+ * (including interest).
134
+ */
135
+ makeCloseLoanInvitation: () => Promise<Invitation>;
136
+ /**
137
+ * Make an invitation to add collateral to protect against liquidation
138
+ */
139
+ makeAddCollateralInvitation: () => Promise<Invitation>;
140
+ /**
141
+ * Get a promise for a priceQuote that will resolve if liquidation
142
+ * occurs. The priceQuote is for the value of the collateral that
143
+ * triggered the liquidation. This may be lower than expected if the
144
+ * price is moving quickly.
145
+ */
146
+ getLiquidationPromise: () => Promise<PriceQuote>;
147
+ /**
148
+ * Get the timestamp at which the debt was most recently recalculated.
149
+ */
150
+ getLastCalculationTimestamp: () => import('@agoric/time').Timestamp;
151
+ /**
152
+ * Get a Notifier that will be updated when the current debt (an Amount with the Loan
153
+ * Brand) changes. This will increase as interest is added.
154
+ */
155
+ getDebtNotifier: () => Notifier<Amount>;
156
+ /**
157
+ * Get a recent report of the amount of collateral in the loan
158
+ */
159
+ getRecentCollateralAmount: () => Amount;
160
+ };
161
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["types.js"],"names":[],"mappings":";;;;;;;sBACa,SAAS,OAAO,cAAc,EAAE,eAAe,CAAC;;;;;;;wBAUhD,QAAQ;;;;;;SAUP,KAAK;sBAGL,gBAAgB;;;;;oBAEhB,cAAc;oBAKd,cAAc;;;;;kBAEd,KAAK;oBAIL,OAAO,cAAc,EAAE,YAAY;eAEnC,KAAK;qBACL,KAAK;;;;;;gBAKL,OAAO;;;;;4BAMR,SAAS,GAAG,kBAAkB;;;;;;oBAQ7B,OAAO;;;;aAKP,MAAM,OAAO,KAAK,CAAC;;;;;;;;;;;;oBAanB,OAAO;;;;;;;;;;8BAYR,oBAAoB,GAAG,wBAAwB;uCAM/C,oBAAoB,GAAG,iCAAiC;iCAM1D,GAAG,UACH,sBAAsB;gCAKtB,GAAG,UACH,SAAS,KACP,QAAQ,UAAU,CAAC;kCAKrB,GAAG,UACH,oBAAoB,KAClB,QAAQ,UAAU,CAAC;qCAKrB,GAAG,UACH,sBAAsB,KACpB,QAAQ,UAAU,CAAC;;;;;yCAQrB,GAAG,UACH,sBAAsB,KACpB,QAAQ,UAAU,CAAC;iDAKrB,oBAAoB;gCAKpB,OAAO,KAAK,CAAC,gBACb,KAAK,KACH,OAAO,KAAK,CAAC;;;;;;oBAKZ,cAAc;;;;kBAKd,OAAO,KAAK,CAAC;;;;oBAIb,cAAc;kBAId,KAAK;;;;oBACL,OAAO,cAAc,EAAE,YAAY;SAInC,GAAG;wBAEH,+BAA+B;;;;;cAC/B,OAAO,cAAc,EAAE,SAAS;;;oBAMhC,OAAO;;;sBAGP,OAAO,UAAU,CAAC;oBAClB,cAAc;oBACd,cAAc;kBACd,MAAM;oBACN,OAAO,cAAc,EAAE,YAAY;gBACnC,OAAO;;;;;;;6BAMP,MAAM,QAAQ,UAAU,CAAC;;;;iCAKzB,MAAM,QAAQ,UAAU,CAAC;;;;;;;2BAIzB,MAAM,QAAQ,UAAU,CAAC;;;;iCAOzB,MAAM,OAAO,cAAc,EAAE,SAAS;;;;;qBAItC,MAAM,SAAS,MAAM,CAAC;;;;+BAKtB,MAAM,MAAM"}
@@ -0,0 +1,11 @@
1
+ /**
2
+ * @type {CalcInterestFn} Calculate the interest using an interest
3
+ * rate in basis points.
4
+ * i.e. oldDebtValue is 40,000
5
+ * interestRate (in basis points) is 5 = 5/10,000
6
+ * interest charged this period is 20 loan brand
7
+ */
8
+ export const calculateInterest: CalcInterestFn;
9
+ /** @type {MakeDebtCalculator} */
10
+ export const makeDebtCalculator: MakeDebtCalculator;
11
+ //# sourceMappingURL=updateDebt.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"updateDebt.d.ts","sourceRoot":"","sources":["updateDebt.js"],"names":[],"mappings":"AAYA;;;;;;GAMG;AACH,gCANU,cAAc,CAOgB;AAExC,iCAAiC;AACjC,iCADW,kBAAkB,CAyE3B"}
@@ -0,0 +1,28 @@
1
+ /**
2
+ * This contract mints non-fungible tokens and creates a selling contract
3
+ * instance to sell the tokens in exchange for some sort of money.
4
+ *
5
+ * startInstance() returns a creatorFacet which is a
6
+ * ticketMaker with a `.sellTokens()` method. `.sellTokens()` takes a
7
+ * specification of what is being sold, such as:
8
+ * {
9
+ * customValueProperties: { ...arbitrary },
10
+ * count: 3n,
11
+ * moneyIssuer: moolaIssuer,
12
+ * sellItemsInstallationHandle,
13
+ * pricePerItem: AmountMath.make(moolaBrand, 20n),
14
+ * }
15
+ * The payouts are returned as an offerResult in the `outcome`, and an API that
16
+ * allows selling the tickets that were produced. You can reuse the ticket maker
17
+ * to mint more tickets (e.g. for a separate show.)
18
+ *
19
+ * @param {ZCF<{
20
+ * tokenName: string,
21
+ * }>} zcf
22
+ */
23
+ export function start(zcf: ZCF<{
24
+ tokenName: string;
25
+ }>): {
26
+ creatorFacet: MintAndSellNFTCreatorFacet;
27
+ };
28
+ //# sourceMappingURL=mintAndSellNFT.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mintAndSellNFT.d.ts","sourceRoot":"","sources":["mintAndSellNFT.js"],"names":[],"mappings":"AAOA;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,2BAJW,IAAI;IACd,SAAW,EAAE,MAAM,CAAC;CACjB,CAAC;;EA4FJ"}
@@ -0,0 +1,30 @@
1
+ /**
2
+ * This is a very simple contract that creates a new issuer and mints payments
3
+ * from it, in order to give an example of how that can be done. This contract
4
+ * sends new tokens to anyone who has an invitation.
5
+ *
6
+ * The expectation is that most contracts that want to do something similar
7
+ * would use the ability to mint new payments internally rather than sharing
8
+ * that ability widely as this one does.
9
+ *
10
+ * To pay others in tokens, the creator of the instance can make
11
+ * invitations for them, which when used to make an offer, will payout
12
+ * the specified amount of tokens.
13
+ *
14
+ * @param {ZCF} zcf
15
+ */
16
+ export function start(zcf: ZCF): Promise<{
17
+ creatorFacet: {
18
+ makeInvitation: (value?: bigint) => Promise<Invitation<string, undefined>>;
19
+ getTokenIssuer: () => globalThis.Issuer<"nat">;
20
+ } & import("@endo/eventual-send").RemotableBrand<{}, {
21
+ makeInvitation: (value?: bigint) => Promise<Invitation<string, undefined>>;
22
+ getTokenIssuer: () => globalThis.Issuer<"nat">;
23
+ }>;
24
+ publicFacet: {
25
+ getTokenIssuer: () => globalThis.Issuer<"nat">;
26
+ } & import("@endo/eventual-send").RemotableBrand<{}, {
27
+ getTokenIssuer: () => globalThis.Issuer<"nat">;
28
+ }>;
29
+ }>;
30
+ //# sourceMappingURL=mintPayments.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mintPayments.d.ts","sourceRoot":"","sources":["mintPayments.js"],"names":[],"mappings":"AAGA;;;;;;;;;;;;;;GAcG;AACH,2BAFW,GAAG;;;;;;;;;;;;;GAyCb"}
@@ -0,0 +1,26 @@
1
+ export type OracleContract = ContractOf<typeof start>;
2
+ export type OracleStart = typeof start;
3
+ /**
4
+ * This contract provides oracle queries for a fee or for free.
5
+ *
6
+ * @param {ZCF} zcf
7
+ */
8
+ export function start(zcf: ZCF): Promise<{
9
+ creatorFacet: {
10
+ initialize(privateParams: any): OracleCreatorFacet;
11
+ } & import("@endo/eventual-send").RemotableBrand<{}, {
12
+ initialize(privateParams: any): OracleCreatorFacet;
13
+ }>;
14
+ publicFacet: {
15
+ /** @param {OracleQuery} query */
16
+ query(query: OracleQuery): Promise<unknown>;
17
+ /** @param {OracleQuery} query */
18
+ makeQueryInvitation(query: OracleQuery): Promise<Invitation<unknown, never>>;
19
+ } & import("@endo/eventual-send").RemotableBrand<{}, {
20
+ /** @param {OracleQuery} query */
21
+ query(query: OracleQuery): Promise<unknown>;
22
+ /** @param {OracleQuery} query */
23
+ makeQueryInvitation(query: OracleQuery): Promise<Invitation<unknown, never>>;
24
+ }>;
25
+ }>;
26
+ //# sourceMappingURL=oracle.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"oracle.d.ts","sourceRoot":"","sources":["oracle.js"],"names":[],"mappings":"6BAyGc,WAAW,YAAY,CAAC;0BACxB,YAAY;AAlG1B;;;;GAIG;AACH,2BAFW,GAAG;;;;;;;QAkDV,iCAAiC;qBAArB,WAAW;QAgBvB,iCAAiC;mCAArB,WAAW;;QAhBvB,iCAAiC;qBAArB,WAAW;QAgBvB,iCAAiC;mCAArB,WAAW;;GAwB1B"}
@@ -0,0 +1,79 @@
1
+ /**
2
+ * This contract is inspired by the description of an OTC Desk smart
3
+ * contract in this article:
4
+ * https://medium.com/dragonfly-research/unbundling-uniswap-the-future-of-on-chain-market-making-1c7d6948d570
5
+ *
6
+ * The creator of this contract instance can take three actions: add
7
+ * inventory, remove inventory, and make quotes for potential trading
8
+ * partners.
9
+ *
10
+ * To add inventory, the creator of the contract instance can call
11
+ * `E(creatorFacet).makeAddInventoryInvitation(issuerKeywordRecord)`
12
+ * and receive an invitation to add inventory. In this call, they must
13
+ * pass in an issuerKeywordRecord of any issuers they wish to add
14
+ * inventory for, if these issuers have not yet been saved to ZCF.
15
+ * When actually escrowing the inventory as an offer, the proposal
16
+ * must not `want` anything. All of the newly escrowed inventory is
17
+ * taken and reallocated to the marketMakerSeat in the contract.
18
+ *
19
+ * To remove inventory, the creator of the contract instance can call
20
+ * `E(creatorFacet).makeRemoveInventoryInvitation()` and receive an
21
+ * invitation to remove inventory. When making an offer to remove
22
+ * inventory, the proposal should specify the `want`, which will be
23
+ * removed, but should not give anything.
24
+ *
25
+ * To make a quote, the creator can call
26
+ * `E(creatorFacet).makeQuote(price, assets, timeAuthority,
27
+ * deadline)`. `price` and `assets` are amountKeywordRecords that will
28
+ * be used in the coveredCall. The assets are the underlyingAssets in
29
+ * the call option, and the price is used as the strikePrice. The
30
+ * timeAuthority should be a timer, and the deadline can be any time
31
+ * understood by the timer. The quote will be cancelled after the
32
+ * deadline. `makeQuote` returns a covered call option that can be
33
+ * given away for free or sold. Importantly, if the recipient chooses
34
+ * to exercise the option, they can verify that the goods being
35
+ * offered are already escrowed, and the trade is guaranteed to
36
+ * succeed if their proposal matches the quote.
37
+ *
38
+ * @param {ZCF<Record<string, any>>} zcf
39
+ */
40
+ export function start(zcf: ZCF<Record<string, any>>): {
41
+ creatorFacet: {
42
+ /**
43
+ * The inventory can be added in bulk before any quotes are made
44
+ * or can be added immediately before a quote.
45
+ *
46
+ * @param {IssuerKeywordRecord} [issuerKeywordRecord]
47
+ * @returns {Promise<Payment>}
48
+ */
49
+ makeAddInventoryInvitation: (issuerKeywordRecord?: IssuerKeywordRecord | undefined) => Promise<Payment>;
50
+ /**
51
+ * The inventory can be removed at any time, since the inventory
52
+ * used for active quotes is escrowed separately within the coveredCall
53
+ * instance.
54
+ *
55
+ * @returns {Promise<Payment>}
56
+ */
57
+ makeRemoveInventoryInvitation: () => Promise<Payment>;
58
+ makeQuote: (price: AmountKeywordRecord, assets: AmountKeywordRecord, timeAuthority: import('@agoric/time').TimerService, deadline: any) => Promise<Payment>;
59
+ } & import("@endo/eventual-send").RemotableBrand<{}, {
60
+ /**
61
+ * The inventory can be added in bulk before any quotes are made
62
+ * or can be added immediately before a quote.
63
+ *
64
+ * @param {IssuerKeywordRecord} [issuerKeywordRecord]
65
+ * @returns {Promise<Payment>}
66
+ */
67
+ makeAddInventoryInvitation: (issuerKeywordRecord?: IssuerKeywordRecord | undefined) => Promise<Payment>;
68
+ /**
69
+ * The inventory can be removed at any time, since the inventory
70
+ * used for active quotes is escrowed separately within the coveredCall
71
+ * instance.
72
+ *
73
+ * @returns {Promise<Payment>}
74
+ */
75
+ makeRemoveInventoryInvitation: () => Promise<Payment>;
76
+ makeQuote: (price: AmountKeywordRecord, assets: AmountKeywordRecord, timeAuthority: import('@agoric/time').TimerService, deadline: any) => Promise<Payment>;
77
+ }>;
78
+ };
79
+ //# sourceMappingURL=otcDesk.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"otcDesk.d.ts","sourceRoot":"","sources":["otcDesk.js"],"names":[],"mappings":"AAUA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsCG;AACH,2BAFW,IAAI,OAAO,MAAM,EAAE,GAAG,CAAC,CAAC;;QAoE/B;;;;;;WAMG;+FADU,QAAQ,OAAO,CAAC;QAM7B;;;;;;WAMG;6CADU,QAAQ,OAAO,CAAC;2BAzEpB,mBAAmB,UACnB,mBAAmB,iBACnB,OAAO,cAAc,EAAE,YAAY,YACnC,GAAG,KACD,QAAQ,OAAO,CAAC;;QAqD3B;;;;;;WAMG;+FADU,QAAQ,OAAO,CAAC;QAM7B;;;;;;WAMG;6CADU,QAAQ,OAAO,CAAC;2BAzEpB,mBAAmB,UACnB,mBAAmB,iBACnB,OAAO,cAAc,EAAE,YAAY,YACnC,GAAG,KACD,QAAQ,OAAO,CAAC;;EA8E9B"}