EnsoFinance / temper

Temper your expectations - Ethereum Transaction Simulator
MIT License
343 stars 43 forks source link

State override in simulate-tx #22

Closed newlysama closed 10 months ago

newlysama commented 11 months ago

Hello, i've discoverd the temper project recently, and 'im trying to simulate a transaction overriding my balance. I want to send a tx to a contract that will perform operations, so i need to override it's balance, here is the body of the request :

body = { "chainId": 5, "from": account.address, "to": phantom.address, "data": tx['input'], "gasLimit": 500000, "blockNumber": w3.eth.get_block_number(), 'stateOverrides': { phantom.address: { 'balance': "100000000000000000000" } } }

The transaction is correctly simulated, but the phantom contract balance is not overriden (still 0), do you know what's the problem here ? :/ I'm testing my contract on goerli, maybe this can cause issues In the function i call in my contract, i have this require at the beginning :

require(address(this).balance > 0, "eth balance of phantom is empty :')");

Which always fails :/