Skip to content

Instantly share code, notes, and snippets.

@z0r0z
Last active June 2, 2022 08:20
Show Gist options
  • Save z0r0z/ea0b752aa9537070b0d61f8a74d5c10c to your computer and use it in GitHub Desktop.
Save z0r0z/ea0b752aa9537070b0d61f8a74d5c10c to your computer and use it in GitHub Desktop.
1-of-1 NFT built on Solmate
// SPDX-License-Identifier: AGPL-3.0-only
pragma solidity >=0.8.0;
import "https://github.com/Rari-Capital/solmate/blob/main/src/tokens/ERC721.sol";
/// @notice 1-of-1 NFT.
contract SingleNFT is ERC721 {
string internal URI;
constructor(
string memory _name,
string memory _symbol,
string memory _URI
) ERC721(_name, _symbol) {
_mint(msg.sender, 0);
URI = _URI;
}
function tokenURI(uint256) public override view returns (string memory) {
return URI;
}
function _mint(address to, uint256 id) internal override {
balanceOf[to] = 1;
ownerOf[id] = to;
emit Transfer(address(0), to, id);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment