mirror of
https://github.com/XRPLF/rippled.git
synced 2026-08-22 23:00:55 +00:00
feat: Add MPT support to DEX (#5285)
This commit is contained in:
committed by
GitHub
parent
6d1a5be8d2
commit
dfcad69155
@@ -150,7 +150,7 @@ public:
|
||||
};
|
||||
|
||||
// bob's offer (the new offer) is the same every time:
|
||||
Amounts const bobOffer{STAmount(XRP(1)), STAmount(USD.issue(), 1, 0)};
|
||||
Amounts const bobOffer{STAmount(XRP(1)), STAmount(USD, 1, 0)};
|
||||
|
||||
// alice's offer has a slightly smaller TakerPays with each
|
||||
// iteration. This should mean that the size of the offer bob
|
||||
@@ -161,10 +161,10 @@ public:
|
||||
mantissaReduce += 20'000'000ull)
|
||||
{
|
||||
STAmount const aliceUSD{
|
||||
bobOffer.out.issue(),
|
||||
bobOffer.out.asset(),
|
||||
bobOffer.out.mantissa() - mantissaReduce,
|
||||
bobOffer.out.exponent()};
|
||||
STAmount const aliceXRP{bobOffer.in.issue(), bobOffer.in.mantissa() - 1};
|
||||
STAmount const aliceXRP{bobOffer.in.asset(), bobOffer.in.mantissa() - 1};
|
||||
Amounts const aliceOffer{aliceUSD, aliceXRP};
|
||||
blockedCount += exerciseOfferPair(aliceOffer, bobOffer);
|
||||
}
|
||||
@@ -282,7 +282,7 @@ public:
|
||||
};
|
||||
|
||||
// alice's offer (the old offer) is the same every time:
|
||||
Amounts const aliceOffer{STAmount(XRP(1)), STAmount(USD.issue(), 1, 0)};
|
||||
Amounts const aliceOffer{STAmount(XRP(1)), STAmount(USD, 1, 0)};
|
||||
|
||||
// bob's offer has a slightly smaller TakerPays with each iteration.
|
||||
// This should mean that the size of the offer alice leaves in the
|
||||
@@ -293,10 +293,10 @@ public:
|
||||
mantissaReduce += 20'000'000ull)
|
||||
{
|
||||
STAmount const bobUSD{
|
||||
aliceOffer.out.issue(),
|
||||
aliceOffer.out.asset(),
|
||||
aliceOffer.out.mantissa() - mantissaReduce,
|
||||
aliceOffer.out.exponent()};
|
||||
STAmount const bobXRP{aliceOffer.in.issue(), aliceOffer.in.mantissa() - 1};
|
||||
STAmount const bobXRP{aliceOffer.in.asset(), aliceOffer.in.mantissa() - 1};
|
||||
Amounts const bobOffer{bobUSD, bobXRP};
|
||||
|
||||
blockedCount += exerciseOfferPair(aliceOffer, bobOffer);
|
||||
@@ -407,7 +407,7 @@ public:
|
||||
auto const USD = gw["USD"];
|
||||
auto const EUR = gw["EUR"];
|
||||
|
||||
STAmount const tinyUSD(USD.issue(), /*mantissa*/ 1, /*exponent*/ -81);
|
||||
STAmount const tinyUSD(USD, /*mantissa*/ 1, /*exponent*/ -81);
|
||||
|
||||
{
|
||||
Env env{*this, testable_amendments()};
|
||||
@@ -417,10 +417,10 @@ public:
|
||||
env.trust(USD(1000), alice, bob);
|
||||
env.trust(EUR(1000), alice, bob);
|
||||
|
||||
STAmount const eurOffer(EUR.issue(), /*mantissa*/ 2957, /*exponent*/ -76);
|
||||
STAmount const usdOffer(USD.issue(), /*mantissa*/ 7109, /*exponent*/ -76);
|
||||
STAmount const eurOffer(EUR, /*mantissa*/ 2957, /*exponent*/ -76);
|
||||
STAmount const usdOffer(USD, /*mantissa*/ 7109, /*exponent*/ -76);
|
||||
|
||||
STAmount const endLoop(USD.issue(), /*mantissa*/ 50, /*exponent*/ -81);
|
||||
STAmount const endLoop(USD, /*mantissa*/ 50, /*exponent*/ -81);
|
||||
|
||||
int blockedOrderBookCount = 0;
|
||||
for (STAmount initialBobUSD = tinyUSD; initialBobUSD <= endLoop;
|
||||
@@ -595,7 +595,7 @@ public:
|
||||
if (badRate == 0)
|
||||
{
|
||||
STAmount const tweakedTakerGets(
|
||||
aliceReducedOffer.in.issue(),
|
||||
aliceReducedOffer.in.asset(),
|
||||
aliceReducedOffer.in.mantissa() + 1,
|
||||
aliceReducedOffer.in.exponent(),
|
||||
aliceReducedOffer.in.negative());
|
||||
@@ -629,7 +629,7 @@ public:
|
||||
unsigned int blockedCount = 0;
|
||||
{
|
||||
STAmount increaseGets = USD(0);
|
||||
STAmount const step(increaseGets.issue(), 1, -8);
|
||||
STAmount const step(increaseGets.asset(), 1, -8);
|
||||
for (unsigned int i = 0; i < loopCount; ++i)
|
||||
{
|
||||
blockedCount +=
|
||||
|
||||
Reference in New Issue
Block a user