xrpld
Loading...
Searching...
No Matches
xrpl::ValidMPTTransfer Class Reference

#include <MPTInvariant.h>

Collaboration diagram for xrpl::ValidMPTTransfer:

Classes

struct  Value

Public Member Functions

void visitEntry (bool isDelete, std::shared_ptr< SLE const > const &before, std::shared_ptr< SLE const > const &after)
 Track MPT balance changes and deleted authorization state.
bool finalize (STTx const &tx, TER const result, XRPAmount const fee, ReadView const &view, beast::Journal const &j)
 Verify MPT transfer authorization invariants.

Private Member Functions

bool isAuthorized (ReadView const &view, MPTID const &mptid, AccountID const &holder, bool requireAuth) const
 Check whether a holder is authorized to send or receive an MPToken.

Private Attributes

hash_map< uint192, hash_map< AccountID, Value > > amount_
hash_map< uint256, bool > deletedAuthorized_

Detailed Description

Definition at line 192 of file MPTInvariant.h.

Member Function Documentation

◆ visitEntry()

void xrpl::ValidMPTTransfer::visitEntry ( bool isDelete,
std::shared_ptr< SLE const > const & before,
std::shared_ptr< SLE const > const & after )

Track MPT balance changes and deleted authorization state.

Parameters
isDeleteWhether the ledger entry is being deleted.
beforeThe ledger entry before transaction application.
afterThe ledger entry after transaction application.

Definition at line 774 of file MPTInvariant.cpp.

◆ finalize()

bool xrpl::ValidMPTTransfer::finalize ( STTx const & tx,
TER const result,
XRPAmount const fee,
ReadView const & view,
beast::Journal const & j )

Verify MPT transfer authorization invariants.

Parameters
txThe transaction being checked.
resultThe transaction result code.
feeThe fee charged by the transaction.
viewThe ledger view after transaction application.
jJournal used for diagnostics.
Returns
true if the invariant checks pass, otherwise false.

Definition at line 833 of file MPTInvariant.cpp.

◆ isAuthorized()

bool xrpl::ValidMPTTransfer::isAuthorized ( ReadView const & view,
MPTID const & mptid,
AccountID const & holder,
bool requireAuth ) const
nodiscardprivate

Check whether a holder is authorized to send or receive an MPToken.

Deleted MPToken SLEs are no longer present in the view by the time finalize() runs, so their authorization state is captured during visitEntry() and stored in deletedAuthorized_. For deleted MPTokens, returns true if reqAuth is false or lsfMPTAuthorized was set at deletion. For existing MPTokens, returns the result of requireAuth().

Parameters
viewThe ledger view after transaction application.
mptidThe MPToken issuance ID.
holderThe holder account being checked.
requireAuthWhether the issuance requires explicit authorization.
Returns
true if the holder is authorized, otherwise false.

Definition at line 810 of file MPTInvariant.cpp.

Member Data Documentation

◆ amount_

hash_map<uint192, hash_map<AccountID, Value> > xrpl::ValidMPTTransfer::amount_
private

Definition at line 200 of file MPTInvariant.h.

◆ deletedAuthorized_

hash_map<uint256, bool> xrpl::ValidMPTTransfer::deletedAuthorized_
private

Definition at line 203 of file MPTInvariant.h.