Clio develop
The XRP Ledger API server.
Loading...
Searching...
No Matches
AMMHelpers.hpp
1//------------------------------------------------------------------------------
2/*
3 This file is part of clio: https://github.com/XRPLF/clio
4 Copyright (c) 2024, the clio developers.
5
6 Permission to use, copy, modify, and distribute this software for any
7 purpose with or without fee is hereby granted, provided that the above
8 copyright notice and this permission notice appear in all copies.
9
10 THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
11 WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
12 MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
13 ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
14 WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
15 ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
16 OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17*/
18//==============================================================================
19
20#pragma once
21
22#include "data/BackendInterface.hpp"
23
24#include <boost/asio/spawn.hpp>
25#include <xrpl/protocol/AccountID.h>
26#include <xrpl/protocol/Issue.h>
27#include <xrpl/protocol/STAmount.h>
28#include <xrpl/protocol/STLedgerEntry.h>
29#include <xrpl/protocol/UintTypes.h>
30
31#include <cstdint>
32#include <utility>
33
34namespace rpc {
35
48std::pair<ripple::STAmount, ripple::STAmount>
50 BackendInterface const& backend,
51 std::uint32_t sequence,
52 ripple::AccountID const& ammAccountID,
53 ripple::Issue const& issue1,
54 ripple::Issue const& issue2,
55 bool freezeHandling,
56 boost::asio::yield_context yield
57);
58
71ripple::STAmount
73 BackendInterface const& backend,
74 std::uint32_t sequence,
75 ripple::Currency const& cur1,
76 ripple::Currency const& cur2,
77 ripple::AccountID const& ammAccount,
78 ripple::AccountID const& lpAccount,
79 boost::asio::yield_context yield
80);
81
92ripple::STAmount
94 BackendInterface const& backend,
95 std::uint32_t sequence,
96 ripple::SLE const& ammSle,
97 ripple::AccountID const& lpAccount,
98 boost::asio::yield_context yield
99);
100
101} // namespace rpc
The interface to the database used by Clio.
Definition BackendInterface.hpp:138
This namespace contains all the RPC logic and handlers.
Definition AMMHelpers.cpp:36
ripple::STAmount getAmmLpHolds(BackendInterface const &backend, std::uint32_t sequence, ripple::Currency const &cur1, ripple::Currency const &cur2, ripple::AccountID const &ammAccount, ripple::AccountID const &lpAccount, boost::asio::yield_context yield)
getAmmLpHolds returns the liquidity provider token balance
Definition AMMHelpers.cpp:57
std::pair< ripple::STAmount, ripple::STAmount > getAmmPoolHolds(BackendInterface const &backend, std::uint32_t sequence, ripple::AccountID const &ammAccountID, ripple::Issue const &issue1, ripple::Issue const &issue2, bool freezeHandling, boost::asio::yield_context yield)
getAmmPoolHolds returns the balances of the amm asset pair
Definition AMMHelpers.cpp:39