# 2 variables not indexed by marketIndex

Two snapshot mappings in Float Capital's Staker.sol lacked a marketIndex key, letting one market overwrite another's shift-index state and misallocate float issuance.

- Payout: Audit contest
- Severity: high
- Program: Float Capital
- Found by: gpersoon
- Disclosed: 2021-09-16
- Write-up quality: 6/10
- Original: https://github.com/code-423n4/2021-08-floatcapital-findings/issues/8
- Library page: https://bugbountylibrary.com/r/c4%3A2021-08-floatcapital%3AH-02
- Tags: area:web3 domain:web3 impact:integrity kind:contest platform:code4rena sev:high tech:solidity technique:source-review vuln:accounting-error

**Target:** Staker.sol token contract (Solidity)
**Root cause:** stakerTokenShiftIndex_to_longShortMarketPriceSnapshotIndex_mapping and stakerTokenShiftIndex_to_accumulativeFloatIssuanceSnapshotIndex_mapping are keyed only by tokenShiftIndex, not marketIndex, so two markets sharing the same batched_stakerNextTokenShiftIndex collide and overwrite each other's entries.
**Steps:**
1. Read pushUpdatedMarketPricesToUpdateFloatIssuanceCalculations in Staker.sol L622.
2. Observe batched_stakerNextTokenShiftIndex is per-marketIndex but the two snapshot mappings are keyed only by that index value.
3. Note that if batched_stakerNextTokenShiftIndex[market1] == batched_stakerNextTokenShiftIndex[market2], writes from market2 overwrite market1's snapshot entries.
4. Downstream _calculateAccumulatedFloat reads corrupted snapshots, allocating too much or too little float.
**How found:** Code reading: noticed one variable was indexed by marketIndex while two sibling mappings were not, and reasoned that equal shift indices across markets would collide.
**Insight:** When auditing per-market accounting, check that every state mapping keyed by a shared counter also includes the market/asset identifier; a single unindexed sibling mapping among indexed ones signals a collision bug.

