Why transferFrom function in openzeppelin's erc721 contract is different from EIP 721?

I’m following cryptozombie’s example for my learning. In this example the transferFrom and approve functions are payable. I thought of using OpenZeppelin’s ERC721 smart contract but found out that both of the functions are not payable. Why there is a difference in OpenZeppelin’s implementation of ERC721 contract?

:1234: Code to reproduce

snippet from EIP721.md

function transferFrom(address _from, address _to, uint256 _tokenId) external payable;

snippet from OpenZeppelin’s ERC721.sol

     * @dev See {IERC721-transferFrom}.
    function transferFrom(address from, address to, uint256 tokenId) public virtual override {
        //solhint-disable-next-line max-line-length
        require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: transfer caller is not owner nor approved");

        _transfer(from, to, tokenId);

Also what’s the difference between ERC721.sol and IERC721.sol and which to inherit for smart contract?

See this issue for why our functions are not payable:

You should inherit ERC721. Consider checking out the Contracts Wizard to get started.

1 Like