-
Notifications
You must be signed in to change notification settings - Fork 109
Feature: New payment types #2198
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
Conversation
TokenId type
blockchain wrapper - get_native_token/is_native_token
Coverage SummaryTotals
FilesExpand
|
|
Contract comparison - from 895d3be to 491cb31
|
rename Payment from contracts
Payment, PaymentVec, PaymentMultiValue, call value all()
Crowdfunding - new payment objects, call value single
crowdfunding-esdt renamed to crowdfunding
Display for TokenId and EgldOrEsdtTokenIdentifier
MultiTransfer marker
Payments: deprecated EgldOrMultiEsdtPayment and call_value any_payment
…aints MultiTransfer marker - constrained argument
big number equality/comparison tests
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR introduces unified token/payment handling for MultiversX smart contracts, removing EGLD's special status and adding support for future sovereign chains with different native tokens. The key changes unify EGLD and ESDT handling through new TokenId and Payment types, add NonZeroBigUint to enforce non-zero payment amounts, expand the call_value API, and rename ManagedVecRef to Ref for clarity.
Key Changes:
- Introduces
TokenIdandPaymenttypes for unified token/payment representation - Adds
NonZeroBigUinttype with validation for non-zero amounts - Expands call_value API with
all(),single(),single_optional(), andarray<N>() - Renames
ManagedVecReftoRef(keeping old name as alias) - Updates Rust toolchain from 1.89 to 1.90
Reviewed changes
Copilot reviewed 194 out of 207 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| tools/rust-debugger/pretty-printers/multiversx_sc_lldb_pretty_printers.py | Updates debugger pretty-printers for new type structure and adds NonZeroBigUint support |
| tools/rust-debugger/format-tests/src/format_tests.rs | Adds test for NonZeroBigUint formatting |
| tools/op-test-gen/src/*.rs | Adds comparison operators and comprehensive test generation for BigInt/BigUint/NonZeroBigUint |
| sdk/scenario-format/src/value_interpreter/parse_num.rs | Uses new is_multiple_of(2) API instead of manual check |
| rust-toolchain.toml | Updates Rust toolchain to 1.90 |
| framework/scenario/tests/*.rs | Adds comprehensive tests for new TokenId and Payment types |
| framework/meta-lib/src/contract/generate_proxy/proxy_generator.rs | Adds new types to proxy generation whitelist |
| framework/meta-lib/src/cargo_toml/cargo_toml_contents.rs | Adds Default derive and simplifies constructor |
| framework/derive/src/*.rs | Updates derive macros for new types and Ref rename |
| framework/base/src/types/managed/wrapped/token/*.rs | Implements new TokenId, Payment, PaymentVec, PaymentRefs types |
| framework/base/src/types/managed/wrapped/num/*.rs | Implements NonZeroBigUint with operators and validation |
| framework/base/src/types/managed/wrapped/managed_vec*.rs | Renames ManagedVecRef to Ref, adds AsRef implementations |
| framework/base/src/types/managed/multi_value/*.rs | Adds PaymentMultiValue and related multi-value support |
| framework/base/src/types/interaction/*.rs | Updates payment handling in transaction API |
| framework/base/src/contract_base/wrappers/*.rs | Expands call_value API and adds native token support |
| framework/base/src/err_msg.rs | Removes INCORRECT_NUM_ESDT_TRANSFERS, adds ZERO_VALUE_NOT_ALLOWED |
| contracts/feature-tests/payable-features/*.rs | Updates to use new payment API |
| contracts/feature-tests/composability/*.rs | Updates vault and forwarder contracts for new payment types |
| contracts/feature-tests//scenarios/.scen.json | Updates test scenarios for EGLD-000000 representation |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
MIP
Please find the full discussion on Agora:
https://agora.multiversx.com/t/spacecraft-new-token-identifier-and-payment-options/546
Problem
EGLD-000000), and future plans aim to treat EGLD as a normal ESDT.Solution
1. New Types
Introduce
TokenIdentandPaymenttypes to represent token identifiers and payments in a unified way.TokenIdentis a simple byte array with validation.TokenIdentifierremains for legacy; ideally, it would be renamed toEgldOrEsdtTokenIdentifier.2. Native Token API
Add an API to get the current native token (used for gas).
3. NonZeroBigUint amounts in Payments
Payment.amountwill useNonZeroBigUint(no zero payments allowed).None, not zero EGLD.NonZeroBigUintis a new type, available in contracts.4. Expanded call_value API
all(): Retrieves the full payment list, supports all scenarios.single(): Expects exactly one payment, returns a reference. Panics otherwise.single_optional(): Expects zero or one payment, returnsOption<Ref<Payment>>.array<const N: usize>(): Expects exactly N payments, returns an array of references.5. Reference Type Rename
ManagedVecReftoReffor clarity (old name kept as alias).This PR unifies token/payment handling, removes EGLD’s special status, and improves API clarity and safety.