A 1904x960 PNG rendering of the function in the CryptoPhunksMarket contract that allows users to withdraw ETH from sales.
It contains a helpful comment about avoiding re-entrancy attacks. If you're anything like me, when you read this code for the first time you thought "what's a re-entrancy attack"?
And then if you read it's a bit terrifying—when you send ETH with transfer()
you need to have your contract's state indicate "this user is not allowed to withdraw more" before you send the ETH. Otherwise you lose all your money.
This is wild because in every other case intra-function code ordering doesn't matter in Solidity.
These days, the standard way to send ETH is this tongue twister: (bool success, ) = msg.sender.call{value: amount}("")
, which actually generates a compiler warning.
Anyway, a true work of art, has probably saved devs millions, available for the first time ever in PNG form. All proceeds go toward furthering the Phunk movement through technology!
CryptoPhunksMarket Re-entrancy Note
- PriceUSD PriceQuantityExpirationFrom
- PriceUSD PriceQuantityFloor DifferenceExpirationFrom
CryptoPhunksMarket Re-entrancy Note
- PriceUSD PriceQuantityExpirationFrom
- PriceUSD PriceQuantityFloor DifferenceExpirationFrom
A 1904x960 PNG rendering of the function in the CryptoPhunksMarket contract that allows users to withdraw ETH from sales.
It contains a helpful comment about avoiding re-entrancy attacks. If you're anything like me, when you read this code for the first time you thought "what's a re-entrancy attack"?
And then if you read it's a bit terrifying—when you send ETH with transfer()
you need to have your contract's state indicate "this user is not allowed to withdraw more" before you send the ETH. Otherwise you lose all your money.
This is wild because in every other case intra-function code ordering doesn't matter in Solidity.
These days, the standard way to send ETH is this tongue twister: (bool success, ) = msg.sender.call{value: amount}("")
, which actually generates a compiler warning.
Anyway, a true work of art, has probably saved devs millions, available for the first time ever in PNG form. All proceeds go toward furthering the Phunk movement through technology!