Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ambitious Eggshell Panther - Withdrawing funds from a graduated market does not send fee to the protocolFeeAddress #132

Open
sherlock-admin2 opened this issue Dec 30, 2024 · 0 comments

Comments

@sherlock-admin2
Copy link

Ambitious Eggshell Panther

Medium

Withdrawing funds from a graduated market does not send fee to the protocolFeeAddress

Summary

Whenever a user buys or sells vote, appropriate fees is calculated which is sent to the protocolFeeAddress.
However when the withdrawGraduatedMarketFunds() is called the funds are sent to the authorized caller but it does not send any fee as it is missing the call to the applyFees().

Proof

As we can see below that when the authorized address call the withdrawGraduatedMarketFunds(), the funds stored in marketFunds is sent to the caller.

File: ReputationMarket.sol

   function withdrawGraduatedMarketFunds(uint256 profileId) public whenNotPaused nonReentrant {
    address authorizedAddress = contractAddressManager.getContractAddressForName(
      "GRADUATION_WITHDRAWAL"
    );
    if (msg.sender != authorizedAddress) revert UnauthorizedWithdrawal();

    _checkMarketExists(profileId);
    if (!graduatedMarkets[profileId]) revert MarketNotGraduated();

    if (marketFunds[profileId] == 0) revert InsufficientFunds();

    _sendEth(marketFunds[profileId]);
    emit MarketFundsWithdrawn(profileId, msg.sender, marketFunds[profileId]);
    marketFunds[profileId] = 0;
  }

But there is no call to applyFees(). Had the votes been sold, the protocol fee would have been sent but since withdrawGraduatedMarketFunds() is missing applyFees(), nothing is sent.

Impact

No protocol fee is sent to the protocolFeeAddress when funds from a graduated market (which still holds some funds) are withdrawn.

Tools Used

Manual Review

Recommendation

Calculate the fee for selling the remaining votes at the time of withdrawing from a graduated market & call applyFees() to send the fee to the protocolFeeAddress.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant