-
Notifications
You must be signed in to change notification settings - Fork 371
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
PunkBought event is emitted from "acceptBidForPunk" with 0x0 for "toAddress" and 0 for "value" #19
Comments
That's a very nice analysis indeed. What will be the approach to fix this? |
|
Problem
PunkBought
event emitted fromacceptBidForPunk
always hastoAddress = 0
andvalue = 0
.See an example transaction on Etherscan
Investigation
At line 216
bid
is set to reference the map's valueand at line 277
the map's value is overridden with "null" Bid having
0x0
forbid.bidder
and0
forvalue
,then at line 229
bid.bidder = 0x0
andbid.value = 0
Who is affected
DApps listening for CryptoPunk's events and willing to know history of punk's transfers with prices have to implement non-trivial workarounds to extract real values for
toAddress
andvalue
:toAddress
value can be obtained from the eventTransfer
emitted at line 223, at which point thebid.bidder
was not yet overriddenvalue
can not be extracted precisely, since theTransfer
emits1
as thevalue
.I see 2 options how a DApp can obtain the
value
:enterBidForPunk
events for the same bidder and record the latest bid's valuepunkBids[punkIndex]
right before the transaction foracceptBidForPunk
is executedAll in all, this seems to be a minor bug not affecting correctness of the CryptoPunks contract but slightly complicating implementation for DApps.
The text was updated successfully, but these errors were encountered: