@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.
Files changed (307) hide show
  1. package/package.json +10 -10
  2. package/source-spec-registry.d.ts +25 -0
  3. package/source-spec-registry.d.ts.map +1 -0
  4. package/src/cleanProposal.d.ts +13 -0
  5. package/src/cleanProposal.d.ts.map +1 -0
  6. package/src/contractFacet/allocationMath.d.ts +11 -0
  7. package/src/contractFacet/allocationMath.d.ts.map +1 -0
  8. package/src/contractFacet/evalContractCode.d.ts +2 -0
  9. package/src/contractFacet/evalContractCode.d.ts.map +1 -0
  10. package/src/contractFacet/exit.d.ts +2 -0
  11. package/src/contractFacet/exit.d.ts.map +1 -0
  12. package/src/contractFacet/offerHandlerStorage.d.ts +14 -0
  13. package/src/contractFacet/offerHandlerStorage.d.ts.map +1 -0
  14. package/src/contractFacet/offerSafety.d.ts +36 -0
  15. package/src/contractFacet/offerSafety.d.ts.map +1 -0
  16. package/src/contractFacet/reallocate.d.ts +6 -0
  17. package/src/contractFacet/reallocate.d.ts.map +1 -0
  18. package/src/contractFacet/rightsConservation.d.ts +13 -0
  19. package/src/contractFacet/rightsConservation.d.ts.map +1 -0
  20. package/src/contractFacet/typeGuards.d.ts +8 -0
  21. package/src/contractFacet/typeGuards.d.ts.map +1 -0
  22. package/src/contractFacet/types.d.ts +182 -0
  23. package/src/contractFacet/types.d.ts.map +1 -0
  24. package/src/contractFacet/vatRoot.d.ts +30 -0
  25. package/src/contractFacet/vatRoot.d.ts.map +1 -0
  26. package/src/contractFacet/zcfMint.d.ts +18 -0
  27. package/src/contractFacet/zcfMint.d.ts.map +1 -0
  28. package/src/contractFacet/zcfSeat.d.ts +12 -0
  29. package/src/contractFacet/zcfSeat.d.ts.map +1 -0
  30. package/src/contractFacet/zcfZygote.d.ts +19 -0
  31. package/src/contractFacet/zcfZygote.d.ts.map +1 -0
  32. package/src/contractSupport/atomicTransfer.d.ts +13 -0
  33. package/src/contractSupport/atomicTransfer.d.ts.map +1 -0
  34. package/src/contractSupport/bondingCurves.d.ts +7 -0
  35. package/src/contractSupport/bondingCurves.d.ts.map +1 -0
  36. package/src/contractSupport/durability.d.ts +10 -0
  37. package/src/contractSupport/durability.d.ts.map +1 -0
  38. package/src/contractSupport/index.d.ts +14 -0
  39. package/src/contractSupport/index.d.ts.map +1 -0
  40. package/src/contractSupport/prepare-ownable.d.ts +14 -0
  41. package/src/contractSupport/prepare-ownable.d.ts.map +1 -0
  42. package/src/contractSupport/priceAuthority.d.ts +36 -0
  43. package/src/contractSupport/priceAuthority.d.ts.map +1 -0
  44. package/src/contractSupport/priceAuthorityInitial.d.ts +8 -0
  45. package/src/contractSupport/priceAuthorityInitial.d.ts.map +1 -0
  46. package/src/contractSupport/priceAuthorityQuoteMint.d.ts +6 -0
  47. package/src/contractSupport/priceAuthorityQuoteMint.d.ts.map +1 -0
  48. package/src/contractSupport/priceAuthorityTransform.d.ts +23 -0
  49. package/src/contractSupport/priceAuthorityTransform.d.ts.map +1 -0
  50. package/src/contractSupport/priceQuote.d.ts +13 -0
  51. package/src/contractSupport/priceQuote.d.ts.map +1 -0
  52. package/src/contractSupport/recorder.d.ts +91 -0
  53. package/src/contractSupport/recorder.d.ts.map +1 -0
  54. package/src/contractSupport/stateMachine.d.ts +6 -0
  55. package/src/contractSupport/stateMachine.d.ts.map +1 -0
  56. package/src/contractSupport/statistics.d.ts +7 -0
  57. package/src/contractSupport/statistics.d.ts.map +1 -0
  58. package/src/contractSupport/testJigHelpers.d.ts +7 -0
  59. package/src/contractSupport/testJigHelpers.d.ts.map +1 -0
  60. package/src/contractSupport/topics.d.ts +52 -0
  61. package/src/contractSupport/topics.d.ts.map +1 -0
  62. package/src/contractSupport/types.d.ts +70 -0
  63. package/src/contractSupport/types.d.ts.map +1 -0
  64. package/src/contractSupport/zoeHelpers.d.ts +53 -0
  65. package/src/contractSupport/zoeHelpers.d.ts.map +1 -0
  66. package/src/contracts/atomicSwap.d.ts +20 -0
  67. package/src/contracts/atomicSwap.d.ts.map +1 -0
  68. package/src/contracts/auction/assertBidSeat.d.ts +2 -0
  69. package/src/contracts/auction/assertBidSeat.d.ts.map +1 -0
  70. package/src/contracts/auction/firstPriceLogic.d.ts +4 -0
  71. package/src/contracts/auction/firstPriceLogic.d.ts.map +1 -0
  72. package/src/contracts/auction/index.d.ts +84 -0
  73. package/src/contracts/auction/index.d.ts.map +1 -0
  74. package/src/contracts/auction/secondPriceLogic.d.ts +4 -0
  75. package/src/contracts/auction/secondPriceLogic.d.ts.map +1 -0
  76. package/src/contracts/automaticRefund.d.ts +29 -0
  77. package/src/contracts/automaticRefund.d.ts.map +1 -0
  78. package/src/contracts/autoswap.d.ts +51 -0
  79. package/src/contracts/autoswap.d.ts.map +1 -0
  80. package/src/contracts/barterExchange.d.ts +26 -0
  81. package/src/contracts/barterExchange.d.ts.map +1 -0
  82. package/src/contracts/callSpread/calculateShares.d.ts +2 -0
  83. package/src/contracts/callSpread/calculateShares.d.ts.map +1 -0
  84. package/src/contracts/callSpread/fundedCallSpread.d.ts +71 -0
  85. package/src/contracts/callSpread/fundedCallSpread.d.ts.map +1 -0
  86. package/src/contracts/callSpread/payoffHandler.d.ts +23 -0
  87. package/src/contracts/callSpread/payoffHandler.d.ts.map +1 -0
  88. package/src/contracts/callSpread/percent.d.ts +3 -0
  89. package/src/contracts/callSpread/percent.d.ts.map +1 -0
  90. package/src/contracts/callSpread/position.d.ts +10 -0
  91. package/src/contracts/callSpread/position.d.ts.map +1 -0
  92. package/src/contracts/callSpread/pricedCallSpread.d.ts +69 -0
  93. package/src/contracts/callSpread/pricedCallSpread.d.ts.map +1 -0
  94. package/src/contracts/callSpread/types.d.ts +34 -0
  95. package/src/contracts/callSpread/types.d.ts.map +1 -0
  96. package/src/contracts/coveredCall-durable.d.ts +23 -0
  97. package/src/contracts/coveredCall-durable.d.ts.map +1 -0
  98. package/src/contracts/coveredCall.d.ts +68 -0
  99. package/src/contracts/coveredCall.d.ts.map +1 -0
  100. package/src/contracts/loan/addCollateral.d.ts +8 -0
  101. package/src/contracts/loan/addCollateral.d.ts.map +1 -0
  102. package/src/contracts/loan/borrow.d.ts +12 -0
  103. package/src/contracts/loan/borrow.d.ts.map +1 -0
  104. package/src/contracts/loan/close.d.ts +8 -0
  105. package/src/contracts/loan/close.d.ts.map +1 -0
  106. package/src/contracts/loan/index.d.ts +75 -0
  107. package/src/contracts/loan/index.d.ts.map +1 -0
  108. package/src/contracts/loan/lend.d.ts +8 -0
  109. package/src/contracts/loan/lend.d.ts.map +1 -0
  110. package/src/contracts/loan/liquidate.d.ts +5 -0
  111. package/src/contracts/loan/liquidate.d.ts.map +1 -0
  112. package/src/contracts/loan/scheduleLiquidation.d.ts +7 -0
  113. package/src/contracts/loan/scheduleLiquidation.d.ts.map +1 -0
  114. package/src/contracts/loan/types.d.ts +176 -0
  115. package/src/contracts/loan/types.d.ts.map +1 -0
  116. package/src/contracts/loan/updateDebt.d.ts +17 -0
  117. package/src/contracts/loan/updateDebt.d.ts.map +1 -0
  118. package/src/contracts/mintAndSellNFT.d.ts +35 -0
  119. package/src/contracts/mintAndSellNFT.d.ts.map +1 -0
  120. package/src/contracts/mintPayments.d.ts +34 -0
  121. package/src/contracts/mintPayments.d.ts.map +1 -0
  122. package/src/contracts/oracle.d.ts +38 -0
  123. package/src/contracts/oracle.d.ts.map +1 -0
  124. package/src/contracts/otcDesk.d.ts +90 -0
  125. package/src/contracts/otcDesk.d.ts.map +1 -0
  126. package/src/contracts/priceAggregator.d.ts +125 -0
  127. package/src/contracts/priceAggregator.d.ts.map +1 -0
  128. package/src/contracts/priceAggregatorTypes.d.ts +83 -0
  129. package/src/contracts/priceAggregatorTypes.d.ts.map +1 -0
  130. package/src/contracts/scaledPriceAuthority.d.ts +26 -0
  131. package/src/contracts/scaledPriceAuthority.d.ts.map +1 -0
  132. package/src/contracts/sellItems.d.ts +40 -0
  133. package/src/contracts/sellItems.d.ts.map +1 -0
  134. package/src/contracts/simpleExchange.d.ts +42 -0
  135. package/src/contracts/simpleExchange.d.ts.map +1 -0
  136. package/src/contracts/types.d.ts +87 -0
  137. package/src/contracts/types.d.ts.map +1 -0
  138. package/src/contracts/valueVow.contract.d.ts +20 -0
  139. package/src/contracts/valueVow.contract.d.ts.map +1 -0
  140. package/src/handleWarning.d.ts +4 -0
  141. package/src/handleWarning.d.ts.map +1 -0
  142. package/src/instanceRecordStorage.d.ts +5 -0
  143. package/src/instanceRecordStorage.d.ts.map +1 -0
  144. package/src/internal-types.d.ts +196 -0
  145. package/src/internal-types.d.ts.map +1 -0
  146. package/src/issuerRecord.d.ts +9 -0
  147. package/src/issuerRecord.d.ts.map +1 -0
  148. package/src/issuerStorage.d.ts +24 -0
  149. package/src/issuerStorage.d.ts.map +1 -0
  150. package/src/makeHandle.d.ts +6 -0
  151. package/src/makeHandle.d.ts.map +1 -0
  152. package/src/typeGuards.d.ts +185 -0
  153. package/src/typeGuards.d.ts.map +1 -0
  154. package/src/types.d.ts +29 -0
  155. package/src/types.d.ts.map +1 -0
  156. package/src/zoeService/createZCFVat.d.ts +2 -0
  157. package/src/zoeService/createZCFVat.d.ts.map +1 -0
  158. package/src/zoeService/escrowStorage.d.ts +12 -0
  159. package/src/zoeService/escrowStorage.d.ts.map +1 -0
  160. package/src/zoeService/feeMint.d.ts +27 -0
  161. package/src/zoeService/feeMint.d.ts.map +1 -0
  162. package/src/zoeService/installationStorage.d.ts +21 -0
  163. package/src/zoeService/installationStorage.d.ts.map +1 -0
  164. package/src/zoeService/instanceAdminStorage.d.ts +107 -0
  165. package/src/zoeService/instanceAdminStorage.d.ts.map +1 -0
  166. package/src/zoeService/internal-types.d.ts +125 -0
  167. package/src/zoeService/internal-types.d.ts.map +1 -0
  168. package/src/zoeService/invitationQueries.d.ts +9 -0
  169. package/src/zoeService/invitationQueries.d.ts.map +1 -0
  170. package/src/zoeService/makeInvitation.d.ts +9 -0
  171. package/src/zoeService/makeInvitation.d.ts.map +1 -0
  172. package/src/zoeService/offer/burnInvitation.d.ts +11 -0
  173. package/src/zoeService/offer/burnInvitation.d.ts.map +1 -0
  174. package/src/zoeService/offer/offer.d.ts +3 -0
  175. package/src/zoeService/offer/offer.d.ts.map +1 -0
  176. package/src/zoeService/originalZoeSeat.d.ts +36 -0
  177. package/src/zoeService/originalZoeSeat.d.ts.map +1 -0
  178. package/src/zoeService/startInstance.d.ts +7 -0
  179. package/src/zoeService/startInstance.d.ts.map +1 -0
  180. package/src/zoeService/types.d.ts +238 -0
  181. package/src/zoeService/types.d.ts.map +1 -0
  182. package/src/zoeService/zoe.d.ts +70 -0
  183. package/src/zoeService/zoe.d.ts.map +1 -0
  184. package/src/zoeService/zoeSeat.d.ts +31 -0
  185. package/src/zoeService/zoeSeat.d.ts.map +1 -0
  186. package/src/zoeService/zoeStorageManager.d.ts +47 -0
  187. package/src/zoeService/zoeStorageManager.d.ts.map +1 -0
  188. package/tools/fakePriceAuthority.d.ts +37 -0
  189. package/tools/fakePriceAuthority.d.ts.map +1 -0
  190. package/tools/fakeVatAdmin.d.ts +118 -0
  191. package/tools/fakeVatAdmin.d.ts.map +1 -0
  192. package/tools/manualPriceAuthority.d.ts +33 -0
  193. package/tools/manualPriceAuthority.d.ts.map +1 -0
  194. package/tools/manualTimer.d.ts +23 -0
  195. package/tools/manualTimer.d.ts.map +1 -0
  196. package/tools/prepare-test-env-ava.d.ts +2 -0
  197. package/tools/prepare-test-env-ava.d.ts.map +1 -0
  198. package/tools/prepare-test-env.d.ts +2 -0
  199. package/tools/prepare-test-env.d.ts.map +1 -0
  200. package/tools/scriptedOracle.d.ts +39 -0
  201. package/tools/scriptedOracle.d.ts.map +1 -0
  202. package/tools/scriptedPriceAuthority.d.ts +37 -0
  203. package/tools/scriptedPriceAuthority.d.ts.map +1 -0
  204. package/tools/setup-zoe.d.ts +43 -0
  205. package/tools/setup-zoe.d.ts.map +1 -0
  206. package/tools/test-utils.d.ts +24 -0
  207. package/tools/test-utils.d.ts.map +1 -0
  208. package/tools/types.d.ts +152 -0
  209. package/tools/types.d.ts.map +1 -0
  210. package/bundles/bundle-contractFacet-js-meta.json +0 -1075
  211. package/bundles/bundle-contractFacet.d.ts +0 -7
  212. package/bundles/bundle-contractFacet.d.ts.map +0 -1
  213. package/bundles/bundle-contractFacet.js +0 -1
  214. package/bundles/bundle-valueVow.contract-esbuild.js +0 -1
  215. package/bundles/bundle-valueVow.contract-js-meta.json +0 -560
  216. package/bundles/bundle-valueVow.contract.js +0 -1
  217. package/bundles/esbuild-bundle-20251113T203237.423Z.js +0 -1
  218. package/bundles/esbuild-bundle-20251113T203238.037Z.js +0 -1
  219. package/bundles/esbuild-bundle-20251113T203238.695Z.js +0 -1
  220. package/bundles/esbuild-bundle-20251113T203327.010Z.js +0 -1
  221. package/bundles/esbuild-bundle-20251113T203330.583Z.js +0 -1
  222. package/bundles/esbuild-bundle-20251113T232226.026Z.js +0 -1
  223. package/bundles/esbuild-bundle-20251113T232229.459Z.js +0 -1
  224. package/bundles/esbuild-bundle-20251114T162409.358Z.js +0 -1
  225. package/bundles/esbuild-bundle-20251114T162409.367Z.js +0 -1
  226. package/bundles/esbuild-bundle-20251114T162417.875Z.js +0 -1
  227. package/bundles/esbuild-bundle-20251114T162419.685Z.js +0 -1
  228. package/bundles/esbuild-bundle-20251114T162420.279Z.js +0 -1
  229. package/bundles/esbuild-bundle-20251114T162421.865Z.js +0 -1
  230. package/bundles/esbuild-bundle-20251114T162422.353Z.js +0 -1
  231. package/bundles/esbuild-bundle-20251114T162423.173Z.js +0 -1
  232. package/bundles/esbuild-bundle-20251114T162427.670Z.js +0 -1
  233. package/bundles/esbuild-bundle-20251114T162429.725Z.js +0 -1
  234. package/bundles/esbuild-bundle-20251114T162429.727Z.js +0 -1
  235. package/bundles/esbuild-bundle-20251114T162430.603Z.js +0 -1
  236. package/bundles/esbuild-bundle-20251114T162431.414Z.js +0 -1
  237. package/bundles/esbuild-bundle-20251114T162433.433Z.js +0 -1
  238. package/bundles/esbuild-bundle-20251114T162435.370Z.js +0 -1
  239. package/bundles/esbuild-bundle-20251114T162437.257Z.js +0 -1
  240. package/bundles/esbuild-bundle-20251114T162438.372Z.js +0 -1
  241. package/bundles/esbuild-bundle-20251114T162438.596Z.js +0 -1
  242. package/bundles/esbuild-bundle-20251114T162439.399Z.js +0 -1
  243. package/bundles/esbuild-bundle-20251114T162439.647Z.js +0 -1
  244. package/bundles/esbuild-bundle-20251114T162441.758Z.js +0 -1
  245. package/bundles/esbuild-bundle-20251114T162441.816Z.js +0 -1
  246. package/bundles/esbuild-bundle-20251114T162442.916Z.js +0 -1
  247. package/bundles/esbuild-bundle-20251114T162443.223Z.js +0 -1
  248. package/bundles/esbuild-bundle-20251114T162443.627Z.js +0 -1
  249. package/bundles/esbuild-bundle-20251114T162444.919Z.js +0 -1
  250. package/bundles/esbuild-bundle-20251114T162445.277Z.js +0 -1
  251. package/bundles/esbuild-bundle-20251114T162446.456Z.js +0 -1
  252. package/bundles/esbuild-bundle-20251114T162446.985Z.js +0 -1
  253. package/bundles/esbuild-bundle-20251114T162447.123Z.js +0 -1
  254. package/bundles/esbuild-bundle-20251114T162448.243Z.js +0 -1
  255. package/bundles/esbuild-bundle-20251114T162448.612Z.js +0 -1
  256. package/bundles/esbuild-bundle-20251114T162448.908Z.js +0 -1
  257. package/bundles/esbuild-bundle-20251114T162449.945Z.js +0 -1
  258. package/bundles/esbuild-bundle-20251114T162450.616Z.js +0 -1
  259. package/bundles/esbuild-bundle-20251114T162451.429Z.js +0 -1
  260. package/bundles/esbuild-bundle-20251114T162451.929Z.js +0 -1
  261. package/bundles/esbuild-bundle-20251114T162452.191Z.js +0 -1
  262. package/bundles/esbuild-bundle-20251114T162452.687Z.js +0 -1
  263. package/bundles/esbuild-bundle-20251114T162453.614Z.js +0 -1
  264. package/bundles/esbuild-bundle-20251114T162454.028Z.js +0 -1
  265. package/bundles/esbuild-bundle-20251114T162454.171Z.js +0 -1
  266. package/bundles/esbuild-bundle-20251114T162455.073Z.js +0 -1
  267. package/bundles/esbuild-bundle-20251114T162455.907Z.js +0 -1
  268. package/bundles/esbuild-bundle-20251114T162500.300Z.js +0 -1
  269. package/bundles/esbuild-bundle-20251114T162501.073Z.js +0 -1
  270. package/bundles/esbuild-bundle-20251114T162502.359Z.js +0 -1
  271. package/bundles/esbuild-bundle-20251114T162502.366Z.js +0 -1
  272. package/bundles/esbuild-bundle-20251114T162503.345Z.js +0 -1
  273. package/bundles/esbuild-bundle-20251114T162503.433Z.js +0 -1
  274. package/bundles/esbuild-bundle-20251114T162504.445Z.js +0 -1
  275. package/bundles/esbuild-bundle-20251114T162505.137Z.js +0 -1
  276. package/bundles/esbuild-bundle-20251114T162505.167Z.js +0 -1
  277. package/bundles/esbuild-bundle-20251114T162505.419Z.js +0 -1
  278. package/bundles/esbuild-bundle-20251114T162515.878Z.js +0 -1
  279. package/bundles/esbuild-bundle-20251114T162516.428Z.js +0 -1
  280. package/bundles/esbuild-bundle-20251114T162518.796Z.js +0 -1
  281. package/bundles/esbuild-bundle-20251114T162521.136Z.js +0 -1
  282. package/bundles/esbuild-bundle-20251114T162521.391Z.js +0 -1
  283. package/bundles/esbuild-bundle-20251114T162522.786Z.js +0 -1
  284. package/bundles/esbuild-bundle-20251114T162523.313Z.js +0 -1
  285. package/bundles/esbuild-bundle-20251114T162524.174Z.js +0 -1
  286. package/bundles/esbuild-bundle-20251114T162526.066Z.js +0 -1
  287. package/bundles/esbuild-bundle-20251114T162527.972Z.js +0 -1
  288. package/bundles/esbuild-bundle-20251114T162533.153Z.js +0 -1
  289. package/bundles/esbuild-bundle-20251114T162537.633Z.js +0 -1
  290. package/bundles/esbuild-bundle-20251114T162603.943Z.js +0 -1
  291. package/bundles/esbuild-bundle-20251114T162604.799Z.js +0 -1
  292. package/bundles/esbuild-bundle-20251114T162605.605Z.js +0 -1
  293. package/bundles/esbuild-bundle-20251114T162606.399Z.js +0 -1
  294. package/bundles/esbuild-bundle-20251114T162607.115Z.js +0 -1
  295. package/bundles/esbuild-bundle-20251114T162607.943Z.js +0 -1
  296. package/bundles/esbuild-bundle-20251114T162608.705Z.js +0 -1
  297. package/bundles/esbuild-bundle-20251114T162609.486Z.js +0 -1
  298. package/bundles/esbuild-bundle-20251114T162610.269Z.js +0 -1
  299. package/bundles/esbuild-bundle-20251114T162611.045Z.js +0 -1
  300. package/bundles/esbuild-bundle-20251114T162611.814Z.js +0 -1
  301. package/bundles/esbuild-bundle-20251114T162612.650Z.js +0 -1
  302. package/bundles/esbuild-bundle-20251114T162613.429Z.js +0 -1
  303. package/bundles/esbuild-bundle-20251114T162614.233Z.js +0 -1
  304. package/bundles/esbuild-bundle-20251114T162640.495Z.js +0 -1
  305. package/bundles/esbuild-bundle-20251114T162950.705Z.js +0 -1
  306. package/bundles/zcf.b64 +0 -1
  307. package/bundles/zcf.zip +0 -0
@@ -0,0 +1,176 @@
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
+ export type PeriodNotifier = Notifier<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
+ export type AutoswapInstance = Instance;
16
+ export 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: RelativeTime;
35
+ loanBrand: Brand;
36
+ collateralBrand: Brand;
37
+ };
38
+ export 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
+ export type LoanConfigWithLender = LoanTerms & LenderSeatProperty;
48
+ export 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
+ export 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
+ export type LoanConfigWithBorrower = LoanConfigWithLender & BorrowerConfigProperties;
80
+ export type LoanConfigWithBorrowerMinusDebt = LoanConfigWithLender & BorrowerConfigPropertiesMinusDebt;
81
+ export type ScheduleLiquidation = (zcf: ZCF, config: LoanConfigWithBorrower) => any;
82
+ export type MakeLendInvitation = (zcf: ZCF, config: LoanTerms) => Promise<Invitation>;
83
+ export type MakeBorrowInvitation = (zcf: ZCF, config: LoanConfigWithLender) => Promise<Invitation>;
84
+ export 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
+ export type MakeAddCollateralInvitation = (zcf: ZCF, config: LoanConfigWithBorrower) => Promise<Invitation>;
90
+ export type MakeDebtCalculator = (debtCalculatorConfig: DebtCalculatorConfig) => any;
91
+ export type CalcInterestFn = (oldDebt: Amount<"nat">, interestRate: Ratio) => Amount<"nat">;
92
+ export 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: RelativeTime;
111
+ zcf: ZCF;
112
+ configMinusGetDebt: LoanConfigWithBorrowerMinusDebt;
113
+ /**
114
+ * The starting point from which to calculate
115
+ * interest.
116
+ */
117
+ basetime: Timestamp;
118
+ };
119
+ export 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: RelativeTime;
128
+ lenderSeat: ZCFSeat;
129
+ };
130
+ export 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: () => 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
+ import type { TimestampRecord } from '@agoric/time';
162
+ import type { Notifier } from '@agoric/notifier';
163
+ import type { Instance } from '@agoric/zoe';
164
+ import type { Ratio } from '@agoric/ertp';
165
+ import type { PriceAuthority } from '../../../tools/types.js';
166
+ import type { RelativeTime } from '@agoric/time';
167
+ import type { Brand } from '@agoric/ertp';
168
+ import type { ZCFSeat } from '../../types-index.js';
169
+ import type { Amount } from '@agoric/ertp';
170
+ import type { PriceQuote } from '../../../tools/types.js';
171
+ import type { PromiseRecord } from '@endo/promise-kit';
172
+ import type { ZCF } from '../../types-index.js';
173
+ import type { Invitation } from '../../types-index.js';
174
+ import type { Timestamp } from '@agoric/time';
175
+ import type { Handle } from '@agoric/zoe';
176
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["types.js"],"names":[],"mappings":";;;;;;;6BAea,SAAS,eAAe,CAAC;;;;;;;+BAUzB,QAAQ;;;;;;SAUP,KAAK;sBAGL,gBAAgB;;;;;oBAEhB,cAAc;oBAKd,cAAc;;;;;kBAEd,KAAK;oBAIL,YAAY;eAEZ,KAAK;qBACL,KAAK;;;;;;gBAKL,OAAO;;;;;mCAMR,SAAS,GAAG,kBAAkB;;;;;;oBAQ7B,OAAO;;;;aAKP,MAAM,OAAO,KAAK,CAAC;;;;;2BAInB,cAAc,UAAU,CAAC;;;;;;;oBASzB,OAAO;;;;;2BAKP,cAAc,UAAU,CAAC;;;;;qCAO1B,oBAAoB,GAAG,wBAAwB;8CAM/C,oBAAoB,GAAG,iCAAiC;wCAM1D,GAAG,UACH,sBAAsB;uCAKtB,GAAG,UACH,SAAS,KACP,OAAO,CAAC,UAAU,CAAC;yCAKrB,GAAG,UACH,oBAAoB,KAClB,OAAO,CAAC,UAAU,CAAC;4CAKrB,GAAG,UACH,sBAAsB,KACpB,OAAO,CAAC,UAAU,CAAC;;;;;gDAQrB,GAAG,UACH,sBAAsB,KACpB,OAAO,CAAC,UAAU,CAAC;wDAKrB,oBAAoB;uCAKpB,OAAO,KAAK,CAAC,gBACb,KAAK,KACH,OAAO,KAAK,CAAC;;;;;;oBAKZ,cAAc;;;;kBAKd,OAAO,KAAK,CAAC;;;;oBAIb,cAAc;kBAId,KAAK;;;;oBACL,YAAY;SAIZ,GAAG;wBAEH,+BAA+B;;;;;cAC/B,SAAS;;;oBAMT,OAAO;2BACP,cAAc,GAAG,CAAC;;sBAElB,OAAO,UAAU,CAAC;oBAClB,cAAc;oBACd,cAAc;kBACd,MAAM;oBACN,YAAY;gBACZ,OAAO;;;;;;;6BAMP,MAAM,OAAO,CAAC,UAAU,CAAC;;;;iCAKzB,MAAM,OAAO,CAAC,UAAU,CAAC;;;;;;;2BAIzB,MAAM,OAAO,CAAC,UAAU,CAAC;;;;iCAOzB,MAAM,SAAS;;;;;qBAIf,MAAM,SAAS,MAAM,CAAC;;;;+BAKtB,MAAM,MAAM;;qCApOQ,cAAc;8BADrB,kBAAkB;8BAWV,aAAa;2BATT,cAAc;oCACpB,yBAAyB;kCAC3B,cAAc;2BAFN,cAAc;6BAG3B,sBAAsB;4BAHT,cAAc;gCAKxB,yBAAyB;mCADtB,mBAAmB;yBAE7B,sBAAsB;gCACf,sBAAsB;+BACvB,cAAc;4BACP,aAAa"}
@@ -0,0 +1,17 @@
1
+ /**
2
+ * @import {TimestampRecord} from '@agoric/time';
3
+ * @import {CalcInterestFn, MakeDebtCalculator} from './types.js';
4
+ */
5
+ /**
6
+ * @type {CalcInterestFn} Calculate the interest using an interest
7
+ * rate in basis points.
8
+ * i.e. oldDebtValue is 40,000
9
+ * interestRate (in basis points) is 5 = 5/10,000
10
+ * interest charged this period is 20 loan brand
11
+ */
12
+ export const calculateInterest: CalcInterestFn;
13
+ /** @type {MakeDebtCalculator} */
14
+ export const makeDebtCalculator: MakeDebtCalculator;
15
+ import type { CalcInterestFn } from './types.js';
16
+ import type { MakeDebtCalculator } from './types.js';
17
+ //# sourceMappingURL=updateDebt.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"updateDebt.d.ts","sourceRoot":"","sources":["updateDebt.js"],"names":[],"mappings":"AASA;;;GAGG;AAKH;;;;;;GAMG;AACH,gCANU,cAAc,CAOgB;AAExC,iCAAiC;AACjC,iCADW,kBAAkB,CAyE3B;oCAzFmD,YAAY;wCAAZ,YAAY"}
@@ -0,0 +1,35 @@
1
+ /**
2
+ * @import {start as sellItemStart} from './sellItems.js';
3
+ * @import {Installation, ZCF} from '@agoric/zoe';
4
+ * @import {MintAndSellNFTCreatorFacet} from './types.js';
5
+ */
6
+ /**
7
+ * This contract mints non-fungible tokens and creates a selling contract
8
+ * instance to sell the tokens in exchange for some sort of money.
9
+ *
10
+ * startInstance() returns a creatorFacet which is a
11
+ * ticketMaker with a `.sellTokens()` method. `.sellTokens()` takes a
12
+ * specification of what is being sold, such as:
13
+ * {
14
+ * customValueProperties: { ...arbitrary },
15
+ * count: 3n,
16
+ * moneyIssuer: moolaIssuer,
17
+ * sellItemsInstallationHandle,
18
+ * pricePerItem: AmountMath.make(moolaBrand, 20n),
19
+ * }
20
+ * The payouts are returned as an offerResult in the `outcome`, and an API that
21
+ * allows selling the tickets that were produced. You can reuse the ticket maker
22
+ * to mint more tickets (e.g. for a separate show.)
23
+ *
24
+ * @param {ZCF<{
25
+ * tokenName: string,
26
+ * }>} zcf
27
+ */
28
+ export function start(zcf: ZCF<{
29
+ tokenName: string;
30
+ }>): {
31
+ creatorFacet: MintAndSellNFTCreatorFacet;
32
+ };
33
+ import type { ZCF } from '@agoric/zoe';
34
+ import type { MintAndSellNFTCreatorFacet } from './types.js';
35
+ //# sourceMappingURL=mintAndSellNFT.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mintAndSellNFT.d.ts","sourceRoot":"","sources":["mintAndSellNFT.js"],"names":[],"mappings":"AAOA;;;;GAIG;AAEH;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,2BAJW,IAAI;IACZ,SAAS,EAAE,MAAM,CAAC;CACjB,CAAC;;EA4FJ;yBApHmC,aAAa;gDACJ,YAAY"}
@@ -0,0 +1,34 @@
1
+ /**
2
+ * @import {ZCF} from '@agoric/zoe';
3
+ */
4
+ /**
5
+ * This is a very simple contract that creates a new issuer and mints payments
6
+ * from it, in order to give an example of how that can be done. This contract
7
+ * sends new tokens to anyone who has an invitation.
8
+ *
9
+ * The expectation is that most contracts that want to do something similar
10
+ * would use the ability to mint new payments internally rather than sharing
11
+ * that ability widely as this one does.
12
+ *
13
+ * To pay others in tokens, the creator of the instance can make
14
+ * invitations for them, which when used to make an offer, will payout
15
+ * the specified amount of tokens.
16
+ *
17
+ * @param {ZCF} zcf
18
+ */
19
+ export function start(zcf: ZCF): Promise<{
20
+ creatorFacet: {
21
+ makeInvitation: (value?: bigint) => Promise<import("@agoric/zoe").Invitation<string, undefined>>;
22
+ getTokenIssuer: () => import("@agoric/ertp").Issuer<"nat", import("@endo/patterns").Key>;
23
+ } & import("@endo/marshal").RemotableObject<`Alleged: ${string}`> & import("@endo/eventual-send").RemotableBrand<{}, {
24
+ makeInvitation: (value?: bigint) => Promise<import("@agoric/zoe").Invitation<string, undefined>>;
25
+ getTokenIssuer: () => import("@agoric/ertp").Issuer<"nat", import("@endo/patterns").Key>;
26
+ }>;
27
+ publicFacet: {
28
+ getTokenIssuer: () => import("@agoric/ertp").Issuer<"nat", import("@endo/patterns").Key>;
29
+ } & import("@endo/marshal").RemotableObject<`Alleged: ${string}`> & import("@endo/eventual-send").RemotableBrand<{}, {
30
+ getTokenIssuer: () => import("@agoric/ertp").Issuer<"nat", import("@endo/patterns").Key>;
31
+ }>;
32
+ }>;
33
+ import type { ZCF } from '@agoric/zoe';
34
+ //# sourceMappingURL=mintPayments.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mintPayments.d.ts","sourceRoot":"","sources":["mintPayments.js"],"names":[],"mappings":"AAGA;;GAEG;AAEH;;;;;;;;;;;;;;GAcG;AACH,2BAFW,GAAG;;;;;;;;;;;;;GAyCb;yBAzDqB,aAAa"}
@@ -0,0 +1,38 @@
1
+ export type OracleContract = ContractOf<typeof start>;
2
+ export type OracleStart = typeof start;
3
+ /**
4
+ * @import {ContractMeta, Invitation, OfferHandler, ZCF, ZCFSeat} from '@agoric/zoe';
5
+ * @import {ContractOf} from '../zoeService/utils.js';
6
+ * @import {OracleHandler} from './priceAggregatorTypes.js';
7
+ * @import {OracleCreatorFacet} from './priceAggregatorTypes.js';
8
+ * @import {OracleQuery} from './priceAggregatorTypes.js';
9
+ */
10
+ /**
11
+ * This contract provides oracle queries for a fee or for free.
12
+ *
13
+ * @param {ZCF} zcf
14
+ */
15
+ export function start(zcf: ZCF): Promise<{
16
+ creatorFacet: {
17
+ initialize(privateParams: any): OracleCreatorFacet;
18
+ } & import("@endo/marshal").RemotableObject<`Alleged: ${string}`> & import("@endo/eventual-send").RemotableBrand<{}, {
19
+ initialize(privateParams: any): OracleCreatorFacet;
20
+ }>;
21
+ publicFacet: {
22
+ /** @param {OracleQuery} query */
23
+ query(query: OracleQuery): Promise<unknown>;
24
+ /** @param {OracleQuery} query */
25
+ makeQueryInvitation(query: OracleQuery): Promise<Invitation<unknown, never>>;
26
+ } & import("@endo/marshal").RemotableObject<`Alleged: ${string}`> & import("@endo/eventual-send").RemotableBrand<{}, {
27
+ /** @param {OracleQuery} query */
28
+ query(query: OracleQuery): Promise<unknown>;
29
+ /** @param {OracleQuery} query */
30
+ makeQueryInvitation(query: OracleQuery): Promise<Invitation<unknown, never>>;
31
+ }>;
32
+ }>;
33
+ import type { ContractOf } from '../zoeService/utils.js';
34
+ import type { ZCF } from '@agoric/zoe';
35
+ import type { OracleCreatorFacet } from './priceAggregatorTypes.js';
36
+ import type { OracleQuery } from './priceAggregatorTypes.js';
37
+ import type { Invitation } from '@agoric/zoe';
38
+ //# sourceMappingURL=oracle.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"oracle.d.ts","sourceRoot":"","sources":["oracle.js"],"names":[],"mappings":"6BAgHc,WAAW,OAAO,KAAK,CAAC;0BACxB,OAAO,KAAK;AA1G1B;;;;;;GAMG;AAEH;;;;GAIG;AACH,2BAFW,GAAG;;;;;;;QAkDV,iCAAiC;qBAArB,WAAW;QAgBvB,iCAAiC;mCAArB,WAAW;;QAhBvB,iCAAiC;qBAArB,WAAW;QAgBvB,iCAAiC;mCAArB,WAAW;;GAwB1B;gCAnG4B,wBAAwB;yBADkB,aAAa;wCAG/C,2BAA2B;iCAClC,2BAA2B;gCAJc,aAAa"}
@@ -0,0 +1,90 @@
1
+ /**
2
+ * @import {TimerService} from '@agoric/time';
3
+ * @import {Invitation, UserSeat} from '../types-index.js';
4
+ * @import {AmountKeywordRecord, IssuerKeywordRecord, ZCF} from '@agoric/zoe';
5
+ * @import {Payment} from '@agoric/ertp';
6
+ */
7
+ /**
8
+ * This contract is inspired by the description of an OTC Desk smart
9
+ * contract in this article:
10
+ * https://medium.com/dragonfly-research/unbundling-uniswap-the-future-of-on-chain-market-making-1c7d6948d570
11
+ *
12
+ * The creator of this contract instance can take three actions: add
13
+ * inventory, remove inventory, and make quotes for potential trading
14
+ * partners.
15
+ *
16
+ * To add inventory, the creator of the contract instance can call
17
+ * `E(creatorFacet).makeAddInventoryInvitation(issuerKeywordRecord)`
18
+ * and receive an invitation to add inventory. In this call, they must
19
+ * pass in an issuerKeywordRecord of any issuers they wish to add
20
+ * inventory for, if these issuers have not yet been saved to ZCF.
21
+ * When actually escrowing the inventory as an offer, the proposal
22
+ * must not `want` anything. All of the newly escrowed inventory is
23
+ * taken and reallocated to the marketMakerSeat in the contract.
24
+ *
25
+ * To remove inventory, the creator of the contract instance can call
26
+ * `E(creatorFacet).makeRemoveInventoryInvitation()` and receive an
27
+ * invitation to remove inventory. When making an offer to remove
28
+ * inventory, the proposal should specify the `want`, which will be
29
+ * removed, but should not give anything.
30
+ *
31
+ * To make a quote, the creator can call
32
+ * `E(creatorFacet).makeQuote(price, assets, timeAuthority,
33
+ * deadline)`. `price` and `assets` are amountKeywordRecords that will
34
+ * be used in the coveredCall. The assets are the underlyingAssets in
35
+ * the call option, and the price is used as the strikePrice. The
36
+ * timeAuthority should be a timer, and the deadline can be any time
37
+ * understood by the timer. The quote will be cancelled after the
38
+ * deadline. `makeQuote` returns a covered call option that can be
39
+ * given away for free or sold. Importantly, if the recipient chooses
40
+ * to exercise the option, they can verify that the goods being
41
+ * offered are already escrowed, and the trade is guaranteed to
42
+ * succeed if their proposal matches the quote.
43
+ *
44
+ * @param {ZCF<Record<string, any>>} zcf
45
+ */
46
+ export function start(zcf: ZCF<Record<string, any>>): {
47
+ creatorFacet: {
48
+ /**
49
+ * The inventory can be added in bulk before any quotes are made
50
+ * or can be added immediately before a quote.
51
+ *
52
+ * @param {IssuerKeywordRecord} [issuerKeywordRecord]
53
+ * @returns {Promise<Payment>}
54
+ */
55
+ makeAddInventoryInvitation: (issuerKeywordRecord?: IssuerKeywordRecord) => Promise<Payment>;
56
+ /**
57
+ * The inventory can be removed at any time, since the inventory
58
+ * used for active quotes is escrowed separately within the coveredCall
59
+ * instance.
60
+ *
61
+ * @returns {Promise<Payment>}
62
+ */
63
+ makeRemoveInventoryInvitation: () => Promise<Payment>;
64
+ makeQuote: (price: AmountKeywordRecord, assets: AmountKeywordRecord, timeAuthority: TimerService, deadline: any) => Promise<Payment>;
65
+ } & import("@endo/marshal").RemotableObject<`Alleged: ${string}`> & import("@endo/eventual-send").RemotableBrand<{}, {
66
+ /**
67
+ * The inventory can be added in bulk before any quotes are made
68
+ * or can be added immediately before a quote.
69
+ *
70
+ * @param {IssuerKeywordRecord} [issuerKeywordRecord]
71
+ * @returns {Promise<Payment>}
72
+ */
73
+ makeAddInventoryInvitation: (issuerKeywordRecord?: IssuerKeywordRecord) => Promise<Payment>;
74
+ /**
75
+ * The inventory can be removed at any time, since the inventory
76
+ * used for active quotes is escrowed separately within the coveredCall
77
+ * instance.
78
+ *
79
+ * @returns {Promise<Payment>}
80
+ */
81
+ makeRemoveInventoryInvitation: () => Promise<Payment>;
82
+ makeQuote: (price: AmountKeywordRecord, assets: AmountKeywordRecord, timeAuthority: TimerService, deadline: any) => Promise<Payment>;
83
+ }>;
84
+ };
85
+ import type { ZCF } from '@agoric/zoe';
86
+ import type { IssuerKeywordRecord } from '@agoric/zoe';
87
+ import type { Payment } from '@agoric/ertp';
88
+ import type { AmountKeywordRecord } from '@agoric/zoe';
89
+ import type { TimerService } from '@agoric/time';
90
+ //# sourceMappingURL=otcDesk.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"otcDesk.d.ts","sourceRoot":"","sources":["otcDesk.js"],"names":[],"mappings":"AAUA;;;;;GAKG;AAEH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsCG;AACH,2BAFW,IAAI,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;;QAoE/B;;;;;;WAMG;2DAFQ,mBAAmB,KACjB,OAAO,CAAC,OAAO,CAAC;QAM7B;;;;;;WAMG;6CADU,OAAO,CAAC,OAAO,CAAC;2BAzEpB,mBAAmB,UACnB,mBAAmB,iBACnB,YAAY,YACZ,GAAG,KACD,OAAO,CAAC,OAAO,CAAC;;QAqD3B;;;;;;WAMG;2DAFQ,mBAAmB,KACjB,OAAO,CAAC,OAAO,CAAC;QAM7B;;;;;;WAMG;6CADU,OAAO,CAAC,OAAO,CAAC;2BAzEpB,mBAAmB,UACnB,mBAAmB,iBACnB,YAAY,YACZ,GAAG,KACD,OAAO,CAAC,OAAO,CAAC;;EA8E9B;yBAtI+D,aAAa;yCAAb,aAAa;6BACnD,cAAc;yCADwB,aAAa;kCAF9C,cAAc"}
@@ -0,0 +1,125 @@
1
+ export type ParsableNumber = bigint | number | string;
2
+ export type OraclePriceSubmission = Readonly<ParsableNumber | {
3
+ data: ParsableNumber;
4
+ }>;
5
+ export type Price = ParsableNumber | Ratio;
6
+ export type PriceAggregatorContract = ContractOf<typeof start>;
7
+ /**
8
+ * @deprecated use fluxAggregator
9
+ *
10
+ * This contract aggregates price values from a set of oracles and provides a
11
+ * PriceAuthority for their median. This naive method is game-able and so this module
12
+ * is a stub until we complete what is now in `fluxAggregatorKit.js`.
13
+ *
14
+ * @param {ZCF<{
15
+ * timer: TimerService,
16
+ * POLL_INTERVAL: bigint,
17
+ * brandIn: Brand<'nat'>,
18
+ * brandOut: Brand<'nat'>,
19
+ * unitAmountIn: Amount<'nat'>,
20
+ * }>} zcf
21
+ * @param {{
22
+ * marshaller: Remote<Marshaller>,
23
+ * quoteMint?: ERef<Mint<'set', PriceDescription>>,
24
+ * storageNode: Remote<StorageNode>,
25
+ * }} privateArgs
26
+ */
27
+ export function start(zcf: ZCF<{
28
+ timer: TimerService;
29
+ POLL_INTERVAL: bigint;
30
+ brandIn: Brand<"nat">;
31
+ brandOut: Brand<"nat">;
32
+ unitAmountIn: Amount<"nat">;
33
+ }>, privateArgs: {
34
+ marshaller: Remote<Marshaller>;
35
+ quoteMint?: ERef<Mint<"set", PriceDescription>>;
36
+ storageNode: Remote<StorageNode>;
37
+ }): Promise<{
38
+ creatorFacet: {
39
+ /**
40
+ * An "oracle invitation" is an invitation to be able to submit data to
41
+ * include in the priceAggregator's results.
42
+ *
43
+ * The offer result from this invitation is a OracleAdmin, which can be used
44
+ * directly to manage the price submissions as well as to terminate the
45
+ * relationship.
46
+ *
47
+ * @param {Instance<unknown> | string} [oracleKey]
48
+ */
49
+ makeOracleInvitation: (oracleKey?: Instance<unknown> | string) => Promise<Invitation<{
50
+ admin: OracleAdmin<Price>;
51
+ invitationMakers: {
52
+ PushPrice: (price: ParsableNumber) => Promise<Invitation<void>>;
53
+ };
54
+ }, {
55
+ notifier?: Notifier<OraclePriceSubmission> | undefined;
56
+ scaleValueOut?: number | undefined;
57
+ } | undefined>>;
58
+ /** @param {OracleKey} oracleKey */
59
+ deleteOracle: (oracleKey: OracleKey) => Promise<void>;
60
+ /**
61
+ * @param {Instance<unknown> | string} [oracleInstance]
62
+ * @param {OracleQuery} [query]
63
+ * @returns {Promise<OracleAdmin<Price>>}
64
+ */
65
+ initOracle: (oracleInstance?: Instance<unknown> | string, query?: OracleQuery) => Promise<OracleAdmin<Price>>;
66
+ } & import("@endo/marshal").RemotableObject<`Alleged: ${string}`> & import("@endo/eventual-send").RemotableBrand<{}, {
67
+ /**
68
+ * An "oracle invitation" is an invitation to be able to submit data to
69
+ * include in the priceAggregator's results.
70
+ *
71
+ * The offer result from this invitation is a OracleAdmin, which can be used
72
+ * directly to manage the price submissions as well as to terminate the
73
+ * relationship.
74
+ *
75
+ * @param {Instance<unknown> | string} [oracleKey]
76
+ */
77
+ makeOracleInvitation: (oracleKey?: Instance<unknown> | string) => Promise<Invitation<{
78
+ admin: OracleAdmin<Price>;
79
+ invitationMakers: {
80
+ PushPrice: (price: ParsableNumber) => Promise<Invitation<void>>;
81
+ };
82
+ }, {
83
+ notifier?: Notifier<OraclePriceSubmission> | undefined;
84
+ scaleValueOut?: number | undefined;
85
+ } | undefined>>;
86
+ /** @param {OracleKey} oracleKey */
87
+ deleteOracle: (oracleKey: OracleKey) => Promise<void>;
88
+ /**
89
+ * @param {Instance<unknown> | string} [oracleInstance]
90
+ * @param {OracleQuery} [query]
91
+ * @returns {Promise<OracleAdmin<Price>>}
92
+ */
93
+ initOracle: (oracleInstance?: Instance<unknown> | string, query?: OracleQuery) => Promise<OracleAdmin<Price>>;
94
+ }>;
95
+ publicFacet: {
96
+ getPriceAuthority(): import("@agoric/zoe/tools/types.js").PriceAuthority;
97
+ getSubscriber: () => import("@agoric/notifier").StoredSubscriber<unknown>;
98
+ /** Diagnostic tool */
99
+ getRoundCompleteNotifier(): Promise<Notifier<any>>;
100
+ } & import("@endo/marshal").RemotableObject<`Alleged: ${string}`> & import("@endo/eventual-send").RemotableBrand<{}, {
101
+ getPriceAuthority(): import("@agoric/zoe/tools/types.js").PriceAuthority;
102
+ getSubscriber: () => import("@agoric/notifier").StoredSubscriber<unknown>;
103
+ /** Diagnostic tool */
104
+ getRoundCompleteNotifier(): Promise<Notifier<any>>;
105
+ }>;
106
+ }>;
107
+ import type { Ratio } from '@agoric/ertp';
108
+ import type { ContractOf } from '../zoeService/utils.js';
109
+ import type { TimerService } from '@agoric/time';
110
+ import type { Brand } from '@agoric/ertp';
111
+ import type { Amount } from '@agoric/ertp';
112
+ import type { ZCF } from '@agoric/zoe';
113
+ import type { Marshaller } from '@agoric/internal/src/lib-chainStorage.js';
114
+ import type { Remote } from '@agoric/internal';
115
+ import type { PriceDescription } from '@agoric/zoe/tools/types.js';
116
+ import type { Mint } from '@agoric/ertp';
117
+ import type { ERef } from '@agoric/vow';
118
+ import type { StorageNode } from '@agoric/internal/src/lib-chainStorage.js';
119
+ import type { Instance } from '@agoric/zoe';
120
+ import type { OracleAdmin } from './priceAggregatorTypes.js';
121
+ import type { Invitation } from '@agoric/zoe';
122
+ import type { Notifier } from '@agoric/notifier';
123
+ import type { OracleKey } from './priceAggregatorTypes.js';
124
+ import type { OracleQuery } from './priceAggregatorTypes.js';
125
+ //# sourceMappingURL=priceAggregator.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"priceAggregator.d.ts","sourceRoot":"","sources":["priceAggregator.js"],"names":[],"mappings":"6BAqDc,MAAM,GAAG,MAAM,GAAG,MAAM;oCAEzB,QAAQ,CAAC,cAAc,GAAG;IAAE,IAAI,EAAE,cAAc,CAAA;CAAE,CAAC;oBAGlD,cAAc,GAAG,KAAK;sCAqlBtB,WAAW,OAAO,KAAK,CAAC;AAhlBtC;;;;;;;;;;;;;;;;;;;GAmBG;AACH,2BAbW,IAAI;IACZ,KAAK,EAAE,YAAY,CAAC;IACpB,aAAa,EAAE,MAAM,CAAC;IACtB,OAAO,EAAE,MAAM,KAAK,CAAC,CAAC;IACtB,QAAQ,EAAE,MAAM,KAAK,CAAC,CAAC;IACvB,YAAY,EAAE,OAAO,KAAK,CAAC,CAAC;CAC3B,CAAC,eACM;IACR,UAAU,EAAE,OAAO,UAAU,CAAC,CAAC;IAC/B,SAAS,CAAC,EAAE,KAAK,KAAK,KAAK,EAAE,gBAAgB,CAAC,CAAC,CAAC;IAChD,WAAW,EAAE,OAAO,WAAW,CAAC,CAAC;CAChC;;QAiXA;;;;;;;;;WASG;2CADQ,SAAS,OAAO,CAAC,GAAG,MAAM;mBAaN,YAAY,KAAK,CAAC;8BAAoB;gBAAC,SAAS,EAAE,CAAC,KAAK,EAAE,cAAc,KAAK,OAAO,CAAC,WAAW,IAAI,CAAC,CAAC,CAAA;aAAC;;;;;QA0CtI,mCAAmC;kCAAvB,SAAS;QAarB;;;;WAIG;sCAHQ,SAAS,OAAO,CAAC,GAAG,MAAM,UAC1B,WAAW,KACT,OAAO,CAAC,YAAY,KAAK,CAAC,CAAC;;QA/ExC;;;;;;;;;WASG;2CADQ,SAAS,OAAO,CAAC,GAAG,MAAM;mBAaN,YAAY,KAAK,CAAC;8BAAoB;gBAAC,SAAS,EAAE,CAAC,KAAK,EAAE,cAAc,KAAK,OAAO,CAAC,WAAW,IAAI,CAAC,CAAC,CAAA;aAAC;;;;;QA0CtI,mCAAmC;kCAAvB,SAAS;QAarB;;;;WAIG;sCAHQ,SAAS,OAAO,CAAC,GAAG,MAAM,UAC1B,WAAW,KACT,OAAO,CAAC,YAAY,KAAK,CAAC,CAAC;;;;;QAoHxC,sBAAsB;;;;;QAAtB,sBAAsB;;;GAOzB;2BAjmBsC,cAAc;gCARxB,wBAAwB;kCAGtB,cAAc;2BAKN,cAAc;4BAAd,cAAc;yBANA,aAAa;gCAWrC,0CAA0C;4BAhB9C,kBAAkB;sCAIkC,4BAA4B;0BAWlF,cAAc;0BAGd,aAAa;iCADN,0CAA0C;8BAZnB,aAAa;iCAQpC,2BAA2B;gCARJ,aAAa;8BAHzB,kBAAkB;+BAU/B,2BAA2B;iCAEzB,2BAA2B"}
@@ -0,0 +1,83 @@
1
+ export type OracleAdmin<R extends unknown> = {
2
+ /**
3
+ * Remove the oracle from the aggregator
4
+ */
5
+ delete: () => Promise<void>;
6
+ /**
7
+ * Rather than waiting for the polling query, push a result directly from this oracle
8
+ */
9
+ pushResult: (result: R) => Promise<void>;
10
+ };
11
+ export type OracleKey = {} | string;
12
+ export type PriceAggregatorKit = Pick<PriceAggregatorContract, "creatorFacet" | "publicFacet">;
13
+ export type OracleQuery = Record<string, unknown> & {
14
+ kind?: string;
15
+ increment?: bigint;
16
+ };
17
+ /**
18
+ * The public methods accessible from the contract instance
19
+ */
20
+ export type OraclePublicFacet = {
21
+ /**
22
+ * Create an invitation for an oracle query
23
+ */
24
+ makeQueryInvitation: (query: OracleQuery) => ERef<Invitation>;
25
+ /**
26
+ * Make an unpaid query
27
+ */
28
+ query: (query: OracleQuery) => ERef<unknown>;
29
+ };
30
+ export type OracleCreatorFacetMakeWithdrawInvitation = (total?: boolean | undefined) => ERef<Invitation>;
31
+ /**
32
+ * The private methods accessible from the contract instance
33
+ */
34
+ export type OracleCreatorFacet = {
35
+ /**
36
+ * Get the current fee amounts
37
+ */
38
+ getCurrentFees: () => AmountKeywordRecord;
39
+ /**
40
+ * Create an invitation to withdraw fees
41
+ */
42
+ makeWithdrawInvitation: OracleCreatorFacetMakeWithdrawInvitation;
43
+ /**
44
+ * Make an invitation to withdraw all fees and shutdown
45
+ */
46
+ makeShutdownInvitation: () => Promise<Invitation>;
47
+ };
48
+ export type OraclePrivateParameters = {
49
+ oracleHandler: OracleHandler;
50
+ };
51
+ export type OracleInitializationFacet = {
52
+ initialize: (privateParams: OraclePrivateParameters) => OracleCreatorFacet;
53
+ };
54
+ export type OracleKit = {
55
+ creatorFacet: OracleCreatorFacet;
56
+ publicFacet: OraclePublicFacet;
57
+ instance: Instance;
58
+ };
59
+ export type OracleReply = {
60
+ reply: unknown;
61
+ requiredFee?: Amount | undefined;
62
+ };
63
+ export type OracleHandler = {
64
+ /**
65
+ * Callback to reply to a query
66
+ */
67
+ onQuery: (query: OracleQuery, fee: Amount) => Promise<OracleReply>;
68
+ /**
69
+ * Notice an error
70
+ */
71
+ onError: (query: OracleQuery, reason: unknown) => void;
72
+ /**
73
+ * Notice a successful reply
74
+ */
75
+ onReply: (query: OracleQuery, reply: unknown, requiredFee: Amount | undefined) => void;
76
+ };
77
+ import type { PriceAggregatorContract } from './priceAggregator.js';
78
+ import type { Invitation } from '../types-index.js';
79
+ import type { ERef } from '@agoric/vow';
80
+ import type { AmountKeywordRecord } from '@agoric/zoe';
81
+ import type { Instance } from '@agoric/zoe';
82
+ import type { Amount } from '@agoric/ertp';
83
+ //# sourceMappingURL=priceAggregatorTypes.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"priceAggregatorTypes.d.ts","sourceRoot":"","sources":["priceAggregatorTypes.js"],"names":[],"mappings":"wBACsB,CAAC;;;;YAET,MAAM,OAAO,CAAC,IAAI,CAAC;;;;gBAEnB,CAAC,MAAM,EAAE,CAAC,KAAK,OAAO,CAAC,IAAI,CAAC;;wBAa7B,EAAE,GAAG,MAAM;iCAIX,IAAI,CAAC,uBAAuB,EAAE,cAAc,GAAG,aAAa,CAAC;0BAI7D,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG;IACpC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,SAAS,CAAC,EAAE,MAAM,CAAC;CAClB;;;;;;;;yBAMU,CAAC,KAAK,EAAE,WAAW,KAAK,KAAK,UAAU,CAAC;;;;WAExC,CAAC,KAAK,EAAE,WAAW,KAAK,KAAK,OAAO,CAAC;;wFAOtC,KAAK,UAAU,CAAC;;;;;;;;oBAMf,MAAM,mBAAmB;;;;4BAEzB,wCAAwC;;;;4BAExC,MAAM,OAAO,CAAC,UAAU,CAAC;;;mBAMzB,aAAa;;;gBAKb,CAAC,aAAa,EAAE,uBAAuB,KAC7C,kBAAkB;;;kBAKZ,kBAAkB;iBAClB,iBAAiB;cACjB,QAAQ;;;WAKR,OAAO;;;;;;;aAMP,CAAC,KAAK,EAAE,WAAW,EAAE,GAAG,EAAE,MAAM,KAAK,OAAO,CAAC,WAAW,CAAC;;;;aAEzD,CAAC,KAAK,EAAE,WAAW,EAAE,MAAM,EAAE,OAAO,KAAK,IAAI;;;;aAE7C,CAAC,KAAK,EAAE,WAAW,EAClB,KAAK,EAAE,OAAO,EACd,WAAW,EAAE,MAAM,GAAG,SAAS,KACtC,IAAI;;6CAjF8B,sBAAsB;gCACnC,mBAAmB;0BAGzB,aAAa;yCAFY,aAAa;8BAAb,aAAa;4BACpC,cAAc"}
@@ -0,0 +1,26 @@
1
+ export function prepare(zcf: ZCF<ScaledPriceAuthorityOpts>, privateArgs: object, baggage: Baggage): Promise<{
2
+ publicFacet: import("@endo/exo").Guarded<{
3
+ getPriceAuthority: () => Promise<PriceAuthority>;
4
+ }>;
5
+ }>;
6
+ export type ScaledPriceAuthorityOpts = {
7
+ sourcePriceAuthority: ERef<PriceAuthority>;
8
+ /**
9
+ * - sourceAmountIn:targetAmountIn
10
+ */
11
+ scaleIn: Ratio;
12
+ /**
13
+ * - sourceAmountOut:targetAmountOut
14
+ */
15
+ scaleOut: Ratio;
16
+ /**
17
+ * - targetAmountIn:targetAmountOut
18
+ */
19
+ initialPrice?: Ratio | undefined;
20
+ };
21
+ import type { ZCF } from '@agoric/zoe';
22
+ import type { Baggage } from '@agoric/vat-data';
23
+ import type { PriceAuthority } from '@agoric/zoe/tools/types.js';
24
+ import type { ERef } from '@agoric/vow';
25
+ import type { Ratio } from '@agoric/ertp';
26
+ //# sourceMappingURL=scaledPriceAuthority.d.ts.map