hey guys any knows a way to trigger a function upon receiving an NFT in a smart contract? Similar to a receive() function for eth
Feb 2, 2022, 4:52 PM
yes, create a listener that listens to WSS and the event
Feb 2, 2022, 5:05 PM
thanks but i meant within the smart contract so u can do reentrancy ? Im just auditing a smart contract
Feb 2, 2022, 5:06 PM
No, as far as i know
Feb 2, 2022, 5:10 PM
In the example given, the best way to prevent this attack is to make sure you don't call an external function until you've done all the internal work you need to do:
Feb 2, 2022, 5:17 PM
yea thanks a lot thats what i will do
Feb 2, 2022, 5:18 PM
Implement the onERC721Received on your contract
Its part of standard erc721
Feb 2, 2022, 5:39 PM
oh right, i saw this too onERC1155Received
Feb 2, 2022, 5:40 PM
Yeah token standards started implementing those
After erc20 getting stuck on contracts
Feb 2, 2022, 5:43 PM