1#include <xrpld/app/tx/detail/DelegateSet.h>
3#include <xrpl/basics/Log.h>
4#include <xrpl/ledger/View.h>
5#include <xrpl/protocol/Feature.h>
6#include <xrpl/protocol/Indexes.h>
7#include <xrpl/protocol/st.h>
19 if (ctx.
tx[sfAccount] == ctx.
tx[sfAuthorize])
24 for (
auto const& permission : permissions)
26 if (!permissionSet.
insert(permission[sfPermissionValue]).second)
30 permission[sfPermissionValue], ctx.
rules))
56 auto const& authAccount =
ctx_.
tx[sfAuthorize];
63 if (permissions.empty())
67 sle->setFieldArray(sfPermissions, permissions);
73 sleOwner->getFieldU32(sfOwnerCount) + 1)};
79 if (!permissions.empty())
82 sle->setAccountID(sfAccount,
account_);
83 sle->setAccountID(sfAuthorize, authAccount);
85 sle->setFieldArray(sfPermissions, permissions);
94 (*sle)[sfOwnerNode] = *page;
116 JLOG(j.
fatal()) <<
"Unable to delete Delegate from owner.";
A generic endpoint for log messages.
beast::Journal const journal
Writeable view to a ledger, for applying a transaction.
virtual void update(std::shared_ptr< SLE > const &sle)=0
Indicate changes to a peeked SLE.
bool dirRemove(Keylet const &directory, std::uint64_t page, uint256 const &key, bool keepRoot)
Remove an entry from a directory.
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.
virtual void erase(std::shared_ptr< SLE > const &sle)=0
Remove a peeked SLE.
static TER preclaim(PreclaimContext const &ctx)
static NotTEC preflight(PreflightContext const &ctx)
static TER deleteDelegate(ApplyView &view, std::shared_ptr< SLE > const &sle, AccountID const &account, beast::Journal j)
static Permission const & getInstance()
bool isDelegatable(std::uint32_t const &permissionValue, Rules const &rules) const
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.
STArray const & getFieldArray(SField const &field) const
Keylet delegate(AccountID const &account, AccountID const &authorizedAccount) noexcept
A keylet for Delegate object.
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 permissionMaxSize
The maximum number of delegate permissions an account can grant.
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
TERSubset< CanCvtToNotTEC > NotTEC
XRPAmount accountReserve(std::size_t ownerCount) const
Returns the account reserve given the owner count, in drops.
State information when determining if a tx is likely to claim a fee.
State information when preflighting a tx.