-
Notifications
You must be signed in to change notification settings - Fork 0
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
0 parents
commit 2da348d
Showing
24 changed files
with
38,036 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,11 @@ | ||
node_modules | ||
.env | ||
coverage | ||
coverage.json | ||
typechain | ||
typechain-types | ||
|
||
#Hardhat files | ||
cache | ||
artifacts | ||
|
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,13 @@ | ||
# Sample Hardhat Project | ||
|
||
This project demonstrates a basic Hardhat use case. It comes with a sample contract, a test for that contract, and a script that deploys that contract. | ||
|
||
Try running some of the following tasks: | ||
|
||
```shell | ||
npx hardhat help | ||
npx hardhat test | ||
GAS_REPORT=true npx hardhat test | ||
npx hardhat node | ||
npx hardhat run scripts/deploy.js | ||
``` |
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,39 @@ | ||
//SPDX-License-Identifier: Unlicense | ||
pragma solidity ^0.8.0; | ||
|
||
error ONLY_OWNER_CAN_ACT(); | ||
error ALREADY_MEMBER(); | ||
|
||
contract Whitelist { | ||
// Create a mapping of whitelistedAddresses | ||
// if an address is whitelisted, we would set it to true, it is false by default for all other addresses. | ||
mapping(address => bool) public whitelistedAddresses; | ||
|
||
// numAddressesWhitelisted would be used to keep track of how many addresses have been whitelisted | ||
uint16 public numAddressesWhitelisted; // 65,536 | ||
address public owner; | ||
|
||
constructor(address _ownerAddr) { | ||
owner = _ownerAddr; | ||
} | ||
|
||
modifier onlyOwner() { | ||
if (msg.sender != owner) { | ||
revert ONLY_OWNER_CAN_ACT(); | ||
} | ||
_; | ||
} | ||
|
||
/** | ||
addAddressToWhitelist - This function adds the address of the sender to the | ||
whitelist | ||
*/ | ||
function addAddressToWhitelist(address _address) public onlyOwner { | ||
if (whitelistedAddresses[_address]) { | ||
revert ALREADY_MEMBER(); | ||
} | ||
whitelistedAddresses[_address] = true; | ||
// Increase the number of whitelisted addresses | ||
numAddressesWhitelisted += 1; | ||
} | ||
} |
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,24 @@ | ||
require("@nomiclabs/hardhat-waffle"); | ||
require("@nomiclabs/hardhat-etherscan"); | ||
require("dotenv").config({ path: ".env" }); | ||
|
||
const ALCHEMY_API_KEY_URL = process.env.ALCHEMY_API_KEY_URL; | ||
|
||
const MUMBAI_PRIVATE_KEY = process.env.MUMBAI_PRIVATE_KEY; | ||
|
||
const POLYGONSCAN_KEY = process.env.POLYGONSCAN_KEY; | ||
|
||
module.exports = { | ||
solidity: "0.8.4", | ||
networks: { | ||
mumbai: { | ||
url: ALCHEMY_API_KEY_URL, | ||
accounts: [MUMBAI_PRIVATE_KEY], | ||
}, | ||
}, | ||
etherscan: { | ||
apiKey: { | ||
polygonMumbai: POLYGONSCAN_KEY, | ||
}, | ||
}, | ||
}; |
Oops, something went wrong.