mattlockyer / composables-998

An implementation and documentation repo for developing the ERC-998 standard for Ethereum.
MIT License
103 stars 64 forks source link

NFT Child Transfer Changes #7

Closed mudgen closed 6 years ago

mudgen commented 6 years ago

Changes:

  1. I added function safeTransferChild(address _to, address _childContract, uint256 _childTokenId) so that child tokens can be safely transferred to contracts.
  2. I replaced transferChildToComposable with function safeTransferChild(address _to, address _childContract, uint256 _childTokenId, bytes _data).
  3. I replaced the transferChildToComposable test with one that successfully uses safeTransferChild to transfer an NFT from a composable to a composable.
  4. I made receiveChild private and removed it from the interface.
  5. 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.
  6. 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:
    1. Using the approve function an ERC721 contract approves a composable contract for a token.
    2. The getChild function gets called on that ERC721 contract and token, which transfers the token into the composable successfully.