2#include <test/jtx/AMM.h>
3#include <test/jtx/AMMTest.h>
16 Env env{*
this, features};
31 auto const lpIssue = ammAlice.
lptIssue();
52 if (features[fixFrozenLPTokenTransfer])
70 Env env{*
this, features};
74 ammAlice.deposit(
carol, 1'000);
75 ammAlice.deposit(
bob, 1'000);
77 auto const lpIssue = ammAlice.lptIssue();
96 if (features[fixFrozenLPTokenTransfer])
151 Env env{*
this, features};
155 ammAlice.deposit(
carol, 1'000);
156 ammAlice.deposit(
bob, 1'000);
158 auto const lpIssue = ammAlice.lptIssue();
166 if (features[fixFrozenLPTokenTransfer])
209 Env env{*
this, features};
214 ammAlice1.deposit(
carol, 10'000'000);
218 ammAlice2.deposit(
carol, 10'000'000);
219 auto const token1 = ammAlice1.lptIssue();
220 auto const token2 = ammAlice2.lptIssue();
238 if (features[fixFrozenLPTokenTransfer])
270 Env env{*
this, features};
274 ammAlice.deposit(
carol, 1'000);
275 ammAlice.deposit(
bob, 1'000);
277 auto const lpIssue = ammAlice.lptIssue();
290 if (features[fixFrozenLPTokenTransfer])
312 using namespace test::jtx;
314 Env env{*
this, features};
319 ammAlice.deposit(
carol, 1'000);
320 ammAlice.deposit(
bob, 1'000);
322 auto const lpIssue = ammAlice.lptIssue();
340 if (features[fixFrozenLPTokenTransfer])
405 for (
auto const features : {
all,
all - fixFrozenLPTokenTransfer})
417BEAST_DEFINE_TESTSUITE(LPTokenTransfer, app,
xrpl);
testcase_t testcase
Memberspace for declaring test cases.
Floating point representation of amounts with high dynamic range.
void run() override
Runs the suite.
void testOfferCrossing(FeatureBitset features)
void testOfferCreation(FeatureBitset features)
void testDirectStep(FeatureBitset features)
void testBookStep(FeatureBitset features)
void testCheck(FeatureBitset features)
void testNFTOffers(FeatureBitset features)
Convenience class to test AMM functionality.
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)
bool expectBalances(STAmount const &asset1, STAmount const &asset2, IOUAmount const &lpt, std::optional< AccountID > const &account=std::nullopt) const
Verify the AMM balances.
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 cash(jtx::Account const &dest, uint256 const &checkId, STAmount const &amount)
Cash a check requiring that a specific amount be delivered.
Json::Value create(A const &account, A const &dest, STAmount const &sendMax)
Create a check.
Json::Value mint(jtx::Account const &account, std::uint32_t nfTokenTaxon)
Mint an NFToken.
Json::Value acceptBuyOffer(jtx::Account const &account, uint256 const &offerIndex)
Accept an NFToken buy offer.
Json::Value acceptSellOffer(jtx::Account const &account, uint256 const &offerIndex)
Accept an NFToken sell offer.
Json::Value createOffer(jtx::Account const &account, uint256 const &nftokenID, STAmount const &amount)
Create an NFTokenOffer.
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.
bool expectOffers(Env &env, AccountID const &account, std::uint16_t size, std::vector< Amounts > const &toMatch)
void fund(jtx::Env &env, jtx::Account const &gw, std::vector< jtx::Account > const &accounts, std::vector< STAmount > const &amts, Fund how)
bool expectHolding(Env &env, AccountID const &account, STAmount const &value, bool defaultLimits)
Json::Value trust(Account const &account, STAmount const &amount, std::uint32_t flags)
Modify a trust line.
XRP_t const XRP
Converts to XRP Issue or STAmount.
Json::Value pay(AccountID const &account, AccountID const &to, AnyAmount amount)
Create a payment.
FeatureBitset testable_amendments()
Json::Value offer(Account const &account, STAmount const &takerPays, STAmount const &takerGets, std::uint32_t flags)
Create an offer.
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
constexpr std::uint32_t const tfTransferable
constexpr std::uint32_t tfPassive
constexpr std::uint32_t tfClearFreeze
constexpr std::uint32_t tfPartialPayment
constexpr std::uint32_t const tfSellNFToken
constexpr std::uint32_t tfSetFreeze