├── contracts ├── NSToken.sol ├── Greeter.sol └── NFT.sol ├── .gitignore ├── hardhat.config.js ├── test └── sample-test.js ├── package.json ├── scripts └── sample-script.js └── README.md /contracts/NSToken.sol: -------------------------------------------------------------------------------- 1 | // contracts/NSToken.sol 2 | // SPDX-License-Identifier: MIT OR Apache-2.0 3 | pragma solidity ^0.8.4; 4 | 5 | import '@openzeppelin/contracts/token/ERC20/ERC20.sol'; 6 | 7 | contract NSToken is ERC20 { 8 | 9 | constructor() ERC20("NSToken", "NST") { 10 | _mint(msg.sender, 1000000); 11 | } 12 | 13 | } -------------------------------------------------------------------------------- /.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 | # production 12 | /build 13 | 14 | # misc 15 | .DS_Store 16 | .env.local 17 | .env.development.local 18 | .env.test.local 19 | .env.production.local 20 | 21 | npm-debug.log* 22 | yarn-debug.log* 23 | yarn-error.log* 24 | 25 | node_modules 26 | 27 | #Hardhat files 28 | cache 29 | artifacts 30 | 31 | node_modules 32 | .env 33 | 34 | #Hardhat files 35 | cache 36 | artifacts 37 | -------------------------------------------------------------------------------- /contracts/Greeter.sol: -------------------------------------------------------------------------------- 1 | //SPDX-License-Identifier: Unlicense 2 | pragma solidity ^0.8.0; 3 | 4 | import "hardhat/console.sol"; 5 | 6 | contract Greeter { 7 | string private greeting; 8 | 9 | constructor(string memory _greeting) { 10 | console.log("Deploying a Greeter with greeting:", _greeting); 11 | greeting = _greeting; 12 | } 13 | 14 | function greet() public view returns (string memory) { 15 | return greeting; 16 | } 17 | 18 | function setGreeting(string memory _greeting) public { 19 | console.log("Changing greeting from '%s' to '%s'", greeting, _greeting); 20 | greeting = _greeting; 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /hardhat.config.js: -------------------------------------------------------------------------------- 1 | require("@nomiclabs/hardhat-waffle"); 2 | require("@nomiclabs/hardhat-web3"); 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.4", 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 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "nft-royalties", 3 | "version": "1.0.0", 4 | "description": "", 5 | "main": "index.js", 6 | "dependencies": { 7 | "@nomiclabs/hardhat-ethers": "^2.0.2", 8 | "@nomiclabs/hardhat-waffle": "^2.0.1", 9 | "@openzeppelin/contracts": "^4.3.0", 10 | "axios": "^0.21.1", 11 | "chai": "^4.3.4", 12 | "ethereum-waffle": "^3.4.0", 13 | "ethers": "^5.4.5", 14 | "hardhat": "^2.6.1", 15 | "ipfs-http-client": "^52.0.1", 16 | "web3modal": "^1.9.4" 17 | }, 18 | "devDependencies": { 19 | "@nomiclabs/hardhat-web3": "^2.0.0", 20 | "@openzeppelin/test-helpers": "^0.5.13", 21 | "web3": "^1.5.2" 22 | }, 23 | "scripts": { 24 | "test": "mocha" 25 | }, 26 | "repository": { 27 | "type": "git", 28 | "url": "git+https://github.com/nsinthunont/nft-royalties.git" 29 | }, 30 | "author": "", 31 | "license": "ISC", 32 | "bugs": { 33 | "url": "https://github.com/nsinthunont/nft-royalties/issues" 34 | }, 35 | "homepage": "https://github.com/nsinthunont/nft-royalties#readme" 36 | } 37 | -------------------------------------------------------------------------------- /scripts/sample-script.js: -------------------------------------------------------------------------------- 1 | // We require the Hardhat Runtime Environment explicitly here. This is optional 2 | // but useful for running the script in a standalone fashion through `node