PR: #37 feat(contracts): full Aave + Venus + PancakeSwap liquidation flow
Commit: 54fe2bb
File: contracts/src/CharonLiquidator.sol lines 278-295
Problem: For vBNB collateral, IVToken.redeem(vBal) causes Venus vBNB contract to send raw native BNB via ETH transfer to caller. Code then immediately calls:
uint256 colBal = IERC20(p.collateralToken).balanceOf(address(this));
If p.collateralToken is native BNB sentinel (e.g. address(0) or 0xEeeee…), IERC20.balanceOf reverts or returns 0. Subsequent exactInputSingle receives amountIn = 0 and slippage guard (amountOutMinimum > 0) reverts. Every vBNB-collateral liquidation fails here.
Impact: vBNB collateral path — one of Venus's largest markets — non-functional at deployment. Silently skips profitable liquidation opportunities and reverts on-chain for any vBNB position.
Fix: After redeem(), check if seized collateral is vBNB; wrap received native BNB into WBNB before reading balanceOf:
if (p.collateralToken == WBNB) {
IWBNB(WBNB).deposit{value: address(this).balance}();
}
uint256 colBal = IERC20(p.collateralToken).balanceOf(address(this));
Add IWBNB interface and WBNB immutable (BSC mainnet: 0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c). Existing receive() payable already accepts native BNB; wrap step must follow.
PR: #37 feat(contracts): full Aave + Venus + PancakeSwap liquidation flow
Commit: 54fe2bb
File: contracts/src/CharonLiquidator.sol lines 278-295
Problem: For vBNB collateral,
IVToken.redeem(vBal)causes Venus vBNB contract to send raw native BNB via ETH transfer to caller. Code then immediately calls:If
p.collateralTokenis native BNB sentinel (e.g. address(0) or 0xEeeee…),IERC20.balanceOfreverts or returns 0. SubsequentexactInputSinglereceivesamountIn = 0and slippage guard (amountOutMinimum > 0) reverts. Every vBNB-collateral liquidation fails here.Impact: vBNB collateral path — one of Venus's largest markets — non-functional at deployment. Silently skips profitable liquidation opportunities and reverts on-chain for any vBNB position.
Fix: After
redeem(), check if seized collateral is vBNB; wrap received native BNB into WBNB before reading balanceOf:Add IWBNB interface and WBNB immutable (BSC mainnet:
0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c). Existingreceive() payablealready accepts native BNB; wrap step must follow.