cairomate icon indicating copy to clipboard operation
cairomate copied to clipboard

Add safeTransferFrom to ERC721

Open exp-table opened this issue 3 years ago • 0 comments

We assume readers will know the difference of how accounts are handled between Ethereum and Starknet (non-smart contracts vs smart-contracts).

Since we cannot rely on examining the bytecode of the recipient to determine if it's an Account or another type of contract, one way to differentiate them, in order to determine how the safe transfer and mint have to behave, is to try to call the get_public_key of the assumed Account, and then if it holds a non-zero felt, it means it's OK, otherwise we call onERC721Received.

Except it's not possible. If the target recipient doesn't implement get_public_key (because it's not an Account but it handles ERC721s), the whole transaction will be reverted naturally.

exp-table avatar Jan 04 '22 23:01 exp-table