This note is a scratchpad for contract API standards in an open, composable storage market.
See also Architecture for programmable storage markets, which improves some pieces here.
Origin of ERCs: https://github.com/ethereum/EIPs/issues/16
https://docs.soliditylang.org/en/v0.8.10/abi-spec.html
https://www.nftstandards.wtf/NFT+Standards+Wiki+-+READ.me
// ERC-20
function name() public view returns (string) // opt
function symbol() public view returns (string) // opt
function decimals() public view returns (uint8) // opt
function totalSupply() public view returns (uint256)
function balanceOf(address _owner) public view returns (uint256 balance)
function transfer(address _to, uint256 _value) public returns (bool success)
function transferFrom(address _from, address _to, uint256 _value) public returns (bool success)
function approve(address _spender, uint256 _value) public returns (bool success)
function allowance(address _owner, address _spender) public view returns (uint256 remaining)
// ERC-721
function balanceOf(address _owner) external view returns (uint256)
function ownerOf(uint256 _tokenId) external view returns (address)
function safeTransferFrom(address _from, address _to, uint256 _tokenId, bytes data) external payable
function safeTransferFrom(address _from, address _to, uint256 _tokenId) external payable
function transferFrom(address _from, address _to, uint256 _tokenId) external payable
function approve(address _approved, uint256 _tokenId) external payable
function setApprovalForAll(address _operator, bool _approved) external
function getApproved(uint256 _tokenId) external view returns (address)
function isApprovedForAll(address _owner, address _operator) external view returns (bool)
// ERC721Metadata (optional)
function name() external view returns (string _name)
function symbol() external view returns (string _symbol)
function tokenURI(uint256 _tokenId) external view returns (string)
// ERC721Enumerable (optional)
function totalSupply() external view returns (uint256)
function tokenByIndex(uint256 _index) external view returns (uint256)
function tokenOfOwnerByIndex(address _owner, uint256 _index) external view returns (uint256)
// ERC-165 (required by ERC-721)
function supportsInterface(bytes4 interfaceID) external view returns (bool)
// ERC721TokenReceiver
function onERC721Received(address _operator, address _from, uint256 _tokenId, bytes _data) external returns(bytes4)
Extend ERC721 to deals.
Expose properties as methods rather than the DealProposal struct to abstract over representations, allow other markets to have other proposal data.
These data are not necessarily immutable.
// Returns proposal PieceCID
// For the multi-part deals this would be the root CID
// For capacity deals, this would be the data most recently committed
function dealPieceCID(tokenId) returns (CID)
// Padded size of data (piece/s)
function dealSize(tokenId) returns uint64
// Current provider. Note: client is the ERC-721 owner.
function dealProvider(tokenId) returns Address
// Arbitrary client-provided label.
function dealLabel(tokenId) returns string
function dealTerm(tokenId) return {start: epoch, end: epoch}
function dealPricePerEpoch(tokenId) return TokenAmount
function dealCollateral(tokenId) return {provider: TokenAmount, client: TokenAmount}
// Note
// IsVerified is not here – registration with incentive schemes belongs with the scheme