git clone https://github.com/worksofallwin/foundry-fund-me-v3.git
cd foundry-fund-me-v3
forge build
- Spin up the anvil chain
anvil
- To load .env in terminal
source .env
Deploy:
This will default to your local node. You need to have it running in another terminal in order for it to deploy.
make deployToAnvil
forge test
or
- Only run test functions matching the specified regex pattern.
forge test --mt testFunctionName
or
- To fork Sepolia chain
forge test --fork-url $SEPOLIA_RPC_URL
forge coverage
- Setup environment variables
-
You'll want to set your
SEPOLIA_RPC_URL
in environment variables. You can add them to a.env
file. -
SEPOLIA_RPC_URL
: This is url of the sepolia testnet node you're working with. You can get setup with one for free from Alchemy -
Optionally, add your
ETHERSCAN_API_KEY
if you want to verify your contract on Etherscan.
- Use wallet options to Encrypt Private Keys
-
To deploy the smart contract with encrypting private key
make deployToSepolia
You can estimate how much gas things cost by running:
forge snapshot
And you'll see and output file called .gas-snapshot
To run code formatting:
forge fmt