Omniscia Steer Protocol Audit
SteerToken Code Style Findings
SteerToken Code Style Findings
STN-01C: Redundant Invocation of Getter Function
Type | Severity | Location |
---|---|---|
Gas Optimization | SteerToken.sol:L38 |
Description:
The decimals
value is equivalent to 18
units in all recent OpenZeppelin implementations unless explicitly overridden.
Example:
contracts/SteerToken.sol
28function initialize(uint256 initialSupply) public initializer {29 __ERC20_init("Steer Protocol", "STEER");30 __ERC20Burnable_init();31 __Pausable_init();32 __Ownable_init();33 __ERC20Permit_init("Steer Protocol");34 __ERC20FlashMint_init();35 __UUPSUpgradeable_init();36
37 // Mint intial supply to deployer38 _mint(msg.sender, initialSupply * 10**decimals());39}
Recommendation:
We advise the decimals
getter function to be replaced by the 18
literal reducing the gas cost of the initialize
function.
Alleviation (200f275c40cbd4798f4a416c044ea726755d4741):
The value literal 18
is now properly utilized in place of decimals()
optimizing the initialization function's gas cost.