code-423n4 / 2021-07-sherlock-findings

0 stars 0 forks source link

Possible divide-by-zero error in `PoolBase` #136

Open code423n4 opened 3 years ago

code423n4 commented 3 years ago

Handle

shw

Vulnerability details

Impact

A possible divide-by-zero error could happen in the getSherXPerBlock(uint256, IERC20) function of PoolBase when the totalSupply of lockToken and _lock are both 0.

Proof of Concept

Referenced code: PoolBase.sol#L215

Recommended Mitigation Steps

Check if baseData().lockToken.totalSupply().add(_lock) equals to 0 before line 214. If so, then return 0.