diff --git a/contracts/CurioERC1155Wrapper.sol b/contracts/CurioERC1155Wrapper.sol index efa71ba..f7e2df3 100644 --- a/contracts/CurioERC1155Wrapper.sol +++ b/contracts/CurioERC1155Wrapper.sol @@ -14,12 +14,11 @@ contract CurioERC1155Wrapper is ERC1155, ERC1155Metadata_URI, Ownable { using SafeMath for uint256; using Address for address; - // nft id => curio contract address mapping (uint256 => address) public contracts; mapping (uint256 => string) public urls; /** - @notice Initialize an nft id's data. + @notice Initialize an nft id's data */ function create(uint256 _id, address _contract, string memory _url) internal { @@ -45,11 +44,11 @@ contract CurioERC1155Wrapper is ERC1155, ERC1155Metadata_URI, Ownable { } /** - @dev override ERC1155 uri function to return IPFS ref. + @notice Returns URI of token metadata @param _id NFT ID - @return IPFS URI pointing to NFT ID's metadata. + @return URI data URI of metadata JSON */ - function uri(uint256 _id) public view returns (string memory) { + function uri(uint256 _id) external override view returns (string memory) { IMastersFedi curio = IMastersFedi(contracts[_id]); return string(abi.encodePacked("data:application/json;base64,", Base64.encode(abi.encodePacked( @@ -66,8 +65,9 @@ contract CurioERC1155Wrapper is ERC1155, ERC1155Metadata_URI, Ownable { } /** - @dev change the external URL for a token. + @notice Change the external URL for a token @param _id NFT ID + @param _url URL pointing to user or site */ function setExternalUrl(uint256 _id, string memory _url) external onlyOwner { require(contracts[_id] != address(0), "id must exist"); @@ -76,18 +76,22 @@ contract CurioERC1155Wrapper is ERC1155, ERC1155Metadata_URI, Ownable { } /** - @dev helper function to see if NFT ID exists, makes OpenSea happy. + @notice If NFT ID exists + @dev Makes OpenSea happy @param _id NFT ID - @return if NFT ID exists. + @return exists if NFT ID exists. */ function exists(uint256 _id) external view returns(bool) { return contracts[_id] != address(0); } /** - @dev for an NFT ID, queries and transfers tokens from the appropriate - curio contract to itself, and mints and transfers corresponding new - ERC-1155 tokens to caller. + @notice Converts old-style NFT to new-style + @dev For an NFT ID, queries and transfers tokens from the appropriate + curio contract to itself, and mints and transfers corresponding new + ERC-1155 tokens to caller + @param _id NFT ID + @param _quantity how many to wrap */ function wrap(uint256 _id, uint256 _quantity) external { address tokenContract = contracts[_id]; @@ -112,7 +116,9 @@ contract CurioERC1155Wrapper is ERC1155, ERC1155Metadata_URI, Ownable { } /** - @dev batch version of wrap. + @notice Batch version of wrap function + @param _ids array of NFT IDs + @param _quantities how many to wrap of each */ function wrapBatch(uint256[] calldata _ids, uint256[] calldata _quantities) external { require(_ids.length == _quantities.length, "ids and quantities must match"); @@ -145,8 +151,11 @@ contract CurioERC1155Wrapper is ERC1155, ERC1155Metadata_URI, Ownable { } /** - @dev for an NFT ID, burns ERC-1155 quantity and transfers curio ERC-20 - tokens to caller. + @notice Unwrap new-style NFTs back to old-style + @dev For an NFT ID, burns ERC-1155 quantity and transfers curio ERC-20 + tokens to caller + @param _id NFT ID + @param _quantity how many to unwrap */ function unwrap(uint256 _id, uint256 _quantity) external { address tokenContract = contracts[_id]; @@ -163,7 +172,9 @@ contract CurioERC1155Wrapper is ERC1155, ERC1155Metadata_URI, Ownable { } /** - @dev batch version of unwrap. + @notice Batch version of unwrap + @param _ids array of NFT IDs + @param _quantities how many to unwrap of each */ function unwrapBatch(uint256[] calldata _ids, uint256[] calldata _quantities) external { require(_ids.length == _quantities.length, "ids and quantities must match");