function withdrawableOf(uint256 tokenId_) public view returns (uint256 withdrawableXDEFI_) {
Position storage position = positionOf[tokenId_];
return _withdrawableGiven(position.units, position.depositedXDEFI, position.pointsCorrection);
}
Can be changed to:
function withdrawableOf(uint256 tokenId_) public view returns (uint256 withdrawableXDEFI_) {
Position memory position = positionOf[tokenId_];
return _withdrawableGiven(position.units, position.depositedXDEFI, position.pointsCorrection);
}
This actually costs more gas, both on deploy and at runtime. Try it by comparing the gas report generated by npm run test before and after changing the 2 storage instances.
Handle
WatchPug
Vulnerability details
https://github.com/XDeFi-tech/xdefi-distribution/blob/3856a42df295183b40c6eee89307308f196612fe/contracts/XDEFIDistribution.sol#L156-L159
Can be changed to:
https://github.com/XDeFi-tech/xdefi-distribution/blob/3856a42df295183b40c6eee89307308f196612fe/contracts/XDEFIDistribution.sol#L298-L301
Can be changed to: