UNPKG

@agoric/zoe

Version:

Zoe: the Smart Contract Framework for Offer Enforcement

147 lines • 5.39 kB
export type PriceQuote = { /** * Amount whose value is a PriceQuoteValue */ quoteAmount: Amount<"set", PriceDescription>; /** * The `quoteAmount` wrapped as a payment */ quotePayment: ERef<Payment<"set", PriceDescription>>; }; /** * A single-valued set of PriceDescriptions. This is the `value` in * PriceQuote.quoteAmount (`{ brand, value: PriceQuoteValue }`). */ export type PriceQuoteValue = [PriceDescription]; /** * A description of a single quote */ export type PriceDescription = { /** * The amount supplied to a trade */ amountIn: Amount<"nat">; /** * The quoted result of trading `amountIn` */ amountOut: Amount<"nat">; /** * The service that gave the `timestamp` */ timer: import("@endo/pass-style").RemotableObject & import("@agoric/time").TimerService; /** * A timestamp according to `timer` for the quote */ timestamp: import("@agoric/time").TimestampRecord; /** * Additional conditions for the quote */ conditions?: any; }; export type PriceQuoteCreate = (priceQuery: PriceQuery) => ERef<PriceQuote> | undefined; export type PriceQuoteTrigger = (createQuote: PriceQuoteCreate) => any; export type PriceAuthorityAdmin = { fireTriggers: (createQuote: PriceQuoteCreate) => Promise<void>; }; export type PriceAuthorityKit = { priceAuthority: PriceAuthority; adminFacet: PriceAuthorityAdmin; }; export type MutableQuote = { cancel: (reason?: any) => void; updateLevel: (amountIn: Amount<"nat">, amountOut: Amount<"nat">) => void; getPromise: () => ERef<PriceQuote>; }; /** * An object that mints PriceQuotes and handles * triggers and notifiers for changes in the price */ export type PriceAuthority = { /** * Get the ERTP issuer of PriceQuotes for a given brandIn/brandOut pair */ getQuoteIssuer: (brandIn: Brand, brandOut: Brand) => ERef<Issuer<"set", PriceDescription>>; /** * Get the timer used in PriceQuotes for a given brandIn/brandOut pair */ getTimerService: (brandIn: Brand, brandOut: Brand) => ERef<import("@agoric/time").TimerService>; /** * Be notified of the latest PriceQuotes for a given * `amountIn`. The rate at which these are issued may be very different between * `priceAuthorities`. */ makeQuoteNotifier: (amountIn: Amount<"nat">, brandOut: Brand<"nat">) => ERef<Notifier<PriceQuote>>; /** * Resolves after `deadline` passes on the * priceAuthority's timerService with the price quote of `amountIn` at that time */ quoteAtTime: (deadline: import("@agoric/time").Timestamp, amountIn: Amount<"nat">, brandOut: Brand<"nat">) => Promise<PriceQuote>; /** * Get a quote corresponding to the specified amountIn */ quoteGiven: (amountIn: Amount<"nat">, brandOut: Brand<"nat">) => Promise<PriceQuote>; /** * Get a quote corresponding to the specified amountOut */ quoteWanted: (brandIn: Brand<"nat">, amountOut: Amount<"nat">) => Promise<PriceQuote>; /** * Resolve when a price quote of `amountIn` exceeds `amountOutLimit` */ quoteWhenGT: (amountIn: Amount<"nat">, amountOutLimit: Amount<"nat">) => Promise<PriceQuote>; /** * Resolve when a price quote of `amountIn` reaches or exceeds `amountOutLimit` */ quoteWhenGTE: (amountIn: Amount<"nat">, amountOutLimit: Amount<"nat">) => Promise<PriceQuote>; /** * Resolve when a price quote of `amountIn` reaches or drops below * `amountOutLimit` */ quoteWhenLTE: (amountIn: Amount, amountOutLimit: Amount) => Promise<PriceQuote>; /** * Resolve when the price quote of `amountIn` drops below `amountOutLimit` */ quoteWhenLT: (amountIn: Amount, amountOutLimit: Amount) => Promise<PriceQuote>; /** * Resolve when a price quote of `amountIn` exceeds `amountOutLimit` */ mutableQuoteWhenGT: (amountIn: Amount, amountOutLimit: Amount) => ERef<MutableQuote>; /** * Resolve when a price quote of `amountIn` reaches or exceeds * `amountOutLimit` */ mutableQuoteWhenGTE: (amountIn: Amount, amountOutLimit: Amount) => ERef<MutableQuote>; /** * Resolve when a price quote of `amountIn` reaches or drops below * `amountOutLimit` */ mutableQuoteWhenLTE: (amountIn: Amount, amountOutLimit: Amount) => ERef<MutableQuote>; /** * Resolve when the price quote of `amountIn` drops below `amountOutLimit` */ mutableQuoteWhenLT: (amountIn: Amount, amountOutLimit: Amount) => ERef<MutableQuote>; }; export type PriceCalculator = (amount: Amount<"nat">) => Amount<"nat">; export type PriceQuery = (calcAmountIn: PriceCalculator, calcAmountOut: PriceCalculator) => { amountIn: Amount<"nat">; amountOut: Amount<"nat">; timestamp?: import("@agoric/time").TimestampRecord; } | undefined; /** * A description of a single quote */ export type PriceLevel = { /** * The amount supplied to a trade */ amountIn: Amount<"nat">; /** * The quoted result of trading `amountIn` */ amountOut: Amount<"nat">; }; import type { Amount } from '@agoric/ertp'; import type { Payment } from '@agoric/ertp'; import type { Brand } from '@agoric/ertp'; import type { Issuer } from '@agoric/ertp'; import type { Notifier } from '@agoric/notifier'; //# sourceMappingURL=types.d.ts.map