For the complete documentation index, see llms.txt. This page is also available as Markdown.

Foundry

Foundry is a fast toolkit for application development written in Rust equipped with a testing framework, as well as utilities for interacting with smart contracts and getting chain data.

The FEVM Foundry Kit is a Foundry template for Filecoin EVM projects. It includes Solidity examples, Filecoin API examples, Foundry remappings, and verification tooling for Filecoin explorers.

Prerequisites

You must have the following installed:

You should also have an address on the Filecoin Calibration testnet. See the MetaMask setup page for information on how to get an address. You also need test tFIL in your wallet.

Steps

  1. Clone the filecoin-project/fevm-foundry-kit repository and move into the fevm-foundry-kit directory:

git clone https://github.com/filecoin-project/fevm-foundry-kit
cd fevm-foundry-kit
  1. Build the contracts and install the project’s npm dependencies:

forge build
npm install
  1. Export your private key from MetaMask. See the MetaMask documentation to find out how to export your private key.

  2. Create your env file by running:

  1. In your newly created .env, replace PRIVATE_KEY with the private key exported from MetaMask. Keep the Calibration RPC URL or replace it with your preferred Filecoin Calibration RPC endpoint:

  1. Load the variables in your current shell before running deployment commands:

Never commit .env files or real private keys. Anyone with access to the private key can spend funds from the account.

  1. Deploy the kit’s DealClient example contract to Calibration:

The deployment output is environment-dependent. Record the Deployed to address from Foundry’s output; you will need it for contract interactions and verification.

  1. You can now interact with your contract using the contract address given by Foundry.

Done! For more information, see the Foundry book.

Was this page helpful?

Last updated