Skip to content
This repository has been archived by the owner on May 26, 2023. It is now read-only.

Breeje - doCutDepositFee and doCutWithdrawFee doesn't take FEES ON TRANSFER TOKENS in account #275

Closed
github-actions bot opened this issue Mar 1, 2023 · 0 comments
Labels
Duplicate A valid issue that is a duplicate of an issue with `Has Duplicates` label Medium A valid Medium severity issue Reward A payout will be made for this issue

Comments

@github-actions
Copy link

github-actions bot commented Mar 1, 2023

Breeje

medium

doCutDepositFee and doCutWithdrawFee doesn't take FEES ON TRANSFER TOKENS in account

Summary

Fees on transfer case not considered in couple of methods.

Vulnerability Detail

In BlueBerryBank, doCutDepositFee and doCutWithdrawFee methods transfers the fees but doesn't handle fees on transfer condition.

Impact

The passes value of deducting the fees can be incorrect.

Code Snippet

File: BlueBerryBank.sol

    function doCutDepositFee(address token, uint256 amount)
        internal
        returns (uint256)
    {
        if (config.treasury() == address(0)) revert NO_TREASURY_SET();
        uint256 fee = (amount * config.depositFee()) / DENOMINATOR;
        IERC20Upgradeable(token).safeTransfer(config.treasury(), fee);
        return amount - fee;
    }

    function doCutWithdrawFee(address token, uint256 amount)
        internal
        returns (uint256)
    {
        if (config.treasury() == address(0)) revert NO_TREASURY_SET();
        uint256 fee = (amount * config.withdrawFee()) / DENOMINATOR;
        IERC20Upgradeable(token).safeTransfer(config.treasury(), fee);
        return amount - fee;
    }

Link to code

Tool used

Manual Review

Recommendation

Recommend to check balance before and after transfer and return the value accordingly

Duplicate of #153

@github-actions github-actions bot added Duplicate A valid issue that is a duplicate of an issue with `Has Duplicates` label Medium A valid Medium severity issue labels Mar 1, 2023
@github-actions github-actions bot closed this as completed Mar 1, 2023
@sherlock-admin sherlock-admin added the Reward A payout will be made for this issue label Mar 19, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Duplicate A valid issue that is a duplicate of an issue with `Has Duplicates` label Medium A valid Medium severity issue Reward A payout will be made for this issue
Projects
None yet
Development

No branches or pull requests

1 participant