Removed OpenZeppelin's implementation of ERC721 from the top-down composable implementation and added my own implementation. I needed to do this because the ownerOf function from ERC721 needed to work differently and authentication works differently.
In both top-down and bottom-up implementations the ownerOf(uint256 _tokenId) function returns the owner address at the top of the tree of composables (rootOwner), not the immediate owner of the supplied token.
In both top-down and bottom-up implementations the tokenOwnerOf(uint256 _tokenId) function returns the parent token contract and parent tokenId.
The onERC998RemovedChild(address _operator, address _toContract, uint256 _tokenId, bytes _data) callback function was added. Contracts that are composable aware must call onERC998RemovedChild in safeTransferFrom functions on the _from address if it is a contract.
In both top-down and bottom-up implementations authentication is done by finding the rootOwner with ownerOf(uint256 _tokenId) and comparing that to msg.sender and getApproved and isApprovedForAll and also comparing these to the immediate owner.
Major changes:
ownerOf
function from ERC721 needed to work differently and authentication works differently.ownerOf(uint256 _tokenId)
function returns the owner address at the top of the tree of composables (rootOwner), not the immediate owner of the supplied token.tokenOwnerOf(uint256 _tokenId)
function returns the parent token contract and parent tokenId.onERC998RemovedChild(address _operator, address _toContract, uint256 _tokenId, bytes _data)
callback function was added. Contracts that are composable aware must callonERC998RemovedChild
insafeTransferFrom
functions on the_from
address if it is a contract.ownerOf(uint256 _tokenId)
and comparing that tomsg.sender
andgetApproved
andisApprovedForAll
and also comparing these to the immediate owner.