add some more helper functions

This commit is contained in:
Mayukha Vadari
2026-03-21 22:02:08 -07:00
parent 89e9caed17
commit 640b231f5f
3 changed files with 44 additions and 0 deletions

View File

@@ -118,6 +118,18 @@ public:
[[nodiscard]] TER
canTransfer(AccountID const& from, AccountID const& to) const override;
//------------------------------------------------------------------------------
//
// Token capability checks (MPT-specific)
//
//------------------------------------------------------------------------------
[[nodiscard]] bool
canClawback() const override;
[[nodiscard]] bool
requiresAuth() const override;
STAmount
accountHolds(
AccountID const& account,

View File

@@ -95,6 +95,18 @@ public:
[[nodiscard]] TER
canTransfer(AccountID const& from, AccountID const& to) const override;
//------------------------------------------------------------------------------
//
// Token capability checks (IOU-specific)
//
//------------------------------------------------------------------------------
[[nodiscard]] bool
canClawback() const override;
[[nodiscard]] bool
requiresAuth() const override;
protected:
Issue const issue_;
AccountID const issuer_;

View File

@@ -140,6 +140,26 @@ public:
[[nodiscard]] virtual TER
canTransfer(AccountID const& from, AccountID const& to) const = 0;
//------------------------------------------------------------------------------
//
// Token capability checks (Asset-based dispatchers)
//
//------------------------------------------------------------------------------
/** Check if the token issuer has enabled clawback capability.
* For IOUs, checks lsfAllowTrustLineClawback on issuer's AccountRoot.
* For MPTs, checks lsfMPTCanClawback on the issuance.
*/
[[nodiscard]] virtual bool
canClawback() const = 0;
/** Check if the token requires authorization for holders.
* For IOUs, checks lsfRequireAuth on issuer's AccountRoot.
* For MPTs, checks lsfMPTRequireAuth on the issuance.
*/
[[nodiscard]] virtual bool
requiresAuth() const = 0;
protected:
TokenBase(ReadView const& view, std::shared_ptr<SLE const> sle) : ReadOnlySLE(sle, view)
{