Skip to content

icyfry/sandbox-foundry

Repository files navigation

Sandbox Foundry

Build Quality Gate Status

This repository contains source codes for experimentation with Foundry and Vue.js

Courses used in the repository

contracts folder contain Cryptozombies smart contracts and dapp folder contain a Vue.js frontend

Install and config

Doc to install foundry

curl -L https://foundry.paradigm.xyz | bash
source ~/.bashrc
foundryup

Install OpenZeppelin

forge install OpenZeppelin/openzeppelin-contracts --no-commit
forge install smartcontractkit/chainlink-brownie-contracts@0.8.0 --no-commit

If needed, to init remappings use forge remappings > remappings.txt

Add private key to foundry keystore

cast wallet import defaultKey --interactive

then add the password in contracts/.password file and PUBLIC_KEY_LOCAL public key in .env

VSCode Configuration

Frontend

The frontend in dapp has been created with vitejs and vitest for unit testing

Test Contracts

Run tests on contracts

task contracts-test
or
forge test --fork-url <URL>

Test call with cast for Cryptozombies

cast call 0x... "getZombiesByOwner(address _owner)" "0x..."

Gas

Create a gas usage snapshot file .gas-snapshot with forge snapshot

Run Contracts and Frontend

Launch a local testnet node, see Anvil doc

anvil

Build and deploy contracts

task contracts-build contracts-deploy

Launch frontend

task frontend-build frontend-run

Resources