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/AmendmentCenterInterface.hpp"
23#include "data/BackendInterface.hpp"
24
25#include <boost/asio/spawn.hpp>
26#include <xrpl/protocol/AccountID.h>
27#include <xrpl/protocol/Issue.h>
28#include <xrpl/protocol/STAmount.h>
29#include <xrpl/protocol/STLedgerEntry.h>
30#include <xrpl/protocol/UintTypes.h>
31
32#include <cstdint>
33#include <utility>
34
35namespace rpc {
36
50std::pair<ripple::STAmount, ripple::STAmount>
52 BackendInterface const& backend,
53 data::AmendmentCenterInterface const& amendmentCenter,
54 std::uint32_t sequence,
55 ripple::AccountID const& ammAccountID,
56 ripple::Issue const& issue1,
57 ripple::Issue const& issue2,
58 bool freezeHandling,
59 boost::asio::yield_context yield
60);
61
74ripple::STAmount
76 BackendInterface const& backend,
77 std::uint32_t sequence,
78 ripple::Currency const& cur1,
79 ripple::Currency const& cur2,
80 ripple::AccountID const& ammAccount,
81 ripple::AccountID const& lpAccount,
82 boost::asio::yield_context yield
83);
84
95ripple::STAmount
97 BackendInterface const& backend,
98 std::uint32_t sequence,
99 ripple::SLE const& ammSle,
100 ripple::AccountID const& lpAccount,
101 boost::asio::yield_context yield
102);
103
104} // namespace rpc
The interface of an amendment center.
Definition AmendmentCenterInterface.hpp:36
The interface to the database used by Clio.
Definition BackendInterface.hpp:140
This namespace contains all the RPC logic and handlers.
Definition AMMHelpers.cpp:37
std::pair< ripple::STAmount, ripple::STAmount > getAmmPoolHolds(BackendInterface const &backend, data::AmendmentCenterInterface const &amendmentCenter, 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:40
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:61