Platform: Code4rena
Start Date: 30/11/2021
Pot Size: $100,000 USDC
Total HM: 15
Participants: 36
Period: 7 days
Judge: 0xean
Total Solo HM: 4
Id: 62
League: ETH
Rank: 31/36
Findings: 3
Award: $362.31
🌟 Selected for report: 0
🚀 Solo Findings: 0
🌟 Selected for report: harleythedog
Also found by: WatchPug, csanuragjain, gpersoon, hubble
csanuragjain
Contract variable unstreamed is not updated in withdraw function which can lead to unstability
function stake(uint112 amount) public lock updateStream(msg.sender) { ... unstreamed += trueDepositAmt; ... }
As we can see once user stakes the unstreamed variable is increased by user's stake amount
Now lets see the withdraw function. This function does not decrease the unstreamed variable by user withdrawn amount bringing contract variable to instability.
Add below statement in withdraw function
unstreamed -= trueDepositAmt;
#0 - 0xean
2022-01-16T00:25:42Z
dupe of #118
🌟 Selected for report: 0x0x0x
Also found by: csanuragjain
45.0947 USDC - $45.09
csanuragjain
It was observed that any feePercent which is greater than MAX_FEE_PERCENT is already rejected in updateFeeParams function of StreamFactory. But on creating stream this is again checked in the constructor for feePercent<=100%
function updateFeeParams(GovernableFeeParams memory newFeeParams) public governed { require(newFeeParams.feePercent <= MAX_FEE_PERCENT, "fee"); GovernableFeeParams memory old = feeParams; feeParams = newFeeParams; emit FeeParametersUpdated(old, newFeeParams); }
As we can see this function checks that user provided fees does not cross max fees
After this user creates a new stream calling createStream function
This inturn calls the constructor of Stream contract
constructor( uint64 _streamId, address creator, bool _isSale, address _rewardToken, address _depositToken, uint32 _startTime, uint32 _streamDuration, uint32 _depositLockDuration, uint32 _rewardLockDuration, uint16 _feePercent, bool _feeEnabled ) LockeERC20(_depositToken, _streamId, _startTime + _streamDuration) ExternallyGoverned(msg.sender) // inherit factory governance public { require(feePercent < 10000, "fee"); }
Remove the below duplicate check imposed at constructor of Stream
require(feePercent < 10000, "fee");
#0 - 0xean
2022-01-17T13:17:43Z
dupe of #185