mirror of
https://github.com/rjNemo/epicNFT
synced 2026-06-06 01:46:38 +00:00
starter contract
This commit is contained in:
parent
d93435ddfc
commit
eca551ee3f
7 changed files with 29 additions and 60 deletions
10
contracts/EpicNFT.sol
Normal file
10
contracts/EpicNFT.sol
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
//SPDX-License-Identifier: Unlicensed
|
||||
pragma solidity ^0.8.0;
|
||||
|
||||
import "hardhat/console.sol";
|
||||
|
||||
contract EpicNFT {
|
||||
constructor() {
|
||||
console.log("My first NFT contract!");
|
||||
}
|
||||
}
|
||||
|
|
@ -1,22 +0,0 @@
|
|||
//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;
|
||||
}
|
||||
}
|
||||
|
|
@ -1,7 +1,5 @@
|
|||
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();
|
||||
|
||||
|
|
@ -10,9 +8,6 @@ task("accounts", "Prints the list of accounts", async (taskArgs, hre) => {
|
|||
}
|
||||
});
|
||||
|
||||
// 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
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
"main": "index.js",
|
||||
"license": "MIT",
|
||||
"scripts": {
|
||||
"dev": "npx hardhat run scripts/sample-script.js"
|
||||
"dev": "npx hardhat run scripts/run.js"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@nomiclabs/hardhat-ethers": "^2.0.0",
|
||||
|
|
|
|||
18
scripts/run.js
Normal file
18
scripts/run.js
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
const hre = require("hardhat"); // this import is optional
|
||||
|
||||
async function main() {
|
||||
const EpicNFT = await hre.ethers.getContractFactory("EpicNFT");
|
||||
const contract = await EpicNFT.deploy();
|
||||
await contract.deployed();
|
||||
console.log("EpicNFT deployed to:", contract.address);
|
||||
}
|
||||
|
||||
(async () => {
|
||||
try {
|
||||
await main();
|
||||
process.exit(0);
|
||||
} catch (err) {
|
||||
console.error(err);
|
||||
process.exit(1);
|
||||
}
|
||||
})();
|
||||
|
|
@ -1,32 +0,0 @@
|
|||
// 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);
|
||||
});
|
||||
Loading…
Reference in a new issue