@agoric/zoe
Version:
Zoe: the Smart Contract Framework for Offer Enforcement
30 lines • 1.32 kB
TypeScript
type PositionKind = "long" | "short";
type MakeOptionInvitation = (positionKind: PositionKind) => Promise<Invitation>;
type PayoffHandler = {
schedulePayoffs: () => void;
makeOptionInvitation: MakeOptionInvitation;
};
/**
* Return value from calculateShares, which represents the portions assigned to
* the long and short side of a transaction. These will be two non-negative
* integers that sum to 100.
*/
type CalculateSharesReturn = {
longShare: Ratio;
shortShare: Ratio;
};
/**
* calculate the portion (as a percentage) of the collateral that should be
* allocated to the long side of a call spread contract. price gives the value
* of the underlying asset at closing that determines the payouts to the parties
*
* if price <= strikePrice1, return Ratio representing 0
* if price >= strikePrice2, return Ratio representing 1.
* Otherwise return longShare and shortShare representing ratios between 0% and
* 100% reflecting the position of the price in the range from strikePrice1 to
* strikePrice2.
*/
type CalculateShares = (collateralBrand: Brand, price: Amount<"nat">, strikePrice1: Amount<"nat">, strikePrice2: Amount<"nat">) => CalculateSharesReturn;
type Make100Percent = (brand: Brand) => Ratio;
type Make0Percent = (brand: Brand) => Ratio;
//# sourceMappingURL=types-ambient.d.ts.map