assert_call_success_with_explanation

Documentation for eth_defi.trace.assert_call_success_with_explanation function.

assert_call_success_with_explanation(func, transaction=None)[source]

Make a Web3.call and if it fails get the Solidity stack trace.

  • We do debug_traceCall first to see if the call fails

  • If it does not fail we do the actual eth_call

Note

Because Anvil does not support trace_call yet, we just do this as sending the transaction. We assume the call does not change any state. See notes in trace_evm_call().

If not gas given, assume 1,000,000 gas units.

Parameters
  • func (web3.contract.contract.ContractFunction) – Prepared ContractFunction call.

  • transaction (Optional[web3.types.TxParams]) – Transactional parameters for the call, like gas limit and sender.

Raises

TransactionAssertionError – Outputs a verbose AssertionError on what went wrong.

Returns

Same results as you would have with func.call(transaction)

Return type

Any