Simulator UI Overview
The Simulator UI gives you an IDE-like experience when simulating transactions. You can either build a transaction from scratch or load an existing transaction into Transaction Simulator, tweak the inputs, and override state variables or the smart contract code.
Replaying an existing transaction using a simulation allows you to:
- Access decoded transaction trace, 100% accurate gas usage overview, asset and balance changes, and storage modifications.
- Validate bugfixes by running simulations on modified smart contract source code.
- Validate adjustments to transaction parameters to find optimal inputs.
- Troubleshoot an existing transaction, either a reverted one or a successful transaction with undesired effects.
Using the Simulator UI
You can use the Simulator UI to:
- Simulate a simple transaction
- Set custom overrides of smart contract variables to impose custom conditions on the simulation.
- Progress to using Simulation API to do simulations programmatically.
- Explore using Forks to simulate several transactions.
Building a simulation
When building a transaction simulation, you can:
- Run a simulation off of an existing transaction by clicking Re-Simulate button on Inspect Transaction page. By default, the simulation executes on the block and timestamp of the original transaction.
- Build a simulation scratch, by choosing a contract, method to call, and arguments to pass.
- Use either the latest block number or specify a historical block number.
- Run a simulation on changed smart contract source code.
- Override smart contract state variables.
- Override a block header by specifying custom blockNumber and timestamp values that the smart contract code receives through
block.number
andblock.timestamp
respectively. - Specify an arbitrary sender (from).
- Specify an arbitrary gas and gasPrice for this particular simulation.