how much gas would it cost to update storage from zero to non-zero then from non-zero to zero after? How would gas refunds work? šŸ¤” (in same tx)

Aug 6, 2021, 6:54 PM
Example?
Aug 6, 2021, 11:50 PM
uint256 private inStorage;

function set() {
inStorage = 1;
delete inStorage;
}
Aug 7, 2021, 5:47 AM
20k for sload, 15k refund for sclear. So 5k?
Aug 7, 2021, 8:34 AM
does the new refund EIP affect that?
Aug 7, 2021, 8:34 AM
Yellow paper haven't been updated yet, so not sure
Aug 7, 2021, 8:35 AM
one sec, i'll think i'll test it
just make your own multi sender contract
Aug 7, 2021, 8:38 AM
It was supposed to be included in london fork
Aug 7, 2021, 8:38 AM
You mean fork it
Aug 7, 2021, 8:39 AM
function multiSend(IERC20 token, uint256[] memory amounts, address[] memory addresses) external {
for (uint256 i; i < addresses.length; i++) {
token.transferFrom(_msgSender(), addresses[i]. amounts[i];
}
}
something like that
and you don't need to pay a fee
:S
it cost 14k
when i tested
35k - 21k
https://rinkeby.etherscan.io/tx/0xb037c5caa8b35e5702b9dc33bea597495c43f96dab138ee4fefea6827c85366b
on rinkeby
ouch, thats a lot of gas
in berlin that cost 2k gas
lol
Aug 7, 2021, 9:06 AM
Is Berlin a public testnet ?
Aug 7, 2021, 9:19 AM
before london
the update was berlin
Aug 7, 2021, 9:19 AM
Oh ok now we are on London mainnet
Aug 7, 2021, 9:20 AM
yes, we are on london currently
Aug 7, 2021, 9:22 AM
That's wierd
Aug 7, 2021, 9:52 AM
ye, thats what I was thinking
Aug 7, 2021, 9:53 AM
https://rinkeby.etherscan.io/tx/0x1c254366ed7f9501d02dc46919c51570d96c67df6af596ac97285ec63a37d2bf
2k for me
Aug 7, 2021, 9:53 AM
same one?
ohh
I didn't use optimizer
Sorry, forgot about that
yeah true, its 2k with optimizer
Aug 7, 2021, 9:55 AM
Can confirm. Without opt, its taking 35kšŸ˜…
Aug 7, 2021, 9:56 AM
No callable value provided, will throw an error in remix
Aug 7, 2021, 10:41 AM
wrote it on telegram
function multiSend(IERC20 token, uint256[] memory amounts, address[] memory addresses) external {
for (uint256 i; i < addresses.length; i++) {
token.transferFrom(_msgSender(), addresses[i]. amounts[i];
}
}
this works
Aug 7, 2021, 10:49 AM
Do you have any idea of how much gas will it cost
Aug 7, 2021, 10:50 AM
depends on token
Aug 7, 2021, 10:50 AM
For example let the token be usdt
Aug 7, 2021, 10:50 AM
30 - 40k
Aug 7, 2021, 10:50 AM
Now can you say
Ok
Aug 7, 2021, 10:51 AM
per transfer
Aug 7, 2021, 10:52 AM

Ā© 2024 Draquery.com All rights reserved.