Skip to main content
In this act, you will:
  • configure packages/tenderly
  • use stage:new command to create an entire environment with multiple Virtual Environments
  • use stage:activate to switch to the newly created environment
  • connect hardhat and nextjs to the environment using stage:connect:hardhat and stage:connect:nextjs
  • deploy contracts and interact with them
1
Configure the tenderly package
2
Go to packages/tenderly create an .env file by copying the .env.example:
3
cd packages/tenderly
cp .env.example .env
4
Populate environment variables
5
Then, populate the placeholders with following values in packages/tenderly/.env:
6
  • TENDERLY_ACCOUNT_ID and TENDERLY_PROJECT_ID (guide)
  • TENDERLY_ACCESS_TOKEN (guide).
  • 7
    Create a staging environment
    8
    From packages/tenderly run npm run stage:new local 1 34443 8453. This will create 3 Virtual Environments (from Mainnet, Mode, and Base).
    9
    cd packages/tenderly
    
    npm run stage:new local 1 34443 8453
    npm run stage:activate local
    
    10
    Then check:
    11
  • The file tenderly/environments/local.json
  • The file packages/tenderly/tenderly.config.ts
  • The list of Virtual Environments in your project
  • 12
    Deploy contracts
    13
    Link hardhat with the active environment and deploy contracts:
    14
    cd packages/tenderly
    npm run stage:connect:hardhat
    cd ../hardhat
    rm -rf deployments
    npx hardhat deploy --network virtual_mainnet
    
    15
    Check the Explorer.
    16
    Run the UI
    17
    Link hardhat with the active environment and deploy contracts:
    18
    cd packages/tenderly
    npm run stage:connect:nextjs
    cd ../nextjs
    npm run dev
    
    19
    Connect TheGraph
    20
    TheGraph is not really integrated, but just suppose it was
    21
    cd packages/tenderly
    npm run stage:connect:thegraph
    echo "Index it!"
    
    22
    Interact
    23
  • Grab funds from the faucet
  • Send a transaction
  • Check the explorer