Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rename mpt holder #49

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion include/xrpl/protocol/detail/sfields.macro
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,7 @@ TYPED_SFIELD(sfUnauthorize, ACCOUNT, 6)
TYPED_SFIELD(sfRegularKey, ACCOUNT, 8)
TYPED_SFIELD(sfNFTokenMinter, ACCOUNT, 9)
TYPED_SFIELD(sfEmitCallback, ACCOUNT, 10)
TYPED_SFIELD(sfMPTokenHolder, ACCOUNT, 11)
TYPED_SFIELD(sfHolder, ACCOUNT, 11)

// account (uncommon)
TYPED_SFIELD(sfHookAccount, ACCOUNT, 16)
Expand Down
6 changes: 3 additions & 3 deletions include/xrpl/protocol/detail/transactions.macro
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ TRANSACTION(ttNFTOKEN_ACCEPT_OFFER, 29, NFTokenAcceptOffer, ({
/** This transaction claws back issued tokens. */
TRANSACTION(ttCLAWBACK, 30, Clawback, ({
{sfAmount, soeREQUIRED, soeMPTSupported},
{sfMPTokenHolder, soeOPTIONAL},
{sfHolder, soeOPTIONAL},
}))

/** This transaction type creates an AMM instance */
Expand Down Expand Up @@ -403,13 +403,13 @@ TRANSACTION(ttMPTOKEN_ISSUANCE_DESTROY, 55, MPTokenIssuanceDestroy, ({
/** This transaction type sets flags on a MPTokensIssuance or MPToken instance */
TRANSACTION(ttMPTOKEN_ISSUANCE_SET, 56, MPTokenIssuanceSet, ({
{sfMPTokenIssuanceID, soeREQUIRED},
{sfMPTokenHolder, soeOPTIONAL},
{sfHolder, soeOPTIONAL},
}))

/** This transaction type authorizes a MPToken instance */
TRANSACTION(ttMPTOKEN_AUTHORIZE, 57, MPTokenAuthorize, ({
{sfMPTokenIssuanceID, soeREQUIRED},
{sfMPTokenHolder, soeOPTIONAL},
{sfHolder, soeOPTIONAL},
}))

/** This system-generated transaction type is used to update the status of the various amendments.
Expand Down
2 changes: 1 addition & 1 deletion src/test/app/MPToken_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1648,7 +1648,7 @@ class MPToken_test : public beast::unit_test::suite
void
testTxJsonMetaFields(FeatureBitset features)
{
// checks synthetically parsed mptissuanceid from `tx` response
// checks synthetically injected mptissuanceid from `tx` response
testcase("Test synthetic fields from tx response");

using namespace test::jtx;
Expand Down
4 changes: 2 additions & 2 deletions src/test/jtx/impl/mpt.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ MPTTester::authorize(MPTAuthorize const& arg)
jv[sfMPTokenIssuanceID] = to_string(*id_);
}
if (arg.holder)
jv[sfMPTokenHolder] = arg.holder->human();
jv[sfHolder] = arg.holder->human();
if (auto const result = submit(arg, jv); result == tesSUCCESS)
{
// Issuer authorizes
Expand Down Expand Up @@ -230,7 +230,7 @@ MPTTester::set(MPTSet const& arg)
jv[sfMPTokenIssuanceID] = to_string(*id_);
}
if (arg.holder)
jv[sfMPTokenHolder] = arg.holder->human();
jv[sfHolder] = arg.holder->human();
if (submit(arg, jv) == tesSUCCESS && arg.flags.value_or(0))
{
auto require = [&](std::optional<Account> const& holder,
Expand Down
2 changes: 1 addition & 1 deletion src/test/jtx/impl/trust.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ claw(
jv[jss::TransactionType] = jss::Clawback;

if (mptHolder)
jv[sfMPTokenHolder.jsonName] = mptHolder->human();
jv[sfHolder.jsonName] = mptHolder->human();

return jv;
}
Expand Down
11 changes: 5 additions & 6 deletions src/xrpld/app/tx/detail/Clawback.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ template <>
NotTEC
preflightHelper<Issue>(PreflightContext const& ctx)
{
if (ctx.tx.isFieldPresent(sfMPTokenHolder))
if (ctx.tx.isFieldPresent(sfHolder))
return temMALFORMED;

AccountID const issuer = ctx.tx[sfAccount];
Expand All @@ -58,7 +58,7 @@ preflightHelper<MPTIssue>(PreflightContext const& ctx)
if (!ctx.rules.enabled(featureMPTokensV1))
return temDISABLED;

auto const mptHolder = ctx.tx[~sfMPTokenHolder];
auto const mptHolder = ctx.tx[~sfHolder];
auto const clawAmount = ctx.tx[sfAmount];

if (!mptHolder)
Expand Down Expand Up @@ -199,9 +199,8 @@ Clawback::preclaim(PreclaimContext const& ctx)
{
AccountID const issuer = ctx.tx[sfAccount];
auto const clawAmount = ctx.tx[sfAmount];
AccountID const holder = clawAmount.holds<Issue>()
? clawAmount.getIssuer()
: ctx.tx[sfMPTokenHolder];
AccountID const holder =
clawAmount.holds<Issue>() ? clawAmount.getIssuer() : ctx.tx[sfHolder];

auto const sleIssuer = ctx.view.read(keylet::account(issuer));
auto const sleHolder = ctx.view.read(keylet::account(holder));
Expand Down Expand Up @@ -260,7 +259,7 @@ applyHelper<MPTIssue>(ApplyContext& ctx)
{
AccountID const issuer = ctx.tx[sfAccount];
auto clawAmount = ctx.tx[sfAmount];
AccountID const holder = ctx.tx[sfMPTokenHolder];
AccountID const holder = ctx.tx[sfHolder];

// Get the spendable balance. Must use `accountHolds`.
STAmount const spendableAmount = accountHolds(
Expand Down
2 changes: 1 addition & 1 deletion src/xrpld/app/tx/detail/InvariantCheck.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1031,7 +1031,7 @@ ValidMPTIssuance::finalize(

if (tx.getTxnType() == ttMPTOKEN_AUTHORIZE)
{
bool const submittedByIssuer = tx.isFieldPresent(sfMPTokenHolder);
bool const submittedByIssuer = tx.isFieldPresent(sfHolder);

if (mptIssuancesCreated_ > 0)
{
Expand Down
6 changes: 3 additions & 3 deletions src/xrpld/app/tx/detail/MPTokenAuthorize.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ MPTokenAuthorize::preflight(PreflightContext const& ctx)
if (ctx.tx.getFlags() & tfMPTokenAuthorizeMask)
return temINVALID_FLAG;

if (ctx.tx[sfAccount] == ctx.tx[~sfMPTokenHolder])
if (ctx.tx[sfAccount] == ctx.tx[~sfHolder])
return temMALFORMED;

return preflight2(ctx);
Expand All @@ -47,7 +47,7 @@ TER
MPTokenAuthorize::preclaim(PreclaimContext const& ctx)
{
auto const accountID = ctx.tx[sfAccount];
auto const holderID = ctx.tx[~sfMPTokenHolder];
auto const holderID = ctx.tx[~sfHolder];

// if non-issuer account submits this tx, then they are trying either:
// 1. Unauthorize/delete MPToken
Expand Down Expand Up @@ -262,7 +262,7 @@ MPTokenAuthorize::doApply()
.mptIssuanceID = tx[sfMPTokenIssuanceID],
.account = account_,
.flags = tx.getFlags(),
.holderID = tx[~sfMPTokenHolder]});
.holderID = tx[~sfHolder]});
}

} // namespace ripple
6 changes: 3 additions & 3 deletions src/xrpld/app/tx/detail/MPTokenIssuanceSet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ MPTokenIssuanceSet::preflight(PreflightContext const& ctx)
return temINVALID_FLAG;

auto const accountID = ctx.tx[sfAccount];
auto const holderID = ctx.tx[~sfMPTokenHolder];
auto const holderID = ctx.tx[~sfHolder];
if (holderID && accountID == holderID)
return temMALFORMED;

Expand All @@ -68,7 +68,7 @@ MPTokenIssuanceSet::preclaim(PreclaimContext const& ctx)
if ((*sleMptIssuance)[sfIssuer] != ctx.tx[sfAccount])
return tecNO_PERMISSION;

if (auto const holderID = ctx.tx[~sfMPTokenHolder])
if (auto const holderID = ctx.tx[~sfHolder])
{
// make sure holder account exists
if (!ctx.view.exists(keylet::account(*holderID)))
Expand All @@ -88,7 +88,7 @@ MPTokenIssuanceSet::doApply()
{
auto const mptIssuanceID = ctx_.tx[sfMPTokenIssuanceID];
auto const txFlags = ctx_.tx.getFlags();
auto const holderID = ctx_.tx[~sfMPTokenHolder];
auto const holderID = ctx_.tx[~sfHolder];
std::shared_ptr<SLE> sle;

if (holderID)
Expand Down
Loading