contracts
contracts copied to clipboard
Update Oracles.sol: Optimized gas
Aims for three main changes that saves gas for this smart contract:
- Using
immutable
for keccak variables rather thanconstant
: This comment by one of Openzeppelin's contributors going to be useful here. - Using internal functions for the modifiers which appears more than often: Some Modifiers do appear more than 2-3 times and this kind of increases the gas costs on deploy time..Thus internal functions do help. Again, this convo between two contributors of Openzeppelin is worthwhile here.
- Enhancing 'for' loops: These for loops have been improved by changing
++i
toi++
. Although, I really doubt that this change really gonna make any change in the gas costs..Cuz as per my past experiences, this 'for' loop change works better with solidity version 0.8. Will be worth it if there's might be an updation of solidity version in future. Still refer this
Thanks @tsudmi