Skip to Content
ReferenceCLISet ERC20 Balances

Set ERC20 Balances

Change an address’s ERC20 token balance on your Stagenet from the command line.

This CLI wraps the ERC20 balance SDK methods. The token’s totalSupply is not adjusted — see the SDK page if your code reads it.

Usage

With a contract.dev.js at your project root (see Setup):

contract.dev erc20-balance <subcommand>

erc20-balance add

Add amount of <token> to <holder>.

contract.dev erc20-balance add 0x1111... \ 0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48 \ 1000000 # +1 USDC (6 decimals)
ArgumentDescription
<holder>The account whose balance to update
<token>The ERC20 token contract address
<amount>Amount in the token’s smallest unit (decimal or 0x-hex)

Sample output:

Added ERC20 balance for 0x1111111111111111111111111111111111111111 on 0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48 (+1000000) new balance: 5000000

Amounts are shown as raw integers in the token’s smallest unit — the CLI doesn’t fetch each token’s decimals() for display.

erc20-balance set

Overwrite a holder’s ERC20 balance.

contract.dev erc20-balance set 0x1111... 0xA0b8...eB48 0

Same arguments as erc20-balance add. Sample output:

Set ERC20 balance for 0x1111111111111111111111111111111111111111 on 0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48 (= 0) new balance: 0

Notes

  • These commands write the token’s balanceOf storage slot directly. ERC20s with non-standard layouts (e.g. rebasing tokens) may not be writable; in that case use state set-storage.
  • For native (ETH) balances, use balance.
Last updated on