├── test └── .gitkeep ├── migrations ├── 1_initial_migration.js └── 2_deploynft.js ├── package.json ├── contracts ├── Migrations.sol └── EdEdNFT.sol ├── deployed ipfs links └── truffle-config.js /test/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /migrations/1_initial_migration.js: -------------------------------------------------------------------------------- 1 | const Migrations = artifacts.require("Migrations"); 2 | 3 | module.exports = function (deployer) { 4 | deployer.deploy(Migrations); 5 | }; 6 | -------------------------------------------------------------------------------- /migrations/2_deploynft.js: -------------------------------------------------------------------------------- 1 | // migrations/2_deploy.js 2 | // SPDX-License-Identifier: MIT 3 | const EdEdNFT = artifacts.require("EdEdNFT"); 4 | 5 | module.exports = function(deployer) { 6 | deployer.deploy(EdEdNFT); 7 | }; -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "ediblenft", 3 | "version": "1.0.0", 4 | "description": "", 5 | "main": "index.js", 6 | "scripts": { 7 | "test": "echo \"Error: no test specified\" && exit 1" 8 | }, 9 | "keywords": [], 10 | "author": "", 11 | "license": "ISC", 12 | "devDependencies": { 13 | "@openzeppelin/contracts": "^4.4.0" 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /contracts/Migrations.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | pragma solidity >=0.4.22 <0.9.0; 3 | 4 | contract Migrations { 5 | address public owner = msg.sender; 6 | uint public last_completed_migration; 7 | 8 | modifier restricted() { 9 | require( 10 | msg.sender == owner, 11 | "This function is restricted to the contract's owner" 12 | ); 13 | _; 14 | } 15 | 16 | function setCompleted(uint completed) public restricted { 17 | last_completed_migration = completed; 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /contracts/EdEdNFT.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | pragma solidity ^0.8.0; 3 | import "@openzeppelin/contracts/token/ERC721/ERC721.sol"; 4 | 5 | contract EdEdNFT is ERC721 { 6 | 7 | constructor() ERC721("First Edible NFT: EdEdNFT", "EdEdNFT") { 8 | _safeMint(msg.sender, 0); 9 | } 10 | 11 | function tokenURI(uint256 tokenId) public view virtual override returns (string memory) { 12 | require(tokenId == 0, "Only 1 edible token exists (tokenId == 0)."); 13 | return "ipfs://Qma5DzcDmGbBXMrofFBmNGSsvySFW2Zv1BMmKKfYnGEreS"; 14 | } 15 | 16 | } -------------------------------------------------------------------------------- /deployed ipfs links: -------------------------------------------------------------------------------- 1 | Metadata of "edednft" was published successfully. 2 | @openzeppelin/contracts/token/ERC721/ERC721.sol : 3 | ipfs://QmbCHTCLP6bz8omQXrP8VuxFGdK9Hh3jqfrSTr38WNpTk4 4 | 5 | @openzeppelin/contracts/token/ERC721/IERC721.sol : 6 | ipfs://QmWfkpRHksy8jFywqYxdmMqdkQ1hxrGTPoNBXbZ48zTvyv 7 | 8 | @openzeppelin/contracts/token/ERC721/IERC721Receiver.sol : 9 | ipfs://QmT3s3PwCdXqHLJk26kcnedrRGTC9T18z52i9Be7PV9ppc 10 | 11 | @openzeppelin/contracts/token/ERC721/extensions/IERC721Metadata.sol : 12 | ipfs://QmTJWQF8j586oaYNpdZv55xnzyHVQc68XN4eBNeiLbKX8d 13 | 14 | @openzeppelin/contracts/utils/Address.sol : 15 | ipfs://QmXkoKbxyMcMzjYdkXi5t4t3ZjBQ81pj7AaanS9jhePxyt 16 | 17 | @openzeppelin/contracts/utils/Context.sol : 18 | ipfs://QmQVv7YeeKmaS11bg7YDTeeGDk6i7sV8LMMfohaLM4SiRu 19 | 20 | @openzeppelin/contracts/utils/Strings.sol : 21 | ipfs://QmbL6k2zFGndQPNPG7vCDivtjKam3quJSrEbRuVsNo4hBw 22 | 23 | @openzeppelin/contracts/utils/introspection/ERC165.sol : 24 | ipfs://Qmb8zbC3TjWFtcuyP3KEEaegMkPcfeKAcPrwzvkAoMR3cZ 25 | 26 | @openzeppelin/contracts/utils/introspection/IERC165.sol : 27 | ipfs://QmZeBojmgXq821dL1TJKFb58B1FogM9jL3u7hXQ8hTEBKT 28 | 29 | contracts/EdEdNFT.sol : 30 | ipfs://QmPsSDNURe1aHYUjceZy4k34DoWDLz8wexrQCMDfGPi7uq 31 | 32 | metadata.json : 33 | ipfs://QmcHH3uPibf791orzkTWzPLUmQ7c7k3oeywSpXxS65h56R 34 | -------------------------------------------------------------------------------- /truffle-config.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Use this file to configure your truffle project. It's seeded with some 3 | * common settings for different networks and features like migrations, 4 | * compilation and testing. Uncomment the ones you need or modify 5 | * them to suit your project as necessary. 6 | * 7 | * More information about configuration can be found at: 8 | * 9 | * trufflesuite.com/docs/advanced/configuration 10 | * 11 | * To deploy via Infura you'll need a wallet provider (like @truffle/hdwallet-provider) 12 | * to sign your transactions before they're sent to a remote public node. Infura accounts 13 | * are available for free at: infura.io/register. 14 | * 15 | * You'll also need a mnemonic - the twelve word phrase the wallet uses to generate 16 | * public/private key pairs. If you're publishing your code to GitHub make sure you load this 17 | * phrase from a file you've .gitignored so it doesn't accidentally become public. 18 | * 19 | */ 20 | 21 | // const HDWalletProvider = require('@truffle/hdwallet-provider'); 22 | // 23 | // const fs = require('fs'); 24 | // const mnemonic = fs.readFileSync(".secret").toString().trim(); 25 | 26 | module.exports = { 27 | /** 28 | * Networks define how you connect to your ethereum client and let you set the 29 | * defaults web3 uses to send transactions. If you don't specify one truffle 30 | * will spin up a development blockchain for you on port 9545 when you 31 | * run `develop` or `test`. You can ask a truffle command to use a specific 32 | * network from the command line, e.g 33 | * 34 | * $ truffle test --network 35 | */ 36 | 37 | networks: { 38 | // Useful for testing. The `development` name is special - truffle uses it by default 39 | // if it's defined here and no other network is specified at the command line. 40 | // You should run a client (like ganache-cli, geth or parity) in a separate terminal 41 | // tab if you use this network and you must also set the `host`, `port` and `network_id` 42 | // options below to some value. 43 | // 44 | // development: { 45 | // host: "127.0.0.1", // Localhost (default: none) 46 | // port: 8545, // Standard Ethereum port (default: none) 47 | // network_id: "*", // Any network (default: none) 48 | // }, 49 | // Another network with more advanced options... 50 | // advanced: { 51 | // port: 8777, // Custom port 52 | // network_id: 1342, // Custom network 53 | // gas: 8500000, // Gas sent with each transaction (default: ~6700000) 54 | // gasPrice: 20000000000, // 20 gwei (in wei) (default: 100 gwei) 55 | // from:
, // Account to send txs from (default: accounts[0]) 56 | // websocket: true // Enable EventEmitter interface for web3 (default: false) 57 | // }, 58 | // Useful for deploying to a public network. 59 | // NB: It's important to wrap the provider as a function. 60 | // ropsten: { 61 | // provider: () => new HDWalletProvider(mnemonic, `https://ropsten.infura.io/v3/YOUR-PROJECT-ID`), 62 | // network_id: 3, // Ropsten's id 63 | // gas: 5500000, // Ropsten has a lower block limit than mainnet 64 | // confirmations: 2, // # of confs to wait between deployments. (default: 0) 65 | // timeoutBlocks: 200, // # of blocks before a deployment times out (minimum/default: 50) 66 | // skipDryRun: true // Skip dry run before migrations? (default: false for public nets ) 67 | // }, 68 | // Useful for private networks 69 | // private: { 70 | // provider: () => new HDWalletProvider(mnemonic, `https://network.io`), 71 | // network_id: 2111, // This network is yours, in the cloud. 72 | // production: true // Treats this network as if it was a public net. (default: false) 73 | // } 74 | }, 75 | 76 | // Set default mocha options here, use special reporters etc. 77 | mocha: { 78 | // timeout: 100000 79 | }, 80 | 81 | // Configure your compilers 82 | compilers: { 83 | solc: { 84 | version: "0.8.9", // Fetch exact version from solc-bin (default: truffle's version) 85 | // docker: true, // Use "0.5.1" you've installed locally with docker (default: false) 86 | // settings: { // See the solidity docs for advice about optimization and evmVersion 87 | // optimizer: { 88 | // enabled: false, 89 | // runs: 200 90 | // }, 91 | // evmVersion: "byzantium" 92 | // } 93 | } 94 | }, 95 | 96 | // Truffle DB is currently disabled by default; to enable it, change enabled: 97 | // false to enabled: true. The default storage location can also be 98 | // overridden by specifying the adapter settings, as shown in the commented code below. 99 | // 100 | // NOTE: It is not possible to migrate your contracts to truffle DB and you should 101 | // make a backup of your artifacts to a safe location before enabling this feature. 102 | // 103 | // After you backed up your artifacts you can utilize db by running migrate as follows: 104 | // $ truffle migrate --reset --compile-all 105 | // 106 | // db: { 107 | // enabled: false, 108 | // host: "127.0.0.1", 109 | // adapter: { 110 | // name: "sqlite", 111 | // settings: { 112 | // directory: ".db" 113 | // } 114 | // } 115 | // } 116 | }; 117 | --------------------------------------------------------------------------------