Instances:
eggNFT should be immutable
eggVault should be immutable
The variable eggNFT is used to reference the NFT contract, and eggVault is used to reference the vault contract. These variables are not expected to change after deployment. Declaring them as immutable ensures that their values are set only once during contract initialization and cannot be modified afterward. This reduces gas costs associated with accessing these variables, as reading from immutable variables is cheaper than reading from storage.
Impact:
Declaring state variables as immutable reduces gas costs by avoiding storage reads. This optimization is particularly beneficial for frequently accessed variables, as it improves contract efficiency and reduces transaction costs.
Recommended Mitigation:
To address the issue, update the contract as follows:
Declare the variables as immutable in the contract.
Modify the constructor to initialize these variables.
This ensures that the variables are set only once during deployment and cannot be modified later, reducing gas costs and improving contract efficiency.
Strategy to save gas and minimize transaction costs
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.