Module nash_protocol::types::exchange[][src]

Expand description

Types used for protocol request inputs (arguments) and outputs. Types specific to a single protocol request will live within the respetitive module. For example protocol::place_order.

Structs

Amount encodes the amount of asset being bought or sold in an order It is encoded with a precision that depends on the market and asset being traded. For example, in the ETH/USD market, ETH has a precision of 4. In an A/B market, amount is always in units of A.

A specific amount of an asset being traded

Assets can potentially have different precisions across markets. This keeps track of what precision we are dealing with

This type encodes all the information necessary for a client operating over the protocol to understand a market.

Order rates impose limits on what trades the smart contract is allowed to execute. For example, the smart contract will reject a payload that requests a less favorable amount of asset_to than is imposed by the minimum order rate. For Sell orders, an order rate represented by currency B an in A/B market. For Buy orders, an order rate is represented in the protocol by currency A. Note that OrderRates are always created w.r.t. currency B, then potentially inverted during payload creation. This is because, unlike the smart contract, the ME always wants order prices expressed in currency B. In either case, these rates are encoded as 64 bit integers which take the initial price ratio, multiply by 10^8, and then drop all precision after the decimal.

Compressed representation for Order as returned by Orderbook queries and subscriptions

Enums

Relation of an account to a trade, whether maker, taker, or not related (none)

Assets are the units of value that can be traded in a market We also use this type as a root for encodings for smart contract operations defined in super::sc_payloads

Representation of blockchains to help navigate encoding issues

Buy or sell type for Nash protocol. We don’t use the one generated automatically from the GraphQL schema as it does not implement necessary traits like Clone

Nonces are 32 bit integers. They increment over time such that data with lower nonces that has already been observed are rejected by the matching engine and smart contract.

Status of an order on Nash

Type of order execution in Nash ME

The Rate enum describes behavior common to rates/prices.