# Shares minted before assets settle

Mint or credit priced on reserves measured mid-operation, before deposits settle or repayment checks run

_Area: DeFi accounting and math bugs. Seen in 3 disclosed reports; latest 2025-07-28. Updated 2026-10-24._

## How it works
Share or LP accounting assumes reserves and the depositor's contribution are measured at a stable, honest moment. The bug appears when shares are priced or minted while reserves are temporarily wrong: drained to near zero, or skewed by a pending flash swap. The mint then uses a distorted denominator or an unvalidated share amount, so the depositor receives far more ownership than the assets they actually put in.

## Where it shows up
- A function that withdraws all liquidity, then makes an arbitrary external call, then re-deposits — any mint/burn reachable in that window [E1](https://bugbountylibrary.com/r/sherlock%3A2024-03-arrakis%3AH-3.md)
- The unchecked router/target address in that call is what lets the caller choose code to run mid-operation, inside the drained window [E1](https://bugbountylibrary.com/r/sherlock%3A2024-03-arrakis%3AH-3.md)
- Flash-swap callbacks that run before repayment/reserve validation, with addLiquidity callable inside the callback [E2](https://bugbountylibrary.com/r/dhl%3A20250728-avaxbifknpair.md)
- A deposit function returning a share amount that is later fed into a separate mint(shares) without re-derivation or bounds [E3](https://bugbountylibrary.com/r/dhl%3A20250617-metapool.md)

## How to review
Identify every path that mints or credits shares, and confirm the reserve/supply inputs are measured after all asset movements settle and cannot be influenced by a caller-controlled call in the same transaction. The invariant: shares issued must equal the depositor's actual contribution valued against honest, post-settlement reserves. Check that returned share amounts are validated before reuse, that flash callbacks cannot reach mint paths before repayment checks, and that any external call made while reserves are disturbed cannot reach a mint.

## Variants seen
- Arbitrary router call after full liquidity withdrawal lets executor mint at near-zero price [E1](https://bugbountylibrary.com/r/sherlock%3A2024-03-arrakis%3AH-3.md)
- Flash-swap callback distorts reserves so dust liquidity mints oversized LP shares [E2](https://bugbountylibrary.com/r/dhl%3A20250728-avaxbifknpair.md)
- Unvalidated share amount from deposit reused in mint, producing shares disproportionate to ETH deposited [E3](https://bugbountylibrary.com/r/dhl%3A20250617-metapool.md)

## Impact and severity
High: near-total vault drain (99%) [E1](https://bugbountylibrary.com/r/sherlock%3A2024-03-arrakis%3AH-3.md), oversized LP mint draining pool funds [E2](https://bugbountylibrary.com/r/dhl%3A20250728-avaxbifknpair.md), disproportionate mint and profit [E3](https://bugbountylibrary.com/r/dhl%3A20250617-metapool.md). Worse when the manipulation window is reachable by a privileged-but-restricted role or by any caller in one transaction.

## Why fixes fail
Evidence shows no fix or regression data.

## Evidence
- E1: https://bugbountylibrary.com/r/sherlock%3A2024-03-arrakis%3AH-3.md
- E2: https://bugbountylibrary.com/r/dhl%3A20250728-avaxbifknpair.md
- E3: https://bugbountylibrary.com/r/dhl%3A20250617-metapool.md
