Smart Contracts

Adding a Contract to your Project via Tenderly Dashboard

After deploying a contract to a Tenderly Fork using a JSON-RPC, REST API or a Simulation you can verify your contract so Tenderly can decode everything into a human readable format.
There are several ways you can add a contract to your project from the Dashboard.

Import public contract

You can import any public (verified) contract by pasting the address...
... or by uploading a JSON...
... or by pasting the contract source from a file/uploading a source file...
... or by uploading the source file itself.

Uploading the source directory

By using the directory option, you can batch upload more than one contract at a time:
If any of the files for verifying your contracts is missing you will be prompted to add them in the list of contract on top:
You will be prompted to choose which contract to upload if the file contains multiple contracts, as well as to define the following:
  • Which network is the contract deployed to.
  • What is it's address
  • (Optionally) add the library name and address for specific contracts that require them.
When your contract is added you can continue to add contracts from this screen via the + Add more button:
The last thing to do is to fill out the compiler info with the following parameters:
  • Compiler Version (automatically refreshed list from Solidity GitHub).
  • Optimizations Used (true/false).
  • Optimization Count.
  • EVM Version (latest is always the default).
Note that choosing the correct Compiler Version for your contract is important to avoid compiler (bytecode mismatch) errors.

CLI Upload

Adding a contract to your project via Tenderly CLI

First things first, we need to get your Smart Contracts into Tenderly to use all of the timesaving features like the Visual Debugger, Gas Profiler, Alerts, and more.
There are a couple of ways we can achieve this: we can use the Tenderly CLI to push contracts to a project, or we can verify our Smart Contracts on Etherscan and then paste in the address into Tenderly. Let's see how we'd do this via the CLI.
If you don't have the Tenderly CLI already installed, it's effortless to set up. Once you've done that, run tenderly login.
The next step is to go into your project directory and run tenderly init. As I'm using the Tennis Match example from a previous article, I'm going to pick Create new project and write Tennis Match.
1
$ tenderly init
2
โœ” Create new project
3
โœ” Project: Tennis Match
4
Project successfully initialized. You can change the project information by editing the tenderly.yaml file or by rerunning tenderly init with the --re-init flag.
Copied!
That's it! Your project is all set up, and you can push it for the first time to Tenderly.
In order for Tenderly to monitor your Smart Contracts in real-time, you need to push them to your dashboard. Pushing your Smart Contracts is as easy as running the tenderly push command. Let's try it now:
1
$ tenderly push
2
Setting up your project...
3
Analyzing Truffle configuration...
4
โ€‹
5
Pushing Smart Contracts for project: tennis-match
6
We have detected the following Smart Contracts:
7
โ€ข Migrations
8
โ€ข TennisMatch
9
โ€‹
10
Successfully pushed Smart Contracts for project tennis-match. You can view your contracts at https://dashboard.tenderly.dev/Habic/tennis-match/contracts
11
โ€‹
12
All Smart Contracts successfully pushed.
Copied!
Now when you open your Tenderly dashboard, you'll see your newly created project, and your Smart Contracts added!
Last modified 1mo ago