Skip to content

[PR #38] p2: vBNB native collateral path has no test — no regression guard for issue #121 fix #130

@obchain

Description

@obchain

Summary

Issue #121 documents that the vBNB collateral redemption path is broken: IVToken(collateralVToken).redeem() returns native BNB (not ERC-20), so IERC20(collateralToken).balanceOf(address(this)) returns 0 and the swap swaps nothing. The fix requires a WBNB wrap step after redeem.

This test PR adds no test — not even a mocked unit test — that exercises the vBNB collateral path. Once #121 is fixed, there will be no regression guard ensuring the fix remains correct. Given that vBNB (0xA07c5b74C9B40447a954e1466938b865b6BBea36) is one of the most-liquidated collateral assets on Venus, this is a high-frequency production path.

Location

contracts/test/CharonLiquidator.t.sol — no test parameterizes collateralVToken = vBNB_ADDRESS or simulates a native BNB return from redeem

Fix

Add a mocked unit test with:

  1. A stub collateral vToken whose redeem() sends native BNB to address(liquidator) (via vm.deal + transfer).
  2. A stub WBNB that accepts native BNB deposits and mints ERC-20.
  3. Assert that the swap router receives WBNB, not zero, and the liquidation succeeds.

This test should remain skipped (via vm.skip) until #121 is fixed, but the test skeleton should exist so the fix author knows exactly what to verify.

Refs #38, Refs #121

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions