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 template repository contains submodules and remappings for ds-test assertions for testing, solmate building blocks for contracts, and forge-std to layer on top of EVM cheat codes to improve UX.
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
Clone the
filecoin-project/fevm-foundry-kitrepository and move into thefevm-foundry-kitdirectory:
git clone https://github.com/filecoin-project/fevm-foundry-kit/tree/main.git
cd fevm-foundry-kitInstall the project dependencies with Yarn:
yarn installExport your private key from MetaMask. See the MetaMask documentation to find out how to export your private key.
Create your env file by running
cp .env.example .envIn your newly created
.envreplacePRIVATE_KEYwith the one gathered from MetaMask. Also, do the same for theCALIBRATIONNET_RPC_URL.:
PRIVATE_KEY=eed8e9d727a647f7302bab440d405ea87d36726e7d9f233ab3ff88036cfbce9c
CALIBRATIONNET_RPC_URL=https://api.calibration.node.glif.io/rpc/v1Inside the
srcfolder in a contract calledSimpleCoin.sol. Deploy this contract using Foundry:
forge build
forge create --rpc-url https://api.calibration.node.glif.io/rpc/v1 --private-key $PRIVATE_KEY src/SimpleCoin.sol:SimpleCoin --broadcastYou can now interact with your contract using the contract address given by Foundry.
Done! For more information, see the Foundry book.
Last updated
Was this helpful?