Skip to content

[PR #37] p1-core: contracts/test/ absent — no fork tests for live liquidation logic #123

@obchain

Description

@obchain

PR: #37 feat(contracts): full Aave + Venus + PancakeSwap liquidation flow
Commit: 54fe2bb
File: contracts/ (test/ directory absent entirely)

Problem: PR #37 introduces complete on-chain liquidation path — flash-loan callback, Venus liquidateBorrow, vToken redeem, PancakeSwap swap, profit sweep — but ships zero Forge tests. PRD acceptance requires fork-test coverage of full flow before contract reviewable for production. Three p0 bugs (evm_version, pragma, cold wallet) and two p1 bugs (vBNB path, fee tier) in this PR would have been caught by one fork test replaying a real BSC liquidation.

Impact: No regression barrier. Future PRs can silently break liquidation callback, change profit accounting, or introduce new collateral paths without any test failure. Reviewers / auditors must manually trace logic without runnable reference.

Fix: Add contracts/test/CharonLiquidator.t.sol with Forge fork tests targeting BSC mainnet (rpc_endpoints.bnb already wired in foundry.toml). Minimum coverage:

  1. Happy path: BNB flash-loan, USDT debt liquidation, USDT collateral swap.
  2. vBNB collateral path: verify WBNB wrap and correct colBal after fix.
  3. Wrong fee tier: assert revert when fee=3000 passed for BTCB pair.
  4. Profit routing: assert COLD_WALLET (not owner) receives profit after fix.
  5. Access control: executeOperation reverts when called by non-Aave address.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions