56336 sc insight stargateethpoolstrategy deallocate would emit false deallocating loss event in some cases
Description
Brief/Intro
Vulnerability Details
function _deallocate(uint256 amount) internal override returns (uint256) {
// Compute LP needed ∝ TVL to withdraw `amount` underlying
// For Stargate, LP tokens are 1:1 with underlying
// So we can just redeem the amount directly
uint256 lpBalance = lp.balanceOf(address(this));
uint256 lpNeeded = amount; // 1:1 ratio
// Cap at available LP balance
if (lpNeeded > lpBalance) {
@> lpNeeded = lpBalance;
}
// Redeem LP to native ETH, then wrap back to WETH
lp.approve(address(pool), lpNeeded);
uint256 ethBalanceBefore = address(this).balance;
@> pool.redeem(lpNeeded, address(this));
uint256 ethBalanceAfter = address(this).balance;
uint256 ethRedeemed = ethBalanceAfter - ethBalanceBefore;
// @audit
if (ethRedeemed < amount) {
emit StrategyDeallocationLoss("Strategy deallocation loss which includes rounding loss.", amount, ethRedeemed);
}
Impact Details
References
Proof of Concept
Proof of Concept
Previous58626 sc critical repayment fee overpayment in liquidation repay only pathNext58133 sc low toke rewards permanently locked in strategy adapter
Was this helpful?