It seems to me that pre 0.5 NFTs are not compatible with more modern solidity versions. I am trying to use the contract written on ^0.7.6 to call "safeTransferFrom(address,address,uint)" from the ^0.4.x contract, and it's causing reverts, even when I try to do a low level call.
The 0.4.x NFT is already deployed. I am trying to deploy a 0.7.6 contract that can make calls to this contract.
Here is the interface of the 0.4.x contract I'm trying to interface with:
pragma solidity ^0.4.21;
/**
* @title ERC721 Non-Fungible Token Standard basic interface
* @dev see https://github.com/ethereum/EIPs/blob/master/EIPS/eip-721.md
*/
contract ERC721Basic {
function ownerOf(uint256 _tokenId) public view returns (address _owner);
function exists(uint256 _tokenId) public view returns (bool _exists);
function approve(address _to, uint256 _tokenId) public;
function getApproved(uint256 _tokenId) public view returns (address _operator);
function setApprovalForAll(address _operator, bool _approved) public;
function isApprovedForAll(address _owner, address _operator) public view returns (bool);
function transferFrom(address _from, address _to, uint256 _tokenId) public;
function safeTransferFrom(address _from, address _to, uint256 _tokenId) public;
}
Here are the important parts of the function I want to call from my 0.7.6 contract:
function _executeOrder(
address nftAddress,
uint256 assetId,
uint256 price,
bytes memory fingerprint
) internal returns (Order memory) {
ERC721BasicInterface nftRegistry = ERC721Interface(nftAddress);
nftRegistry.safeTransferFrom(order.seller, _msgSender(), assetId);
}
The issue is, what should ERC721Interface be defined as in my 0.7.6 contract? Clearly, the interface written in 0.4.21 is not compatible with 0.7.6 (external function modifiers). I tried calling safeTransferFrom using a more modern ERC721 interface on the 0.4.21 NFT but the transactions were reverted. This is correct behavior I'm assuming, since the interface is different.