Foundry-based smart contracts for the PayNode stateless payment router on Base L2.
src/: Core logic (PayNodeRouter.sol,MockUSDC.sol).test/: Unit, integration, and fuzz tests (*.t.sol).script/: Deployment and configuration scripts (*.s.sol).lib/: Forge standard library and OpenZeppelin dependencies.
- Logic:
src/PayNodeRouter.solcontains thepay()andpayWithPermit()entries. - Config:
script/Config.s.sol(auto-generated) holds protocol addresses and constants. - Tests:
test/PayNodeRouter.t.solprovides examples of permit signature generation. - Deployment:
script/DeploySepolia.s.solfor network-specific deployment logic.
- Testing: Use
vm.expectEmitfor allPaymentReceivedevents. - Permits: Always test
payWithPermitusingvm.signwith known private keys. - Gas: Monitor contract sizes with
forge build --sizesduring PRs. - Formatting: Strict adherence to
forge fmt. - Fuzzing: Use
uint256 amountfuzzing in tests to verify fee calculation at scale.
- No Storage: Never add
SSTOREoperations toPayNodeRouter. Use events only. - No Hardcoding: Do not hardcode addresses in
src/. Usescript/Config.s.sol. - Safe Transfer: Never use
transfer(). UseSafeERC20for all token movements. - Permit Safety: Don't ignore the
deadlineparameter in permit functions.