Skip to content
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

Fix erc721 transferFrom comment #341

Merged
merged 7 commits into from
Jun 15, 2022
10 changes: 4 additions & 6 deletions docs/ERC721.md
Original file line number Diff line number Diff line change
Expand Up @@ -160,15 +160,15 @@ await signer.send_transaction(

### Token Transfers

EIP721 discourages the use of `transferFrom` and favors `safeTransferFrom` in regard to token transfers. The safe function adds the following conditional logic:
This library includes `transferFrom` and `safeTransferFrom` to transfer NFTs. If using `transferFrom`, note that THE CALLER IS RESPONSIBLE TO CONFIRM THAT THE RECIPIENT IS CAPABLE OF RECEIVING NFTS OR ELSE THEY MAY BE PERMANENTLY LOST.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what about bold text instead of uppercase?


The `safeTransferFrom` method incorporates the following conditional logic:

1. if the calling address is an account contract, the token transfer will behave as if `transferFrom` was called
2. if the calling address is not an account contract, the safe function will check that the contract supports ERC721 tokens

The current implementation of `safeTansferFrom` checks for `onERC721Received` and requires that the recipient contract supports ERC165 and exposes the `supportsInterface` method. See [ERC721Received](#erc721received)

Please be aware that transferring tokens with `transferFrom` to a contract that does not support ERC721 can result in lost tokens forever.

### Interpreting ERC721 URIs

Token URIs in Cairo are stored as single field elements. Each field element equates to 252-bits (or 31.5 bytes) which means that a token's URI can be no longer than 31 characters.
Expand Down Expand Up @@ -432,9 +432,7 @@ None.

#### `transferFrom`

Transfers `tokenId` token from `from_` to `to`.

> Note that this function should be used instead of `safeTransferFrom` to transfer tokens. Exercise caution as tokens sent to a contract that does not support ERC721 can be lost forever.
Transfers `tokenId` token from `from_` to `to`. The caller is responsible to confirm that `to` is capable of receiving NFTs or else they may be permanently lost.
andrew-fleming marked this conversation as resolved.
Show resolved Hide resolved

Emits a [Transfer](#transfer-event) event.

Expand Down