Make sure to install foundry: https://book.getfoundry.sh/getting-started/installation. Then, build the project:
forge build
To start testing, create a Contract.t.sol
file in the test
folder and write your tests.
Then, run the tests:
forge test
forge coverage
Start a local network:
anvil
Deploy the contract using the local network fork on http://localhost:8545:
forge script script/<file>.s.sol:<contract> --fork-url anvil --broadcast --private-key <anvil-private-key>
To deploy, create a new wallet keystore:
cast wallet import --interactive
# or
cast wallet new
Then, deploy the contract:
forge script script/<file>.s.sol:<script> --rpc-url base-sepolia --account <cast-account> --sender <address> --verify --verifier blockscout --verifier-url 'https://base-sepolia.blockscout.com/api/' --broadcast