Skip to content

Commit

Permalink
fixed compilation
Browse files Browse the repository at this point in the history
  • Loading branch information
sobolev-igor committed Jul 23, 2021
1 parent 59f20c9 commit 3ad488a
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 8 deletions.
3 changes: 3 additions & 0 deletions contracts/IZerionGenesisNFT.sol
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,7 @@ interface IZerionGenesisNFT is IERC1155 {

/// @notice Collection metadata URI.
function contractURI() external view returns (string memory);

/// @notice IPFS URI for a given id.
function uri(uint256) external view returns (string memory);
}
12 changes: 9 additions & 3 deletions contracts/ZerionGenesisNFT.sol
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,10 @@ contract ZerionGenesisNFT is ERC1155Supply, IZerionGenesisNFT {
string public override symbol;
/// @inheritdoc IZerionGenesisNFT
string public override contractURI;
/// @notice IPFS URI for a given id.
mapping(uint256 => string) public override uri;

bytes10 internal immutable rarities;
uint256 internal immutable totalRarity;
mapping(uint256 => string) internal ipfsHashes;

uint256 internal constant TOKEN_AMOUNT = 1;
string internal constant IPFS_PREFIX = "ipfs://";
Expand All @@ -45,7 +44,7 @@ contract ZerionGenesisNFT is ERC1155Supply, IZerionGenesisNFT {
uint256 deadline_
) ERC1155("") {
for (uint256 i = 0; i < 10; i++) {
uri[i + 1] = hashToURI(ipfsHashes_[i]);
ipfsHashes[i + 1] = ipfsHashes_[i];
emit URI(hashToURI(ipfsHashes_[i]), i + 1);
}
contractURI = hashToURI(contractIpfsHash_);
Expand Down Expand Up @@ -81,6 +80,13 @@ contract ZerionGenesisNFT is ERC1155Supply, IZerionGenesisNFT {
return (uint256(uint8(rarities[tokenId - 1])) * 1000) / uint256(totalRarity);
}

/// @inheritdoc IZerionGenesisNFT
function uri(uint256 tokenId) public view virtual override(ERC1155, IZerionGenesisNFT) returns (string memory) {
if (tokenId == 0 || tokenId > 10) return "";

return hashToURI(ipfsHashes[tokenId]);
}

/// @inheritdoc IERC165
function supportsInterface(bytes4 interfaceId)
public
Expand Down
4 changes: 2 additions & 2 deletions docs/main.js

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "genesis-collection-nft",
"version": "1.0.0",
"version": "1.0.0-rc",
"main": "hardhat.config.ts",
"directories": {
"test": "test"
Expand Down

0 comments on commit 3ad488a

Please sign in to comment.