Submitted by WatchPug
https://github.com/XDeFi-tech/xdefi-distribution/blob/3856a42df295183b40c6eee89307308f196612fe/contracts/XDEFIDistribution.sol#L151-L151
In the current implementation,  _pointsPerUnit can be changed in updateDistribution() which can be called by anyone.
A malicious early user can lock() with only 1 wei of XDEFI and makes _pointsPerUnit to be very large, causing future users not to be able to lock() and/or unlock() anymore due to overflow in arithmetic related to _pointsMultiplier.
As a result, the contract can be malfunctioning and even freeze users funds in edge cases.
Given:
Uniswap v2 solved a similar problem by sending the first 1000 lp tokens to the zero address.
The same solution should work here, i.e., on constructor set an initial amount (like 1e8) for totalUnits
https://github.com/XDeFi-tech/xdefi-distribution/blob/3856a42df295183b40c6eee89307308f196612fe/contracts/XDEFIDistribution.sol#L39-L44
deluca-mike (XDEFI) confirmed:
deluca-mike (XDEFI) commented:
deluca-mike (XDEFI) commented:
Ivshti (Judge) commented:
