Introduce MPT support (XLS-33d): (#5143)

Amendment:
- MPTokensV1

New Transactions:
- MPTokenIssuanceCreate
- MPTokenIssuanceDestroy
- MPTokenIssuanceSet
- MPTokenAuthorize

Modified Transactions:
- Payment
- Clawback

New Objects:
- MPTokenIssuance
- MPToken

API updates:
- ledger_entry
- account_objects
- ledger_data

Other:
- Add += and -= operators to ValueProxy

Read full spec: https://github.com/XRPLF/XRPL-Standards/tree/master/XLS-0033d-multi-purpose-tokens

---------
Co-authored-by: Shawn Xie <shawnxie920@gmail.com>
Co-authored-by: Howard Hinnant <howard.hinnant@gmail.com>
Co-authored-by: Ed Hennis <ed@ripple.com>
Co-authored-by: John Freeman <jfreeman08@gmail.com>
This commit is contained in:
Gregory Tsipenyuk
2024-10-29 15:19:28 -04:00
committed by GitHub
parent 63209c2646
commit 23c37fa506
92 changed files with 7115 additions and 1088 deletions

View File

@@ -198,11 +198,23 @@ template <>
Json::Value
STUInt64::getJson(JsonOptions) const
{
std::string str(16, 0);
auto ret = std::to_chars(str.data(), str.data() + str.size(), value_, 16);
assert(ret.ec == std::errc());
str.resize(std::distance(str.data(), ret.ptr));
return str;
auto convertToString = [](uint64_t const value, int const base) {
assert(base == 10 || base == 16);
std::string str(
base == 10 ? 20 : 16, 0); // Allocate space depending on base
auto ret =
std::to_chars(str.data(), str.data() + str.size(), value, base);
assert(ret.ec == std::errc());
str.resize(std::distance(str.data(), ret.ptr));
return str;
};
if (auto const& fName = getFName(); fName.shouldMeta(SField::sMD_BaseTen))
{
return convertToString(value_, 10); // Convert to base 10
}
return convertToString(value_, 16); // Convert to base 16
}
} // namespace ripple