Public Getter Functions Not Used Internally Should Be Marked External to Optimize Gas
In the TokenDivider contract, several getter functions are declared as public but are never used internally within the contract. These functions include TokenDivider::getBalanceOf, TokenDivider::getErc20TotalMintedAmount, TokenDivider::getErc20InfoFromNft, and TokenDivider::getOrderPrice. Following Solidity best practices, functions that are only called externally should be marked as external instead of public to save gas.
The affected functions in the contract:
Using public instead of external for these functions results in:
Slightly higher gas costs as public functions copy function arguments to memory
external functions can directly read arguments from calldata, which is more gas efficient
While the gas savings per call is small, it accumulates across all external calls to these functions
Foundry
Change the visibility specifier from public to external for these getter functions. Here's the diff of the changes:
The contest is live. Earn rewards by submitting a finding.
This is your time to appeal against judgements on your submissions.
Appeals are being carefully reviewed by our judges.