sherlock-audit / 2023-04-unitasprotocol-judging

4 stars 3 forks source link

Avci - lack of receive _Balance logic in contract PoolBalances.sol #159

Closed sherlock-admin closed 1 year ago

sherlock-admin commented 1 year ago

Avci

medium

lack of receive _Balance logic in contract PoolBalances.sol

Summary

lack of receive _Balance logic in contract PoolBalances.sol

Vulnerability Detail

in the contract poolbalances.sol we have two mappings

   mapping(address => uint256) internal _balance;

    mapping(address => uint256) internal _portfolio;

we have receive for _portfoilo to update the portfolio mapping for receives but not for _balance mapping

 function _receivePortfolio(address token, address sender, uint256 amount) internal virtual {

Impact

we need it for updating after receiving balance

Code Snippet

 function _receivePortfolio(address token, address sender, uint256 amount) internal virtual {

https://github.com/sherlock-audit/2023-04-unitasprotocol/blob/main/Unitas-Protocol/src/PoolBalances.sol#L64

Tool used

Manual Review

Recommendation