UNPKG

@agoric/zoe

Version:

Zoe: the Smart Contract Framework for Offer Enforcement

79 lines 3.94 kB
/** * This contract is inspired by the description of an OTC Desk smart * contract in this article: * https://medium.com/dragonfly-research/unbundling-uniswap-the-future-of-on-chain-market-making-1c7d6948d570 * * The creator of this contract instance can take three actions: add * inventory, remove inventory, and make quotes for potential trading * partners. * * To add inventory, the creator of the contract instance can call * `E(creatorFacet).makeAddInventoryInvitation(issuerKeywordRecord)` * and receive an invitation to add inventory. In this call, they must * pass in an issuerKeywordRecord of any issuers they wish to add * inventory for, if these issuers have not yet been saved to ZCF. * When actually escrowing the inventory as an offer, the proposal * must not `want` anything. All of the newly escrowed inventory is * taken and reallocated to the marketMakerSeat in the contract. * * To remove inventory, the creator of the contract instance can call * `E(creatorFacet).makeRemoveInventoryInvitation()` and receive an * invitation to remove inventory. When making an offer to remove * inventory, the proposal should specify the `want`, which will be * removed, but should not give anything. * * To make a quote, the creator can call * `E(creatorFacet).makeQuote(price, assets, timeAuthority, * deadline)`. `price` and `assets` are amountKeywordRecords that will * be used in the coveredCall. The assets are the underlyingAssets in * the call option, and the price is used as the strikePrice. The * timeAuthority should be a timer, and the deadline can be any time * understood by the timer. The quote will be cancelled after the * deadline. `makeQuote` returns a covered call option that can be * given away for free or sold. Importantly, if the recipient chooses * to exercise the option, they can verify that the goods being * offered are already escrowed, and the trade is guaranteed to * succeed if their proposal matches the quote. * * @param {ZCF<Record<string, any>>} zcf */ export function start(zcf: ZCF<Record<string, any>>): { creatorFacet: { /** * The inventory can be added in bulk before any quotes are made * or can be added immediately before a quote. * * @param {IssuerKeywordRecord} [issuerKeywordRecord] * @returns {Promise<Payment>} */ makeAddInventoryInvitation: (issuerKeywordRecord?: IssuerKeywordRecord) => Promise<Payment>; /** * The inventory can be removed at any time, since the inventory * used for active quotes is escrowed separately within the coveredCall * instance. * * @returns {Promise<Payment>} */ makeRemoveInventoryInvitation: () => Promise<Payment>; makeQuote: (price: AmountKeywordRecord, assets: AmountKeywordRecord, timeAuthority: import("@agoric/time").TimerService, deadline: any) => Promise<Payment>; } & RemotableObject<`Alleged: ${string}`> & import("@endo/eventual-send").RemotableBrand<{}, { /** * The inventory can be added in bulk before any quotes are made * or can be added immediately before a quote. * * @param {IssuerKeywordRecord} [issuerKeywordRecord] * @returns {Promise<Payment>} */ makeAddInventoryInvitation: (issuerKeywordRecord?: IssuerKeywordRecord) => Promise<Payment>; /** * The inventory can be removed at any time, since the inventory * used for active quotes is escrowed separately within the coveredCall * instance. * * @returns {Promise<Payment>} */ makeRemoveInventoryInvitation: () => Promise<Payment>; makeQuote: (price: AmountKeywordRecord, assets: AmountKeywordRecord, timeAuthority: import("@agoric/time").TimerService, deadline: any) => Promise<Payment>; }>; }; //# sourceMappingURL=otcDesk.d.ts.map