@agoric/zoe
Version:
Zoe: the Smart Contract Framework for Offer Enforcement
67 lines • 3.13 kB
TypeScript
/**
* This contract implements a fully collateralized call spread. This is a
* combination of a call option bought at one strike price and a second call
* option sold at a higher price. The invitations are produced in pairs. The
* creatorFacet has a method makeInvitationPair(longCollateralShare) whose
* argument must be a number between 0 and 100. makeInvitationPair() returns two
* invitations which require depositing amounts summing to the settlement amount
* in the proportions longCollateralShare and (100 - longCollateralShare) to
* redeem the respective options/invitations. (They are returned under the
* Keyword 'Option'.) The options are ERTP invitations that are suitable for
* resale.
*
* This option contract is settled financially. There is no requirement that the
* creator have ownership of the underlying asset at the start, and
* the beneficiaries shouldn't expect to take delivery at closing.
*
* The issuerKeywordRecord specifies the issuers for three keywords: Underlying,
* Strike, and Collateral. The payout is in Collateral. Strike amounts are used
* for the price oracle's quotes as to the value of the Underlying, as well as
* the strike prices in the terms.
*
* terms include:
* `timer` is a timer, and must be recognized by `priceAuthority`.
* `expiration` is a time recognized by the `timer`.
* `underlyingAmount` is passed to `priceAuthority`. It could be an NFT or a
* fungible amount.
* `strikePrice2` must be greater than `strikePrice1`.
* `settlementAmount` is the amount deposited by the funder and split between
* the holders of the options. It uses Collateral.
* `priceAuthority` is an oracle that has a timer so it can respond to requests
* for prices as of a stated time. After the deadline, it will issue a
* PriceQuote giving the value of the underlying asset in the strike currency.
*
* Future enhancements:
* + issue multiple option pairs with the same expiration from a single instance
*
* @param {ZCF<{
* strikePrice1: Amount<'nat'>,
* strikePrice2: Amount<'nat'>,
* settlementAmount: Amount<'nat'>,
* priceAuthority: PriceAuthority,
* expiration: bigint,
* underlyingAmount: Amount<'nat'>,
* }>} zcf
*/
export function start(zcf: ZCF<{
strikePrice1: Amount<"nat">;
strikePrice2: Amount<"nat">;
settlementAmount: Amount<"nat">;
priceAuthority: PriceAuthority;
expiration: bigint;
underlyingAmount: Amount<"nat">;
}>): {
creatorFacet: {
makeInvitationPair: (longCollateralShare: any) => {
longInvitation: Promise<globalThis.Invitation<unknown, never>>;
shortInvitation: Promise<globalThis.Invitation<unknown, never>>;
};
} & RemotableObject<`Alleged: ${string}`> & import("@endo/eventual-send").RemotableBrand<{}, {
makeInvitationPair: (longCollateralShare: any) => {
longInvitation: Promise<globalThis.Invitation<unknown, never>>;
shortInvitation: Promise<globalThis.Invitation<unknown, never>>;
};
}>;
};
import type { PriceAuthority } from '@agoric/zoe/tools/types.js';
//# sourceMappingURL=pricedCallSpread.d.ts.map