Closed mudgen closed 6 years ago
Great catch Nick, is there any chance you might be able to send me a pull request? It should just be a simple one liner 👍
I came up with this:
if (childContractIndex[_tokenId][_from] == 0 && childContracts[0] != _from) {
childContractIndex[_tokenId][_from] = childContracts[_tokenId].length;
childContracts[_tokenId].push(_from);
}
But how do you know when to remove the contract from the contracts list? Since you don't know if you're removing the last token from that contract that's owned by this contract?
Is there anything we can do besides iterate?
Perhaps we'll need to store an array of childTokenId for each contract?
Good solution. I will look into it.
The latest pull request fixes this.
I am really liking composable NFTs!
I noticed that the childReceived function will add duplicate contracts to
childContracts[_tokenId]
if multiple tokens from the same contract are transferred. When this happens thechildContractsOwnedBy
will return duplicate contracts, and this will cause other problems in the contract.It seems that if a contract has already been added to
childContracts[_tokenId]
then it should not be added again.