21#include <test/jtx/AMM.h>
22#include <test/jtx/AMMTest.h>
35 Env env{*
this, features};
53 auto const lpIssue = ammAlice.
lptIssue();
75 if (features[fixFrozenLPTokenTransfer])
93 Env env{*
this, features};
99 {
USD(10'000),
EUR(10'000)},
102 ammAlice.deposit(
carol, 1'000);
103 ammAlice.deposit(
bob, 1'000);
105 auto const lpIssue = ammAlice.lptIssue();
124 if (features[fixFrozenLPTokenTransfer])
189 Env env{*
this, features};
195 {
USD(10'000),
EUR(10'000)},
198 ammAlice.deposit(
carol, 1'000);
199 ammAlice.deposit(
bob, 1'000);
201 auto const lpIssue = ammAlice.lptIssue();
209 if (features[fixFrozenLPTokenTransfer])
256 Env env{*
this, features};
261 ammAlice1.deposit(
carol, 10'000'000);
265 ammAlice2.deposit(
carol, 10'000'000);
266 auto const token1 = ammAlice1.lptIssue();
267 auto const token2 = ammAlice2.lptIssue();
285 if (features[fixFrozenLPTokenTransfer])
319 Env env{*
this, features};
325 {
USD(10'000),
EUR(10'000)},
328 ammAlice.deposit(
carol, 1'000);
329 ammAlice.deposit(
bob, 1'000);
331 auto const lpIssue = ammAlice.lptIssue();
344 if (features[fixFrozenLPTokenTransfer])
367 using namespace test::jtx;
369 Env env{*
this, features};
376 {
USD(10'000),
EUR(10'000)},
379 ammAlice.deposit(
carol, 1'000);
380 ammAlice.deposit(
bob, 1'000);
382 auto const lpIssue = ammAlice.lptIssue();
401 if (features[fixFrozenLPTokenTransfer])
472 for (
auto const features : {
all,
all - fixFrozenLPTokenTransfer})
484BEAST_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