# The _currentExchangeRate of the Vault contract can't increase and will always be lower than or equal to _assetUnit

PoolTogether Vault's _currentExchangeRate is capped by _lastRecordedExchangeRate, so a temporarily under-collateralized YieldVault can never re-collateralize, blocking deposits.

- Payout: Contest reward
- Severity: high
- Program: PoolTogether
- Credited: KIntern\_NA
- Disclosed: 2023-09-27
- Write-up quality: 6/10
- Original: https://github.com/code-423n4/2023-07-pooltogether-findings/issues/443
- Library page: https://bugbountylibrary.com/r/c4%3A2023-07-pooltogether%3AH-01
- Tags: domain:web3 impact:dos kind:contest platform:code4rena sev:high tech:evm tech:solidity vuln:accounting-error vuln:business-logic

**Target:** ERC4626 Vault contract exchange rate logic over YieldVault
**Root cause:** The clamp `if (_withdrawableAssets > _totalSupplyToAssets) _withdrawableAssets = _totalSupplyToAssets` forces _currentExchangeRate <= _lastRecordedExchangeRate, so the rate can never rise back to _assetUnit after under-collateralization.
**Steps:**
1. Read `_currentExchangeRate()`: computes `_totalSupplyToAssets = _convertToAssets(_totalSupply(), _lastRecordedExchangeRate, Down)`.
2. Note `_withdrawableAssets = _yieldVault.maxWithdraw(address(this))` is clamped down to `_totalSupplyToAssets` when larger.
3. Return value is `_withdrawableAssets.mulDiv(_assetUnit, _totalSupplyAmount, Down)`, hence always <= `_lastRecordedExchangeRate` <= `_assetUnit`.
4. Add `assert(_withdrawableAssets.mulDiv(_assetUnit, _totalSupplyAmount, Down) <= _assetUnit)` and run `forge test`; all tests pass.
5. When YieldVault is under-collateralized, rate < _assetUnit and can never recover, so deposits are blocked.
**How found:** Code reading of the exchange-rate function; noticed the clamp against _totalSupplyToAssets mathematically bounds the returned rate, then confirmed with an added assert across the test suite.
**Insight:** When auditing ERC4626-style vaults, check whether any clamp on withdrawable assets also caps the exchange rate; a rate that can only decrease means a momentary under-collateralization becomes permanent and blocks recapitalization.
