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

@@ -398,8 +398,15 @@ parseLeaf(
std::uint64_t val;
bool const useBase10 =
field.shouldMeta(SField::sMD_BaseTen);
// if the field is amount, serialize as base 10
auto [p, ec] = std::from_chars(
str.data(), str.data() + str.size(), val, 16);
str.data(),
str.data() + str.size(),
val,
useBase10 ? 10 : 16);
if (ec != std::errc() || (p != str.data() + str.size()))
Throw<std::invalid_argument>("invalid data");
@@ -454,6 +461,30 @@ parseLeaf(
break;
}
case STI_UINT192: {
if (!value.isString())
{
error = bad_type(json_name, fieldName);
return ret;
}
uint192 num;
if (auto const s = value.asString(); !num.parseHex(s))
{
if (!s.empty())
{
error = invalid_data(json_name, fieldName);
return ret;
}
num.zero();
}
ret = detail::make_stvar<STUInt192>(field, num);
break;
}
case STI_UINT160: {
if (!value.isString())
{