handsome pfp
handsome
@wizard
🔥 Day 2 of #30daysweb3security @Web3SecurityDAO Today I learnt THREE interesting gas saving tips 🧵: 1. Changing a uint from zero to non-zero cost 20k gas, but only 5k gas when changed from non-zero to non-zero. So, start your NFT totalSupply from 1 instead of 0!
2 replies
0 recast
0 reaction

handsome pfp
handsome
@wizard
2. For JS peeps, don't use <= or >=. It is more gas intensive because it checks if values are less than AND also checks for equality. Instead, use totalSupply < 1001 instead of totalSupply<= 1000 !
0 reply
0 recast
0 reaction