1#include <xrpld/app/tx/detail/PermissionedDomainSet.h>
3#include <xrpl/ledger/CredentialHelpers.h>
4#include <xrpl/ledger/View.h>
5#include <xrpl/protocol/STObject.h>
6#include <xrpl/protocol/TxFlags.h>
28 auto const domain = ctx.
tx.
at(~sfDomainID);
29 if (domain && *domain == beast::zero)
53 auto const sleDomain = ctx.
view.
read(
57 if (sleDomain->getAccountID(sfOwner) != account)
72 auto const sortedTxCredentials =
74 STArray sortedLE(sfAcceptedCredentials, sortedTxCredentials.size());
75 for (
auto const& p : sortedTxCredentials)
78 cred.setAccountID(sfIssuer, p.first);
79 cred.setFieldVL(sfCredentialType, p.second);
90 slePd->peekFieldArray(sfAcceptedCredentials) = std::move(sortedLE);
97 auto const balance =
STAmount((*ownerSle)[sfBalance]).
xrp();
100 if (balance < reserve)
109 slePd->setAccountID(sfOwner,
account_);
111 slePd->peekFieldArray(sfAcceptedCredentials) = std::move(sortedLE);
117 slePd->setFieldU64(sfOwnerNode, *page);
beast::Journal const journal
virtual void update(std::shared_ptr< SLE > const &sle)=0
Indicate changes to a peeked SLE.
virtual void insert(std::shared_ptr< SLE > const &sle)=0
Insert a new state SLE.
std::optional< std::uint64_t > dirInsert(Keylet const &directory, uint256 const &key, std::function< void(std::shared_ptr< SLE > const &)> const &describe)
Insert an entry to a directory.
virtual std::shared_ptr< SLE > peek(Keylet const &k)=0
Prepare to modify the SLE associated with key.
static NotTEC preflight(PreflightContext const &ctx)
static TER preclaim(PreclaimContext const &ctx)
TER doApply() override
Attempt to create the Permissioned Domain.
static bool checkExtraFeatures(PreflightContext const &ctx)
virtual std::shared_ptr< SLE const > read(Keylet const &k) const =0
Return the state item associated with a key.
virtual Fees const & fees() const =0
Returns the fees for the base ledger.
virtual bool exists(Keylet const &k) const =0
Determine if a state item exists.
bool enabled(uint256 const &feature) const
Returns true if a feature is enabled.
void push_back(STObject const &object)
AccountID getAccountID(SField const &field) const
STArray const & getFieldArray(SField const &field) const
T::value_type at(TypedField< T > const &f) const
Get the value of a field.
std::uint32_t getFieldU32(SField const &field) const
bool isFieldPresent(SField const &field) const
static STObject makeInnerObject(SField const &name)
uint256 getFieldH256(SField const &field) const
NotTEC checkArray(STArray const &credentials, unsigned maxSize, beast::Journal j)
std::set< std::pair< AccountID, Slice > > makeSorted(STArray const &credentials)
Keylet permissionedDomain(AccountID const &account, std::uint32_t seq) noexcept
Keylet account(AccountID const &id) noexcept
AccountID root.
Keylet ownerDir(AccountID const &id) noexcept
The root page of an account's directory.
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
std::size_t constexpr maxPermissionedDomainCredentialsArraySize
The maximum number of credentials can be passed in array for permissioned domain.
void adjustOwnerCount(ApplyView &view, std::shared_ptr< SLE > const &sle, std::int32_t amount, beast::Journal j)
Adjust the owner count up or down.
std::function< void(SLE::ref)> describeOwnerDir(AccountID const &account)
@ tecINSUFFICIENT_RESERVE
bool isTesSuccess(TER x) noexcept
@ credential
Credentials signature.
XRPAmount accountReserve(std::size_t ownerCount) const
Returns the account reserve given the owner count, in drops.
A pair of SHAMap key and LedgerEntryType.
State information when determining if a tx is likely to claim a fee.
State information when preflighting a tx.