57565 sc medium the amount of dust will be permanently locked in stargateethpoolstrategy
Description
Finding Description and Impact
Code Snippet
Mitigation
interface IStargatePool {
function deposit(address receiver, uint256 amountLD) external payable returns (uint256 amountLDOut);
function redeem(uint256 lpAmount, address receiver) external returns (uint256 amountLDOut);
@@ -42,13 +44,14 @@ contract StargateEthPoolStrategy is MYTStrategy {
function _allocate(uint256 amount) internal override returns (uint256) {
require(TokenUtils.safeBalanceOf(address(weth), address(this)) >= amount, "not enough WETH");
// unwrap to native ETH for Pool Native
- weth.withdraw(amount);
uint256 amountToDeposit = (amount / 1e12) * 1e12;
+ weth.withdraw(amountToDeposit);
+
uint256 dust = amount - amountToDeposit;
if (dust > 0) {
- emit StrategyAllocationLoss("Strategy allocation loss due to rounding.", amount, amountToDeposit);
+ emit StrategyAllocationLoss("Strategy allocation loss due to rounding.", amount, amountToDeposit);//@audit dust amounts should be returned to msg.sender
}Proof of Concept
Proof of Concept
Previous58469 sc low pending admin cannot accept ownershipNext57860 sc high incorrect mytsharesdeposited accounting inflates collateral and underreports bad debt enabling insolvency
Was this helpful?