Skip to content

feat: add ChainSimulatorSetTokenBalanceStep for arbitrary ESDT balance creation - #185

Merged
EtienneWallet merged 5 commits into
developfrom
feat/token_faucet
May 7, 2026
Merged

feat: add ChainSimulatorSetTokenBalanceStep for arbitrary ESDT balance creation#185
EtienneWallet merged 5 commits into
developfrom
feat/token_faucet

Conversation

@EtienneWallet

Copy link
Copy Markdown
Contributor

Summary

Add a new chain-simulator-only step ChainSimulatorSetTokenBalanceStep that enables creating arbitrary fungible ESDT token balances "from thin air" on accounts. This is useful for test scenarios where you want to set up specific token balances without needing to clone accounts from a source network.

Key Features

  • Fungible tokens only (v1): Supports setting arbitrary amounts for standard ESDT tokens
  • Automatic token registration: If a token doesn't exist on the chain simulator, it's automatically cloned from the source network (default: mainnet)
  • Multi-receiver support: Set balances for multiple accounts in a single step
  • Storage preservation: Uses set_address_state() to surgically update balances without affecting other account state (code, nonce, balance)
  • Idempotent behavior: Re-running with the same or different amounts updates balances cleanly

Changes

  • ChainSimulatorSetTokenBalanceStep implementation with protobuf encoding for ESDT values
  • Helper functions for storage key generation and value encoding
  • Support for reusing existing ESDT token reconciliation logic from AccountCloneStep
  • 28 unit tests covering encoding, validation, and execution paths
  • Integration test demonstrating end-to-end balance creation and verification
  • User and developer documentation

Testing

  • All 296 unit tests pass (including 28 new tests for this step)
  • All code quality gates pass (bandit, flake8, ruff, pylint > 9.5)
  • Integration test successfully creates balances on chain simulator and verifies via proxy queries

@EtienneWallet
EtienneWallet merged commit 2bb5b13 into develop May 7, 2026
@EtienneWallet
EtienneWallet deleted the feat/token_faucet branch May 7, 2026 11:45
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