Skip to content

[PR #37] p1-core: PancakeSwap fee tier hardcoded 3000; BTCB/ETH/XVS pools need 500 or 10000 #122

@obchain

Description

@obchain

PR: #37 feat(contracts): full Aave + Venus + PancakeSwap liquidation flow
Commit: 54fe2bb
File: contracts/src/CharonLiquidator.sol line 289
File: contracts/src/interfaces/ISwapRouter.sol (ExactInputSingleParams.fee field)

Problem: Swap call hardcodes fee: 3000 (0.30% tier) for every collateral-to-debt swap. On PancakeSwap V3 on BSC, most liquid pools for BTCB, ETH, XVS do not exist at 3000 tier. Wrong fee → router computes pool address with zero or negligible liquidity; swap reverts on amountOutMinimum slippage guard or executes at extreme price against dust pool.

Impact: Liquidations involving BTCB, ETH, XVS collateral revert or execute at severely adverse prices. BTCB and ETH among highest-value Venus collateral markets — eliminates or corrupts large fraction of profitable opportunities.

Fix: Add poolFee: uint24 to LiquidationParams struct passed through flash-loan callback:

struct LiquidationParams {
    ...
    uint24 poolFee;
}

Use p.poolFee in ExactInputSingleParams instead of literal 3000. Off-chain Rust executor selects correct tier per market (500 for BTCB/ETH, 10000 for XVS, 3000 for USDT/BUSD pairs) before encoding calldata.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions