Docs

Testing

24 tests across four files, including a suite forked against real BSC mainnet PancakeSwap contracts.

24 tests, four files

contracts/test/ covers each contract in isolation, plus an integration suite forked against real BSC mainnet state:

forge test
$ forge test
Ran 5 tests for test/SnowballRegistry.t.sol:SnowballRegistryTest
Suite result: ok. 5 passed; 0 failed; 0 skipped
Ran 6 tests for test/FeeRouter.t.sol:FeeRouterTest
Suite result: ok. 6 passed; 0 failed; 0 skipped
Ran 10 tests for test/SnowballToken.t.sol:SnowballTokenTest
Suite result: ok. 10 passed; 0 failed; 0 skipped
Ran 3 tests for test/Integration.t.sol:IntegrationTest
Suite result: ok. 3 passed; 0 failed; 0 skipped
Ran 4 test suites: 24 tests passed, 0 failed, 0 skipped

Why Integration.t.sol forks real mainnet

Integration.t.sol calls vm.createSelectFork() against a live BSC RPC and runs everything against that fork: seeding real liquidity, buying and selling through the actual deployed PancakeSwap router, then calling swapAndBurn against the real router and factory, not a mock. It costs zero gas and zero real funds (it's a read/simulate fork, nothing is broadcast), and it's the closest thing to a mainnet dry run available before actually deploying.

The reentrancy proof

test/mocks/MaliciousToken.sol is a token whose burn() calls back into FeeRouter.swapAndBurn(). The test in FeeRouter.t.sol asserts the outer call reverts, proving the guard holds under an actual reentrancy attempt, not just by inspection.

Running it yourself

1

Set up the RPC

Copy contracts/.env.example to contracts/.env. The public default (bsc-dataseed.binance.org) works for tests; swap in a paid provider if you hit rate limits.
2

Build

cd contracts && forge build --sizes
3

Test

forge test -vvv, which includes the mainnet-forked integration suite automatically.
4

Format check

forge fmt --check, matching what CI (.github/workflows/test.yml) runs.