I added function safeTransferChild(address _to, address _childContract, uint256 _childTokenId) so that child tokens can be safely transferred to contracts.
I replaced transferChildToComposable with function safeTransferChild(address _to, address _childContract, uint256 _childTokenId, bytes _data).
I replaced the transferChildToComposable test with one that successfully uses safeTransferChild to transfer an NFT from a composable to a composable.
I made receiveChild private and removed it from the interface.
I added additional requires that ensure that tokenId exists and that a received childTokenId is owned by the receiving contract before adding it, and that the childTokeId has not already been added before adding it.
I added a getChild function and added it to the interface. getChild solves the problem of transferring an ERC721 token that does not have a safeTransferChild function to a composable. For example, cryptokitties does not have a safeTransferChild function. Here is the sequence:
Using the approve function an ERC721 contract approves a composable contract for a token.
The getChild function gets called on that ERC721 contract and token, which transfers the token into the composable successfully.
Changes:
function safeTransferChild(address _to, address _childContract, uint256 _childTokenId)
so that child tokens can be safely transferred to contracts.transferChildToComposable
withfunction safeTransferChild(address _to, address _childContract, uint256 _childTokenId, bytes _data)
.safeTransferChild
to transfer an NFT from a composable to a composable.receiveChild
private and removed it from the interface.getChild
function and added it to the interface.getChild
solves the problem of transferring an ERC721 token that does not have a safeTransferChild function to a composable. For example, cryptokitties does not have a safeTransferChild function. Here is the sequence:approve
function an ERC721 contract approves a composable contract for a token.getChild
function gets called on that ERC721 contract and token, which transfers the token into the composable successfully.