F-2025-0003·incorrect-calculation

Minting to the active bin returns reduced/unfair shares for LPs

Acknowledgeddexammbinned-liquiditygithub.com/mira-amm/mira-binned-liquidity
TL;DR

Active-bin minting overestimates bin liquidity by including non-protocol fees, which produces reduced shares for LPs. Behaviour follows the LFJ V2 formula and was acknowledged rather than fixed.

Severity
MEDIUM
Impact
MEDIUM
Likelihood
HIGH
Method
MManual review
CAT.
Complexity
LOW
Exploitability
MEDIUM
02Section · Description

Description

When minting liquidity for an active bin, the shares minted for the liquidity provider are overpriced, further disincentivizing liquidity provision to the active bins and causing unfair share distribution for the providers.

code
/// Handle composition fees for active bin
#[storage(read, write)]
fn handle_composition_fees(
storage_keys: MintStorageKeys,
internal_bin_id: InternalBinId,
bin_reserves: Amounts,
amounts_in: Amounts,
fees: Amounts,
price: Price,
total_shares_in_bin: u256,
) -> (u256, Amounts) {
let amounts_after_fees = amounts_in.sub(fees);
let user_liquidity = get_liquidity(amounts_after_fees, price);
// ... code snippet ..
let non_protocol_fees = fees.sub(protocol_fees);
let bin_reserves_with_fees = bin_reserves.add(non_protocol_fees);
let bin_liquidity = get_liquidity(bin_reserves_with_fees, price);
let shares = math::uint256x256_math::mul_div_round_down(user_liquidity,
total_shares_in_bin, bin_liquidity);
(shares, amounts_in)
}

bin_reserves is topped up with the non-protocol fees, and the calculation for the shares uses this overestimated liquidity, not taking into account that total fees have already been deducted from the user.

While the code for calculating user obtained shares diminishes the LP value, the code follows strictly the LFJ V2 formula which has been accepted by the market for a long time already. That is why the chosen severity for it is Medium.

03Section · Impact

Impact

Liquidity providers minting to active bins receive fewer shares than the value they contribute, materially diminishing LP value over time and disincentivizing active-bin liquidity provision.

04Section · Recommendation

Recommendation

Use the normal bin_reserves for the calculation of the shares the user gets when providing liquidity for an active bin.

05Section · Resolution

Resolution

Acknowledged. The team chose to retain the LFJ V2 formula behaviour for compatibility.

F-2025-0003

oog
zealynx

Smart Contract Security Digest

Monthly exploit breakdowns, audit checklists, and DeFi security research — straight to your inbox

© 2026 Zealynx