init project

This commit is contained in:
Ruidy 2022-04-07 06:43:28 -04:00
commit d93435ddfc
No known key found for this signature in database
GPG key ID: 85530F50B592CC84
9 changed files with 7971 additions and 0 deletions

9
.gitignore vendored Normal file
View file

@ -0,0 +1,9 @@
node_modules
.env
coverage
coverage.json
typechain
#Hardhat files
cache
artifacts

8
README.md Normal file
View file

@ -0,0 +1,8 @@
# My NFT Collection
Demo NFT collection for learning purposes.
## Built With
- [Solidity](https://soliditylang.org/)
- [Hardhat](https://hardhat.org/)

22
contracts/Greeter.sol Normal file
View file

@ -0,0 +1,22 @@
//SPDX-License-Identifier: Unlicense
pragma solidity ^0.8.0;
import "hardhat/console.sol";
contract Greeter {
string private greeting;
constructor(string memory _greeting) {
console.log("Deploying a Greeter with greeting:", _greeting);
greeting = _greeting;
}
function greet() public view returns (string memory) {
return greeting;
}
function setGreeting(string memory _greeting) public {
console.log("Changing greeting from '%s' to '%s'", greeting, _greeting);
greeting = _greeting;
}
}

21
hardhat.config.js Normal file
View file

@ -0,0 +1,21 @@
require("@nomiclabs/hardhat-waffle");
// This is a sample Hardhat task. To learn how to create your own go to
// https://hardhat.org/guides/create-task.html
task("accounts", "Prints the list of accounts", async (taskArgs, hre) => {
const accounts = await hre.ethers.getSigners();
for (const account of accounts) {
console.log(account.address);
}
});
// You need to export an object to set up your config
// Go to https://hardhat.org/config/ to learn more
/**
* @type import('hardhat/config').HardhatUserConfig
*/
module.exports = {
solidity: "0.8.4",
};

20
package.json Normal file
View file

@ -0,0 +1,20 @@
{
"name": "nft-collection",
"version": "1.0.0",
"main": "index.js",
"license": "MIT",
"scripts": {
"dev": "npx hardhat run scripts/sample-script.js"
},
"devDependencies": {
"@nomiclabs/hardhat-ethers": "^2.0.0",
"@nomiclabs/hardhat-waffle": "^2.0.0",
"chai": "^4.2.0",
"ethereum-waffle": "^3.0.0",
"ethers": "^5.0.0",
"hardhat": "^2.9.3"
},
"dependencies": {
"@openzeppelin/contracts": "^4.5.0"
}
}

32
scripts/sample-script.js Normal file
View file

@ -0,0 +1,32 @@
// We require the Hardhat Runtime Environment explicitly here. This is optional
// but useful for running the script in a standalone fashion through `node <script>`.
//
// When running the script with `npx hardhat run <script>` you'll find the Hardhat
// Runtime Environment's members available in the global scope.
const hre = require("hardhat");
async function main() {
// Hardhat always runs the compile task when running scripts with its command
// line interface.
//
// If this script is run directly using `node` you may want to call compile
// manually to make sure everything is compiled
// await hre.run('compile');
// We get the contract to deploy
const Greeter = await hre.ethers.getContractFactory("Greeter");
const greeter = await Greeter.deploy("Hello, Hardhat!");
await greeter.deployed();
console.log("Greeter deployed to:", greeter.address);
}
// We recommend this pattern to be able to use async/await everywhere
// and properly handle errors.
main()
.then(() => process.exit(0))
.catch((error) => {
console.error(error);
process.exit(1);
});

19
test/sample-test.js Normal file
View file

@ -0,0 +1,19 @@
const { expect } = require("chai");
const { ethers } = require("hardhat");
describe("Greeter", function () {
it("Should return the new greeting once it's changed", async function () {
const Greeter = await ethers.getContractFactory("Greeter");
const greeter = await Greeter.deploy("Hello, world!");
await greeter.deployed();
expect(await greeter.greet()).to.equal("Hello, world!");
const setGreetingTx = await greeter.setGreeting("Hola, mundo!");
// wait until the transaction is mined
await setGreetingTx.wait();
expect(await greeter.greet()).to.equal("Hola, mundo!");
});
});

55
yarn-error.log Normal file
View file

@ -0,0 +1,55 @@
Arguments:
/Users/rnemausat/.nvm/versions/node/v16.13.2/bin/node /usr/local/Cellar/yarn/1.22.18/libexec/bin/yarn.js init
PATH:
/Users/rnemausat/.pyenv/shims:/Users/rnemausat/.pyenv/bin:/usr/local/sbin:/Users/rnemausat/.deno/bin:/Users/rnemausat/.pyenv/shims:/Users/rnemausat/.pyenv/bin:/Users/rnemausat/.nvm/versions/node/v16.13.2/bin:/usr/local/sbin:/Users/rnemausat/.deno/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/go/bin:/Library/Apple/usr/bin:/Users/rnemausat/.cargo/bin:/Users/rnemausat/.local/bin:/Users/rnemausat/.fig/bin:/Users/rnemausat/.local/bin:/Users/rnemausat/.local/bin:/Users/rnemausat/Library/Android/sdk/emulator:/Users/rnemausat/Library/Android/sdk/tools:/Users/rnemausat/Library/Android/sdk/tools/bin:/Users/rnemausat/Library/Android/sdk/platform-tools:/Users/rnemausat/flutter/bin:/Users/rnemausat/go/bin:/Users/rnemausat/.local/bin:/Users/rnemausat/.local/bin:/Users/rnemausat/Library/Android/sdk/emulator:/Users/rnemausat/Library/Android/sdk/tools:/Users/rnemausat/Library/Android/sdk/tools/bin:/Users/rnemausat/Library/Android/sdk/platform-tools:/Users/rnemausat/flutter/bin:/Users/rnemausat/go/bin
Yarn version:
1.22.18
Node version:
16.13.2
Platform:
darwin x64
Trace:
Error: canceled
at Interface.<anonymous> (/usr/local/Cellar/yarn/1.22.18/libexec/lib/cli.js:137143:13)
at Interface.emit (node:events:390:28)
at Interface._ttyWrite (node:readline:1081:16)
at ReadStream.onkeypress (node:readline:288:10)
at ReadStream.emit (node:events:390:28)
at emitKeys (node:internal/readline/utils:358:14)
at emitKeys.next (<anonymous>)
at ReadStream.onData (node:internal/readline/emitKeypressEvents:61:36)
at ReadStream.emit (node:events:390:28)
at addChunk (node:internal/streams/readable:315:12)
npm manifest:
{
"name": "nft-collection",
"version": "1.0.0",
"main": "index.js",
"license": "MIT",
"scripts": {
"dev": "npx hardhat run scripts/sample-script.js"
},
"devDependencies": {
"@nomiclabs/hardhat-ethers": "^2.0.0",
"@nomiclabs/hardhat-waffle": "^2.0.0",
"chai": "^4.2.0",
"ethereum-waffle": "^3.0.0",
"ethers": "^5.0.0",
"hardhat": "^2.9.3"
},
"dependencies": {
"@openzeppelin/contracts": "^4.5.0"
}
}
yarn manifest:
No manifest
Lockfile:
No lockfile

7785
yarn.lock Normal file

File diff suppressed because it is too large Load diff