more usage of MPToken

This commit is contained in:
Mayukha Vadari
2026-03-21 22:31:37 -07:00
parent 96d4a69a37
commit ad2c359f21
16 changed files with 123 additions and 102 deletions

View File

@@ -37,6 +37,18 @@ public:
{
}
[[nodiscard]] AccountID const&
getIssuer() const
{
return issuer_;
}
[[nodiscard]] Currency const&
getCurrency() const
{
return currency_;
}
[[nodiscard]] bool
isGlobalFrozen() const override
{

View File

@@ -1,5 +1,6 @@
#pragma once
#include <xrpl/ledger/entries/MPTokenHelpers.h>
#include <xrpl/protocol/STAmount.h>
#include <xrpl/protocol/STLedgerEntry.h>
@@ -21,7 +22,7 @@ namespace xrpl {
[[nodiscard]] std::optional<STAmount>
assetsToSharesDeposit(
std::shared_ptr<SLE const> const& vault,
std::shared_ptr<SLE const> const& issuance,
MPToken const& issuance,
STAmount const& assets);
/** From the perspective of a vault, return the number of assets to take from
@@ -37,7 +38,7 @@ assetsToSharesDeposit(
[[nodiscard]] std::optional<STAmount>
sharesToAssetsDeposit(
std::shared_ptr<SLE const> const& vault,
std::shared_ptr<SLE const> const& issuance,
MPToken const& issuance,
STAmount const& shares);
/** Controls whether to truncate shares instead of rounding. */
@@ -58,7 +59,7 @@ enum class TruncateShares : bool { no = false, yes = true };
[[nodiscard]] std::optional<STAmount>
assetsToSharesWithdraw(
std::shared_ptr<SLE const> const& vault,
std::shared_ptr<SLE const> const& issuance,
MPToken const& issuance,
STAmount const& assets,
TruncateShares truncate = TruncateShares::no);
@@ -75,7 +76,7 @@ assetsToSharesWithdraw(
[[nodiscard]] std::optional<STAmount>
sharesToAssetsWithdraw(
std::shared_ptr<SLE const> const& vault,
std::shared_ptr<SLE const> const& issuance,
MPToken const& issuance,
STAmount const& shares);
} // namespace xrpl

View File

@@ -1,5 +1,6 @@
#pragma once
#include <xrpl/ledger/entries/MPTokenHelpers.h>
#include <xrpl/tx/Transactor.h>
namespace xrpl {
@@ -26,7 +27,7 @@ private:
Expected<std::pair<STAmount, STAmount>, TER>
assetsToClawback(
std::shared_ptr<SLE> const& vault,
std::shared_ptr<SLE const> const& sleShareIssuance,
MPToken const& shareIssuance,
AccountID const& holder,
STAmount const& clawbackAmount);
};