Constants are sorted alphabetically and not by category
bogberry opened this issue · comments
Constants defined here are sorted alphabetically, and not by category. Many of these constants are effectively enum variants, so variants belonging to the same enum should be placed together.
econia/src/move/econia/sources/market.move
Lines 857 to 938 in e6c85bd
// Constants >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> | |
/// Ascending AVL queue flag, for asks AVL queue. | |
const ASCENDING: bool = true; | |
/// Flag to abort during a self match. | |
const ABORT: u8 = 0; | |
/// Flag for ask side. | |
const ASK: bool = true; | |
/// Flag for bid side. | |
const BID: bool = false; | |
/// Flag for buy direction. | |
const BUY: bool = false; | |
/// Flag to cancel maker and taker order during a self match. | |
const CANCEL_BOTH: u8 = 1; | |
/// Flag to cancel maker order only during a self match. | |
const CANCEL_MAKER: u8 = 2; | |
/// Order cancelled because it was evicted from the price-time | |
/// priority queue. | |
const CANCEL_REASON_EVICTION: u8 = 1; | |
/// Order cancelled because it was an immediate-or-cancel order | |
/// that did not immediately fill. | |
const CANCEL_REASON_IMMEDIATE_OR_CANCEL: u8 = 2; | |
/// Order cancelled because it was manually cancelled by either | |
/// signing user or custodian. | |
const CANCEL_REASON_MANUAL_CANCEL: u8 = 3; | |
/// Order cancelled because no more quote asset could be traded. | |
const CANCEL_REASON_MAX_QUOTE_TRADED: u8 = 4; | |
/// Order cancelled because there was not enough liquidity to take | |
/// from. | |
const CANCEL_REASON_NOT_ENOUGH_LIQUIDITY: u8 = 5; | |
/// Order cancelled because it was on the maker side of an fill | |
/// where self match behavior indicated cancelling the maker order. | |
const CANCEL_REASON_SELF_MATCH_MAKER: u8 = 6; | |
/// Order cancelled because it was on the taker side of an fill | |
/// where self match behavior indicated cancelling the taker order. | |
const CANCEL_REASON_SELF_MATCH_TAKER: u8 = 7; | |
/// Flag to cancel taker order only during a self match. | |
const CANCEL_TAKER: u8 = 3; | |
/// Critical tree height above which evictions may take place. | |
const CRITICAL_HEIGHT: u8 = 18; | |
/// Descending AVL queue flag, for bids AVL queue. | |
const DESCENDING: bool = false; | |
/// Flag for fill-or-abort order restriction. | |
const FILL_OR_ABORT: u8 = 1; | |
/// `u64` bitmask with all bits set, generated in Python via | |
/// `hex(int('1' * 64, 2))`. | |
const HI_64: u64 = 0xffffffffffffffff; | |
/// All bits set in integer of width required to encode price. | |
/// Generated in Python via `hex(int('1' * 32, 2))`. | |
const HI_PRICE: u64 = 0xffffffff; | |
/// Flag for immediate-or-cancel order restriction. | |
const IMMEDIATE_OR_CANCEL: u8 = 2; | |
/// Flag to trade max possible asset amount: `u64` bitmask with all | |
/// bits set, generated in Python via `hex(int('1' * 64, 2))`. | |
const MAX_POSSIBLE: u64 = 0xffffffffffffffff; | |
/// Number of restriction flags. | |
const N_RESTRICTIONS: u8 = 3; | |
/// Flag for null value when null defined as 0. | |
const NIL: u64 = 0; | |
/// Custodian ID flag for no custodian. | |
const NO_CUSTODIAN: u64 = 0; | |
/// Flag for no order restriction. | |
const NO_RESTRICTION: u8 = 0; | |
/// Taker address flag for when taker order does not originate from | |
/// a market account or a signing swapper. | |
const NO_TAKER_ADDRESS: address = @0x0; | |
/// Underwriter ID flag for no underwriter. | |
const NO_UNDERWRITER: u64 = 0; | |
/// Flag for passive order specified by percent advance. | |
const PERCENT: bool = true; | |
/// Maximum percentage passive advance. | |
const PERCENT_100: u64 = 100; | |
/// Flag for post-or-abort order restriction. | |
const POST_OR_ABORT: u8 = 3; | |
/// Flag for sell direction. | |
const SELL: bool = true; | |
/// Number of bits order counter is shifted in an order ID. | |
const SHIFT_COUNTER: u8 = 64; | |
/// Flag for passive order specified by advance in ticks. | |
const TICKS: bool = false; | |
// Constants <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< |
For example, there is no indication that FILL_OR_ABORT
and IMMEDIATE_OR_CANCEL
belong together. If one were to add a new variant to this enum, it's hard to tell what values have already been used.