Created
October 24, 2021 08:14
-
-
Save soenkeba/84c023fde55a8400400e559e3c12977c to your computer and use it in GitHub Desktop.
Created using remix-ide: Realtime Ethereum Contract Compiler and Runtime. Load this file by pasting this gists URL or ID at https://remix.ethereum.org/#version=soljson-v0.8.7+commit.e28d00a7.js&optimize=false&runs=200&gist=
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pragma solidity ^0.8.0; | |
import "@openzeppelin/contracts/token/ERC1155/ERC1155.sol"; | |
import "@openzeppelin/contracts/utils/Strings.sol" | |
contract sciencefaction is ERC1155 { | |
uint256 public constant NFThistory = 0x01559ae4021a99b0d373d7bc8a80504bad782367abe12c21373c83adc6bf6a7e; | |
function mint( | |
address to, | |
uint256 id, | |
uint256 amount, | |
bytes memory data | |
) virtual public { // minting is public | |
_mint(to, id, amount, data); | |
} | |
constructor() public ERC1155("ipfs://f0{id}") { // This URI base is not relevant in this case - legacy | |
_mint(msg.sender, NFThistory, 1, ""); | |
} | |
// overriding the uri function - Opensea and such a like expect a completley working sring back | |
function uri(uint256 _tokenID) override public view returns (string memory) { | |
string memory hexstringtokenID; | |
hexstringtokenID = uint2hexstr(_tokenID); | |
return string( | |
abi.encodePacked( | |
"ipfs://f0", | |
hexstringtokenID) | |
); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment