Skip to content

Foundry for Tempo

Tempo builds on top of Foundry: the leading Ethereum development toolkit, through a custom fork that adds first-class support for Tempo.

This fork extends Foundry with Tempo's protocol-level features, enabling developers to build, test, and deploy contracts that go beyond the limits of standard EVM chains.

For general information about Foundry, see the Foundry documentation.

Get started with Foundry

Install using foundryup

Tempo's Foundry fork is installed through the standard upstream foundryup using the -n tempo flag, no separate installer is required.

Getting started is very easy:

Install regular foundryup:

curl -L https://foundry.paradigm.xyz | bash

Or if you already have foundryup installed:

foundryup --update

Next, run:

foundryup -n tempo

It will automatically install the latest nightly release of the precompiled binaries: forge and cast.

To install a specific version, replace <TAG_NAME> with the desired release tag:

foundryup -n tempo -i <TAG_NAME>

Verify Installation

forge -V

You should see version information include -tempo, indicating you are using the Tempo fork.

# forge <version>-tempo (<commit> <timestamp>)

Create a new Foundry project

Initialize a new project with Tempo support:

forge init -n tempo my-project && cd my-project

Each new project is configured for Tempo out of the box, with tempo-std, the Tempo standard library installed, containing helpers for Tempo's protocol-level features.

Use Foundry for your workflows

All standard Foundry commands are supported out of the box.

Test & deploy with forge locally

# Build your contracts
forge build
 
# Run all tests locally
forge test
 
# Run deployment scripts locally
forge script script/Mail.s.sol

Test & deploy with forge on Tempo's testnet

# Set environment variables
export TEMPO_RPC_URL=https://rpc.testnet.tempo.xyz
export VERIFIER_URL=https://scout.tempo.xyz/api/
 
# Optional: create a new keypair and request some testnet tokens from the faucet.
cast wallet new
cast rpc tempo_fundAddress <YOUR_WALLET_ADDRESS> --rpc-url $TEMPO_RPC_URL
 
# Run all tests on Tempo's testnet
forge test
 
# Deploy a simple contract
forge create src/Mail.sol:Mail \
  --rpc-url $TEMPO_RPC_URL \
  --interactive \
  --broadcast \
  --verify \
  --constructor-args 0x20c0000000000000000000000000000000000001
 
# Deploy a simple contract with custom fee token
forge create src/Mail.sol:Mail \
  --fee-token <FEE_TOKEN_ADDRESS> \
  --rpc-url $TEMPO_RPC_URL \
  --interactive \
  --broadcast \
  --verify \
  --constructor-args 0x20c0000000000000000000000000000000000001
 
# Run a deployment script and verify on Tempo's explorer
forge script script/Mail.s.sol \
  --rpc-url $TEMPO_RPC_URL \
  --interactive \
  --sender <YOUR_WALLET_ADDRESS> \
  --broadcast \
  --verify
 
# Run a deployment script with custom fee token and verify on Tempo's explorer
forge script script/Mail.s.sol \
  --fee-token <FEE_TOKEN_ADDRESS> \
  --rpc-url $TEMPO_RPC_URL \
  --interactive \
  --sender <YOUR_WALLET_ADDRESS> \
  --broadcast \
  --verify

Interact & debug with cast

# Check that your contract is deployed:
cast code <CONTRACT_ADDRESS> \
  --rpc-url $TEMPO_RPC_URL
 
# Interact with the contract, retrieving the token address:
cast call <CONTRACT_ADDRESS> "token()" \
  --rpc-url $TEMPO_RPC_URL
 
# Get the name of an ERC20 token:
cast erc20 name <TOKEN_ADDRESS> \
  --rpc-url $TEMPO_RPC_URL
 
# Check the ERC20 token balance of your address:
cast erc20 balance <TOKEN_ADDRESS> <YOUR_WALLET_ADDRESS> \
  --rpc-url $TEMPO_RPC_URL
 
# Transfer some of your ERC20 tokens:
cast erc20 transfer <TOKEN_ADDRESS> <RECEIVER_ADDRESS> <AMOUNT> \
  --rpc-url $TEMPO_RPC_URL \
  --interactive
 
# Transfer some of your ERC20 tokens with custom fee token:
cast erc20 transfer <TOKEN_ADDRESS> <RECEIVER_ADDRESS> <AMOUNT> \
  --fee-token <FEE_TOKEN_ADDRESS>
  --rpc-url $TEMPO_RPC_URL \
  --interactive
 
# Send a transaction with custom fee token:
cast send <CONTRACT_ADDRESS> <FUNCTION_SIGNATURE> \
  --fee-token <FEE_TOKEN_ADDRESS> \
  --rpc-url $TEMPO_RPC_URL \
  --interactive
 
# Replay a transaction by hash:
cast run <TX_HASH> \
  --rpc-url $TEMPO_RPC_URL

Limitations

Ledger and Trezor wallets are not yet compatible with the --fee-token option.