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:
- A stub collateral vToken whose
redeem() sends native BNB to address(liquidator) (via vm.deal + transfer).
- A stub WBNB that accepts native BNB deposits and mints ERC-20.
- 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
Summary
Issue #121 documents that the vBNB collateral redemption path is broken:
IVToken(collateralVToken).redeem()returns native BNB (not ERC-20), soIERC20(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 parameterizescollateralVToken = vBNB_ADDRESSor simulates a native BNB return from redeemFix
Add a mocked unit test with:
redeem()sends native BNB toaddress(liquidator)(viavm.deal+ transfer).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