Context
Before a single mainnet tx, the liquidator contract must pass fork tests against real BSC state. Fork tests pin a block number, fork the chain in-memory, and execute the full flow with real reserves — the closest we get to mainnet without spending gas.
Scope
contracts/test/CharonLiquidator.t.sol
- Fork setup: pin a block number where a known Venus position is liquidatable
- Happy path: full liquidation, assert profit > 0, assert flash-loan repaid in full
- Slippage path: force a bad
minAmountOut, assert tx reverts (no state change)
- Authorization: call
executeLiquidation from non-owner, assert revert
- Multi-market: parameterize test to run across top-5 Venus vTokens (BNB, USDT, USDC, BTCB, ETH)
- Foundry
forge snapshot to lock gas costs
Acceptance criteria
References
Context
Before a single mainnet tx, the liquidator contract must pass fork tests against real BSC state. Fork tests pin a block number, fork the chain in-memory, and execute the full flow with real reserves — the closest we get to mainnet without spending gas.
Scope
contracts/test/CharonLiquidator.t.solminAmountOut, assert tx reverts (no state change)executeLiquidationfrom non-owner, assert revertforge snapshotto lock gas costsAcceptance criteria
forge test --fork-url <bsc-rpc>passes all tests.gas-snapshot) and checked in CIReferences