How to simulate a transaction and debug it ?
On tenderly you can add any contract and simulate transactions.
Step 1: Find the contract you want to interact with, in this example we will use the SushiBar contract. Find the address and enter it in the search bar.
Image Not Showing
Possible Reasons
- The image file may be corrupted
- The server hosting the image is unavailable
- The image path is incorrect
- The image format is not supported
Learn More โ
Step 2: Add the contract to your project.
Image Not Showing
Possible Reasons
- The image file may be corrupted
- The server hosting the image is unavailable
- The image path is incorrect
- The image format is not supported
Learn More โ
Image Not Showing
Possible Reasons
- The image file may be corrupted
- The server hosting the image is unavailable
- The image path is incorrect
- The image format is not supported
Learn More โ
Step 3: Go in the contract tab and find the contract you just added and click on it.
Image Not Showing
Possible Reasons
- The image file may be corrupted
- The server hosting the image is unavailable
- The image path is incorrect
- The image format is not supported
Learn More โ
Image Not Showing
Possible Reasons
- The image file may be corrupted
- The server hosting the image is unavailable
- The image path is incorrect
- The image format is not supported
Learn More โ
Step 4: Once on the contract page, click on simulate a transaction.
Image Not Showing
Possible Reasons
- The image file may be corrupted
- The server hosting the image is unavailable
- The image path is incorrect
- The image format is not supported
Learn More โ
Step 5: Select the function you want to call, I will call the enter function which allows to enter in the sushiBar (convert Sushi into xSUSHI). I will enter 1 Sushi in the amount (18 zero = decimals).
Image Not Showing
Possible Reasons
- The image file may be corrupted
- The server hosting the image is unavailable
- The image path is incorrect
- The image format is not supported
Learn More โ
Image Not Showing
Possible Reasons
- The image file may be corrupted
- The server hosting the image is unavailable
- The image path is incorrect
- The image format is not supported
Learn More โ
Step 6: On the right you can change how you want to call the function : You can change the block, the caller, the gas price etcโฆ
I will call with a random empty address I just created.
Image Not Showing
Possible Reasons
- The image file may be corrupted
- The server hosting the image is unavailable
- The image path is incorrect
- The image format is not supported
Learn More โ
Step 7: We are now on the transaction page. As you can see my transaction was reverted because I don't have any Sushi in my wallet.
Image Not Showing
Possible Reasons
- The image file may be corrupted
- The server hosting the image is unavailable
- The image path is incorrect
- The image format is not supported
Learn More โ
Step 8: Sometime you will need more details to understand why a transaction failed, you can scroll down and use the debugger. Inside the debugger you can jump up and down between every action and function calls to find where the error happened.
In this example we see that at the moment of the transfer it failed because our amount exceeds our balance.
Image Not Showing
Possible Reasons
- The image file may be corrupted
- The server hosting the image is unavailable
- The image path is incorrect
- The image format is not supported
Learn More โ
Image Not Showing
Possible Reasons
- The image file may be corrupted
- The server hosting the image is unavailable
- The image path is incorrect
- The image format is not supported
Learn More โ
Image Not Showing
Possible Reasons
- The image file may be corrupted
- The server hosting the image is unavailable
- The image path is incorrect
- The image format is not supported
Learn More โ
Good job ! You now are able to simulate and analyze transactions on tenderly.
Image Not Showing
Possible Reasons
- The image file may be corrupted
- The server hosting the image is unavailable
- The image path is incorrect
- The image format is not supported
Learn More โ