@agoric/zoe
Version:
Zoe: the Smart Contract Framework for Offer Enforcement
63 lines • 2.41 kB
TypeScript
type SeatGainsLossesRecord = {
seat: ZCFSeat;
/**
* - what the seat will
* gain as a result of this trade
*/
gains: AmountKeywordRecord;
/**
* - what the seat [will]
* give up as a result of this trade. Losses is optional, but can
* only be omitted if the keywords for both seats are the same.
* If losses is not defined, the gains of the other seat is
* subtracted.
*/
losses: AmountKeywordRecord;
};
/**
* If two seats can satisfy each other's wants, trade enough to
* satisfy the wants of both seats and exit both seats.
*
* The surplus remains with the original seat. For example if seat A
* gives 5 moola and seat B only wants 3 moola, seat A retains 2
* moola.
*
* If the swap fails, no assets are transferred, both seats will fail,
* and the function throws.
*
* The keywords for both seats must match.
*/
type Swap = (zcf: ZCF, leftSeat: ZCFSeat, rightSeat: ZCFSeat) => string;
/**
* Swap such that both seats gain what they want and lose everything
* that they gave. Only good for exact and entire swaps where each
* seat wants everything that the other seat has. The benefit of using
* this method is that the keywords of each seat do not matter.
*
* If the swap fails, no assets are transferred, both seats will fail,
* and the function throws.
*/
type SwapExact = (zcf: ZCF, leftSeat: ZCFSeat, rightSeat: ZCFSeat) => string;
/**
* A mapping of keywords to keywords.
*/
type KeywordKeywordRecord = Record<Keyword, Keyword>;
/**
* Given a mapping of keywords to keywords, invert the keys and
* values. This is used to map the offers made to another contract
* back to the keywords used in the first contract.
*/
type Reverse = (keywordRecord?: KeywordKeywordRecord | undefined) => KeywordKeywordRecord;
/**
* Remap the keywords of an amountKeywordRecord, issuerKeywordRecord, or a
* PaymentPKeywordRecord according to a mapping. This is used to remap
* from keywords used in contractA to keywords used in contractB and
* vice versa in `offerTo`
*/
type MapKeywords = (keywordRecord: AmountKeywordRecord | PaymentPKeywordRecord | IssuerKeywordRecord | undefined, keywordMapping: KeywordKeywordRecord) => any;
type Ratio = {
numerator: Amount<"nat">;
denominator: Amount<"nat">;
};
type ScaleAmount = (amount: Amount<"nat">, ratio: Ratio) => Amount<"nat">;
//# sourceMappingURL=types-ambient.d.ts.map