Open allwin199 opened 6 months ago
@kristofgazso Making these changes will help in code readability and gas cost.
Making these changes will break the test cases. I am willing to work on it and make sure everything works as intended.
Hey @allwin199 are you still working on this issue?? If not I'll take up this issue
This codebase currently uses magic numbers in certain areas. Replacing these magic numbers with descriptive constants will significantly improve code readability and maintainability.
https://github.com/pimlicolabs/erc20-paymaster/blob/8e37933ea0125352d89659cb623a959071bf879e/src/ERC20Paymaster.sol#L79
1e6
magic number
can be updated withPRICE_DENOMINATOR
in the below line https://github.com/pimlicolabs/erc20-paymaster/blob/8e37933ea0125352d89659cb623a959071bf879e/src/ERC20Paymaster.sol#L134-L136https://github.com/pimlicolabs/erc20-paymaster/blob/8e37933ea0125352d89659cb623a959071bf879e/src/ERC20Paymaster.sol#L140-L142
The above lines can be updated with the below lines of code.
some more magic numbers are used. It can be updated with
constants
Also, Instead of declaring all variables as
public
. All variables can be declared asprivate
and we can writeexternal
getter functions to get the values. Which can prove to be gas-efficient.External Getter function