Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BrainPass Nft Contract #4

Open
wants to merge 55 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 21 commits
Commits
Show all changes
55 commits
Select commit Hold shift + click to select a range
4e773ae
BrainPass Nft Contract Added
OleanjiKingCode May 22, 2023
c4aec5a
addedexpalainable comments to functions
OleanjiKingCode May 22, 2023
c2f67f9
refined the vars in the brainpass contract
OleanjiKingCode May 22, 2023
bc3a1cc
adds brainpass deployer script
Emmanueldmlr May 22, 2023
51cd490
started testing
OleanjiKingCode May 22, 2023
1c6e3fe
updated test file and improved contract
OleanjiKingCode May 23, 2023
d88b6e8
changes noticed fix, getAllPassType Func,
OleanjiKingCode May 23, 2023
4482b93
labelling functions
OleanjiKingCode May 23, 2023
2959b63
updated contract and arranged the functions, used reverts instead of …
OleanjiKingCode May 24, 2023
a3e0bd7
changed all require func to if..revert
OleanjiKingCode May 24, 2023
9e52d56
readme doc
OleanjiKingCode May 24, 2023
ff9f7db
validate pass duration func
OleanjiKingCode May 24, 2023
347c98c
test for the new contract update
OleanjiKingCode May 24, 2023
a74cb88
Update README.md
OleanjiKingCode May 24, 2023
ae58340
test for the new contract update
OleanjiKingCode May 24, 2023
566e6a9
Merge branch 'BrainPass' of https://github.com/EveripediaNetwork/ep-c…
OleanjiKingCode May 24, 2023
ef3731a
IncresePassTime Func Refined
OleanjiKingCode May 24, 2023
5ef8ca1
changes variable names
Emmanueldmlr May 25, 2023
9a9bc99
removed for loop
OleanjiKingCode May 25, 2023
77d4183
renmoved a mapping
OleanjiKingCode May 25, 2023
0301aa2
removes unused script
Emmanueldmlr May 25, 2023
7444fee
changes function name
Emmanueldmlr May 25, 2023
3bbca93
corrected the test script
OleanjiKingCode May 25, 2023
f7c7a5d
removing unused error and added maxSupplyReached test
OleanjiKingCode May 25, 2023
888dc99
little fix in maxtokenminted per pass
OleanjiKingCode May 27, 2023
6696764
describing functions well
OleanjiKingCode May 28, 2023
b21b030
Update README.md
OleanjiKingCode May 28, 2023
639d9a0
more tests and pause Func
OleanjiKingCode May 28, 2023
8379083
Updated readme file, allows different url for differnt pass type, mor…
OleanjiKingCode May 29, 2023
92444b8
removed unsed contrac import,toggle pass type status
OleanjiKingCode May 29, 2023
d9b5bda
validating users to know if they do an activity that requires their pass
OleanjiKingCode May 29, 2023
9ed21bc
configureMintlimit test and pause contract testing
OleanjiKingCode May 30, 2023
f0dc368
seperated the withdraw func
OleanjiKingCode May 30, 2023
86eb11d
updated README.md
OleanjiKingCode May 30, 2023
cef37c7
updated readme file and contract with test
OleanjiKingCode May 31, 2023
b8fffdf
removed the id logic for passtypes
OleanjiKingCode May 31, 2023
9a230bf
added more tests for the validator
OleanjiKingCode May 31, 2023
3e6c1f6
updated the contract
OleanjiKingCode May 31, 2023
a4065fc
little changes
OleanjiKingCode Jun 1, 2023
49a3661
checking for validity of the timestamp entered
OleanjiKingCode Jun 5, 2023
2fe00bd
little fixes in the contract
OleanjiKingCode Jun 9, 2023
721b931
improved test from edited contract
OleanjiKingCode Jun 9, 2023
3f9a1eb
improved test from edited contract
OleanjiKingCode Jun 9, 2023
f717fe8
using erc721pausable
OleanjiKingCode Jun 9, 2023
717d7a0
using erc721pausable tests
OleanjiKingCode Jun 9, 2023
6260675
improving the brainPassValidator
OleanjiKingCode Jun 10, 2023
fc932ed
improved the READMe file
OleanjiKingCode Jun 11, 2023
8669373
removed unused code and improved tests
OleanjiKingCode Jun 13, 2023
fa5b0fb
removed discount
OleanjiKingCode Jun 13, 2023
b7f9781
reworked the event
OleanjiKingCode Jun 14, 2023
bb03b8e
added data to event
OleanjiKingCode Jun 14, 2023
f63d3fa
improved the contract, tests, deployment scripts
OleanjiKingCode Jun 14, 2023
7095eb3
fixed failed assertion
OleanjiKingCode Jun 14, 2023
903fdfc
deployer script
OleanjiKingCode Jun 15, 2023
b2283b2
updated the tests
OleanjiKingCode Jun 15, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
68 changes: 67 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,72 @@ Deploy and verify a contract
source .env

# To deploy and verify our contract
forge script script/WikiNoValidator.s.sol:WikiNoValidator --rpc-url $RPC_URL --private-key $PRIVATE_KEY --broadcast --verify --etherscan-api-key $ETHERSCAN_KEY -vvvv --gas-price 60 --legacy
forge script script/BrainPassDeployer.s.sol:BrainPassDeployer --rpc-url $RPC_URL --private-key $PRIVATE_KEY --broadcast --verify --etherscan-api-key $ETHERSCAN_KEY -vvvv --gas-price 60 --legacy

```

# Expalaining How BrainPassCollectibles Works

BrainPassCollectibles is a Solidity smart contract that enables the creation and management of BrainPass NFTs. It allows users to buy passes to have some Wiki previledges on IQ Wiki and provides functionalities to mint NFTs, increase pass time, and manage pass types.
OleanjiKingCode marked this conversation as resolved.
Show resolved Hide resolved

## Usage

### Contract Deployment

Deploy the `BrainPassCollectibles` contract by providing the address of the IQ token contract as a constructor parameter.

### Adding a Pass Type
This function allows the contract owner to add a new pass type.

Call the `addPassType` function with the following parameters:
OleanjiKingCode marked this conversation as resolved.
Show resolved Hide resolved
- `pricePerDay`: The price per day in IQ tokens for the pass.
- `tokenURI`: The base URI for the pass token metadata.
- `name`: The name of the pass type.
- `maxTokens`: The maximum number of tokens that can be minted for this pass type.
- `discount`: The discount percentage applied to the pass price (optional).

### Minting an NFT Pass
This function allows users to mint a BrainPass NFT for a specific pass type and duration.
Call the `mintNFT` function with the following parameters:
- `passId`: The ID of the pass type to mint.
- `startTimestamp`: The start timestamp for the pass.
- `endTimestamp`: The end timestamp for the pass.
- the duration is calculated by endTimestamp - startTimestamp
- An address can only mint one passtype.
- The payment is in IQ Token

### Increasing Pass Time
This function is ued to increase the duration for which a pass is owned for.
Call the `increasePassTime` function with the following parameters:
- `tokenId`: The ID of the NFT whose time should be increased.
- `newStartTime`: The new start timestamp for the pass.
kesar marked this conversation as resolved.
Show resolved Hide resolved
- `newEndTime`: The new end timestamp for the pass.

### Get User Pass Details
This gets the details of the tokenId the user has in the particular passId
Call the `getUserPassDetails` function with the following parameters:
- `user`: The address of the user.
- `passId`: The ID of the pass type.

### Get Pass Types
Call the `getAllPassType` function to get an array of all pass types.

### Get Pass Type Details
This gets a single passtype details
Call the `getPassType` function with the following parameters:
- `passId`: The ID of the pass type.

### Withdraw Ether
Only the contract owner can call the `withdraw` function to withdraw any amount of Ether stored in the contract.

## Events

The contract emits the following events:

- `BrainPassBought`: Emitted when a user buys a BrainPass NFT.
- `TimeIncreased`: Emitted when the time of a BrainPass NFT is increased.
- `NewPassAdded`: Emitted when a new pass type is added.

## PICTORAL EXPLANATION
![image](https://github.com/EveripediaNetwork/ep-contract/assets/75235148/eee4d631-28d9-4ca4-bc0e-62e5a02998a2)

22 changes: 22 additions & 0 deletions script/BrainPassDeployer.s.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.13;

import {Script} from "../lib/forge-std/src/Script.sol";
import {console} from "../lib/forge-std/src/console.sol";

import {BrainPassCollectibles} from "../src/BrainPass/BrainPass.sol";


contract BrainPassDeployer is Script {
address constant owner = address(0xE161eB85f00eC6471E0de06bA1Cfc136C053fFfe);

function run() external {
vm.startBroadcast();

console.log("Deploying Brainpass deployer....");
BrainPassCollectibles validator = new BrainPassCollectibles(0x5E959c60f86D17fb7D764AB69B654227d464E820);
console.log("Brainpass Deployed", address(validator));

vm.stopBroadcast();
}
}
2 changes: 0 additions & 2 deletions script/WikiWhitelistValidator.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,8 @@ contract WikiWhitelistValidator is Script {
validator.whitelistEditor(address(0xF6d9467758C08d05571f1bFa0a03A2286cE1F043));
validator.whitelistEditor(address(0x2fE6aCD015384E1ee5138eF79fe1a434dA8FA12e));
validator.whitelistEditor(address(0xb029c0367CCFeEFBc6D00B4cc22fcbFd6A781F5c));

validator.whitelistEditor(address(0x9fEAB70f3c4a944B97b7565BAc4991dF5B7A69ff));
validator.whitelistEditor(address(0x14B68b85E1037d1C75726b7794e99C20554f9CC3));

validator.setOwner(owner);

vm.stopBroadcast();
Expand Down
Loading