├── README.md ├── metadata ├── images │ ├── cryptobeetle_001.gif │ ├── cryptobeetle_002.gif │ ├── cryptobeetle_022.gif │ ├── cryptobeetle_024.gif │ ├── cryptobeetle_031.gif │ ├── cryptobeetle_069.gif │ ├── cryptobeetle_075.gif │ ├── cryptobeetle_137.gif │ ├── cryptobeetle_155.gif │ ├── cryptobeetle_171.gif │ ├── cryptobeetle_177.gif │ ├── cryptobeetle_185.gif │ ├── cryptobeetle_187.gif │ ├── cryptobeetle_190.gif │ ├── cryptobeetle_193.gif │ ├── cryptobeetle_197.gif │ ├── cryptobeetle_201.gif │ ├── cryptobeetle_39.gif │ ├── cryptobeetle_95.gif │ ├── cryptobeetles_060.gif │ └── cryptobeetles_116.gif ├── cryptobeetle_001.json ├── cryptobeetle_002.json ├── cryptobeetle_31.json ├── cryptobeetle_022.json └── cryptobeetle_024.json ├── .gitignore ├── package.json ├── test └── sample-test.js ├── contracts └── CryptoBeetles.sol ├── scripts └── deploy.js └── hardhat.config.js /README.md: -------------------------------------------------------------------------------- 1 | # Crypto Beetles ERC-721 smart contract 2 | -------------------------------------------------------------------------------- /metadata/images/cryptobeetle_001.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jspruance/cryptobeetles/main/metadata/images/cryptobeetle_001.gif -------------------------------------------------------------------------------- /metadata/images/cryptobeetle_002.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jspruance/cryptobeetles/main/metadata/images/cryptobeetle_002.gif -------------------------------------------------------------------------------- /metadata/images/cryptobeetle_022.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jspruance/cryptobeetles/main/metadata/images/cryptobeetle_022.gif -------------------------------------------------------------------------------- /metadata/images/cryptobeetle_024.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jspruance/cryptobeetles/main/metadata/images/cryptobeetle_024.gif -------------------------------------------------------------------------------- /metadata/images/cryptobeetle_031.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jspruance/cryptobeetles/main/metadata/images/cryptobeetle_031.gif -------------------------------------------------------------------------------- /metadata/images/cryptobeetle_069.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jspruance/cryptobeetles/main/metadata/images/cryptobeetle_069.gif -------------------------------------------------------------------------------- /metadata/images/cryptobeetle_075.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jspruance/cryptobeetles/main/metadata/images/cryptobeetle_075.gif -------------------------------------------------------------------------------- /metadata/images/cryptobeetle_137.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jspruance/cryptobeetles/main/metadata/images/cryptobeetle_137.gif -------------------------------------------------------------------------------- /metadata/images/cryptobeetle_155.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jspruance/cryptobeetles/main/metadata/images/cryptobeetle_155.gif -------------------------------------------------------------------------------- /metadata/images/cryptobeetle_171.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jspruance/cryptobeetles/main/metadata/images/cryptobeetle_171.gif -------------------------------------------------------------------------------- /metadata/images/cryptobeetle_177.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jspruance/cryptobeetles/main/metadata/images/cryptobeetle_177.gif -------------------------------------------------------------------------------- /metadata/images/cryptobeetle_185.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jspruance/cryptobeetles/main/metadata/images/cryptobeetle_185.gif -------------------------------------------------------------------------------- /metadata/images/cryptobeetle_187.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jspruance/cryptobeetles/main/metadata/images/cryptobeetle_187.gif -------------------------------------------------------------------------------- /metadata/images/cryptobeetle_190.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jspruance/cryptobeetles/main/metadata/images/cryptobeetle_190.gif -------------------------------------------------------------------------------- /metadata/images/cryptobeetle_193.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jspruance/cryptobeetles/main/metadata/images/cryptobeetle_193.gif -------------------------------------------------------------------------------- /metadata/images/cryptobeetle_197.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jspruance/cryptobeetles/main/metadata/images/cryptobeetle_197.gif -------------------------------------------------------------------------------- /metadata/images/cryptobeetle_201.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jspruance/cryptobeetles/main/metadata/images/cryptobeetle_201.gif -------------------------------------------------------------------------------- /metadata/images/cryptobeetle_39.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jspruance/cryptobeetles/main/metadata/images/cryptobeetle_39.gif -------------------------------------------------------------------------------- /metadata/images/cryptobeetle_95.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jspruance/cryptobeetles/main/metadata/images/cryptobeetle_95.gif -------------------------------------------------------------------------------- /metadata/images/cryptobeetles_060.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jspruance/cryptobeetles/main/metadata/images/cryptobeetles_060.gif -------------------------------------------------------------------------------- /metadata/images/cryptobeetles_116.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jspruance/cryptobeetles/main/metadata/images/cryptobeetles_116.gif -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | .env 3 | coverage 4 | coverage.json 5 | typechain 6 | contract_info.txt 7 | 8 | #Hardhat files 9 | cache 10 | artifacts 11 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "cryptobeetles", 3 | "version": "1.0.0", 4 | "description": "A limited-edition NFT collection beetle pixel art.", 5 | "main": "index.js", 6 | "scripts": { 7 | "test": "echo \"Error: no test specified\" && exit 1" 8 | }, 9 | "author": "", 10 | "license": "ISC", 11 | "devDependencies": { 12 | "@nomiclabs/hardhat-ethers": "^2.0.2", 13 | "ethereum-waffle": "^3.4.0", 14 | "ethers": "^5.5.1", 15 | "hardhat": "^2.7.0" 16 | }, 17 | "dependencies": { 18 | "@nomiclabs/hardhat-waffle": "^2.0.1", 19 | "@openzeppelin/contracts": "^4.4.0", 20 | "dotenv": "^10.0.0" 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /test/sample-test.js: -------------------------------------------------------------------------------- 1 | const { expect } = require("chai"); 2 | const { ethers } = require("hardhat"); 3 | 4 | describe("Greeter", function () { 5 | it("Should return the new greeting once it's changed", async function () { 6 | const Greeter = await ethers.getContractFactory("Greeter"); 7 | const greeter = await Greeter.deploy("Hello, world!"); 8 | await greeter.deployed(); 9 | 10 | expect(await greeter.greet()).to.equal("Hello, world!"); 11 | 12 | const setGreetingTx = await greeter.setGreeting("Hola, mundo!"); 13 | 14 | // wait until the transaction is mined 15 | await setGreetingTx.wait(); 16 | 17 | expect(await greeter.greet()).to.equal("Hola, mundo!"); 18 | }); 19 | }); 20 | -------------------------------------------------------------------------------- /contracts/CryptoBeetles.sol: -------------------------------------------------------------------------------- 1 | // contracts/CryptoBeetles.sol 2 | // SPDX-License-Identifier: MIT 3 | pragma solidity ^0.8.2; 4 | 5 | import "@openzeppelin/contracts/token/ERC721/extensions/ERC721URIStorage.sol"; 6 | import "@openzeppelin/contracts/utils/Counters.sol"; 7 | 8 | contract CryptoBeetles is ERC721URIStorage { 9 | using Counters for Counters.Counter; 10 | Counters.Counter private _tokenIds; 11 | 12 | constructor(string memory _name, string memory _symbol) ERC721(_name, _symbol) {} 13 | 14 | function mint(string memory tokenURI) 15 | public 16 | returns (uint256) 17 | { 18 | _tokenIds.increment(); 19 | 20 | uint256 newItemId = _tokenIds.current(); 21 | _mint(msg.sender, newItemId); 22 | _setTokenURI(newItemId, tokenURI); 23 | 24 | return newItemId; 25 | } 26 | } -------------------------------------------------------------------------------- /scripts/deploy.js: -------------------------------------------------------------------------------- 1 | 2 | const { ethers } = require("hardhat") 3 | 4 | async function main() { 5 | const CryptoBeetles = await ethers.getContractFactory("CryptoBeetles") 6 | const cryptoBeetles = await CryptoBeetles.deploy("CryptoBeetles", "CBEET") 7 | 8 | try { 9 | await cryptoBeetles.deployed() 10 | console.log(`Success! Contract deployed to ${cryptoBeetles.address}`) 11 | } catch(err) { 12 | console.log(`deployment error: ${err.message}`) 13 | } 14 | 15 | // CID from Pinata for json metadata file 16 | try { 17 | const newItemId = await cryptoBeetles.mint("") 18 | console.log(`NFT succesfully minted! :::: ${newItemId}`) 19 | } catch(err) { 20 | console.log(`minting error: ${err.message}`) 21 | } 22 | } 23 | 24 | main() 25 | .then(() => process.exit(0)) 26 | .catch((error) => { 27 | console.error(error) 28 | process.exit(1) 29 | }); 30 | -------------------------------------------------------------------------------- /hardhat.config.js: -------------------------------------------------------------------------------- 1 | require("@nomiclabs/hardhat-waffle"); 2 | require("dotenv").config(); 3 | 4 | // This is a sample Hardhat task. To learn how to create your own go to 5 | // https://hardhat.org/guides/create-task.html 6 | task("accounts", "Prints the list of accounts", async (taskArgs, hre) => { 7 | const accounts = await hre.ethers.getSigners(); 8 | 9 | for (const account of accounts) { 10 | console.log(account.address); 11 | } 12 | }); 13 | 14 | // You need to export an object to set up your config 15 | // Go to https://hardhat.org/config/ to learn more 16 | 17 | /** 18 | * @type import('hardhat/config').HardhatUserConfig 19 | */ 20 | module.exports = { 21 | solidity: "0.8.2", 22 | networks: { 23 | mumbai: { 24 | url: process.env.MUMBAI_URL, 25 | accounts: [process.env.PRIVATE_KEY], 26 | }, 27 | mainnet: { 28 | url: process.env.MAINNET_URL, 29 | accounts: [process.env.PRIVATE_KEY], 30 | gas: 200000, 31 | gasPrice: 100000000000, 32 | } 33 | } 34 | }; -------------------------------------------------------------------------------- /metadata/cryptobeetle_001.json: -------------------------------------------------------------------------------- 1 | { 2 | "name" : "Crypto Beetle 001", 3 | "description": "Crypto Beetle", 4 | "image" : "https://ipfs.io/ipfs/QmbB8vrz117iixtkgNg4UxFqMuvHczNRgmrhXosCxyypJv", 5 | "attributes": [ 6 | { 7 | "trait_type": "Generation", 8 | "value": 1 9 | }, 10 | { 11 | "trait_type": "Dots", 12 | "value": 6, 13 | "max_value": 8 14 | }, 15 | { 16 | "trait_type": "Color", 17 | "value": "red" 18 | }, 19 | { 20 | "trait_type": "Eyes", 21 | "value": "regular" 22 | }, 23 | { 24 | "trait_type": "Antenna", 25 | "value": "regular" 26 | }, 27 | { 28 | "trait_type": "Front legs", 29 | "value": "regular" 30 | }, 31 | { 32 | "trait_type": "Eye orientation", 33 | "value": "indeterminate" 34 | }, 35 | { 36 | "trait_type": "Background", 37 | "value": "space" 38 | }, 39 | { 40 | "trait_type": "Nebula", 41 | "value": 0, 42 | "maxValue": 10 43 | } 44 | ] 45 | } -------------------------------------------------------------------------------- /metadata/cryptobeetle_002.json: -------------------------------------------------------------------------------- 1 | { 2 | "name" : "Crypto Beetle 001", 3 | "description": "Crypto Beetle", 4 | "image" : "https://ipfs.io/ipfs/QmQp81HYsjUkPJoMwEZHBHtvX2sR6nrMEskiGmSysCrara", 5 | "attributes": [ 6 | { 7 | "trait_type": "Generation", 8 | "value": 1 9 | }, 10 | { 11 | "trait_type": "Dots", 12 | "value": 6, 13 | "max_value": 8 14 | }, 15 | { 16 | "trait_type": "Color", 17 | "value": "green" 18 | }, 19 | { 20 | "trait_type": "Eyes", 21 | "value": "regular" 22 | }, 23 | { 24 | "trait_type": "Antenna", 25 | "value": "regular" 26 | }, 27 | { 28 | "trait_type": "Front legs", 29 | "value": "regular" 30 | }, 31 | { 32 | "trait_type": "Eye orientation", 33 | "value": "indeterminate" 34 | }, 35 | { 36 | "trait_type": "Background", 37 | "value": "space" 38 | }, 39 | { 40 | "trait_type": "Nebula", 41 | "value": 0, 42 | "maxValue": 10 43 | } 44 | ] 45 | } -------------------------------------------------------------------------------- /metadata/cryptobeetle_31.json: -------------------------------------------------------------------------------- 1 | { 2 | "name" : "Crypto Beetle 022", 3 | "description": "Crypto Beetle", 4 | "image" : "https://ipfs.io/ipfs/QmYdjwAaZSxx2YEmNNkBAyxFoU6uidfyq3GSDZaVgiQ58j", 5 | "attributes": [ 6 | { 7 | "trait_type": "Generation", 8 | "value": 1 9 | }, 10 | { 11 | "trait_type": "Dots", 12 | "value": 6, 13 | "max_value": 8 14 | }, 15 | { 16 | "trait_type": "Color", 17 | "value": "aqua" 18 | }, 19 | { 20 | "trait_type": "Eyes", 21 | "value": "regular" 22 | }, 23 | { 24 | "trait_type": "Antenna", 25 | "value": "regular" 26 | }, 27 | { 28 | "trait_type": "Front legs", 29 | "value": "regular" 30 | }, 31 | { 32 | "trait_type": "Eye orientation", 33 | "value": "indeterminate" 34 | }, 35 | { 36 | "trait_type": "Background", 37 | "value": "space" 38 | }, 39 | { 40 | "trait_type": "Nebula", 41 | "value": 4, 42 | "maxValue": 10 43 | } 44 | ] 45 | } -------------------------------------------------------------------------------- /metadata/cryptobeetle_022.json: -------------------------------------------------------------------------------- 1 | { 2 | "name" : "Crypto Beetle 022", 3 | "description": "Crypto Beetle", 4 | "image" : "https://ipfs.io/ipfs/QmdHR8386jYce6q8GwifrH1DbutFnm36HGfNStrSh8biPx", 5 | "attributes": [ 6 | { 7 | "trait_type": "Generation", 8 | "value": 1 9 | }, 10 | { 11 | "trait_type": "Dots", 12 | "value": 6, 13 | "max_value": 8 14 | }, 15 | { 16 | "trait_type": "Color", 17 | "value": "magenta" 18 | }, 19 | { 20 | "trait_type": "Eyes", 21 | "value": "regular" 22 | }, 23 | { 24 | "trait_type": "Antenna", 25 | "value": "regular" 26 | }, 27 | { 28 | "trait_type": "Front legs", 29 | "value": "regular" 30 | }, 31 | { 32 | "trait_type": "Eye orientation", 33 | "value": "indeterminate" 34 | }, 35 | { 36 | "trait_type": "Background", 37 | "value": "space" 38 | }, 39 | { 40 | "trait_type": "Nebula", 41 | "value": 4, 42 | "maxValue": 10 43 | } 44 | ] 45 | } -------------------------------------------------------------------------------- /metadata/cryptobeetle_024.json: -------------------------------------------------------------------------------- 1 | { 2 | "name" : "Crypto Beetle 022", 3 | "description": "Crypto Beetle", 4 | "image" : "https://ipfs.io/ipfs/QmfAfAXZZVqzyqSJvHsEwzKietEUq5EPpYAMNwUGP5jvL5", 5 | "attributes": [ 6 | { 7 | "trait_type": "Generation", 8 | "value": 1 9 | }, 10 | { 11 | "trait_type": "Dots", 12 | "value": 6, 13 | "max_value": 8 14 | }, 15 | { 16 | "trait_type": "Color", 17 | "value": "seafoam green" 18 | }, 19 | { 20 | "trait_type": "Eyes", 21 | "value": "regular" 22 | }, 23 | { 24 | "trait_type": "Antenna", 25 | "value": "regular" 26 | }, 27 | { 28 | "trait_type": "Front legs", 29 | "value": "regular" 30 | }, 31 | { 32 | "trait_type": "Eye orientation", 33 | "value": "indeterminate" 34 | }, 35 | { 36 | "trait_type": "Background", 37 | "value": "space" 38 | }, 39 | { 40 | "trait_type": "Nebula", 41 | "value": 8, 42 | "maxValue": 10 43 | } 44 | ] 45 | } --------------------------------------------------------------------------------