rippled
Loading...
Searching...
No Matches
AMMCore.h
1#ifndef XRPL_PROTOCOL_AMMCORE_H_INCLUDED
2#define XRPL_PROTOCOL_AMMCORE_H_INCLUDED
3
4#include <xrpl/basics/Number.h>
5#include <xrpl/protocol/AccountID.h>
6#include <xrpl/protocol/Issue.h>
7#include <xrpl/protocol/TER.h>
8#include <xrpl/protocol/UintTypes.h>
9
10namespace ripple {
11
12std::uint16_t constexpr TRADING_FEE_THRESHOLD = 1000; // 1%
13
14// Auction slot
15std::uint32_t constexpr TOTAL_TIME_SLOT_SECS = 24 * 3600;
23
24// Votes
27
28class STObject;
29class STAmount;
30class Rules;
31
35ammLPTCurrency(Currency const& cur1, Currency const& cur2);
36
41 Currency const& cur1,
42 Currency const& cur2,
43 AccountID const& ammAccountID);
44
52 STAmount const& amount,
54 bool validZero = false);
55
58 Issue const& issue,
60
63 Issue const& issue1,
64 Issue const& issue2,
66
71
74bool
75ammEnabled(Rules const&);
76
81inline Number
86
90inline Number
92{
93 return 1 - getFee(tfee);
94}
95
99inline Number
101{
102 return 1 - getFee(tfee) / 2;
103}
104
105} // namespace ripple
106
107#endif // XRPL_PROTOCOL_AMMCORE_H_INCLUDED
A currency issued by an account.
Definition Issue.h:14
Rules controlling protocol behavior.
Definition Rules.h:19
T is_same_v
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
Definition algorithm.h:6
NotTEC invalidAMMAmount(STAmount const &amount, std::optional< std::pair< Issue, Issue > > const &pair=std::nullopt, bool validZero=false)
Validate the amount.
Definition AMMCore.cpp:76
std::uint32_t constexpr TOTAL_TIME_SLOT_SECS
Definition AMMCore.h:15
std::uint16_t constexpr AUCTION_SLOT_TIME_INTERVALS
Definition AMMCore.h:16
std::optional< std::uint8_t > ammAuctionTimeSlot(std::uint64_t current, STObject const &auctionSlot)
Get time slot of the auction slot.
Definition AMMCore.cpp:89
NotTEC invalidAMMAsset(Issue const &issue, std::optional< std::pair< Issue, Issue > > const &pair=std::nullopt)
Definition AMMCore.cpp:47
Currency ammLPTCurrency(Currency const &cur1, Currency const &cur2)
Calculate Liquidity Provider Token (LPT) Currency.
Definition AMMCore.cpp:24
bool ammEnabled(Rules const &)
Return true if required AMM amendments are enabled.
Definition AMMCore.cpp:110
Issue ammLPTIssue(Currency const &cur1, Currency const &cur2, AccountID const &ammAccountID)
Calculate LPT Issue from AMM asset pair.
Definition AMMCore.cpp:38
@ current
This was a new validation and was added.
std::uint32_t constexpr AUCTION_SLOT_MIN_FEE_FRACTION
Definition AMMCore.h:20
Number feeMult(std::uint16_t tfee)
Get fee multiplier (1 - tfee) @tfee trading fee in basis points.
Definition AMMCore.h:91
std::uint32_t constexpr AUCTION_SLOT_FEE_SCALE_FACTOR
Definition AMMCore.h:18
Number getFee(std::uint16_t tfee)
Convert to the fee from the basis points.
Definition AMMCore.h:82
std::uint32_t constexpr VOTE_WEIGHT_SCALE_FACTOR
Definition AMMCore.h:26
NotTEC invalidAMMAssetPair(Issue const &issue1, Issue const &issue2, std::optional< std::pair< Issue, Issue > > const &pair=std::nullopt)
Definition AMMCore.cpp:61
std::uint32_t constexpr AUCTION_SLOT_INTERVAL_DURATION
Definition AMMCore.h:21
Number feeMultHalf(std::uint16_t tfee)
Get fee multiplier (1 - tfee / 2) @tfee trading fee in basis points.
Definition AMMCore.h:100
std::uint16_t constexpr VOTE_MAX_SLOTS
Definition AMMCore.h:25
std::uint16_t constexpr TRADING_FEE_THRESHOLD
Definition AMMCore.h:12
std::uint16_t constexpr AUCTION_SLOT_MAX_AUTH_ACCOUNTS
Definition AMMCore.h:17
std::uint32_t constexpr AUCTION_SLOT_DISCOUNTED_FEE_FRACTION
Definition AMMCore.h:19