add distinct 721 and 1155 sample contracts and tests
parent
923d0ff04e
commit
c1c58ce115
@ -1,22 +0,0 @@
|
|||||||
// SPDX-License-Identifier: UNLICENSED
|
|
||||||
pragma solidity ^0.8.13;
|
|
||||||
|
|
||||||
import "solmate/tokens/ERC721.sol";
|
|
||||||
import "openzeppelin-contracts/utils/Strings.sol";
|
|
||||||
|
|
||||||
contract NFT is ERC721 {
|
|
||||||
uint256 public currentTokenId;
|
|
||||||
|
|
||||||
constructor() ERC721("NFT", "NFT") {}
|
|
||||||
|
|
||||||
function mint(address r, uint256 mintAmount) external {
|
|
||||||
for(uint256 i; i < mintAmount; i++) {
|
|
||||||
currentTokenId += 1;
|
|
||||||
_safeMint(r, currentTokenId);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function tokenURI(uint256 id) public view virtual override returns (string memory) {
|
|
||||||
return Strings.toString(id);
|
|
||||||
}
|
|
||||||
}
|
|
@ -0,0 +1,19 @@
|
|||||||
|
// SPDX-License-Identifier: UNLICENSED
|
||||||
|
pragma solidity ^0.8.13;
|
||||||
|
|
||||||
|
import {ERC1155} from "openzeppelin-contracts/token/ERC1155/ERC1155.sol";
|
||||||
|
import {Strings} from "openzeppelin-contracts/utils/Strings.sol";
|
||||||
|
import {Counters} from "openzeppelin-contracts/utils/Counters.sol";
|
||||||
|
import {Ownable} from "openzeppelin-contracts/access/Ownable.sol";
|
||||||
|
|
||||||
|
contract NFT1155 is ERC1155, Ownable {
|
||||||
|
using Counters for Counters.Counter;
|
||||||
|
|
||||||
|
Counters.Counter private _tokenIdCounter;
|
||||||
|
|
||||||
|
constructor() ERC1155("") {}
|
||||||
|
|
||||||
|
function mint(uint256 id, uint256 amount) external {
|
||||||
|
_mint(msg.sender, id, amount, "");
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,23 @@
|
|||||||
|
// SPDX-License-Identifier: UNLICENSED
|
||||||
|
pragma solidity ^0.8.13;
|
||||||
|
|
||||||
|
import {ERC721} from "openzeppelin-contracts/token/ERC721/ERC721.sol";
|
||||||
|
import {Strings} from "openzeppelin-contracts/utils/Strings.sol";
|
||||||
|
import {Counters} from "openzeppelin-contracts/utils/Counters.sol";
|
||||||
|
import {Ownable} from "openzeppelin-contracts/access/Ownable.sol";
|
||||||
|
|
||||||
|
contract NFT721 is ERC721, Ownable {
|
||||||
|
using Counters for Counters.Counter;
|
||||||
|
|
||||||
|
Counters.Counter private _tokenIdCounter;
|
||||||
|
|
||||||
|
constructor() ERC721("NFT", "NFT") {}
|
||||||
|
|
||||||
|
function mint(uint256 amount) external {
|
||||||
|
for (uint256 i; i < amount; i++) {
|
||||||
|
_tokenIdCounter.increment();
|
||||||
|
uint256 tokenId = _tokenIdCounter.current();
|
||||||
|
_safeMint(msg.sender, tokenId);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue