# In the unlockProtectedListing() function, the interest that was supposed to be distributed to LP holders was instead burned.

Flayer's unlockProtectedListing burns the full unlock fee including interest, destroying LP yield and deflating collectionToken supply, breaking redemptions and utilization.

- Payout: Audit contest
- Severity: medium
- Program: Flayer
- Found by: 0x73696d616f
- Disclosed: 2024-08-06
- Write-up quality: 6/10
- Original: https://github.com/sherlock-audit/2024-08-flayer-judging/issues/431
- Library page: https://bugbountylibrary.com/r/sherlock%3A2024-08-flayer%3AM-14
- Tags: area:web3 domain:web3 impact:dos impact:funds-loss kind:contest platform:sherlock sev:medium tech:evm tech:solidity technique:source-review vuln:accounting-error vuln:reward-distribution

**Target:** ProtectedListings.sol unlockProtectedListing()
**Root cause:** unlockPrice() returns principal plus compounded interest, but the entire fee is burned via collectionToken.burnFrom instead of routing the interest portion to LP holders via implementation.depositFees as liquidateProtectedListing does.
**Steps:**
1. Create a protected listing via createProtectedListing, taking a loan of tokenTaken.
2. Wait so compound interest accrues on the loan.
3. Call unlockProtectedListing(_collection, _tokenId, true) as the listing owner.
4. Observe `fee = unlockPrice(...) * 10**denomination` includes interest, and `collectionToken.burnFrom(msg.sender, fee)` burns it all.
5. Compare with liquidateProtectedListing which calls `implementation.depositFees(_collection, 0, remainingCollateral)` to distribute interest to LPs.
6. Observe totalSupply deflates, utilizationRate() exceeds 100%, and interestRate_ spikes.
**How found:** Code review comparing unlockProtectedListing's burn of the full unlockPrice against liquidateProtectedListing's depositFees call, noticing interest is included in the fee but never routed to LPs.
**Exploitation:** Any listing owner unlocking a protected listing triggers the burn; no attacker capital needed. Repeated unlocks progressively deflate collectionToken supply, raising utilization above 100% and blocking new protected listings while LPs lose accrued interest.
**Escalation:** Repeated unlocks across many listings compound the supply deflation, eventually making some NFTs unredeemable and ProtectedListings unusable.
**Insight:** When a fee variable bundles principal and interest, check every consumer path (unlock vs liquidate) to confirm interest is routed to LPs rather than burned; supply-deflation bugs surface via utilizationRate() exceeding 100%.

## Proof of concept (copied exactly from the original report)

**unlockProtectedListing burns fee including interest**

```
uint fee = unlockPrice(_collection, _tokenId) * 10 ** denomination;
@>>        collectionToken.burnFrom(msg.sender, fee);

        // We need to burn the amount that was paid into the Listings contract
@>>        collectionToken.burn((1 ether - tokenTaken) * 10 ** denomination);
```

**unlockPrice compounds principal and interest**

```
unlockPrice_ = locker.taxCalculator().compound({
            _principle: listing.tokenTaken,
            _initialCheckpoint: collectionCheckpoints[_collection][listing.checkpoint],
            _currentCheckpoint: _currentCheckpoint(_collection)
```

**liquidateProtectedListing deposits fees to LPs**

```
uint remainingCollateral = (1 ether - listing.tokenTaken - KEEPER_REWARD) * 10 ** denomination;
        if (remainingCollateral > 0) {
            IBaseImplementation implementation = locker.implementation();
            collectionToken.approve(address(implementation), remainingCollateral);
@>>            implementation.depositFees(_collection, 0, remainingCollateral);
```

