🤔 Got questions? Schedule an office hours session.
Simulations
Asset and Balance Changes

Asset and Balance Changes

Both the RPC and API simulation responses provide information about the asset and balance changes that have occurred converted into dollar values. The displayed dollar value represents the current dollar value and reflects the most recent market data sourced from CoinGecko.

Supported token standards: ERC20 and ERC721.

RPC response

Asset and balance changes are always returned as part of the response when you call both the tenderly_simulateTransaction (single simulation) and the tenderly_simulateBundle (bundled simulations) RPC methods. See the RPC Reference.

https://mainnet.gateway.tenderly.co/${TENDERLY_NODE_ACCESS_KEY}

Follow these paths to access this information:

  • Asset Changes: Look under result.assetChanges. This will provide a breakdown of how assets have been altered or moved during the transaction.
  • Balance Changes: Find these under result.balanceChanges. This offers insights into the balance fluctuations in token and dollar values.

Example response

example.json
{
  "assetChanges": [
    {
      "assetInfo": {
        "standard": "ERC20",
        "type": "Fungible",
        "contractAddress": "0xc02...c2",
        "symbol": "weth",
        "name": "WETH",
        "logo": "https://assets.coingecko.com/coins/images/2518/large/weth.webp?1696503332",
        "decimals": 18,
        "dollarValue": "2195.8701171875"
      },
      "type": "Transfer",
      "from": "0xd8...45",
      "to": "0x20...d6",
      "rawAmount": "0x1",
      "amount": "0.000000000000000001",
      "dollarValue": "10.0071875"
    }
  ],
  "balanceChanges": [
    {
      "address": "0x20...1d6",
      "dollarValue": "0.0000021958701171875",
      "transfers": [
        0
      ]
    },
    {
      "address": "0xd8...045",
      "dollarValue": "0.00021958701171875",
      "transfers": [
        0
      ]
    }
  ]
}

API response

Asset and balance changes are also returned as part of the API response when you call the simulate (single simulations) endpoint:

https://api.tenderly.co/api/v1/account/${TENDERLY_ACCOUNT_SLUG}/project/${TENDERLY_PROJECT_SLUG}/simulate

and simulate-bundle (bundled simulations) endpoint:

https://api.tenderly.co/api/v1/account/${TENDERLY_ACCOUNT_SLUG}/project/${TENDERLY_PROJECT_SLUG}/simulate-bundle

In the API response, the structure is similarly intuitive:

  • Asset Changes: Find transaction.transaction_info.asset_changes. Here, you’ll find details like the type of change (transfer, mint, burn), involved addresses, and the amount in both the token and its dollar value.
  • Balance Changes: Find transaction.transaction_info.balance_changes. This section will show you how balances have shifted as a result of the transaction in token and dollar terms.

Example response

example.json
{
  "asset_changes": [
    {
      "token_info": {
        "standard": "ERC20",
        "type": "Fungible",
        "contract_address": "0xc02...c2",
        "symbol": "weth",
        "name": "WETH",
        "logo": "https://assets.coingecko.com/coins/images/2518/large/weth.webp?1696503332",
        "decimals": 18,
        "dollar_value": "2195.8701171875"
      },
      "type": "Transfer",
      "from": "0xd8...045",
      "to": "0x20...d6",
      "amount": "0.000000000000000001",
      "raw_amount": "1",
      "dollar_value": "0.0000000000000021958701171875"
    }
  ],
  "balance_changes": [
    {
      "address": "0x20...d6",
      "dollar_value": "0.0000000000000021958701171875",
      "transfers": [
        0
      ]
    },
    {
      "address": "0xd...045",
      "dollar_value": "-0.0000000000000021958701171875",
      "transfers": [
        0
      ]
    }
  ]
}

For more information, consult the API reference and RPC references.