Gas Optimization of convertRewardsToPTokens Function
Summary
The optimized version introduces a conditional check before performing the division operation. By checking if _amountToConvert < rewardsPerPToken, the function can revert early without performing unnecessary operations. This saves gas in cases where the amount is too small to convert.
By moving the if (_amountToConvert < rewardsPerPToken) check before the transfer, the function potentially avoids an expensive transfer and division operation, resulting in a more efficient execution.(https://github.com/sherlock-audit/2024-07-sense-points-marketplace/blob/main/point-tokenization-vault/contracts/PointTokenVault.sol#L229-L254)
Howling Marigold Elk
Low/Info
Gas Optimization of convertRewardsToPTokens Function
Summary
The optimized version introduces a conditional check before performing the division operation. By checking if _amountToConvert < rewardsPerPToken, the function can revert early without performing unnecessary operations. This saves gas in cases where the amount is too small to convert. By moving the if (_amountToConvert < rewardsPerPToken) check before the transfer, the function potentially avoids an expensive transfer and division operation, resulting in a more efficient execution.(https://github.com/sherlock-audit/2024-07-sense-points-marketplace/blob/main/point-tokenization-vault/contracts/PointTokenVault.sol#L229-L254)
Tool used
Manual Review
Recommendation