# Incomplete TVL Calculation in AerodromeConnector::_getPositionTVL Function

AerodromeConnector._getPositionTVL ignores liquidity tokens staked in the gauge, understating vault TVL and corrupting share-price calculations.

- Payout: Audit contest
- Severity: high
- Program: NOYA
- Found by: KupiaSec
- Disclosed: 2025-02-17
- Write-up quality: 6/10
- Original: https://github.com/code-423n4/2024-04-noya-findings/issues/1360
- Library page: https://bugbountylibrary.com/r/c4%3A2024-04-noya%3AH-06
- Tags: area:web3 domain:web3 impact:funds-loss kind:contest platform:code4rena sev:high tech:evm tech:solidity technique:source-review vuln:accounting-error vuln:share-inflation

**Target:** AerodromeConnector Solidity connector (_getPositionTVL / stake)
**Root cause:** stake() deposits pool LP tokens into the Aerodrome gauge, but _getPositionTVL only reads IERC20(pool).balanceOf(address(this)), omitting the gauge-held balance.
**Steps:**
1. Call `AerodromeConnector.stake(pool, liquidity)`; LP tokens transfer to `voter.gauges(pool)` gauge via `IGauge.deposit`.
2. Call `_getPositionTVL(p, base)`; it computes balance solely from `IERC20(pool).balanceOf(address(this))`.
3. Observe returned TVL excludes staked liquidity, understating position value.
4. Fix: add `IERC20(gauge).balanceOf(address(this))` to balance.
**How found:** Code review comparing stake()'s token flow into the gauge against _getPositionTVL's balance source, spotting the missing gauge balance.
**Escalation:** Understated TVL feeds share/price calculation, mispricing vault shares.
**Insight:** When a connector both holds and stakes the same LP token, verify every TVL/accounting read sums all custody locations (wallet + gauge/staking contract), not just the token balance.

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

**AerodromeConnector stake deposits liquidity to gauge**

```
function stake(address pool, uint256 liquidity) public onlyManager nonReentrant {
101:         address gauge = voter.gauges(pool);
102:         IERC20(pool).forceApprove(address(gauge), liquidity);
103:         IGauge(gauge).deposit(liquidity, address(this));  // @audit-info this sends tokens to the gauge
```

**Gauge deposit transfers staking tokens to gauge**

```
function _depositFor(uint256 _amount, address _recipient) internal nonReentrant {
        if (_amount == 0) revert ZeroAmount();
        if (!IVoter(voter).isAlive(address(this))) revert NotAlive();


        address sender = _msgSender();
        _updateRewards(_recipient);


        IERC20(stakingToken).safeTransferFrom(sender, address(this), _amount); // @audit-info liquidity tokens are sent to the gauge.
```

**_getPositionTVL only counts pool balance not gauge**

```
function _getPositionTVL(HoldingPI memory p, address base) public view override returns (uint256) { 
126:         PositionBP memory pBP = registry.getPositionBP(vaultId, p.positionId);
127:         (address pool) = abi.decode(pBP.data, (address));
128:         uint256 balance = IERC20(pool).balanceOf(address(this)); // @audit-issue only accounts the liquidity token balance at the aerodrome pool, does not include the gauge pool
```

