# Emergency unlocking penalty makes long duration positions economically advantageous

Static 2% emergency unlock penalty vs up to 16x reward weight for 1-year locks lets users farm boosted rewards then cheaply exit.

- Payout: Audit contest
- Severity: medium
- Program: MANTRA
- Credited: Lambda
- Disclosed: 2025-03-31
- Write-up quality: 6/10
- Original: https://code4rena.com/reports/2024-11-mantra-dex#m-15
- Library page: https://bugbountylibrary.com/r/c4%3A2024-11-mantra-dex%3AM-15
- Tags: domain:web3 impact:funds-loss kind:contest platform:code4rena sev:medium tech:solidity technique:source-review vuln:business-logic vuln:reward-distribution

**Target:** farm-manager contract (CosmWasm staking/lockup)
**Root cause:** Emergency unlock penalty is a fixed 2% set at initialization, independent of lock duration, while reward weight scales up to ~16x with lock duration.
**Steps:**
1. Create position with max unlock duration (e.g. 1 year) and 1000 tokens to get ~16x weight (16000).
2. Accrue boosted rewards over epochs.
3. Call emergency unlock, paying only fixed 2% (20 tokens).
4. Net: 16x rewards with effective liquidity at minimal cost.
5. Alternatively open huge position 1 second before epoch end and withdraw in new epoch.
**How found:** Code reading of deployment config (2% static penalty) compared against weight calculation function showing duration-scaled multiplier up to 16x; recognized economic mismatch between penalty and reward.
**Exploitation:** User locks max duration for highest weight multiplier, collects boosted emissions, then emergency-unlocks paying flat 2%, retaining liquidity while capturing 16x rewards; epoch-boundary sniping further extracts rewards from real users.
**Insight:** When a penalty is a flat percentage but rewards scale with a user-chosen parameter, check whether the parameter can be maxed for reward then cheaply exited; also probe epoch-boundary timing for reward sniping.
