From 129c00c267f31691c0cbe66d0e4c4a000332aee2 Mon Sep 17 00:00:00 2001 From: Superior Date: Wed, 16 Oct 2024 18:48:34 +0100 Subject: [PATCH] feat:added my profile --- packages/hardhat/.env.example | 11 -- packages/hardhat/contracts/BatchRegistry.sol | 103 ------------------- packages/nextjs/.env.example | 13 --- 3 files changed, 127 deletions(-) delete mode 100644 packages/hardhat/.env.example delete mode 100644 packages/hardhat/contracts/BatchRegistry.sol delete mode 100644 packages/nextjs/.env.example diff --git a/packages/hardhat/.env.example b/packages/hardhat/.env.example deleted file mode 100644 index e4df931..0000000 --- a/packages/hardhat/.env.example +++ /dev/null @@ -1,11 +0,0 @@ -# Template for Hardhat environment variables. - -# To use this template, copy this file, rename it .env, and fill in the values. - -# If not set, we provide default values (check `hardhat.config.ts`) so developers can start prototyping out of the box, -# but we recommend getting your own API Keys for Production Apps. - -# To access the values stored in this .env file you can use: process.env.VARIABLENAME -ALCHEMY_API_KEY= -DEPLOYER_PRIVATE_KEY= -ETHERSCAN_API_KEY= \ No newline at end of file diff --git a/packages/hardhat/contracts/BatchRegistry.sol b/packages/hardhat/contracts/BatchRegistry.sol deleted file mode 100644 index e4f033e..0000000 --- a/packages/hardhat/contracts/BatchRegistry.sol +++ /dev/null @@ -1,103 +0,0 @@ -//SPDX-License-Identifier: MIT -pragma solidity >=0.8.0 <0.9.0; - -import "@openzeppelin/contracts/access/Ownable.sol"; -import "./BatchGraduationNFT.sol"; - -contract BatchRegistry is Ownable { - uint16 public immutable BATCH_NUMBER; - uint256 constant CHECK_IN_REWARD = 0.01 ether; - BatchGraduationNFT public batchGraduationNFT; - - mapping(address => bool) public allowList; - mapping(address => address) public yourContractAddress; - mapping(address => uint256) public graduatedTokenId; - bool public isOpen = true; - bool public graduationOpen = false; - uint256 public checkedInCounter; - - event CheckedIn(bool first, address builder, address checkInContract); - - // Errors - error BatchNotOpen(); - error NotAContract(); - error NotInAllowList(); - error AlreadyGraduated(); - error NotCheckedIn(); - error GraduationClosed(); - - modifier batchIsOpen() { - if (!isOpen) revert BatchNotOpen(); - _; - } - - modifier senderIsContract() { - if (tx.origin == msg.sender) revert NotAContract(); - _; - } - - constructor( - address initialOwner, - uint16 batchNumber - ) Ownable(initialOwner) { - batchGraduationNFT = new BatchGraduationNFT(address(this)); - BATCH_NUMBER = batchNumber; - } - - function updateAllowList( - address[] calldata builders, - bool[] calldata statuses - ) public onlyOwner { - require( - builders.length == statuses.length, - "Builders and statuses length mismatch" - ); - - for (uint256 i = 0; i < builders.length; i++) { - allowList[builders[i]] = statuses[i]; - } - } - - function toggleBatchOpenStatus() public onlyOwner { - isOpen = !isOpen; - } - - function toggleGraduationOpenStatus() public onlyOwner { - graduationOpen = !graduationOpen; - } - - function checkIn() public senderIsContract batchIsOpen { - if (!allowList[tx.origin]) revert NotInAllowList(); - - bool wasFirstTime; - if (yourContractAddress[tx.origin] == address(0)) { - checkedInCounter++; - wasFirstTime = true; - (bool success, ) = tx.origin.call{ value: CHECK_IN_REWARD }(""); - require(success, "Failed to send check in reward"); - } - - yourContractAddress[tx.origin] = msg.sender; - emit CheckedIn(wasFirstTime, tx.origin, msg.sender); - } - - function graduate() public { - if (!graduationOpen) revert GraduationClosed(); - if (graduatedTokenId[msg.sender] != 0) revert AlreadyGraduated(); - if (yourContractAddress[msg.sender] == address(0)) - revert NotCheckedIn(); - - uint256 newTokenId = batchGraduationNFT.mint(msg.sender); - graduatedTokenId[msg.sender] = newTokenId; - } - - // Withdraw function for admins in case some builders don't end up checking in - function withdraw() public onlyOwner { - (bool success, ) = payable(owner()).call{ - value: address(this).balance - }(""); - require(success, "Failed to withdraw"); - } - - receive() external payable {} -} diff --git a/packages/nextjs/.env.example b/packages/nextjs/.env.example deleted file mode 100644 index c4d46a8..0000000 --- a/packages/nextjs/.env.example +++ /dev/null @@ -1,13 +0,0 @@ -# Template for NextJS environment variables. - -# For local development, copy this file, rename it to .env.local, and fill in the values. -# When deploying live, you'll need to store the vars in Vercel/System config. - -# If not set, we provide default values (check `scaffold.config.ts`) so developers can start prototyping out of the box, -# but we recommend getting your own API Keys for Production Apps. - -# To access the values stored in this env file you can use: process.env.VARIABLENAME -# You'll need to prefix the variables names with NEXT_PUBLIC_ if you want to access them on the client side. -# More info: https://nextjs.org/docs/pages/building-your-application/configuring/environment-variables -NEXT_PUBLIC_ALCHEMY_API_KEY= -NEXT_PUBLIC_WALLET_CONNECT_PROJECT_ID= \ No newline at end of file