Crypto Composables ERC-998 Update #2

Matt Lockyer
May 15, 2018 · 7 min read
Blockchain Week NYC
Richard Burton and Balance Wallet crew at the Brooklyn HQ

Refactoring the ERC-998 Interface

Curation Markets meetup with Trent McConaghy hosted by FOAM
Composing Composables with Inheritance

CNFTs Owning FTs

// mapping from nft to all ftp contracts
mapping(uint256 => address[]) ftpContracts;
// mapping for the ftp contract index
mapping(uint256 => mapping(address => uint256)) ftpContractIndex;
// mapping from contract pseudo-address owner ftp to the tokenIds
mapping(address => uint256) ftpBalances;
/**************************************
* Public View Functions (wallet integration)
**************************************/
// returns the ftp contracts owned by a composable
function ftpContractsOwnedBy(uint256 _tokenId) public view returns(address[]) {
return ftpContracts[_tokenId];
}
// returns the ftps owned by the composable for a specific ftp contract
function ftpBalanceOf(uint256 _tokenId, address _ftpContract) public view returns(uint256) {
return ftpBalances[_ftpAddress(_tokenId, _ftpContract)];
}
/**************************************
* Public Transfer and Receive Methods
**************************************/
function safeTransferFTP(
address _to, uint256 _tokenId, address _ftpContract, uint256 _value, bytes _data
) public {
transferFTP(_to, _tokenId, _ftpContract, _value);
ftpReceived(_ftpContract, _value, _data);
}
function onERC20Received(address _from, uint256 _value, bytes _data) public returns(bytes4) {
ftpReceived(msg.sender, _value, _data);
return ERC20_RECEIVED;
}

Bookkeeping

Enumeration

Transferring and Receiving

Time to Standardize!

The Future of Decentralized Gaming

Wrapping Up

Curation Markets meetup with Jess Sloss hosted by FOAM

Coinmonks

Coinmonks is a technology-focused publication embracing decentralize technologies. We are Non-profit and education is our core value. Learn, Build and thrive. Our other project— https://coinmonks.com, https://cryptofi.co, https://coincodecap.com

Matt Lockyer

Written by

Building Blockchain Solutions to Real World Problems - "The revolution will not be centralized."

Coinmonks

Coinmonks

Coinmonks is a technology-focused publication embracing decentralize technologies. We are Non-profit and education is our core value. Learn, Build and thrive. Our other project— https://coinmonks.com, https://cryptofi.co, https://coincodecap.com