0xApeToshi / eip-2929

to fix `.transfer()` methods directed to gnosis safe because of berlin hardfork (aka fix eip-2929 with eip-2930)

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Fix eip 2929 with eip 2930

After the berlin hardfork eip 2929 was added which increased the cost for state access opcodes. This broke any contract which used address.transfer(eth) to gnosis safes because the hard-coded 2300 gas was no longer enough to execute the transaction. In order to help contracts that were affected they made eip 2930 which adds an access list to the transaction. Any address added to this access list has gas prepaid on their behalf as part of the total gas calculation. This reduces the gas required when interacting with them which allows the original 2300 gas to succeed.

For our situation we needed to run withdrawETH on our ERC-1155 contract that would allow the transfer to the gnosis safe to occur. Quoting reply from @rmeissner on stack exchange:

"The mastercopy address of the Safe can be obtained using their services, checked via Etherscan or looked up on-chain by using the masterCopy() function. A general list of addresses for the Safe contracts can be found in the safe-deployments repository."

Look at ./index.js for a complete example.

(shout out @rmeissner for the help here)

About

to fix `.transfer()` methods directed to gnosis safe because of berlin hardfork (aka fix eip-2929 with eip-2930)


Languages

Language:JavaScript 100.0%