rippled
Loading...
Searching...
No Matches
VaultHelpers.h
1#pragma once
2
3#include <xrpl/protocol/STAmount.h>
4#include <xrpl/protocol/STLedgerEntry.h>
5
6#include <memory>
7#include <optional>
8
9namespace xrpl {
10
21[[nodiscard]] std::optional<STAmount>
23 std::shared_ptr<SLE const> const& vault,
24 std::shared_ptr<SLE const> const& issuance,
25 STAmount const& assets);
26
37[[nodiscard]] std::optional<STAmount>
39 std::shared_ptr<SLE const> const& vault,
40 std::shared_ptr<SLE const> const& issuance,
41 STAmount const& shares);
42
44enum class TruncateShares : bool { no = false, yes = true };
45
58[[nodiscard]] std::optional<STAmount>
60 std::shared_ptr<SLE const> const& vault,
61 std::shared_ptr<SLE const> const& issuance,
62 STAmount const& assets,
64
75[[nodiscard]] std::optional<STAmount>
77 std::shared_ptr<SLE const> const& vault,
78 std::shared_ptr<SLE const> const& issuance,
79 STAmount const& shares);
80
81} // namespace xrpl
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
Definition algorithm.h:5
std::optional< STAmount > sharesToAssetsDeposit(std::shared_ptr< SLE const > const &vault, std::shared_ptr< SLE const > const &issuance, STAmount const &shares)
From the perspective of a vault, return the number of assets to take from depositor when they receive...
TruncateShares
Controls whether to truncate shares instead of rounding.
std::optional< STAmount > assetsToSharesDeposit(std::shared_ptr< SLE const > const &vault, std::shared_ptr< SLE const > const &issuance, STAmount const &assets)
From the perspective of a vault, return the number of shares to give depositor when they offer a fixe...
std::optional< STAmount > assetsToSharesWithdraw(std::shared_ptr< SLE const > const &vault, std::shared_ptr< SLE const > const &issuance, STAmount const &assets, TruncateShares truncate=TruncateShares::no)
From the perspective of a vault, return the number of shares to demand from the depositor when they a...
std::optional< STAmount > sharesToAssetsWithdraw(std::shared_ptr< SLE const > const &vault, std::shared_ptr< SLE const > const &issuance, STAmount const &shares)
From the perspective of a vault, return the number of assets to give the depositor when they redeem a...
@ no
Definition Steps.h:24
@ yes
Definition Steps.h:24