2#include <test/jtx/AMM.h>
3#include <test/jtx/AMMTest.h>
16 Env env{*
this, features};
34 auto const lpIssue = ammAlice.
lptIssue();
56 if (features[fixFrozenLPTokenTransfer])
74 Env env{*
this, features};
80 {
USD(10'000),
EUR(10'000)},
83 ammAlice.deposit(
carol, 1'000);
84 ammAlice.deposit(
bob, 1'000);
86 auto const lpIssue = ammAlice.lptIssue();
105 if (features[fixFrozenLPTokenTransfer])
170 Env env{*
this, features};
176 {
USD(10'000),
EUR(10'000)},
179 ammAlice.deposit(
carol, 1'000);
180 ammAlice.deposit(
bob, 1'000);
182 auto const lpIssue = ammAlice.lptIssue();
190 if (features[fixFrozenLPTokenTransfer])
237 Env env{*
this, features};
242 ammAlice1.deposit(
carol, 10'000'000);
246 ammAlice2.deposit(
carol, 10'000'000);
247 auto const token1 = ammAlice1.lptIssue();
248 auto const token2 = ammAlice2.lptIssue();
266 if (features[fixFrozenLPTokenTransfer])
300 Env env{*
this, features};
306 {
USD(10'000),
EUR(10'000)},
309 ammAlice.deposit(
carol, 1'000);
310 ammAlice.deposit(
bob, 1'000);
312 auto const lpIssue = ammAlice.lptIssue();
325 if (features[fixFrozenLPTokenTransfer])
348 using namespace test::jtx;
350 Env env{*
this, features};
357 {
USD(10'000),
EUR(10'000)},
360 ammAlice.deposit(
carol, 1'000);
361 ammAlice.deposit(
bob, 1'000);
363 auto const lpIssue = ammAlice.lptIssue();
382 if (features[fixFrozenLPTokenTransfer])
453 for (
auto const features : {
all,
all - fixFrozenLPTokenTransfer})
465BEAST_DEFINE_TESTSUITE(LPTokenTransfer, app,
ripple);
testcase_t testcase
Memberspace for declaring test cases.
Floating point representation of amounts with high dynamic range.
void testOfferCrossing(FeatureBitset features)
void testNFTOffers(FeatureBitset features)
void testDirectStep(FeatureBitset features)
void run() override
Runs the suite.
void testOfferCreation(FeatureBitset features)
void testCheck(FeatureBitset features)
void testBookStep(FeatureBitset features)
Convenience class to test AMM functionality.
bool expectBalances(STAmount const &asset1, STAmount const &asset2, IOUAmount const &lpt, std::optional< AccountID > const &account=std::nullopt) const
Verify the AMM balances.
IOUAmount deposit(std::optional< Account > const &account, LPToken tokens, std::optional< STAmount > const &asset1InDetails=std::nullopt, std::optional< std::uint32_t > const &flags=std::nullopt, std::optional< ter > const &ter=std::nullopt)
A transaction testing environment.
Sets the SendMax on a JTx.
Set the expected result code for a JTx The test will fail if the code doesn't match.
Sets the optional Owner on an NFTokenOffer.
Keylet nftoffer(AccountID const &owner, std::uint32_t seq)
An offer from an account to buy or sell an NFT.
Keylet check(AccountID const &id, std::uint32_t seq) noexcept
A Check.
Json::Value create(A const &account, A const &dest, STAmount const &sendMax)
Create a check.
Json::Value cash(jtx::Account const &dest, uint256 const &checkId, STAmount const &amount)
Cash a check requiring that a specific amount be delivered.
uint256 getNextID(jtx::Env const &env, jtx::Account const &issuer, std::uint32_t nfTokenTaxon, std::uint16_t flags, std::uint16_t xferFee)
Get the next NFTokenID that will be issued.
Json::Value createOffer(jtx::Account const &account, uint256 const &nftokenID, STAmount const &amount)
Create an NFTokenOffer.
Json::Value acceptSellOffer(jtx::Account const &account, uint256 const &offerIndex)
Accept an NFToken sell offer.
Json::Value acceptBuyOffer(jtx::Account const &account, uint256 const &offerIndex)
Accept an NFToken buy offer.
Json::Value mint(jtx::Account const &account, std::uint32_t nfTokenTaxon)
Mint an NFToken.
bool expectOffers(Env &env, AccountID const &account, std::uint16_t size, std::vector< Amounts > const &toMatch)
Json::Value trust(Account const &account, STAmount const &amount, std::uint32_t flags)
Modify a trust line.
Json::Value pay(AccountID const &account, AccountID const &to, AnyAmount amount)
Create a payment.
void fund(jtx::Env &env, jtx::Account const &gw, std::vector< jtx::Account > const &accounts, std::vector< STAmount > const &amts, Fund how)
FeatureBitset testable_amendments()
Json::Value offer(Account const &account, STAmount const &takerPays, STAmount const &takerGets, std::uint32_t flags)
Create an offer.
bool expectHolding(Env &env, AccountID const &account, STAmount const &value, bool defaultLimits)
XRP_t const XRP
Converts to XRP Issue or STAmount.
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
constexpr std::uint32_t const tfSellNFToken
constexpr std::uint32_t tfPassive
constexpr std::uint32_t tfPartialPayment
constexpr std::uint32_t tfClearFreeze
constexpr std::uint32_t tfSetFreeze
constexpr std::uint32_t const tfTransferable