foundry-testing

UNLICENSE License

Stars
9

Foundry Testing

Test coverage

Quick test coverage:

forge coverage

Detailed test logs:

forge test --vvv

Detailed branch coverage:

  1. Run
forge coverage --report lcov && genhtml lcov.info -o report --branch-coverage
  1. Check coverage results in
report/index.html
  1. Delete the following before pushing to GitHub to keep commits lightweight:
lcov.info
reports

Fork a network and get coverage results:

forge coverage --fork-url $mainnetHTTPS_InfuraAPIKey --report lcov && genhtml lcov.info -o report --branch-coverage

Deploy and Verify

(reference: https://docs.moonbeam.network/builders/build/eth-api/verify-contracts/etherscan-plugins/):

Base Sepolia with EIP-1559 Gas (Default)

forge create src/Contract.sol:SimpleStorage \
--private-key $devTestnetPrivateKey \
--rpc-url $baseSepoliaHTTPS \
--etherscan-api-key $basescanApiKey \
--verify 

Base Sepolia with Legacy Gas

forge create src/Contract.sol:SimpleStorage \
--private-key $devTestnetPrivateKey \
--rpc-url $baseSepoliaHTTPS \
--etherscan-api-key $basescanApiKey \
--verify \
--legacy

Blockscout Updated

forge create --rpc-url https://rpc.jolnir.taiko.xyz --private-key $devTestnetPrivateKey src/Contract.sol:SimpleStorage --verify --verifier blockscout --verifier-url https://blockscoutapi.jolnir.taiko.xyz/api\?

Blockscout Outdated

forge create --rpc-url https://rpc.test.taiko.xyz --private-key $devTestnetPrivateKey src/Contract.sol:SimpleStorage --verify --verifier blockscout --verifier-url https://explorer.test.taiko.xyz/api\? 

Testnet Bridges Sepolia to L2 EVM Rollups

Base Sepolia

https://superbridge.app/base-sepolia

Optimism Sepolia

https://superbridge.app/op-sepolia