Content pfp
Content
@
0 reply
0 recast
0 reaction

Steve pfp
Steve
@stevedylandev.eth
Solidity devs, need your help confirming something: Let’s say I have 100 ERC721 tokens that have a custom uint8 state, and I want to update that state by -1 for all tokens at once. Would you: A. Loop over in the contract with high gas estimation B. Loop on the client sending lots of smaller transactions
3 replies
1 recast
2 reactions

Jannik pfp
Jannik
@jannik
I think I would try to avoid that. How about storing a single global diff value and subtracting it on read in a getter function?
1 reply
0 recast
1 reaction

Michael Amadi pfp
Michael Amadi
@michaels
Transaction has a 21k gas overhead so doing it in the contract would be cheaper since you just pay the 21k gas overhead once
1 reply
0 recast
0 reaction

✳️ dcposch on daimo pfp
✳️ dcposch on daimo
@dcposch.eth
For only 100? One transaction General case with n? In batches Best to avoid this situation where possible. State writes are by far the most expensive operation in the evm
0 reply
0 recast
0 reaction