# Minting stake tokens is not updating the pool's borrowing fee rate

Minting stake tokens adds pool liquidity but fails to update the borrowing fee rate, causing unfair fee accrual and skewed liquidations.

- Payout: Contest reward
- Severity: high
- Program: Elfi Protocol
- Credited: mstpr-brainbot
- Disclosed: 2024-05-09
- Write-up quality: 6/10
- Original: https://github.com/sherlock-audit/2024-05-elfi-protocol-judging/issues/136
- Library page: https://bugbountylibrary.com/r/sherlock%3A2024-05-elfi-protocol%3AH-26
- Tags: domain:web3 impact:funds-loss kind:contest platform:sherlock sev:high tech:solidity technique:source-review vuln:accounting-error vuln:business-logic

**Target:** LpPool borrowing rate / MintProcess stake minting
**Root cause:** MintProcess._mintStakeToken calls pool.addBaseToken but never recomputes the pool's borrowing rate, so getLongBorrowingRatePerSecond uses stale holdAmount/totalAmount ratios.
**Steps:**
1. Call mint stake token flow in MintProcess._mintStakeToken, which invokes pool.addBaseToken(cache.mintTokenAmount).
2. Observe borrowing rate is derived from holdAmount/totalAmount in getLongBorrowingRatePerSecond.
3. Note totalAmount increased but rate not recalculated, leaving stale rate applied to positions.
4. Compare with opening orders which do update rates after base amount changes.
**How found:** Code review of MintProcess minting path versus rate calculation in MarketQueryProcess, noticing addBaseToken changes pool totals without a corresponding rate update, unlike the open-order path.
**Insight:** When a pool's balance-mutating function changes utilization inputs, check every derived rate/view function for a matching refresh call; compare against sibling paths (open orders) that do update rates to spot the missing one.
