# Reserving a listing checkpoints the collection's `compoundFactor` at an intermediary higher compound factor

Reserving a listing checkpoints compoundFactor mid-transaction while CollectionToken totalSupply is temporarily reduced, inflating utilization and interest on the new protected loan.

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

**Target:** Listings.reserve / ProtectedListings.createListings checkpoint logic
**Root cause:** reserve() burns _collateral before createListings() checkpoints compoundFactor, so utilizationRate is computed against a temporarily reduced totalSupply; the second burn and listingCount increment happen after the checkpoint.
**Steps:**
1. Call `Listings.reserve(collection, tokenId, _collateral)` on a collection with existing protected listings.
2. Observe order: tax refund transfer, price transfer, `collectionToken.burnFrom(msg.sender, _collateral)` (totalSupply drops), then `protectedListings.createListings(...)`.
3. Inside createListings, `_createCheckpoint` calls `utilizationRate` which reads the reduced `collectionToken.totalSupply()`, producing an inflated utilization.
4. `calculateCompoundedFactor` stores the inflated compoundedFactor in the checkpoint and the new listing references it.
5. After the call, `burn((1 ether - _collateral))` and `listingCount++` restore supply, but the checkpoint remains wrong; repeat reserves compound the error.
**How found:** Code-reading of reserve()'s CollectionToken operation ordering (transfer, transfer, burn, mint, transfer, burn) and noticing createListings checkpoints compoundFactor between the first burn and the mint.
**Exploitation:** No attacker action needed; any user reserving a listing triggers the mischeckpoint, causing all borrowers in the collection to accrue higher interest than correct.
**Escalation:** Error compounds with each reserve() call and grows with longer time between checkpoints.
**Insight:** When auditing interest/rate checkpointing, trace the exact ordering of totalSupply-mutating calls (burn/mint/transfer) around the checkpoint call; any transient supply change between checkpoint and final state skews utilization-derived rates.

