Skip to content

API documentation of Agoric SDK / Exports / @agoric/zoe / src/contractSupport/types

Module: src/contractSupport/types

Table of contents

Interfaces

Type Aliases

Type Aliases

KeywordKeywordRecord

Ƭ KeywordKeywordRecord: Record<Keyword, Keyword>

A mapping of keywords to keywords.

Defined in

zoe/src/contractSupport/types.js:55


MapKeywords

Ƭ MapKeywords: (keywordRecord: AmountKeywordRecord | PaymentPKeywordRecord | IssuerKeywordRecord | undefined, keywordMapping: KeywordKeywordRecord) => any

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 declaration

▸ (keywordRecord, keywordMapping): any

Parameters
NameType
keywordRecordAmountKeywordRecord | PaymentPKeywordRecord | IssuerKeywordRecord | undefined
keywordMappingKeywordKeywordRecord
Returns

any

Defined in

zoe/src/contractSupport/types.js:71


Reverse

Ƭ Reverse: (keywordRecord?: KeywordKeywordRecord) => KeywordKeywordRecord

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 declaration

▸ (keywordRecord?): KeywordKeywordRecord

Parameters
NameType
keywordRecord?KeywordKeywordRecord
Returns

KeywordKeywordRecord

Defined in

zoe/src/contractSupport/types.js:61


ScaleAmount

Ƭ ScaleAmount: (amount: Amount<"nat">, ratio: Ratio) => Amount<"nat">

Type declaration

▸ (amount, ratio): Amount<"nat">

Parameters
NameType
amountAmount<"nat">
ratioRatio
Returns

Amount<"nat">

Defined in

zoe/src/contractSupport/types.js:89


Swap

Ƭ Swap: (zcf: ZCF, leftSeat: ZCFSeat, rightSeat: ZCFSeat) => string

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 declaration

▸ (zcf, leftSeat, rightSeat): string

Parameters
NameType
zcfZCF
leftSeatZCFSeat
rightSeatZCFSeat
Returns

string

Defined in

zoe/src/contractSupport/types.js:18


SwapExact

Ƭ SwapExact: (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 declaration

▸ (zcf, leftSeat, rightSeat): string

Parameters
NameType
zcfZCF
leftSeatZCFSeat
rightSeatZCFSeat
Returns

string

Defined in

zoe/src/contractSupport/types.js:38