Add practical ESDT payment examples and token identifier clarifications #1176
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What This PR Adds
1. Practical ESDT Payment Examples (
sc-payments.md)ESDTTransfer2. Token Identifier Format Clarifications (
fungible-tokens.md)TOKEN-abc123vsTOKEN)Why These Changes?
As a Technical writer understanding smart cotracts, building ESDT-powered smart contracts on MultiversX, I encountered several issues that weren't clearly documented in the existing pages:
Token ID Format: The current docs mention that identifiers include a random suffix but don't warn that omitting it causes contract errors. This is the Update esdt-tokens.md #1 issue new developers hit.
Testing Pattern: The docs explain
#[payable]but don't show the actualESDTTransfercommand needed to test these endpoints, which is non-obvious for developers coming from other chains.Decimal Handling: While decimals are mentioned, there's no specific warning with code examples showing how to correctly calculate amounts, leading to "amount mismatch" errors.
Validation Patterns: The docs list available API functions but don't show complete examples of how to properly validate payments in production contracts.
These additions address gaps I personally experienced while building a token vesting contract on devnet. The examples are from real, deployed contracts that handle these scenarios correctly.
Impact
This PR enhances the existing documentation by:
Testing
All code examples are based on contracts successfully deployed and tested on devnet:
The validation patterns shown follow MultiversX best practices and prevent common security/logic issues.