`totalBPTSupply` will be excessively inflated
The `totalBPTSupply` will be excessively inflated as `totalSupply` was used instead of `virtualSupply`. This might cause a boosted balancer leverage vault not to be emergency settled in a timely manner and holds too large of a share of the liquidity within the pool, thus having problems exiting its position.\\nBalancer's Boosted Pool uses Phantom BPT where all pool tokens are minted at the time of pool creation and are held by the pool itself. Therefore, `virtualSupply` should be used instead of `totalSupply` to determine the amount of BPT supply in circulation.\\nHowever, within the `Boosted3TokenAuraVault.getEmergencySettlementBPTAmount` function, the `totalBPTSupply` at Line 169 is derived from the `totalSupply` instead of the `virtualSupply`. As a result, `totalBPTSupply` will be excessively inflated (2**(111)).\\n```\\nFile: Boosted3TokenAuraVault.sol\\n    function getEmergencySettlementBPTAmount(uint256 maturity) external view returns (uint256 bptToSettle) {\\n        Boosted3TokenAuraStrategyContext memory context = _strategyContext();\\n        bptToSettle = context.baseStrategy._getEmergencySettlementParams({\\n            maturity: maturity, \\n            totalBPTSupply: IERC20(context.poolContext.basePool.basePool.pool).totalSupply()\\n        });\\n    }\\n```\\n\\nAs a result, the `emergencyBPTWithdrawThreshold` threshold will be extremely high. As such, the condition at Line 97 will always be evaluated as true and result in a revert.\\n```\\nFile: SettlementUtils.sol\\n    function _getEmergencySettlementParams(\\n        StrategyContext memory strategyContext,\\n        uint256 maturity,\\n        uint256 totalBPTSupply\\n    )  internal view returns(uint256 bptToSettle) {\\n        StrategyVaultSettings memory settings = strategyContext.vaultSettings;\\n        StrategyVaultState memory state = strategyContext.vaultState;\\n\\n        // Not in settlement window, check if BPT held is greater than maxBalancerPoolShare * total BPT supply\\n        uint256 emergencyBPTWithdrawThreshold = settings._bptThreshold(totalBPTSupply);\\n\\n        if (strategyContext.vaultState.totalBPTHeld <= emergencyBPTWithdrawThreshold)\\n            revert Errors.InvalidEmergencySettlement();\\n```\\n\\n```\\nFile: BalancerVaultStorage.sol\\n    function _bptThreshold(StrategyVaultSettings memory strategyVaultSettings, uint256 totalBPTSupply)\\n        internal pure returns (uint256) {\\n        return (totalBPTSupply * strategyVaultSettings.maxBalancerPoolShare) / BalancerConstants.VAULT_PERCENT_BASIS;\\n    }\\n```\\n
Update the function to compute the `totalBPTSupply` from the virtual supply.\\n```\\n    function getEmergencySettlementBPTAmount(uint256 maturity) external view returns (uint256 bptToSettle) {\\n        Boosted3TokenAuraStrategyContext memory context = _strategyContext();\\n        bptToSettle = context.baseStrategy._getEmergencySettlementParams({\\n            maturity: maturity, \\n// Remove the line below\\n           totalBPTSupply: IERC20(context.poolContext.basePool.basePool.pool).totalSupply()\\n// Add the line below\\n   totalBPTSupply: context.poolContext._getVirtualSupply(context.oracleContext)\\n        });\\n    }\\n```\\n
Anyone (e.g. off-chain keeper or bot) that relies on the `SettlementUtils.getEmergencySettlementBPTAmount` to determine if an emergency settlement is needed would be affected. The caller will presume that since the function reverts, emergency settlement is not required and the BPT threshold is still within the healthy level. The caller will wrongly decided not to perform an emergency settlement on a vault that has already exceeded the BPT threshold.\\nIf a boosted balancer leverage vault is not emergency settled in a timely manner and holds too large of a share of the liquidity within the pool, it will have problems exiting its position.
```\\nFile: Boosted3TokenAuraVault.sol\\n    function getEmergencySettlementBPTAmount(uint256 maturity) external view returns (uint256 bptToSettle) {\\n        Boosted3TokenAuraStrategyContext memory context = _strategyContext();\\n        bptToSettle = context.baseStrategy._getEmergencySettlementParams({\\n            maturity: maturity, \\n            totalBPTSupply: IERC20(context.poolContext.basePool.basePool.pool).totalSupply()\\n        });\\n    }\\n```\\n