Skip to content

Conversation

@creativElla
Copy link

What This PR Adds

1. Practical ESDT Payment Examples (sc-payments.md)

  • Complete working example of ESDT payment validation with all necessary checks
  • Explanation of how to test ESDT contract endpoints using ESDTTransfer
  • Common validation patterns (single token, multiple tokens, amount ranges)
  • Troubleshooting section covering common errors and their solutions

2. Token Identifier Format Clarifications (fungible-tokens.md)

  • Warning callout about token ID format (TOKEN-abc123 vs TOKEN)
  • Decimal precision warning with code examples
  • Solutions to common mistakes developers encounter

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:

  1. 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.

  2. Testing Pattern: The docs explain #[payable] but don't show the actual ESDTTransfer command needed to test these endpoints, which is non-obvious for developers coming from other chains.

  3. 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.

  4. 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:

  • Adding practical, copy-pasteable examples developers can learn from
  • Preventing common errors through specific warnings
  • Bridging the gap between API reference and real-world usage
  • Providing troubleshooting guidance for typical issues

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.

- Added complete working examples of ESDT payment validation in sc-payments.md
- Added ESDTTransfer testing command explanation
- Added common validation patterns
- Added troubleshooting section for common ESDT payment errors
- Added token ID format warning in fungible-tokens.md
- Added decimal precision warning with code examples
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant