hats-finance / ether-fi-0x36c3b77853dec9c4a237a692623293223d4b9bc4

Smart Contracts for Ether Fi dapp
1 stars 1 forks source link

Users can't withdraw their deposits from `LiquidityPool` #45

Open hats-bug-reporter[bot] opened 11 months ago

hats-bug-reporter[bot] commented 11 months ago

Github username: -- Submission hash (on-chain): 0x957746d44ea354bc488287fb74e7ad667a71a205f08c522eec23eb90f9d4ec93 Severity: high

Description: Description

Attack Scenario

Attachments

Revised Code File LiquidityPool.withdraw function

   function withdraw(address _recipient, uint256 _amount) external whenNotPaused returns (uint256) {
       uint256 share = sharesForWithdrawalAmount(_amount);
-       require(msg.sender == address(withdrawRequestNFT) || msg.sender == address(membershipManager), "Incorrect Caller");
       if (totalValueInLp < _amount || (msg.sender == address(withdrawRequestNFT) && -ethAmountLockedForWithdrawal < _amount) || eETH.balanceOf(msg.sender) < _amount) revert InsufficientLiquidity();

       if (_amount > type(uint128).max || _amount == 0 || share == 0) revert InvalidAmount();

       totalValueInLp -= uint128(_amount);
       if (msg.sender == address(withdrawRequestNFT)) {
           ethAmountLockedForWithdrawal -= uint128(_amount);
       }

       eETH.burnShares(msg.sender, share);

       (bool sent, ) = _recipient.call{value: _amount}("");
       if (!sent) revert SendFail();

       return share;
   }
seongyun-ko commented 11 months ago

Withdrawal is made via requestWithdraw functions. WithdrawRequestNFT is involved. Plz check those code

seongyun-ko commented 11 months ago

close