cryptozombies-lesson-code icon indicating copy to clipboard operation
cryptozombies-lesson-code copied to clipboard

Update zombieownership.sol

Open webcrafters opened this issue 4 years ago • 2 comments

For our specified use cases, this should help in preventing honest mistakes of users of the contract.

I may invoke transferFrom(A, B, Z) and be the owner of Z, but if A is not my correct address, the code will reduce someone else's zombieCount and also emit a Transfer event that's not accurate in what it says.

webcrafters avatar Dec 24 '20 15:12 webcrafters

👍 I noticed this bug as well while completing the lesson.

BrandonNoad avatar Jan 02 '22 14:01 BrandonNoad

I noticed this also and came to see if it was discussed. I think the best place to verify the ownership is in the _transfer function, that way developers don't have to remember to check before calling it: require(zombieToOwner[_tokenId] == _from) then for transferFrom, you just need _from == msg.sender in the first half

luizchagasjardim avatar Jan 05 '22 17:01 luizchagasjardim