-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
32,738 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
ALCHEMY_API_KEY= | ||
ROPSTEN_PRIVATE_KEY= |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
node_modules | ||
.env | ||
|
||
#Hardhat files | ||
cache | ||
artifacts | ||
dist |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
{ | ||
"overrides": [ | ||
{ | ||
"files": "*.sol", | ||
"options": { | ||
"printWidth": 120, | ||
"tabWidth": 2, | ||
"useTabs": false, | ||
"singleQuote": false, | ||
"bracketSpacing": false, | ||
"explicitTypes": "always", | ||
"semi": true | ||
} | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
// SPDX-License-Identifier: GPL-3.0 | ||
|
||
/* | ||
Requirements: | ||
- Must receive eth in exchange for an ERC20 token | ||
- There is a recipient address that receives all incoming eth. | ||
- Exchange rate is fixed. 1 eth = 1000 tokens | ||
- Minimum investment is 0.01 eth and maximum is 5 eth. | ||
- The ICO hardcap is 300 eth. | ||
- An admin decides when the ICO starts and ends. | ||
- The ICO ends when the hardcap is reached or end time is reached. | ||
- The token will be tradeable only after a specific time set by the admin | ||
*/ | ||
|
||
pragma solidity ^0.8.7; | ||
|
||
import "@openzeppelin/contracts/token/ERC721/ERC721.sol"; | ||
|
||
contract NFTest is ERC721("Test", "TEST") { | ||
function mint(address to, uint256 tokenId) public { | ||
_mint(to, tokenId); | ||
} | ||
|
||
function transfer( | ||
address from, | ||
address to, | ||
uint256 tokenId | ||
) public { | ||
_transfer(from, to, tokenId); | ||
} | ||
|
||
function mintWithMerkleProof( | ||
address to, | ||
uint256 tokenId, | ||
string[] calldata proof | ||
) public { | ||
_mint(to, tokenId); | ||
_hashProof(proof); | ||
} | ||
|
||
function transferWithMerkleProof( | ||
address from, | ||
address to, | ||
uint256 tokenId, | ||
string[] calldata proof | ||
) public { | ||
_hashProof(proof); | ||
_transfer(from, to, tokenId); | ||
} | ||
|
||
function _hashProof(string[] calldata proof) internal pure { | ||
for (uint256 index = 0; index < proof.length; index++) { | ||
keccak256(abi.encode(proof[index])); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
import { task } from "hardhat/config"; | ||
import "@nomiclabs/hardhat-waffle"; | ||
import "hardhat-gas-reporter" | ||
import "hardhat-tracer" | ||
import "@atixlabs/hardhat-time-n-mine" | ||
import "@atixlabs/hardhat-time-n-mine/dist/src/type-extensions"; | ||
|
||
import dotenv from 'dotenv' | ||
dotenv.config() | ||
|
||
// 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 (args, hre) => { | ||
const accounts = await hre.ethers.getSigners(); | ||
|
||
for (const account of accounts) { | ||
console.log(await account.address); | ||
} | ||
}); | ||
|
||
// You need to export an object to set up your config | ||
// Go to https://hardhat.org/config/ to learn more | ||
|
||
export default { | ||
solidity: { | ||
version: '0.8.7', | ||
settings: { | ||
outputSelection: { | ||
"*": { | ||
"*": ["storageLayout"], | ||
}, | ||
}, | ||
} | ||
}, | ||
networks: { | ||
ropsten: { | ||
url: `https://eth-ropsten.alchemyapi.io/v2/${process.env.ALCHEMY_API_KEY}`, | ||
accounts: [`0x${process.env.ROPSTEN_PRIVATE_KEY}`], | ||
}, | ||
}, | ||
}; |
Oops, something went wrong.