78    auto const& params(context.
params);
 
   86    struct ValuesFromContextParams
 
   94    auto getValuesFromContextParams =
 
  102            return (params.isMember(jss::asset) !=
 
  103                    params.isMember(jss::asset2)) ||
 
  104                (params.isMember(jss::asset) ==
 
  105                 params.isMember(jss::amm_account));
 
  112        if (params.isMember(jss::asset))
 
  114            if (
auto const i = 
getIssue(params[jss::asset], context.
j))
 
  120        if (params.isMember(jss::asset2))
 
  122            if (
auto const i = 
getIssue(params[jss::asset2], context.
j))
 
  128        if (params.isMember(jss::amm_account))
 
  130            auto const id = 
getAccount(params[jss::amm_account], result);
 
  136            ammID = sle->getFieldH256(sfAMMID);
 
  141        if (params.isMember(jss::account))
 
  143            accountID = 
getAccount(params[jss::account], result);
 
  155            "ripple::doAMMInfo : issue1 and issue2 do match");
 
  157        auto const ammKeylet = [&]() {
 
  158            if (issue1 && issue2)
 
  160            XRPL_ASSERT(ammID, 
"ripple::doAMMInfo::ammKeylet : ammID is set");
 
  163        auto const amm = ledger->read(ammKeylet);
 
  166        if (!issue1 && !issue2)
 
  168            issue1 = (*amm)[sfAsset].get<
Issue>();
 
  169            issue2 = (*amm)[sfAsset2].get<
Issue>();
 
  172        return ValuesFromContextParams{
 
  173            accountID, *issue1, *issue2, std::move(amm)};
 
  176    auto const r = getValuesFromContextParams();
 
  183    auto const& [accountID, issue1, issue2, amm] = *r;
 
  185    auto const ammAccountID = amm->getAccountID(sfAccount);
 
  188    auto const [asset1Balance, asset2Balance] = 
ammPoolHolds(
 
  195    auto const lptAMMBalance = accountID
 
  197        : (*amm)[sfLPTokenBalance];
 
  200    asset1Balance.setJson(ammResult[jss::amount]);
 
  201    asset2Balance.setJson(ammResult[jss::amount2]);
 
  202    lptAMMBalance.setJson(ammResult[jss::lp_token]);
 
  203    ammResult[jss::trading_fee] = (*amm)[sfTradingFee];
 
  204    ammResult[jss::account] = 
to_string(ammAccountID);
 
  206    if (amm->isFieldPresent(sfVoteSlots))
 
  208        for (
auto const& voteEntry : amm->getFieldArray(sfVoteSlots))
 
  211            vote[jss::account] = 
to_string(voteEntry.getAccountID(sfAccount));
 
  212            vote[jss::trading_fee] = voteEntry[sfTradingFee];
 
  213            vote[jss::vote_weight] = voteEntry[sfVoteWeight];
 
  214            voteSlots.
append(std::move(vote));
 
  217    if (voteSlots.
size() > 0)
 
  218        ammResult[jss::vote_slots] = std::move(voteSlots);
 
  220        !ledger->rules().enabled(fixInnerObjTemplate) ||
 
  221            amm->isFieldPresent(sfAuctionSlot),
 
  222        "ripple::doAMMInfo : auction slot is set");
 
  223    if (amm->isFieldPresent(sfAuctionSlot))
 
  225        auto const& auctionSlot =
 
  226            static_cast<STObject const&
>(amm->peekAtField(sfAuctionSlot));
 
  227        if (auctionSlot.isFieldPresent(sfAccount))
 
  231                ledger->info().parentCloseTime.time_since_epoch().count(),
 
  233            auction[jss::time_interval] =
 
  235            auctionSlot[sfPrice].setJson(auction[jss::price]);
 
  236            auction[jss::discounted_fee] = auctionSlot[sfDiscountedFee];
 
  237            auction[jss::account] =
 
  238                to_string(auctionSlot.getAccountID(sfAccount));
 
  241            if (auctionSlot.isFieldPresent(sfAuthAccounts))
 
  244                for (
auto const& acct :
 
  245                     auctionSlot.getFieldArray(sfAuthAccounts))
 
  248                    jv[jss::account] = 
to_string(acct.getAccountID(sfAccount));
 
  251                auction[jss::auth_accounts] = auth;
 
  253            ammResult[jss::auction_slot] = std::move(auction);
 
  257    if (!
isXRP(asset1Balance))
 
  258        ammResult[jss::asset_frozen] =
 
  259            isFrozen(*ledger, ammAccountID, issue1.currency, issue1.account);
 
  260    if (!
isXRP(asset2Balance))
 
  261        ammResult[jss::asset2_frozen] =
 
  262            isFrozen(*ledger, ammAccountID, issue2.currency, issue2.account);
 
  264    result[jss::amm] = std::move(ammResult);
 
  265    if (!result.
isMember(jss::ledger_index) &&
 
  267        result[jss::ledger_current_index] = ledger->info().seq;