├── .gitignore ├── contracts └── Migrations.sol ├── migrations ├── 1_initial_migration.js └── 2_deploy_token.js ├── package-lock.json ├── package.json ├── secrets.json ├── test └── .gitkeep └── truffle-config.js /.gitignore: -------------------------------------------------------------------------------- 1 | # See https://help.github.com/articles/ignoring-files/ for more about ignoring files. 2 | 3 | # dependencies 4 | /node_modules 5 | /.pnp 6 | .pnp.js 7 | 8 | # testing 9 | /coverage 10 | 11 | # next.js 12 | /.next/ 13 | /out/ 14 | 15 | # production 16 | /build 17 | 18 | # misc 19 | .DS_Store 20 | *.pem 21 | 22 | # debug 23 | npm-debug.log* 24 | yarn-debug.log* 25 | yarn-error.log* 26 | .pnpm-debug.log* 27 | 28 | # local env files 29 | .env*.local 30 | 31 | # vercel 32 | .vercel 33 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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_deploy_token.js: -------------------------------------------------------------------------------- 1 | // migrations/2_deploy_token.js 2 | // SPDX-License-Identifier: MIT 3 | 4 | const ERC721PresetMinterPauserAutoId = artifacts.require("ERC721PresetMinterPauserAutoId"); 5 | module.exports = function (deployer) { 6 | deployer.deploy(ERC721PresetMinterPauserAutoId, "My NFT", "NFT", "https://gateway.pinata.cloud/ipfs/QmcdnHCTuPoazQG8ft3tsRQ6RZTob6EDgAR5Mo3LV2Weif/"); 7 | }; -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "creating_nft_from_scratch_on_opensea", 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.5.0", 14 | "@truffle/hdwallet-provider": "^2.0.7" 15 | }, 16 | "dependencies": { 17 | "truffle": "^5.5.11" 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /secrets.json: -------------------------------------------------------------------------------- 1 | { 2 | "mnemonic": "car photo eye hurricane hawk ...", 3 | "projectId": "91230ccd9c5243d8bcd4612da884da24" 4 | } -------------------------------------------------------------------------------- /test/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/techwizard210/Creating_NFT_from_Scratch_On_Opensea/c10422d3ac724e1ac776b37349483c49240f553c/test/.gitkeep -------------------------------------------------------------------------------- /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 { projectId, mnemonic } = require('./secrets.json'); 24 | 25 | module.exports = { 26 | /** 27 | * Networks define how you connect to your ethereum client and let you set the 28 | * defaults web3 uses to send transactions. If you don't specify one truffle 29 | * will spin up a development blockchain for you on port 9545 when you 30 | * run `develop` or `test`. You can ask a truffle command to use a specific 31 | * network from the command line, e.g 32 | * 33 | * $ truffle test --network 34 | */ 35 | 36 | networks: { 37 | // Useful for testing. The `development` name is special - truffle uses it by default 38 | // if it's defined here and no other network is specified at the command line. 39 | // You should run a client (like ganache-cli, geth or parity) in a separate terminal 40 | // tab if you use this network and you must also set the `host`, `port` and `network_id` 41 | // options below to some value. 42 | // 43 | // development: { 44 | // host: "127.0.0.1", // Localhost (default: none) 45 | // port: 8545, // Standard Ethereum port (default: none) 46 | // network_id: "*", // Any network (default: none) 47 | // }, 48 | // Another network with more advanced options... 49 | // advanced: { 50 | // port: 8777, // Custom port 51 | // network_id: 1342, // Custom network 52 | // gas: 8500000, // Gas sent with each transaction (default: ~6700000) 53 | // gasPrice: 20000000000, // 20 gwei (in wei) (default: 100 gwei) 54 | // from:
, // Account to send txs from (default: accounts[0]) 55 | // websocket: true // Enable EventEmitter interface for web3 (default: false) 56 | // }, 57 | // Useful for deploying to a public network. 58 | // NB: It's important to wrap the provider as a function. 59 | // ropsten: { 60 | // provider: () => new HDWalletProvider(mnemonic, `https://ropsten.infura.io/v3/YOUR-PROJECT-ID`), 61 | // network_id: 3, // Ropsten's id 62 | // gas: 5500000, // Ropsten has a lower block limit than mainnet 63 | // confirmations: 2, // # of confs to wait between deployments. (default: 0) 64 | // timeoutBlocks: 200, // # of blocks before a deployment times out (minimum/default: 50) 65 | // skipDryRun: true // Skip dry run before migrations? (default: false for public nets ) 66 | // }, 67 | // Useful for private networks 68 | // private: { 69 | // provider: () => new HDWalletProvider(mnemonic, `https://network.io`), 70 | // network_id: 2111, // This network is yours, in the cloud. 71 | // production: true // Treats this network as if it was a public net. (default: false) 72 | // } 73 | 74 | rinkeby: { 75 | provider: () => new HDWalletProvider(mnemonic, `https://rinkeby.infura.io/v3/${projectId}`), 76 | network_id: 4, // Rinkeby's id 77 | gas: 5500000, // Rinkeby has a lower block limit than mainnet 78 | confirmations: 2, // # of confs to wait between deployments. (default: 0) 79 | timeoutBlocks: 500, // # of blocks before a deployment times out (minimum/default: 50) 80 | skipDryRun: true // Skip dry run before migrations? (default: false for public nets ) 81 | }, 82 | 83 | 84 | }, 85 | 86 | // Set default mocha options here, use special reporters etc. 87 | mocha: { 88 | // timeout: 100000 89 | }, 90 | 91 | // Configure your compilers 92 | compilers: { 93 | solc: { 94 | version: "0.8.9", // Fetch exact version from solc-bin (default: truffle's version) 95 | // docker: true, // Use "0.5.1" you've installed locally with docker (default: false) 96 | // settings: { // See the solidity docs for advice about optimization and evmVersion 97 | // optimizer: { 98 | // enabled: false, 99 | // runs: 200 100 | // }, 101 | // evmVersion: "byzantium" 102 | // } 103 | } 104 | }, 105 | 106 | // Truffle DB is currently disabled by default; to enable it, change enabled: 107 | // false to enabled: true. The default storage location can also be 108 | // overridden by specifying the adapter settings, as shown in the commented code below. 109 | // 110 | // NOTE: It is not possible to migrate your contracts to truffle DB and you should 111 | // make a backup of your artifacts to a safe location before enabling this feature. 112 | // 113 | // After you backed up your artifacts you can utilize db by running migrate as follows: 114 | // $ truffle migrate --reset --compile-all 115 | // 116 | // db: { 117 | // enabled: false, 118 | // host: "127.0.0.1", 119 | // adapter: { 120 | // name: "sqlite", 121 | // settings: { 122 | // directory: ".db" 123 | // } 124 | // } 125 | // } 126 | }; --------------------------------------------------------------------------------