mirror of
https://github.com/XRPLF/rippled.git
synced 2025-12-06 17:27:55 +00:00
Introduce AMM support (XLS-30d): (#4294)
Add AMM functionality: - InstanceCreate - Deposit - Withdraw - Governance - Auctioning - payment engine integration To support this functionality, add: - New RPC method, `amm_info`, to fetch pool and LPT balances - AMM Root Account - trust line for each IOU AMM token - trust line to track Liquidity Provider Tokens (LPT) - `ltAMM` object The `ltAMM` object tracks: - fee votes - auction slot bids - AMM tokens pair - total outstanding tokens balance - `AMMID` to AMM `RootAccountID` mapping Add new classes to facilitate AMM integration into the payment engine. `BookStep` uses these classes to infer if AMM liquidity can be consumed. The AMM formula implementation uses the new Number class added in #4192. IOUAmount and STAmount use Number arithmetic. Add AMM unit tests for all features. AMM requires the following amendments: - featureAMM - fixUniversalNumber - featureFlowCross Notes: - Current trading fee threshold is 1% - AMM currency is generated by: 0x03 + 152 bits of sha256{cur1, cur2} - Current max AMM Offers is 30 --------- Co-authored-by: Howard Hinnant <howard.hinnant@gmail.com>
This commit is contained in:
committed by
GitHub
parent
eeb8b41889
commit
3c9db4b69e
@@ -28,6 +28,7 @@
|
||||
#include <ripple/ledger/Sandbox.h>
|
||||
#include <ripple/protocol/Feature.h>
|
||||
#include <ripple/protocol/jss.h>
|
||||
#include "ripple/app/paths/AMMContext.h"
|
||||
#include <test/jtx.h>
|
||||
#include <test/jtx/PathSet.h>
|
||||
|
||||
@@ -245,6 +246,7 @@ class TheoreticalQuality_test : public beast::unit_test::suite
|
||||
std::optional<Quality> const& expectedQ = {})
|
||||
{
|
||||
PaymentSandbox sb(closed.get(), tapNONE);
|
||||
AMMContext ammContext(rcp.srcAccount, false);
|
||||
|
||||
auto const sendMaxIssue = [&rcp]() -> std::optional<Issue> {
|
||||
if (rcp.sendMax)
|
||||
@@ -265,6 +267,7 @@ class TheoreticalQuality_test : public beast::unit_test::suite
|
||||
/*defaultPaths*/ rcp.paths.empty(),
|
||||
sb.rules().enabled(featureOwnerPaysFee),
|
||||
/*offerCrossing*/ false,
|
||||
ammContext,
|
||||
dummyJ);
|
||||
|
||||
BEAST_EXPECT(sr.first == tesSUCCESS);
|
||||
|
||||
Reference in New Issue
Block a user