Project work for learning Solidity and Foundry. Local testing and development has more relaxed key management for faster feedback cycles. Production development notes at end of document.
To add a new project folder in the main directory, execute
forge init project-name
Then in project-name
delete the .gitmodules
file and the .git/
directory to make this new project not a git submodule. Then any changes can be tracked normally with git.
Check that .env
is in the .gitignore
then add the first anvil private key, and the RPC URL to .env
as environment variables
PRIVATE_KEY=0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80
RPC_URL=http://127.0.0.1:8545
In one shell run anvil
In a second shell run
forge script script/DeployScript.s.sol --rpc-url $RPC_URL --broadcast --private-key $PRIVATE_KEY
Do not use a .env
file to store environment variables for private keys. Use cast
to store an account, following these instructions