├── .DS_Store
├── .gitignore
├── README.md
├── migrations
├── 1_initial_migration.js
└── 2_deploy_contracts.js
├── package-lock.json
├── package.json
├── public
└── index.html
├── screenshot1.png
├── screenshot2.png
├── src
├── .DS_Store
├── abis
│ ├── Address.json
│ ├── Context.json
│ ├── Counters.json
│ ├── ERC165.json
│ ├── ERC721.json
│ ├── ERC721URIStorage.json
│ ├── IERC165.json
│ ├── IERC721.json
│ ├── IERC721Metadata.json
│ ├── IERC721Receiver.json
│ ├── Migrations.json
│ ├── Strings.json
│ ├── Zim.json
│ └── ZimCollectables.json
├── assets
│ ├── .DS_Store
│ ├── images
│ │ ├── games.png
│ │ ├── gettingstarted.png
│ │ ├── market.png
│ │ └── mint.png
│ └── videos
│ │ ├── .DS_Store
│ │ ├── Zelda1.mp4
│ │ ├── bg-video.mp4
│ │ ├── video-bg-2.mp4
│ │ └── videoplayback.mp4
├── components
│ ├── App.css
│ ├── App.js
│ ├── games
│ │ ├── Brick
│ │ │ ├── breakout
│ │ │ │ ├── BallMovement.js
│ │ │ │ ├── Brick.js
│ │ │ │ ├── Paddle.js
│ │ │ │ ├── PlayerStats.js
│ │ │ │ ├── board.js
│ │ │ │ ├── index.js
│ │ │ │ └── util
│ │ │ │ │ ├── AllBroken.js
│ │ │ │ │ ├── BrickCollision.js
│ │ │ │ │ ├── PaddleHit.js
│ │ │ │ │ ├── ResetBall.js
│ │ │ │ │ └── WallCollision.js
│ │ │ └── data.js
│ │ ├── Floppy
│ │ │ ├── FloppyApp.css
│ │ │ ├── FloppyApp.js
│ │ │ ├── bottom-background.png
│ │ │ ├── fb-game-background.png
│ │ │ ├── flappy-bird.png
│ │ │ └── flappybird-pipe.png
│ │ ├── Hangman
│ │ │ ├── HangmanApp.css
│ │ │ ├── HangmanApp.js
│ │ │ ├── components
│ │ │ │ ├── Figure.js
│ │ │ │ ├── Header.js
│ │ │ │ ├── Notification.js
│ │ │ │ ├── Popup.js
│ │ │ │ ├── Word.js
│ │ │ │ └── WrongLetters.js
│ │ │ └── helpers
│ │ │ │ └── helpers.js
│ │ └── Tetris
│ │ │ ├── Tetris.css
│ │ │ └── Tetris.js
│ ├── mini
│ │ ├── Actions.js
│ │ ├── AuthNavBar.js
│ │ ├── Buttons.js
│ │ ├── Carousel.css
│ │ ├── Carousel.js
│ │ ├── GetStarted.css
│ │ ├── GetStarted.js
│ │ ├── HeroSection.js
│ │ ├── HomeInfo.js
│ │ ├── NFTMinter.js
│ │ ├── Navbar.css
│ │ ├── Navbar.js
│ │ ├── NftsBox.js
│ │ ├── PointsSummary.js
│ │ └── Sidebar.js
│ └── pages
│ │ ├── Auth.css
│ │ ├── Auth.js
│ │ ├── Games.css
│ │ ├── Games.js
│ │ ├── Home.js
│ │ ├── Market.css
│ │ ├── Market.js
│ │ ├── Mint.css
│ │ ├── Mint.js
│ │ ├── Profile.css
│ │ ├── Profile.js
│ │ └── Settings.js
├── contracts
│ ├── Migrations.sol
│ ├── Zim.sol
│ └── ZimCollectables.sol
├── index.css
├── index.js
├── redux
│ ├── buttons
│ │ └── buttons.js
│ └── store.js
└── theme.js
├── techstack.png
├── test
└── .gitkeep
├── truffle-config.js
└── yt.png
/.DS_Store:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ehp2021/zims/a6a1bc0e3fa3eda7d1a3930244b7ca76c8a4c9b0/.DS_Store
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | node_modules
2 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # What is ZIMS?
2 |
3 | ZIMS is a NFT-based online game platform which allows users to play arcade games (Tetris, Brick Breaker, Hangman, Floppy Bird, and more to come) to earn points to mint NFTs.
4 |
5 | 
6 | 
7 |
8 | Check out our full demo video here:
9 | https://www.youtube.com/watch?v=8g5ACWz_FC0
10 |
11 |
12 | # Collaborators 🤝 🤝
13 | - [Ayaan Namazi](https://github.com/namaziay)
14 | - [Emily Park](https://github.com/ehp2021)
15 | - [Joao Felipe Silveira](https://github.com/accessjoao)
16 | - [Pedro Ramos](https://github.com/pedrotmr)
17 | - [Richard Brown](https://github.com/richsbrown)
18 |
19 | # Getting Started with ZIMS
20 |
21 | This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app).
22 |
23 | ## Available Scripts
24 |
25 | In the project directory, you can run:
26 |
27 | ### `npm start`
28 |
29 | Runs the app in the development mode.\
30 | Open [http://localhost:3000](http://localhost:3000) to view it in the browser.
31 |
32 | The page will reload if you make edits.\
33 | You will also see any lint errors in the console.
34 |
35 | # Tech Stack
36 | 
37 |
--------------------------------------------------------------------------------
/migrations/1_initial_migration.js:
--------------------------------------------------------------------------------
1 | const Migrations = artifacts.require("Migrations");
2 |
3 | module.exports = function (deployer) {
4 | deployer.deploy(Migrations);
5 | };
6 |
--------------------------------------------------------------------------------
/migrations/2_deploy_contracts.js:
--------------------------------------------------------------------------------
1 | const zimCoin = artifacts.require('Zim');
2 | const zimCollectables = artifacts.require('ZimCollectables');
3 |
4 | module.exports = function(deployer) {
5 | deployer.deploy(zimCoin);
6 | deployer.deploy(zimCollectables);
7 | };
--------------------------------------------------------------------------------
/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "my-app",
3 | "version": "0.1.0",
4 | "private": true,
5 | "dependencies": {
6 | "@chakra-ui/icons": "^1.1.1",
7 | "@chakra-ui/react": "^1.7.2",
8 | "@emotion/react": "^11.7.0",
9 | "@emotion/styled": "^11.6.0",
10 | "@fortawesome/fontawesome-svg-core": "^1.2.36",
11 | "@fortawesome/react-fontawesome": "^0.1.16",
12 | "@openzeppelin/contracts": "^4.4.0",
13 | "@testing-library/jest-dom": "^5.15.1",
14 | "@testing-library/react": "^11.2.7",
15 | "@testing-library/user-event": "^12.8.3",
16 | "@walletconnect/web3-provider": "^1.6.6",
17 | "axios": "^0.24.0",
18 | "dotenv": "^10.0.0",
19 | "font-awesome": "^4.7.0",
20 | "framer-motion": "^4.1.17",
21 | "moment": "^2.29.1",
22 | "moralis": "^0.0.135",
23 | "moralis-admin-cli": "^2.1.16",
24 | "react": "^17.0.2",
25 | "react-alice-carousel": "^2.5.1",
26 | "react-countdown": "^2.3.2",
27 | "react-dom": "^17.0.2",
28 | "react-file-base64": "^1.0.3",
29 | "react-google-charts": "^3.0.15",
30 | "react-hook-form": "^7.20.4",
31 | "react-icons": "^4.3.1",
32 | "react-moralis": "^0.3.0",
33 | "react-router-dom": "^6.0.2",
34 | "react-scripts": "4.0.3",
35 | "react-scroll": "^1.8.4",
36 | "react-tetris": "^0.2.0",
37 | "styled-components": "^5.3.3",
38 | "truffle": "^5.4.22",
39 | "web-vitals": "^1.1.2",
40 | "web3": "^1.6.1"
41 | },
42 | "scripts": {
43 | "start": "react-scripts start",
44 | "build": "react-scripts build",
45 | "test": "react-scripts test",
46 | "eject": "react-scripts eject"
47 | },
48 | "eslintConfig": {
49 | "extends": [
50 | "react-app",
51 | "react-app/jest"
52 | ]
53 | },
54 | "browserslist": {
55 | "production": [
56 | ">0.2%",
57 | "not dead",
58 | "not op_mini all"
59 | ],
60 | "development": [
61 | "last 1 chrome version",
62 | "last 1 firefox version",
63 | "last 1 safari version"
64 | ]
65 | }
66 | }
--------------------------------------------------------------------------------
/public/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 | Zims
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
--------------------------------------------------------------------------------
/screenshot1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ehp2021/zims/a6a1bc0e3fa3eda7d1a3930244b7ca76c8a4c9b0/screenshot1.png
--------------------------------------------------------------------------------
/screenshot2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ehp2021/zims/a6a1bc0e3fa3eda7d1a3930244b7ca76c8a4c9b0/screenshot2.png
--------------------------------------------------------------------------------
/src/.DS_Store:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ehp2021/zims/a6a1bc0e3fa3eda7d1a3930244b7ca76c8a4c9b0/src/.DS_Store
--------------------------------------------------------------------------------
/src/abis/Context.json:
--------------------------------------------------------------------------------
1 | {
2 | "contractName": "Context",
3 | "abi": [],
4 | "metadata": "{\"compiler\":{\"version\":\"0.8.10+commit.fc410830\"},\"language\":\"Solidity\",\"output\":{\"abi\":[],\"devdoc\":{\"details\":\"Provides information about the current execution context, including the sender of the transaction and its data. While these are generally available via msg.sender and msg.data, they should not be accessed in such a direct manner, since when dealing with meta-transactions the account sending and paying for execution may not be the actual sender (as far as an application is concerned). This contract is only required for intermediate, library-like contracts.\",\"kind\":\"dev\",\"methods\":{},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"@openzeppelin/contracts/utils/Context.sol\":\"Context\"},\"evmVersion\":\"london\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\"},\"optimizer\":{\"enabled\":false,\"runs\":200},\"remappings\":[]},\"sources\":{\"@openzeppelin/contracts/utils/Context.sol\":{\"keccak256\":\"0x7736c187e6f1358c1ea9350a2a21aa8528dec1c2f43b374a9067465a3a51f5d3\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://4fd625dca17657403af518cc6c8ab5c54c58898cf6e912ca2e1b0f3194ad0405\",\"dweb:/ipfs/QmQVv7YeeKmaS11bg7YDTeeGDk6i7sV8LMMfohaLM4SiRu\"]}},\"version\":1}",
5 | "bytecode": "0x",
6 | "deployedBytecode": "0x",
7 | "immutableReferences": {},
8 | "generatedSources": [],
9 | "deployedGeneratedSources": [],
10 | "sourceMap": "",
11 | "deployedSourceMap": "",
12 | "source": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.0 (utils/Context.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Provides information about the current execution context, including the\n * sender of the transaction and its data. While these are generally available\n * via msg.sender and msg.data, they should not be accessed in such a direct\n * manner, since when dealing with meta-transactions the account sending and\n * paying for execution may not be the actual sender (as far as an application\n * is concerned).\n *\n * This contract is only required for intermediate, library-like contracts.\n */\nabstract contract Context {\n function _msgSender() internal view virtual returns (address) {\n return msg.sender;\n }\n\n function _msgData() internal view virtual returns (bytes calldata) {\n return msg.data;\n }\n}\n",
13 | "sourcePath": "@openzeppelin/contracts/utils/Context.sol",
14 | "ast": {
15 | "absolutePath": "@openzeppelin/contracts/utils/Context.sol",
16 | "exportedSymbols": {
17 | "Context": [
18 | 1438
19 | ]
20 | },
21 | "id": 1439,
22 | "license": "MIT",
23 | "nodeType": "SourceUnit",
24 | "nodes": [
25 | {
26 | "id": 1418,
27 | "literals": [
28 | "solidity",
29 | "^",
30 | "0.8",
31 | ".0"
32 | ],
33 | "nodeType": "PragmaDirective",
34 | "src": "86:23:6"
35 | },
36 | {
37 | "abstract": true,
38 | "baseContracts": [],
39 | "canonicalName": "Context",
40 | "contractDependencies": [],
41 | "contractKind": "contract",
42 | "documentation": {
43 | "id": 1419,
44 | "nodeType": "StructuredDocumentation",
45 | "src": "111:496:6",
46 | "text": " @dev Provides information about the current execution context, including the\n sender of the transaction and its data. While these are generally available\n via msg.sender and msg.data, they should not be accessed in such a direct\n manner, since when dealing with meta-transactions the account sending and\n paying for execution may not be the actual sender (as far as an application\n is concerned).\n This contract is only required for intermediate, library-like contracts."
47 | },
48 | "fullyImplemented": true,
49 | "id": 1438,
50 | "linearizedBaseContracts": [
51 | 1438
52 | ],
53 | "name": "Context",
54 | "nameLocation": "626:7:6",
55 | "nodeType": "ContractDefinition",
56 | "nodes": [
57 | {
58 | "body": {
59 | "id": 1427,
60 | "nodeType": "Block",
61 | "src": "702:34:6",
62 | "statements": [
63 | {
64 | "expression": {
65 | "expression": {
66 | "id": 1424,
67 | "name": "msg",
68 | "nodeType": "Identifier",
69 | "overloadedDeclarations": [],
70 | "referencedDeclaration": 4294967281,
71 | "src": "719:3:6",
72 | "typeDescriptions": {
73 | "typeIdentifier": "t_magic_message",
74 | "typeString": "msg"
75 | }
76 | },
77 | "id": 1425,
78 | "isConstant": false,
79 | "isLValue": false,
80 | "isPure": false,
81 | "lValueRequested": false,
82 | "memberName": "sender",
83 | "nodeType": "MemberAccess",
84 | "src": "719:10:6",
85 | "typeDescriptions": {
86 | "typeIdentifier": "t_address",
87 | "typeString": "address"
88 | }
89 | },
90 | "functionReturnParameters": 1423,
91 | "id": 1426,
92 | "nodeType": "Return",
93 | "src": "712:17:6"
94 | }
95 | ]
96 | },
97 | "id": 1428,
98 | "implemented": true,
99 | "kind": "function",
100 | "modifiers": [],
101 | "name": "_msgSender",
102 | "nameLocation": "649:10:6",
103 | "nodeType": "FunctionDefinition",
104 | "parameters": {
105 | "id": 1420,
106 | "nodeType": "ParameterList",
107 | "parameters": [],
108 | "src": "659:2:6"
109 | },
110 | "returnParameters": {
111 | "id": 1423,
112 | "nodeType": "ParameterList",
113 | "parameters": [
114 | {
115 | "constant": false,
116 | "id": 1422,
117 | "mutability": "mutable",
118 | "name": "",
119 | "nameLocation": "-1:-1:-1",
120 | "nodeType": "VariableDeclaration",
121 | "scope": 1428,
122 | "src": "693:7:6",
123 | "stateVariable": false,
124 | "storageLocation": "default",
125 | "typeDescriptions": {
126 | "typeIdentifier": "t_address",
127 | "typeString": "address"
128 | },
129 | "typeName": {
130 | "id": 1421,
131 | "name": "address",
132 | "nodeType": "ElementaryTypeName",
133 | "src": "693:7:6",
134 | "stateMutability": "nonpayable",
135 | "typeDescriptions": {
136 | "typeIdentifier": "t_address",
137 | "typeString": "address"
138 | }
139 | },
140 | "visibility": "internal"
141 | }
142 | ],
143 | "src": "692:9:6"
144 | },
145 | "scope": 1438,
146 | "src": "640:96:6",
147 | "stateMutability": "view",
148 | "virtual": true,
149 | "visibility": "internal"
150 | },
151 | {
152 | "body": {
153 | "id": 1436,
154 | "nodeType": "Block",
155 | "src": "809:32:6",
156 | "statements": [
157 | {
158 | "expression": {
159 | "expression": {
160 | "id": 1433,
161 | "name": "msg",
162 | "nodeType": "Identifier",
163 | "overloadedDeclarations": [],
164 | "referencedDeclaration": 4294967281,
165 | "src": "826:3:6",
166 | "typeDescriptions": {
167 | "typeIdentifier": "t_magic_message",
168 | "typeString": "msg"
169 | }
170 | },
171 | "id": 1434,
172 | "isConstant": false,
173 | "isLValue": false,
174 | "isPure": false,
175 | "lValueRequested": false,
176 | "memberName": "data",
177 | "nodeType": "MemberAccess",
178 | "src": "826:8:6",
179 | "typeDescriptions": {
180 | "typeIdentifier": "t_bytes_calldata_ptr",
181 | "typeString": "bytes calldata"
182 | }
183 | },
184 | "functionReturnParameters": 1432,
185 | "id": 1435,
186 | "nodeType": "Return",
187 | "src": "819:15:6"
188 | }
189 | ]
190 | },
191 | "id": 1437,
192 | "implemented": true,
193 | "kind": "function",
194 | "modifiers": [],
195 | "name": "_msgData",
196 | "nameLocation": "751:8:6",
197 | "nodeType": "FunctionDefinition",
198 | "parameters": {
199 | "id": 1429,
200 | "nodeType": "ParameterList",
201 | "parameters": [],
202 | "src": "759:2:6"
203 | },
204 | "returnParameters": {
205 | "id": 1432,
206 | "nodeType": "ParameterList",
207 | "parameters": [
208 | {
209 | "constant": false,
210 | "id": 1431,
211 | "mutability": "mutable",
212 | "name": "",
213 | "nameLocation": "-1:-1:-1",
214 | "nodeType": "VariableDeclaration",
215 | "scope": 1437,
216 | "src": "793:14:6",
217 | "stateVariable": false,
218 | "storageLocation": "calldata",
219 | "typeDescriptions": {
220 | "typeIdentifier": "t_bytes_calldata_ptr",
221 | "typeString": "bytes"
222 | },
223 | "typeName": {
224 | "id": 1430,
225 | "name": "bytes",
226 | "nodeType": "ElementaryTypeName",
227 | "src": "793:5:6",
228 | "typeDescriptions": {
229 | "typeIdentifier": "t_bytes_storage_ptr",
230 | "typeString": "bytes"
231 | }
232 | },
233 | "visibility": "internal"
234 | }
235 | ],
236 | "src": "792:16:6"
237 | },
238 | "scope": 1438,
239 | "src": "742:99:6",
240 | "stateMutability": "view",
241 | "virtual": true,
242 | "visibility": "internal"
243 | }
244 | ],
245 | "scope": 1439,
246 | "src": "608:235:6",
247 | "usedErrors": []
248 | }
249 | ],
250 | "src": "86:758:6"
251 | },
252 | "legacyAST": {
253 | "absolutePath": "@openzeppelin/contracts/utils/Context.sol",
254 | "exportedSymbols": {
255 | "Context": [
256 | 1438
257 | ]
258 | },
259 | "id": 1439,
260 | "license": "MIT",
261 | "nodeType": "SourceUnit",
262 | "nodes": [
263 | {
264 | "id": 1418,
265 | "literals": [
266 | "solidity",
267 | "^",
268 | "0.8",
269 | ".0"
270 | ],
271 | "nodeType": "PragmaDirective",
272 | "src": "86:23:6"
273 | },
274 | {
275 | "abstract": true,
276 | "baseContracts": [],
277 | "canonicalName": "Context",
278 | "contractDependencies": [],
279 | "contractKind": "contract",
280 | "documentation": {
281 | "id": 1419,
282 | "nodeType": "StructuredDocumentation",
283 | "src": "111:496:6",
284 | "text": " @dev Provides information about the current execution context, including the\n sender of the transaction and its data. While these are generally available\n via msg.sender and msg.data, they should not be accessed in such a direct\n manner, since when dealing with meta-transactions the account sending and\n paying for execution may not be the actual sender (as far as an application\n is concerned).\n This contract is only required for intermediate, library-like contracts."
285 | },
286 | "fullyImplemented": true,
287 | "id": 1438,
288 | "linearizedBaseContracts": [
289 | 1438
290 | ],
291 | "name": "Context",
292 | "nameLocation": "626:7:6",
293 | "nodeType": "ContractDefinition",
294 | "nodes": [
295 | {
296 | "body": {
297 | "id": 1427,
298 | "nodeType": "Block",
299 | "src": "702:34:6",
300 | "statements": [
301 | {
302 | "expression": {
303 | "expression": {
304 | "id": 1424,
305 | "name": "msg",
306 | "nodeType": "Identifier",
307 | "overloadedDeclarations": [],
308 | "referencedDeclaration": 4294967281,
309 | "src": "719:3:6",
310 | "typeDescriptions": {
311 | "typeIdentifier": "t_magic_message",
312 | "typeString": "msg"
313 | }
314 | },
315 | "id": 1425,
316 | "isConstant": false,
317 | "isLValue": false,
318 | "isPure": false,
319 | "lValueRequested": false,
320 | "memberName": "sender",
321 | "nodeType": "MemberAccess",
322 | "src": "719:10:6",
323 | "typeDescriptions": {
324 | "typeIdentifier": "t_address",
325 | "typeString": "address"
326 | }
327 | },
328 | "functionReturnParameters": 1423,
329 | "id": 1426,
330 | "nodeType": "Return",
331 | "src": "712:17:6"
332 | }
333 | ]
334 | },
335 | "id": 1428,
336 | "implemented": true,
337 | "kind": "function",
338 | "modifiers": [],
339 | "name": "_msgSender",
340 | "nameLocation": "649:10:6",
341 | "nodeType": "FunctionDefinition",
342 | "parameters": {
343 | "id": 1420,
344 | "nodeType": "ParameterList",
345 | "parameters": [],
346 | "src": "659:2:6"
347 | },
348 | "returnParameters": {
349 | "id": 1423,
350 | "nodeType": "ParameterList",
351 | "parameters": [
352 | {
353 | "constant": false,
354 | "id": 1422,
355 | "mutability": "mutable",
356 | "name": "",
357 | "nameLocation": "-1:-1:-1",
358 | "nodeType": "VariableDeclaration",
359 | "scope": 1428,
360 | "src": "693:7:6",
361 | "stateVariable": false,
362 | "storageLocation": "default",
363 | "typeDescriptions": {
364 | "typeIdentifier": "t_address",
365 | "typeString": "address"
366 | },
367 | "typeName": {
368 | "id": 1421,
369 | "name": "address",
370 | "nodeType": "ElementaryTypeName",
371 | "src": "693:7:6",
372 | "stateMutability": "nonpayable",
373 | "typeDescriptions": {
374 | "typeIdentifier": "t_address",
375 | "typeString": "address"
376 | }
377 | },
378 | "visibility": "internal"
379 | }
380 | ],
381 | "src": "692:9:6"
382 | },
383 | "scope": 1438,
384 | "src": "640:96:6",
385 | "stateMutability": "view",
386 | "virtual": true,
387 | "visibility": "internal"
388 | },
389 | {
390 | "body": {
391 | "id": 1436,
392 | "nodeType": "Block",
393 | "src": "809:32:6",
394 | "statements": [
395 | {
396 | "expression": {
397 | "expression": {
398 | "id": 1433,
399 | "name": "msg",
400 | "nodeType": "Identifier",
401 | "overloadedDeclarations": [],
402 | "referencedDeclaration": 4294967281,
403 | "src": "826:3:6",
404 | "typeDescriptions": {
405 | "typeIdentifier": "t_magic_message",
406 | "typeString": "msg"
407 | }
408 | },
409 | "id": 1434,
410 | "isConstant": false,
411 | "isLValue": false,
412 | "isPure": false,
413 | "lValueRequested": false,
414 | "memberName": "data",
415 | "nodeType": "MemberAccess",
416 | "src": "826:8:6",
417 | "typeDescriptions": {
418 | "typeIdentifier": "t_bytes_calldata_ptr",
419 | "typeString": "bytes calldata"
420 | }
421 | },
422 | "functionReturnParameters": 1432,
423 | "id": 1435,
424 | "nodeType": "Return",
425 | "src": "819:15:6"
426 | }
427 | ]
428 | },
429 | "id": 1437,
430 | "implemented": true,
431 | "kind": "function",
432 | "modifiers": [],
433 | "name": "_msgData",
434 | "nameLocation": "751:8:6",
435 | "nodeType": "FunctionDefinition",
436 | "parameters": {
437 | "id": 1429,
438 | "nodeType": "ParameterList",
439 | "parameters": [],
440 | "src": "759:2:6"
441 | },
442 | "returnParameters": {
443 | "id": 1432,
444 | "nodeType": "ParameterList",
445 | "parameters": [
446 | {
447 | "constant": false,
448 | "id": 1431,
449 | "mutability": "mutable",
450 | "name": "",
451 | "nameLocation": "-1:-1:-1",
452 | "nodeType": "VariableDeclaration",
453 | "scope": 1437,
454 | "src": "793:14:6",
455 | "stateVariable": false,
456 | "storageLocation": "calldata",
457 | "typeDescriptions": {
458 | "typeIdentifier": "t_bytes_calldata_ptr",
459 | "typeString": "bytes"
460 | },
461 | "typeName": {
462 | "id": 1430,
463 | "name": "bytes",
464 | "nodeType": "ElementaryTypeName",
465 | "src": "793:5:6",
466 | "typeDescriptions": {
467 | "typeIdentifier": "t_bytes_storage_ptr",
468 | "typeString": "bytes"
469 | }
470 | },
471 | "visibility": "internal"
472 | }
473 | ],
474 | "src": "792:16:6"
475 | },
476 | "scope": 1438,
477 | "src": "742:99:6",
478 | "stateMutability": "view",
479 | "virtual": true,
480 | "visibility": "internal"
481 | }
482 | ],
483 | "scope": 1439,
484 | "src": "608:235:6",
485 | "usedErrors": []
486 | }
487 | ],
488 | "src": "86:758:6"
489 | },
490 | "compiler": {
491 | "name": "solc",
492 | "version": "0.8.10+commit.fc410830.Emscripten.clang"
493 | },
494 | "networks": {},
495 | "schemaVersion": "3.4.3",
496 | "updatedAt": "2021-12-01T23:30:39.405Z",
497 | "devdoc": {
498 | "details": "Provides information about the current execution context, including the sender of the transaction and its data. While these are generally available via msg.sender and msg.data, they should not be accessed in such a direct manner, since when dealing with meta-transactions the account sending and paying for execution may not be the actual sender (as far as an application is concerned). This contract is only required for intermediate, library-like contracts.",
499 | "kind": "dev",
500 | "methods": {},
501 | "version": 1
502 | },
503 | "userdoc": {
504 | "kind": "user",
505 | "methods": {},
506 | "version": 1
507 | }
508 | }
--------------------------------------------------------------------------------
/src/abis/ERC165.json:
--------------------------------------------------------------------------------
1 | {
2 | "contractName": "ERC165",
3 | "abi": [
4 | {
5 | "inputs": [
6 | {
7 | "internalType": "bytes4",
8 | "name": "interfaceId",
9 | "type": "bytes4"
10 | }
11 | ],
12 | "name": "supportsInterface",
13 | "outputs": [
14 | {
15 | "internalType": "bool",
16 | "name": "",
17 | "type": "bool"
18 | }
19 | ],
20 | "stateMutability": "view",
21 | "type": "function"
22 | }
23 | ],
24 | "metadata": "{\"compiler\":{\"version\":\"0.8.10+commit.fc410830\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"bytes4\",\"name\":\"interfaceId\",\"type\":\"bytes4\"}],\"name\":\"supportsInterface\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"}],\"devdoc\":{\"details\":\"Implementation of the {IERC165} interface. Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check for the additional interface id that will be supported. For example: ```solidity function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId); } ``` Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation.\",\"kind\":\"dev\",\"methods\":{\"supportsInterface(bytes4)\":{\"details\":\"See {IERC165-supportsInterface}.\"}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"@openzeppelin/contracts/utils/introspection/ERC165.sol\":\"ERC165\"},\"evmVersion\":\"london\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\"},\"optimizer\":{\"enabled\":false,\"runs\":200},\"remappings\":[]},\"sources\":{\"@openzeppelin/contracts/utils/introspection/ERC165.sol\":{\"keccak256\":\"0x905cd0ecd91d1de79a4679d745b79cf852ca8ccda5d25d1c49c6bd17a5edc0cf\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://8dd1601fcd370546d8c06ea1902d7e7364fc490fbf0ebc3004230ef1f5db473c\",\"dweb:/ipfs/Qmb8zbC3TjWFtcuyP3KEEaegMkPcfeKAcPrwzvkAoMR3cZ\"]},\"@openzeppelin/contracts/utils/introspection/IERC165.sol\":{\"keccak256\":\"0x6aa521718bf139b44ce56f194f6aea1d590cacef995b5a84703fb1579fa49be9\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://100f8d367b5e94eb9cb991914f1de133cf272654c0708faa893bbc17a5b35b93\",\"dweb:/ipfs/QmZeBojmgXq821dL1TJKFb58B1FogM9jL3u7hXQ8hTEBKT\"]}},\"version\":1}",
25 | "bytecode": "0x",
26 | "deployedBytecode": "0x",
27 | "immutableReferences": {},
28 | "generatedSources": [],
29 | "deployedGeneratedSources": [],
30 | "sourceMap": "",
31 | "deployedSourceMap": "",
32 | "source": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.0 (utils/introspection/ERC165.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IERC165.sol\";\n\n/**\n * @dev Implementation of the {IERC165} interface.\n *\n * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check\n * for the additional interface id that will be supported. For example:\n *\n * ```solidity\n * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);\n * }\n * ```\n *\n * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation.\n */\nabstract contract ERC165 is IERC165 {\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n return interfaceId == type(IERC165).interfaceId;\n }\n}\n",
33 | "sourcePath": "@openzeppelin/contracts/utils/introspection/ERC165.sol",
34 | "ast": {
35 | "absolutePath": "@openzeppelin/contracts/utils/introspection/ERC165.sol",
36 | "exportedSymbols": {
37 | "ERC165": [
38 | 1739
39 | ],
40 | "IERC165": [
41 | 1751
42 | ]
43 | },
44 | "id": 1740,
45 | "license": "MIT",
46 | "nodeType": "SourceUnit",
47 | "nodes": [
48 | {
49 | "id": 1717,
50 | "literals": [
51 | "solidity",
52 | "^",
53 | "0.8",
54 | ".0"
55 | ],
56 | "nodeType": "PragmaDirective",
57 | "src": "99:23:9"
58 | },
59 | {
60 | "absolutePath": "@openzeppelin/contracts/utils/introspection/IERC165.sol",
61 | "file": "./IERC165.sol",
62 | "id": 1718,
63 | "nameLocation": "-1:-1:-1",
64 | "nodeType": "ImportDirective",
65 | "scope": 1740,
66 | "sourceUnit": 1752,
67 | "src": "124:23:9",
68 | "symbolAliases": [],
69 | "unitAlias": ""
70 | },
71 | {
72 | "abstract": true,
73 | "baseContracts": [
74 | {
75 | "baseName": {
76 | "id": 1720,
77 | "name": "IERC165",
78 | "nodeType": "IdentifierPath",
79 | "referencedDeclaration": 1751,
80 | "src": "754:7:9"
81 | },
82 | "id": 1721,
83 | "nodeType": "InheritanceSpecifier",
84 | "src": "754:7:9"
85 | }
86 | ],
87 | "canonicalName": "ERC165",
88 | "contractDependencies": [],
89 | "contractKind": "contract",
90 | "documentation": {
91 | "id": 1719,
92 | "nodeType": "StructuredDocumentation",
93 | "src": "149:576:9",
94 | "text": " @dev Implementation of the {IERC165} interface.\n Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check\n for the additional interface id that will be supported. For example:\n ```solidity\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);\n }\n ```\n Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation."
95 | },
96 | "fullyImplemented": true,
97 | "id": 1739,
98 | "linearizedBaseContracts": [
99 | 1739,
100 | 1751
101 | ],
102 | "name": "ERC165",
103 | "nameLocation": "744:6:9",
104 | "nodeType": "ContractDefinition",
105 | "nodes": [
106 | {
107 | "baseFunctions": [
108 | 1750
109 | ],
110 | "body": {
111 | "id": 1737,
112 | "nodeType": "Block",
113 | "src": "920:64:9",
114 | "statements": [
115 | {
116 | "expression": {
117 | "commonType": {
118 | "typeIdentifier": "t_bytes4",
119 | "typeString": "bytes4"
120 | },
121 | "id": 1735,
122 | "isConstant": false,
123 | "isLValue": false,
124 | "isPure": false,
125 | "lValueRequested": false,
126 | "leftExpression": {
127 | "id": 1730,
128 | "name": "interfaceId",
129 | "nodeType": "Identifier",
130 | "overloadedDeclarations": [],
131 | "referencedDeclaration": 1724,
132 | "src": "937:11:9",
133 | "typeDescriptions": {
134 | "typeIdentifier": "t_bytes4",
135 | "typeString": "bytes4"
136 | }
137 | },
138 | "nodeType": "BinaryOperation",
139 | "operator": "==",
140 | "rightExpression": {
141 | "expression": {
142 | "arguments": [
143 | {
144 | "id": 1732,
145 | "name": "IERC165",
146 | "nodeType": "Identifier",
147 | "overloadedDeclarations": [],
148 | "referencedDeclaration": 1751,
149 | "src": "957:7:9",
150 | "typeDescriptions": {
151 | "typeIdentifier": "t_type$_t_contract$_IERC165_$1751_$",
152 | "typeString": "type(contract IERC165)"
153 | }
154 | }
155 | ],
156 | "expression": {
157 | "argumentTypes": [
158 | {
159 | "typeIdentifier": "t_type$_t_contract$_IERC165_$1751_$",
160 | "typeString": "type(contract IERC165)"
161 | }
162 | ],
163 | "id": 1731,
164 | "name": "type",
165 | "nodeType": "Identifier",
166 | "overloadedDeclarations": [],
167 | "referencedDeclaration": 4294967269,
168 | "src": "952:4:9",
169 | "typeDescriptions": {
170 | "typeIdentifier": "t_function_metatype_pure$__$returns$__$",
171 | "typeString": "function () pure"
172 | }
173 | },
174 | "id": 1733,
175 | "isConstant": false,
176 | "isLValue": false,
177 | "isPure": true,
178 | "kind": "functionCall",
179 | "lValueRequested": false,
180 | "names": [],
181 | "nodeType": "FunctionCall",
182 | "src": "952:13:9",
183 | "tryCall": false,
184 | "typeDescriptions": {
185 | "typeIdentifier": "t_magic_meta_type_t_contract$_IERC165_$1751",
186 | "typeString": "type(contract IERC165)"
187 | }
188 | },
189 | "id": 1734,
190 | "isConstant": false,
191 | "isLValue": false,
192 | "isPure": true,
193 | "lValueRequested": false,
194 | "memberName": "interfaceId",
195 | "nodeType": "MemberAccess",
196 | "src": "952:25:9",
197 | "typeDescriptions": {
198 | "typeIdentifier": "t_bytes4",
199 | "typeString": "bytes4"
200 | }
201 | },
202 | "src": "937:40:9",
203 | "typeDescriptions": {
204 | "typeIdentifier": "t_bool",
205 | "typeString": "bool"
206 | }
207 | },
208 | "functionReturnParameters": 1729,
209 | "id": 1736,
210 | "nodeType": "Return",
211 | "src": "930:47:9"
212 | }
213 | ]
214 | },
215 | "documentation": {
216 | "id": 1722,
217 | "nodeType": "StructuredDocumentation",
218 | "src": "768:56:9",
219 | "text": " @dev See {IERC165-supportsInterface}."
220 | },
221 | "functionSelector": "01ffc9a7",
222 | "id": 1738,
223 | "implemented": true,
224 | "kind": "function",
225 | "modifiers": [],
226 | "name": "supportsInterface",
227 | "nameLocation": "838:17:9",
228 | "nodeType": "FunctionDefinition",
229 | "overrides": {
230 | "id": 1726,
231 | "nodeType": "OverrideSpecifier",
232 | "overrides": [],
233 | "src": "896:8:9"
234 | },
235 | "parameters": {
236 | "id": 1725,
237 | "nodeType": "ParameterList",
238 | "parameters": [
239 | {
240 | "constant": false,
241 | "id": 1724,
242 | "mutability": "mutable",
243 | "name": "interfaceId",
244 | "nameLocation": "863:11:9",
245 | "nodeType": "VariableDeclaration",
246 | "scope": 1738,
247 | "src": "856:18:9",
248 | "stateVariable": false,
249 | "storageLocation": "default",
250 | "typeDescriptions": {
251 | "typeIdentifier": "t_bytes4",
252 | "typeString": "bytes4"
253 | },
254 | "typeName": {
255 | "id": 1723,
256 | "name": "bytes4",
257 | "nodeType": "ElementaryTypeName",
258 | "src": "856:6:9",
259 | "typeDescriptions": {
260 | "typeIdentifier": "t_bytes4",
261 | "typeString": "bytes4"
262 | }
263 | },
264 | "visibility": "internal"
265 | }
266 | ],
267 | "src": "855:20:9"
268 | },
269 | "returnParameters": {
270 | "id": 1729,
271 | "nodeType": "ParameterList",
272 | "parameters": [
273 | {
274 | "constant": false,
275 | "id": 1728,
276 | "mutability": "mutable",
277 | "name": "",
278 | "nameLocation": "-1:-1:-1",
279 | "nodeType": "VariableDeclaration",
280 | "scope": 1738,
281 | "src": "914:4:9",
282 | "stateVariable": false,
283 | "storageLocation": "default",
284 | "typeDescriptions": {
285 | "typeIdentifier": "t_bool",
286 | "typeString": "bool"
287 | },
288 | "typeName": {
289 | "id": 1727,
290 | "name": "bool",
291 | "nodeType": "ElementaryTypeName",
292 | "src": "914:4:9",
293 | "typeDescriptions": {
294 | "typeIdentifier": "t_bool",
295 | "typeString": "bool"
296 | }
297 | },
298 | "visibility": "internal"
299 | }
300 | ],
301 | "src": "913:6:9"
302 | },
303 | "scope": 1739,
304 | "src": "829:155:9",
305 | "stateMutability": "view",
306 | "virtual": true,
307 | "visibility": "public"
308 | }
309 | ],
310 | "scope": 1740,
311 | "src": "726:260:9",
312 | "usedErrors": []
313 | }
314 | ],
315 | "src": "99:888:9"
316 | },
317 | "legacyAST": {
318 | "absolutePath": "@openzeppelin/contracts/utils/introspection/ERC165.sol",
319 | "exportedSymbols": {
320 | "ERC165": [
321 | 1739
322 | ],
323 | "IERC165": [
324 | 1751
325 | ]
326 | },
327 | "id": 1740,
328 | "license": "MIT",
329 | "nodeType": "SourceUnit",
330 | "nodes": [
331 | {
332 | "id": 1717,
333 | "literals": [
334 | "solidity",
335 | "^",
336 | "0.8",
337 | ".0"
338 | ],
339 | "nodeType": "PragmaDirective",
340 | "src": "99:23:9"
341 | },
342 | {
343 | "absolutePath": "@openzeppelin/contracts/utils/introspection/IERC165.sol",
344 | "file": "./IERC165.sol",
345 | "id": 1718,
346 | "nameLocation": "-1:-1:-1",
347 | "nodeType": "ImportDirective",
348 | "scope": 1740,
349 | "sourceUnit": 1752,
350 | "src": "124:23:9",
351 | "symbolAliases": [],
352 | "unitAlias": ""
353 | },
354 | {
355 | "abstract": true,
356 | "baseContracts": [
357 | {
358 | "baseName": {
359 | "id": 1720,
360 | "name": "IERC165",
361 | "nodeType": "IdentifierPath",
362 | "referencedDeclaration": 1751,
363 | "src": "754:7:9"
364 | },
365 | "id": 1721,
366 | "nodeType": "InheritanceSpecifier",
367 | "src": "754:7:9"
368 | }
369 | ],
370 | "canonicalName": "ERC165",
371 | "contractDependencies": [],
372 | "contractKind": "contract",
373 | "documentation": {
374 | "id": 1719,
375 | "nodeType": "StructuredDocumentation",
376 | "src": "149:576:9",
377 | "text": " @dev Implementation of the {IERC165} interface.\n Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check\n for the additional interface id that will be supported. For example:\n ```solidity\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);\n }\n ```\n Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation."
378 | },
379 | "fullyImplemented": true,
380 | "id": 1739,
381 | "linearizedBaseContracts": [
382 | 1739,
383 | 1751
384 | ],
385 | "name": "ERC165",
386 | "nameLocation": "744:6:9",
387 | "nodeType": "ContractDefinition",
388 | "nodes": [
389 | {
390 | "baseFunctions": [
391 | 1750
392 | ],
393 | "body": {
394 | "id": 1737,
395 | "nodeType": "Block",
396 | "src": "920:64:9",
397 | "statements": [
398 | {
399 | "expression": {
400 | "commonType": {
401 | "typeIdentifier": "t_bytes4",
402 | "typeString": "bytes4"
403 | },
404 | "id": 1735,
405 | "isConstant": false,
406 | "isLValue": false,
407 | "isPure": false,
408 | "lValueRequested": false,
409 | "leftExpression": {
410 | "id": 1730,
411 | "name": "interfaceId",
412 | "nodeType": "Identifier",
413 | "overloadedDeclarations": [],
414 | "referencedDeclaration": 1724,
415 | "src": "937:11:9",
416 | "typeDescriptions": {
417 | "typeIdentifier": "t_bytes4",
418 | "typeString": "bytes4"
419 | }
420 | },
421 | "nodeType": "BinaryOperation",
422 | "operator": "==",
423 | "rightExpression": {
424 | "expression": {
425 | "arguments": [
426 | {
427 | "id": 1732,
428 | "name": "IERC165",
429 | "nodeType": "Identifier",
430 | "overloadedDeclarations": [],
431 | "referencedDeclaration": 1751,
432 | "src": "957:7:9",
433 | "typeDescriptions": {
434 | "typeIdentifier": "t_type$_t_contract$_IERC165_$1751_$",
435 | "typeString": "type(contract IERC165)"
436 | }
437 | }
438 | ],
439 | "expression": {
440 | "argumentTypes": [
441 | {
442 | "typeIdentifier": "t_type$_t_contract$_IERC165_$1751_$",
443 | "typeString": "type(contract IERC165)"
444 | }
445 | ],
446 | "id": 1731,
447 | "name": "type",
448 | "nodeType": "Identifier",
449 | "overloadedDeclarations": [],
450 | "referencedDeclaration": 4294967269,
451 | "src": "952:4:9",
452 | "typeDescriptions": {
453 | "typeIdentifier": "t_function_metatype_pure$__$returns$__$",
454 | "typeString": "function () pure"
455 | }
456 | },
457 | "id": 1733,
458 | "isConstant": false,
459 | "isLValue": false,
460 | "isPure": true,
461 | "kind": "functionCall",
462 | "lValueRequested": false,
463 | "names": [],
464 | "nodeType": "FunctionCall",
465 | "src": "952:13:9",
466 | "tryCall": false,
467 | "typeDescriptions": {
468 | "typeIdentifier": "t_magic_meta_type_t_contract$_IERC165_$1751",
469 | "typeString": "type(contract IERC165)"
470 | }
471 | },
472 | "id": 1734,
473 | "isConstant": false,
474 | "isLValue": false,
475 | "isPure": true,
476 | "lValueRequested": false,
477 | "memberName": "interfaceId",
478 | "nodeType": "MemberAccess",
479 | "src": "952:25:9",
480 | "typeDescriptions": {
481 | "typeIdentifier": "t_bytes4",
482 | "typeString": "bytes4"
483 | }
484 | },
485 | "src": "937:40:9",
486 | "typeDescriptions": {
487 | "typeIdentifier": "t_bool",
488 | "typeString": "bool"
489 | }
490 | },
491 | "functionReturnParameters": 1729,
492 | "id": 1736,
493 | "nodeType": "Return",
494 | "src": "930:47:9"
495 | }
496 | ]
497 | },
498 | "documentation": {
499 | "id": 1722,
500 | "nodeType": "StructuredDocumentation",
501 | "src": "768:56:9",
502 | "text": " @dev See {IERC165-supportsInterface}."
503 | },
504 | "functionSelector": "01ffc9a7",
505 | "id": 1738,
506 | "implemented": true,
507 | "kind": "function",
508 | "modifiers": [],
509 | "name": "supportsInterface",
510 | "nameLocation": "838:17:9",
511 | "nodeType": "FunctionDefinition",
512 | "overrides": {
513 | "id": 1726,
514 | "nodeType": "OverrideSpecifier",
515 | "overrides": [],
516 | "src": "896:8:9"
517 | },
518 | "parameters": {
519 | "id": 1725,
520 | "nodeType": "ParameterList",
521 | "parameters": [
522 | {
523 | "constant": false,
524 | "id": 1724,
525 | "mutability": "mutable",
526 | "name": "interfaceId",
527 | "nameLocation": "863:11:9",
528 | "nodeType": "VariableDeclaration",
529 | "scope": 1738,
530 | "src": "856:18:9",
531 | "stateVariable": false,
532 | "storageLocation": "default",
533 | "typeDescriptions": {
534 | "typeIdentifier": "t_bytes4",
535 | "typeString": "bytes4"
536 | },
537 | "typeName": {
538 | "id": 1723,
539 | "name": "bytes4",
540 | "nodeType": "ElementaryTypeName",
541 | "src": "856:6:9",
542 | "typeDescriptions": {
543 | "typeIdentifier": "t_bytes4",
544 | "typeString": "bytes4"
545 | }
546 | },
547 | "visibility": "internal"
548 | }
549 | ],
550 | "src": "855:20:9"
551 | },
552 | "returnParameters": {
553 | "id": 1729,
554 | "nodeType": "ParameterList",
555 | "parameters": [
556 | {
557 | "constant": false,
558 | "id": 1728,
559 | "mutability": "mutable",
560 | "name": "",
561 | "nameLocation": "-1:-1:-1",
562 | "nodeType": "VariableDeclaration",
563 | "scope": 1738,
564 | "src": "914:4:9",
565 | "stateVariable": false,
566 | "storageLocation": "default",
567 | "typeDescriptions": {
568 | "typeIdentifier": "t_bool",
569 | "typeString": "bool"
570 | },
571 | "typeName": {
572 | "id": 1727,
573 | "name": "bool",
574 | "nodeType": "ElementaryTypeName",
575 | "src": "914:4:9",
576 | "typeDescriptions": {
577 | "typeIdentifier": "t_bool",
578 | "typeString": "bool"
579 | }
580 | },
581 | "visibility": "internal"
582 | }
583 | ],
584 | "src": "913:6:9"
585 | },
586 | "scope": 1739,
587 | "src": "829:155:9",
588 | "stateMutability": "view",
589 | "virtual": true,
590 | "visibility": "public"
591 | }
592 | ],
593 | "scope": 1740,
594 | "src": "726:260:9",
595 | "usedErrors": []
596 | }
597 | ],
598 | "src": "99:888:9"
599 | },
600 | "compiler": {
601 | "name": "solc",
602 | "version": "0.8.10+commit.fc410830.Emscripten.clang"
603 | },
604 | "networks": {},
605 | "schemaVersion": "3.4.3",
606 | "updatedAt": "2021-12-01T23:30:39.409Z",
607 | "devdoc": {
608 | "details": "Implementation of the {IERC165} interface. Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check for the additional interface id that will be supported. For example: ```solidity function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId); } ``` Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation.",
609 | "kind": "dev",
610 | "methods": {
611 | "supportsInterface(bytes4)": {
612 | "details": "See {IERC165-supportsInterface}."
613 | }
614 | },
615 | "version": 1
616 | },
617 | "userdoc": {
618 | "kind": "user",
619 | "methods": {},
620 | "version": 1
621 | }
622 | }
--------------------------------------------------------------------------------
/src/abis/IERC165.json:
--------------------------------------------------------------------------------
1 | {
2 | "contractName": "IERC165",
3 | "abi": [
4 | {
5 | "inputs": [
6 | {
7 | "internalType": "bytes4",
8 | "name": "interfaceId",
9 | "type": "bytes4"
10 | }
11 | ],
12 | "name": "supportsInterface",
13 | "outputs": [
14 | {
15 | "internalType": "bool",
16 | "name": "",
17 | "type": "bool"
18 | }
19 | ],
20 | "stateMutability": "view",
21 | "type": "function"
22 | }
23 | ],
24 | "metadata": "{\"compiler\":{\"version\":\"0.8.10+commit.fc410830\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"bytes4\",\"name\":\"interfaceId\",\"type\":\"bytes4\"}],\"name\":\"supportsInterface\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"}],\"devdoc\":{\"details\":\"Interface of the ERC165 standard, as defined in the https://eips.ethereum.org/EIPS/eip-165[EIP]. Implementers can declare support of contract interfaces, which can then be queried by others ({ERC165Checker}). For an implementation, see {ERC165}.\",\"kind\":\"dev\",\"methods\":{\"supportsInterface(bytes4)\":{\"details\":\"Returns true if this contract implements the interface defined by `interfaceId`. See the corresponding https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section] to learn more about how these ids are created. This function call must use less than 30 000 gas.\"}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"@openzeppelin/contracts/utils/introspection/IERC165.sol\":\"IERC165\"},\"evmVersion\":\"london\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\"},\"optimizer\":{\"enabled\":false,\"runs\":200},\"remappings\":[]},\"sources\":{\"@openzeppelin/contracts/utils/introspection/IERC165.sol\":{\"keccak256\":\"0x6aa521718bf139b44ce56f194f6aea1d590cacef995b5a84703fb1579fa49be9\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://100f8d367b5e94eb9cb991914f1de133cf272654c0708faa893bbc17a5b35b93\",\"dweb:/ipfs/QmZeBojmgXq821dL1TJKFb58B1FogM9jL3u7hXQ8hTEBKT\"]}},\"version\":1}",
25 | "bytecode": "0x",
26 | "deployedBytecode": "0x",
27 | "immutableReferences": {},
28 | "generatedSources": [],
29 | "deployedGeneratedSources": [],
30 | "sourceMap": "",
31 | "deployedSourceMap": "",
32 | "source": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.0 (utils/introspection/IERC165.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC165 standard, as defined in the\n * https://eips.ethereum.org/EIPS/eip-165[EIP].\n *\n * Implementers can declare support of contract interfaces, which can then be\n * queried by others ({ERC165Checker}).\n *\n * For an implementation, see {ERC165}.\n */\ninterface IERC165 {\n /**\n * @dev Returns true if this contract implements the interface defined by\n * `interfaceId`. See the corresponding\n * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]\n * to learn more about how these ids are created.\n *\n * This function call must use less than 30 000 gas.\n */\n function supportsInterface(bytes4 interfaceId) external view returns (bool);\n}\n",
33 | "sourcePath": "@openzeppelin/contracts/utils/introspection/IERC165.sol",
34 | "ast": {
35 | "absolutePath": "@openzeppelin/contracts/utils/introspection/IERC165.sol",
36 | "exportedSymbols": {
37 | "IERC165": [
38 | 1751
39 | ]
40 | },
41 | "id": 1752,
42 | "license": "MIT",
43 | "nodeType": "SourceUnit",
44 | "nodes": [
45 | {
46 | "id": 1741,
47 | "literals": [
48 | "solidity",
49 | "^",
50 | "0.8",
51 | ".0"
52 | ],
53 | "nodeType": "PragmaDirective",
54 | "src": "100:23:10"
55 | },
56 | {
57 | "abstract": false,
58 | "baseContracts": [],
59 | "canonicalName": "IERC165",
60 | "contractDependencies": [],
61 | "contractKind": "interface",
62 | "documentation": {
63 | "id": 1742,
64 | "nodeType": "StructuredDocumentation",
65 | "src": "125:279:10",
66 | "text": " @dev Interface of the ERC165 standard, as defined in the\n https://eips.ethereum.org/EIPS/eip-165[EIP].\n Implementers can declare support of contract interfaces, which can then be\n queried by others ({ERC165Checker}).\n For an implementation, see {ERC165}."
67 | },
68 | "fullyImplemented": false,
69 | "id": 1751,
70 | "linearizedBaseContracts": [
71 | 1751
72 | ],
73 | "name": "IERC165",
74 | "nameLocation": "415:7:10",
75 | "nodeType": "ContractDefinition",
76 | "nodes": [
77 | {
78 | "documentation": {
79 | "id": 1743,
80 | "nodeType": "StructuredDocumentation",
81 | "src": "429:340:10",
82 | "text": " @dev Returns true if this contract implements the interface defined by\n `interfaceId`. See the corresponding\n https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]\n to learn more about how these ids are created.\n This function call must use less than 30 000 gas."
83 | },
84 | "functionSelector": "01ffc9a7",
85 | "id": 1750,
86 | "implemented": false,
87 | "kind": "function",
88 | "modifiers": [],
89 | "name": "supportsInterface",
90 | "nameLocation": "783:17:10",
91 | "nodeType": "FunctionDefinition",
92 | "parameters": {
93 | "id": 1746,
94 | "nodeType": "ParameterList",
95 | "parameters": [
96 | {
97 | "constant": false,
98 | "id": 1745,
99 | "mutability": "mutable",
100 | "name": "interfaceId",
101 | "nameLocation": "808:11:10",
102 | "nodeType": "VariableDeclaration",
103 | "scope": 1750,
104 | "src": "801:18:10",
105 | "stateVariable": false,
106 | "storageLocation": "default",
107 | "typeDescriptions": {
108 | "typeIdentifier": "t_bytes4",
109 | "typeString": "bytes4"
110 | },
111 | "typeName": {
112 | "id": 1744,
113 | "name": "bytes4",
114 | "nodeType": "ElementaryTypeName",
115 | "src": "801:6:10",
116 | "typeDescriptions": {
117 | "typeIdentifier": "t_bytes4",
118 | "typeString": "bytes4"
119 | }
120 | },
121 | "visibility": "internal"
122 | }
123 | ],
124 | "src": "800:20:10"
125 | },
126 | "returnParameters": {
127 | "id": 1749,
128 | "nodeType": "ParameterList",
129 | "parameters": [
130 | {
131 | "constant": false,
132 | "id": 1748,
133 | "mutability": "mutable",
134 | "name": "",
135 | "nameLocation": "-1:-1:-1",
136 | "nodeType": "VariableDeclaration",
137 | "scope": 1750,
138 | "src": "844:4:10",
139 | "stateVariable": false,
140 | "storageLocation": "default",
141 | "typeDescriptions": {
142 | "typeIdentifier": "t_bool",
143 | "typeString": "bool"
144 | },
145 | "typeName": {
146 | "id": 1747,
147 | "name": "bool",
148 | "nodeType": "ElementaryTypeName",
149 | "src": "844:4:10",
150 | "typeDescriptions": {
151 | "typeIdentifier": "t_bool",
152 | "typeString": "bool"
153 | }
154 | },
155 | "visibility": "internal"
156 | }
157 | ],
158 | "src": "843:6:10"
159 | },
160 | "scope": 1751,
161 | "src": "774:76:10",
162 | "stateMutability": "view",
163 | "virtual": false,
164 | "visibility": "external"
165 | }
166 | ],
167 | "scope": 1752,
168 | "src": "405:447:10",
169 | "usedErrors": []
170 | }
171 | ],
172 | "src": "100:753:10"
173 | },
174 | "legacyAST": {
175 | "absolutePath": "@openzeppelin/contracts/utils/introspection/IERC165.sol",
176 | "exportedSymbols": {
177 | "IERC165": [
178 | 1751
179 | ]
180 | },
181 | "id": 1752,
182 | "license": "MIT",
183 | "nodeType": "SourceUnit",
184 | "nodes": [
185 | {
186 | "id": 1741,
187 | "literals": [
188 | "solidity",
189 | "^",
190 | "0.8",
191 | ".0"
192 | ],
193 | "nodeType": "PragmaDirective",
194 | "src": "100:23:10"
195 | },
196 | {
197 | "abstract": false,
198 | "baseContracts": [],
199 | "canonicalName": "IERC165",
200 | "contractDependencies": [],
201 | "contractKind": "interface",
202 | "documentation": {
203 | "id": 1742,
204 | "nodeType": "StructuredDocumentation",
205 | "src": "125:279:10",
206 | "text": " @dev Interface of the ERC165 standard, as defined in the\n https://eips.ethereum.org/EIPS/eip-165[EIP].\n Implementers can declare support of contract interfaces, which can then be\n queried by others ({ERC165Checker}).\n For an implementation, see {ERC165}."
207 | },
208 | "fullyImplemented": false,
209 | "id": 1751,
210 | "linearizedBaseContracts": [
211 | 1751
212 | ],
213 | "name": "IERC165",
214 | "nameLocation": "415:7:10",
215 | "nodeType": "ContractDefinition",
216 | "nodes": [
217 | {
218 | "documentation": {
219 | "id": 1743,
220 | "nodeType": "StructuredDocumentation",
221 | "src": "429:340:10",
222 | "text": " @dev Returns true if this contract implements the interface defined by\n `interfaceId`. See the corresponding\n https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]\n to learn more about how these ids are created.\n This function call must use less than 30 000 gas."
223 | },
224 | "functionSelector": "01ffc9a7",
225 | "id": 1750,
226 | "implemented": false,
227 | "kind": "function",
228 | "modifiers": [],
229 | "name": "supportsInterface",
230 | "nameLocation": "783:17:10",
231 | "nodeType": "FunctionDefinition",
232 | "parameters": {
233 | "id": 1746,
234 | "nodeType": "ParameterList",
235 | "parameters": [
236 | {
237 | "constant": false,
238 | "id": 1745,
239 | "mutability": "mutable",
240 | "name": "interfaceId",
241 | "nameLocation": "808:11:10",
242 | "nodeType": "VariableDeclaration",
243 | "scope": 1750,
244 | "src": "801:18:10",
245 | "stateVariable": false,
246 | "storageLocation": "default",
247 | "typeDescriptions": {
248 | "typeIdentifier": "t_bytes4",
249 | "typeString": "bytes4"
250 | },
251 | "typeName": {
252 | "id": 1744,
253 | "name": "bytes4",
254 | "nodeType": "ElementaryTypeName",
255 | "src": "801:6:10",
256 | "typeDescriptions": {
257 | "typeIdentifier": "t_bytes4",
258 | "typeString": "bytes4"
259 | }
260 | },
261 | "visibility": "internal"
262 | }
263 | ],
264 | "src": "800:20:10"
265 | },
266 | "returnParameters": {
267 | "id": 1749,
268 | "nodeType": "ParameterList",
269 | "parameters": [
270 | {
271 | "constant": false,
272 | "id": 1748,
273 | "mutability": "mutable",
274 | "name": "",
275 | "nameLocation": "-1:-1:-1",
276 | "nodeType": "VariableDeclaration",
277 | "scope": 1750,
278 | "src": "844:4:10",
279 | "stateVariable": false,
280 | "storageLocation": "default",
281 | "typeDescriptions": {
282 | "typeIdentifier": "t_bool",
283 | "typeString": "bool"
284 | },
285 | "typeName": {
286 | "id": 1747,
287 | "name": "bool",
288 | "nodeType": "ElementaryTypeName",
289 | "src": "844:4:10",
290 | "typeDescriptions": {
291 | "typeIdentifier": "t_bool",
292 | "typeString": "bool"
293 | }
294 | },
295 | "visibility": "internal"
296 | }
297 | ],
298 | "src": "843:6:10"
299 | },
300 | "scope": 1751,
301 | "src": "774:76:10",
302 | "stateMutability": "view",
303 | "virtual": false,
304 | "visibility": "external"
305 | }
306 | ],
307 | "scope": 1752,
308 | "src": "405:447:10",
309 | "usedErrors": []
310 | }
311 | ],
312 | "src": "100:753:10"
313 | },
314 | "compiler": {
315 | "name": "solc",
316 | "version": "0.8.10+commit.fc410830.Emscripten.clang"
317 | },
318 | "networks": {},
319 | "schemaVersion": "3.4.3",
320 | "updatedAt": "2021-12-01T23:30:39.409Z",
321 | "devdoc": {
322 | "details": "Interface of the ERC165 standard, as defined in the https://eips.ethereum.org/EIPS/eip-165[EIP]. Implementers can declare support of contract interfaces, which can then be queried by others ({ERC165Checker}). For an implementation, see {ERC165}.",
323 | "kind": "dev",
324 | "methods": {
325 | "supportsInterface(bytes4)": {
326 | "details": "Returns true if this contract implements the interface defined by `interfaceId`. See the corresponding https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section] to learn more about how these ids are created. This function call must use less than 30 000 gas."
327 | }
328 | },
329 | "version": 1
330 | },
331 | "userdoc": {
332 | "kind": "user",
333 | "methods": {},
334 | "version": 1
335 | }
336 | }
--------------------------------------------------------------------------------
/src/abis/IERC721Receiver.json:
--------------------------------------------------------------------------------
1 | {
2 | "contractName": "IERC721Receiver",
3 | "abi": [
4 | {
5 | "inputs": [
6 | {
7 | "internalType": "address",
8 | "name": "operator",
9 | "type": "address"
10 | },
11 | {
12 | "internalType": "address",
13 | "name": "from",
14 | "type": "address"
15 | },
16 | {
17 | "internalType": "uint256",
18 | "name": "tokenId",
19 | "type": "uint256"
20 | },
21 | {
22 | "internalType": "bytes",
23 | "name": "data",
24 | "type": "bytes"
25 | }
26 | ],
27 | "name": "onERC721Received",
28 | "outputs": [
29 | {
30 | "internalType": "bytes4",
31 | "name": "",
32 | "type": "bytes4"
33 | }
34 | ],
35 | "stateMutability": "nonpayable",
36 | "type": "function"
37 | }
38 | ],
39 | "metadata": "{\"compiler\":{\"version\":\"0.8.10+commit.fc410830\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"operator\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"from\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"tokenId\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"}],\"name\":\"onERC721Received\",\"outputs\":[{\"internalType\":\"bytes4\",\"name\":\"\",\"type\":\"bytes4\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}],\"devdoc\":{\"details\":\"Interface for any contract that wants to support safeTransfers from ERC721 asset contracts.\",\"kind\":\"dev\",\"methods\":{\"onERC721Received(address,address,uint256,bytes)\":{\"details\":\"Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom} by `operator` from `from`, this function is called. It must return its Solidity selector to confirm the token transfer. If any other value is returned or the interface is not implemented by the recipient, the transfer will be reverted. The selector can be obtained in Solidity with `IERC721.onERC721Received.selector`.\"}},\"title\":\"ERC721 token receiver interface\",\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol\":\"IERC721Receiver\"},\"evmVersion\":\"london\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\"},\"optimizer\":{\"enabled\":false,\"runs\":200},\"remappings\":[]},\"sources\":{\"@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol\":{\"keccak256\":\"0x483b106386dd309f168672928252a19f30c30efb4d17d4b8e2b0f587ca784a11\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://189a39d066c6886ddbe86c79bb36d6cbe66e98bc6a94956e28f5503dae4ad406\",\"dweb:/ipfs/QmT3s3PwCdXqHLJk26kcnedrRGTC9T18z52i9Be7PV9ppc\"]}},\"version\":1}",
40 | "bytecode": "0x",
41 | "deployedBytecode": "0x",
42 | "immutableReferences": {},
43 | "generatedSources": [],
44 | "deployedGeneratedSources": [],
45 | "sourceMap": "",
46 | "deployedSourceMap": "",
47 | "source": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.0 (token/ERC721/IERC721Receiver.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @title ERC721 token receiver interface\n * @dev Interface for any contract that wants to support safeTransfers\n * from ERC721 asset contracts.\n */\ninterface IERC721Receiver {\n /**\n * @dev Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom}\n * by `operator` from `from`, this function is called.\n *\n * It must return its Solidity selector to confirm the token transfer.\n * If any other value is returned or the interface is not implemented by the recipient, the transfer will be reverted.\n *\n * The selector can be obtained in Solidity with `IERC721.onERC721Received.selector`.\n */\n function onERC721Received(\n address operator,\n address from,\n uint256 tokenId,\n bytes calldata data\n ) external returns (bytes4);\n}\n",
48 | "sourcePath": "@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol",
49 | "ast": {
50 | "absolutePath": "@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol",
51 | "exportedSymbols": {
52 | "IERC721Receiver": [
53 | 964
54 | ]
55 | },
56 | "id": 965,
57 | "license": "MIT",
58 | "nodeType": "SourceUnit",
59 | "nodes": [
60 | {
61 | "id": 948,
62 | "literals": [
63 | "solidity",
64 | "^",
65 | "0.8",
66 | ".0"
67 | ],
68 | "nodeType": "PragmaDirective",
69 | "src": "101:23:2"
70 | },
71 | {
72 | "abstract": false,
73 | "baseContracts": [],
74 | "canonicalName": "IERC721Receiver",
75 | "contractDependencies": [],
76 | "contractKind": "interface",
77 | "documentation": {
78 | "id": 949,
79 | "nodeType": "StructuredDocumentation",
80 | "src": "126:152:2",
81 | "text": " @title ERC721 token receiver interface\n @dev Interface for any contract that wants to support safeTransfers\n from ERC721 asset contracts."
82 | },
83 | "fullyImplemented": false,
84 | "id": 964,
85 | "linearizedBaseContracts": [
86 | 964
87 | ],
88 | "name": "IERC721Receiver",
89 | "nameLocation": "289:15:2",
90 | "nodeType": "ContractDefinition",
91 | "nodes": [
92 | {
93 | "documentation": {
94 | "id": 950,
95 | "nodeType": "StructuredDocumentation",
96 | "src": "311:485:2",
97 | "text": " @dev Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom}\n by `operator` from `from`, this function is called.\n It must return its Solidity selector to confirm the token transfer.\n If any other value is returned or the interface is not implemented by the recipient, the transfer will be reverted.\n The selector can be obtained in Solidity with `IERC721.onERC721Received.selector`."
98 | },
99 | "functionSelector": "150b7a02",
100 | "id": 963,
101 | "implemented": false,
102 | "kind": "function",
103 | "modifiers": [],
104 | "name": "onERC721Received",
105 | "nameLocation": "810:16:2",
106 | "nodeType": "FunctionDefinition",
107 | "parameters": {
108 | "id": 959,
109 | "nodeType": "ParameterList",
110 | "parameters": [
111 | {
112 | "constant": false,
113 | "id": 952,
114 | "mutability": "mutable",
115 | "name": "operator",
116 | "nameLocation": "844:8:2",
117 | "nodeType": "VariableDeclaration",
118 | "scope": 963,
119 | "src": "836:16:2",
120 | "stateVariable": false,
121 | "storageLocation": "default",
122 | "typeDescriptions": {
123 | "typeIdentifier": "t_address",
124 | "typeString": "address"
125 | },
126 | "typeName": {
127 | "id": 951,
128 | "name": "address",
129 | "nodeType": "ElementaryTypeName",
130 | "src": "836:7:2",
131 | "stateMutability": "nonpayable",
132 | "typeDescriptions": {
133 | "typeIdentifier": "t_address",
134 | "typeString": "address"
135 | }
136 | },
137 | "visibility": "internal"
138 | },
139 | {
140 | "constant": false,
141 | "id": 954,
142 | "mutability": "mutable",
143 | "name": "from",
144 | "nameLocation": "870:4:2",
145 | "nodeType": "VariableDeclaration",
146 | "scope": 963,
147 | "src": "862:12:2",
148 | "stateVariable": false,
149 | "storageLocation": "default",
150 | "typeDescriptions": {
151 | "typeIdentifier": "t_address",
152 | "typeString": "address"
153 | },
154 | "typeName": {
155 | "id": 953,
156 | "name": "address",
157 | "nodeType": "ElementaryTypeName",
158 | "src": "862:7:2",
159 | "stateMutability": "nonpayable",
160 | "typeDescriptions": {
161 | "typeIdentifier": "t_address",
162 | "typeString": "address"
163 | }
164 | },
165 | "visibility": "internal"
166 | },
167 | {
168 | "constant": false,
169 | "id": 956,
170 | "mutability": "mutable",
171 | "name": "tokenId",
172 | "nameLocation": "892:7:2",
173 | "nodeType": "VariableDeclaration",
174 | "scope": 963,
175 | "src": "884:15:2",
176 | "stateVariable": false,
177 | "storageLocation": "default",
178 | "typeDescriptions": {
179 | "typeIdentifier": "t_uint256",
180 | "typeString": "uint256"
181 | },
182 | "typeName": {
183 | "id": 955,
184 | "name": "uint256",
185 | "nodeType": "ElementaryTypeName",
186 | "src": "884:7:2",
187 | "typeDescriptions": {
188 | "typeIdentifier": "t_uint256",
189 | "typeString": "uint256"
190 | }
191 | },
192 | "visibility": "internal"
193 | },
194 | {
195 | "constant": false,
196 | "id": 958,
197 | "mutability": "mutable",
198 | "name": "data",
199 | "nameLocation": "924:4:2",
200 | "nodeType": "VariableDeclaration",
201 | "scope": 963,
202 | "src": "909:19:2",
203 | "stateVariable": false,
204 | "storageLocation": "calldata",
205 | "typeDescriptions": {
206 | "typeIdentifier": "t_bytes_calldata_ptr",
207 | "typeString": "bytes"
208 | },
209 | "typeName": {
210 | "id": 957,
211 | "name": "bytes",
212 | "nodeType": "ElementaryTypeName",
213 | "src": "909:5:2",
214 | "typeDescriptions": {
215 | "typeIdentifier": "t_bytes_storage_ptr",
216 | "typeString": "bytes"
217 | }
218 | },
219 | "visibility": "internal"
220 | }
221 | ],
222 | "src": "826:108:2"
223 | },
224 | "returnParameters": {
225 | "id": 962,
226 | "nodeType": "ParameterList",
227 | "parameters": [
228 | {
229 | "constant": false,
230 | "id": 961,
231 | "mutability": "mutable",
232 | "name": "",
233 | "nameLocation": "-1:-1:-1",
234 | "nodeType": "VariableDeclaration",
235 | "scope": 963,
236 | "src": "953:6:2",
237 | "stateVariable": false,
238 | "storageLocation": "default",
239 | "typeDescriptions": {
240 | "typeIdentifier": "t_bytes4",
241 | "typeString": "bytes4"
242 | },
243 | "typeName": {
244 | "id": 960,
245 | "name": "bytes4",
246 | "nodeType": "ElementaryTypeName",
247 | "src": "953:6:2",
248 | "typeDescriptions": {
249 | "typeIdentifier": "t_bytes4",
250 | "typeString": "bytes4"
251 | }
252 | },
253 | "visibility": "internal"
254 | }
255 | ],
256 | "src": "952:8:2"
257 | },
258 | "scope": 964,
259 | "src": "801:160:2",
260 | "stateMutability": "nonpayable",
261 | "virtual": false,
262 | "visibility": "external"
263 | }
264 | ],
265 | "scope": 965,
266 | "src": "279:684:2",
267 | "usedErrors": []
268 | }
269 | ],
270 | "src": "101:863:2"
271 | },
272 | "legacyAST": {
273 | "absolutePath": "@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol",
274 | "exportedSymbols": {
275 | "IERC721Receiver": [
276 | 964
277 | ]
278 | },
279 | "id": 965,
280 | "license": "MIT",
281 | "nodeType": "SourceUnit",
282 | "nodes": [
283 | {
284 | "id": 948,
285 | "literals": [
286 | "solidity",
287 | "^",
288 | "0.8",
289 | ".0"
290 | ],
291 | "nodeType": "PragmaDirective",
292 | "src": "101:23:2"
293 | },
294 | {
295 | "abstract": false,
296 | "baseContracts": [],
297 | "canonicalName": "IERC721Receiver",
298 | "contractDependencies": [],
299 | "contractKind": "interface",
300 | "documentation": {
301 | "id": 949,
302 | "nodeType": "StructuredDocumentation",
303 | "src": "126:152:2",
304 | "text": " @title ERC721 token receiver interface\n @dev Interface for any contract that wants to support safeTransfers\n from ERC721 asset contracts."
305 | },
306 | "fullyImplemented": false,
307 | "id": 964,
308 | "linearizedBaseContracts": [
309 | 964
310 | ],
311 | "name": "IERC721Receiver",
312 | "nameLocation": "289:15:2",
313 | "nodeType": "ContractDefinition",
314 | "nodes": [
315 | {
316 | "documentation": {
317 | "id": 950,
318 | "nodeType": "StructuredDocumentation",
319 | "src": "311:485:2",
320 | "text": " @dev Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom}\n by `operator` from `from`, this function is called.\n It must return its Solidity selector to confirm the token transfer.\n If any other value is returned or the interface is not implemented by the recipient, the transfer will be reverted.\n The selector can be obtained in Solidity with `IERC721.onERC721Received.selector`."
321 | },
322 | "functionSelector": "150b7a02",
323 | "id": 963,
324 | "implemented": false,
325 | "kind": "function",
326 | "modifiers": [],
327 | "name": "onERC721Received",
328 | "nameLocation": "810:16:2",
329 | "nodeType": "FunctionDefinition",
330 | "parameters": {
331 | "id": 959,
332 | "nodeType": "ParameterList",
333 | "parameters": [
334 | {
335 | "constant": false,
336 | "id": 952,
337 | "mutability": "mutable",
338 | "name": "operator",
339 | "nameLocation": "844:8:2",
340 | "nodeType": "VariableDeclaration",
341 | "scope": 963,
342 | "src": "836:16:2",
343 | "stateVariable": false,
344 | "storageLocation": "default",
345 | "typeDescriptions": {
346 | "typeIdentifier": "t_address",
347 | "typeString": "address"
348 | },
349 | "typeName": {
350 | "id": 951,
351 | "name": "address",
352 | "nodeType": "ElementaryTypeName",
353 | "src": "836:7:2",
354 | "stateMutability": "nonpayable",
355 | "typeDescriptions": {
356 | "typeIdentifier": "t_address",
357 | "typeString": "address"
358 | }
359 | },
360 | "visibility": "internal"
361 | },
362 | {
363 | "constant": false,
364 | "id": 954,
365 | "mutability": "mutable",
366 | "name": "from",
367 | "nameLocation": "870:4:2",
368 | "nodeType": "VariableDeclaration",
369 | "scope": 963,
370 | "src": "862:12:2",
371 | "stateVariable": false,
372 | "storageLocation": "default",
373 | "typeDescriptions": {
374 | "typeIdentifier": "t_address",
375 | "typeString": "address"
376 | },
377 | "typeName": {
378 | "id": 953,
379 | "name": "address",
380 | "nodeType": "ElementaryTypeName",
381 | "src": "862:7:2",
382 | "stateMutability": "nonpayable",
383 | "typeDescriptions": {
384 | "typeIdentifier": "t_address",
385 | "typeString": "address"
386 | }
387 | },
388 | "visibility": "internal"
389 | },
390 | {
391 | "constant": false,
392 | "id": 956,
393 | "mutability": "mutable",
394 | "name": "tokenId",
395 | "nameLocation": "892:7:2",
396 | "nodeType": "VariableDeclaration",
397 | "scope": 963,
398 | "src": "884:15:2",
399 | "stateVariable": false,
400 | "storageLocation": "default",
401 | "typeDescriptions": {
402 | "typeIdentifier": "t_uint256",
403 | "typeString": "uint256"
404 | },
405 | "typeName": {
406 | "id": 955,
407 | "name": "uint256",
408 | "nodeType": "ElementaryTypeName",
409 | "src": "884:7:2",
410 | "typeDescriptions": {
411 | "typeIdentifier": "t_uint256",
412 | "typeString": "uint256"
413 | }
414 | },
415 | "visibility": "internal"
416 | },
417 | {
418 | "constant": false,
419 | "id": 958,
420 | "mutability": "mutable",
421 | "name": "data",
422 | "nameLocation": "924:4:2",
423 | "nodeType": "VariableDeclaration",
424 | "scope": 963,
425 | "src": "909:19:2",
426 | "stateVariable": false,
427 | "storageLocation": "calldata",
428 | "typeDescriptions": {
429 | "typeIdentifier": "t_bytes_calldata_ptr",
430 | "typeString": "bytes"
431 | },
432 | "typeName": {
433 | "id": 957,
434 | "name": "bytes",
435 | "nodeType": "ElementaryTypeName",
436 | "src": "909:5:2",
437 | "typeDescriptions": {
438 | "typeIdentifier": "t_bytes_storage_ptr",
439 | "typeString": "bytes"
440 | }
441 | },
442 | "visibility": "internal"
443 | }
444 | ],
445 | "src": "826:108:2"
446 | },
447 | "returnParameters": {
448 | "id": 962,
449 | "nodeType": "ParameterList",
450 | "parameters": [
451 | {
452 | "constant": false,
453 | "id": 961,
454 | "mutability": "mutable",
455 | "name": "",
456 | "nameLocation": "-1:-1:-1",
457 | "nodeType": "VariableDeclaration",
458 | "scope": 963,
459 | "src": "953:6:2",
460 | "stateVariable": false,
461 | "storageLocation": "default",
462 | "typeDescriptions": {
463 | "typeIdentifier": "t_bytes4",
464 | "typeString": "bytes4"
465 | },
466 | "typeName": {
467 | "id": 960,
468 | "name": "bytes4",
469 | "nodeType": "ElementaryTypeName",
470 | "src": "953:6:2",
471 | "typeDescriptions": {
472 | "typeIdentifier": "t_bytes4",
473 | "typeString": "bytes4"
474 | }
475 | },
476 | "visibility": "internal"
477 | }
478 | ],
479 | "src": "952:8:2"
480 | },
481 | "scope": 964,
482 | "src": "801:160:2",
483 | "stateMutability": "nonpayable",
484 | "virtual": false,
485 | "visibility": "external"
486 | }
487 | ],
488 | "scope": 965,
489 | "src": "279:684:2",
490 | "usedErrors": []
491 | }
492 | ],
493 | "src": "101:863:2"
494 | },
495 | "compiler": {
496 | "name": "solc",
497 | "version": "0.8.10+commit.fc410830.Emscripten.clang"
498 | },
499 | "networks": {},
500 | "schemaVersion": "3.4.3",
501 | "updatedAt": "2021-12-01T23:30:39.394Z",
502 | "devdoc": {
503 | "details": "Interface for any contract that wants to support safeTransfers from ERC721 asset contracts.",
504 | "kind": "dev",
505 | "methods": {
506 | "onERC721Received(address,address,uint256,bytes)": {
507 | "details": "Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom} by `operator` from `from`, this function is called. It must return its Solidity selector to confirm the token transfer. If any other value is returned or the interface is not implemented by the recipient, the transfer will be reverted. The selector can be obtained in Solidity with `IERC721.onERC721Received.selector`."
508 | }
509 | },
510 | "title": "ERC721 token receiver interface",
511 | "version": 1
512 | },
513 | "userdoc": {
514 | "kind": "user",
515 | "methods": {},
516 | "version": 1
517 | }
518 | }
--------------------------------------------------------------------------------
/src/assets/.DS_Store:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ehp2021/zims/a6a1bc0e3fa3eda7d1a3930244b7ca76c8a4c9b0/src/assets/.DS_Store
--------------------------------------------------------------------------------
/src/assets/images/games.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ehp2021/zims/a6a1bc0e3fa3eda7d1a3930244b7ca76c8a4c9b0/src/assets/images/games.png
--------------------------------------------------------------------------------
/src/assets/images/gettingstarted.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ehp2021/zims/a6a1bc0e3fa3eda7d1a3930244b7ca76c8a4c9b0/src/assets/images/gettingstarted.png
--------------------------------------------------------------------------------
/src/assets/images/market.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ehp2021/zims/a6a1bc0e3fa3eda7d1a3930244b7ca76c8a4c9b0/src/assets/images/market.png
--------------------------------------------------------------------------------
/src/assets/images/mint.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ehp2021/zims/a6a1bc0e3fa3eda7d1a3930244b7ca76c8a4c9b0/src/assets/images/mint.png
--------------------------------------------------------------------------------
/src/assets/videos/.DS_Store:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ehp2021/zims/a6a1bc0e3fa3eda7d1a3930244b7ca76c8a4c9b0/src/assets/videos/.DS_Store
--------------------------------------------------------------------------------
/src/assets/videos/Zelda1.mp4:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ehp2021/zims/a6a1bc0e3fa3eda7d1a3930244b7ca76c8a4c9b0/src/assets/videos/Zelda1.mp4
--------------------------------------------------------------------------------
/src/assets/videos/bg-video.mp4:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ehp2021/zims/a6a1bc0e3fa3eda7d1a3930244b7ca76c8a4c9b0/src/assets/videos/bg-video.mp4
--------------------------------------------------------------------------------
/src/assets/videos/video-bg-2.mp4:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ehp2021/zims/a6a1bc0e3fa3eda7d1a3930244b7ca76c8a4c9b0/src/assets/videos/video-bg-2.mp4
--------------------------------------------------------------------------------
/src/assets/videos/videoplayback.mp4:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ehp2021/zims/a6a1bc0e3fa3eda7d1a3930244b7ca76c8a4c9b0/src/assets/videos/videoplayback.mp4
--------------------------------------------------------------------------------
/src/components/App.css:
--------------------------------------------------------------------------------
1 | @import url('https://fonts.googleapis.com/css2?family=Press+Start+2P&display=swap');
2 | @import url('https://fonts.googleapis.com/css2?family=Play&display=swap');
3 | .zimFont {
4 | font-family: 'Press Start 2P';
5 | font-weight: 900;
6 | }
7 |
8 | .homeFont {
9 | font-family: 'Play';
10 | }
11 |
12 | .link {
13 | text-decoration: underline;
14 | cursor: pointer;
15 | margin: 0.5rem;
16 | color: hsl(51, 99%, 50%);
17 | }
18 |
19 | .home-hero {
20 | background: #0c0c0c;
21 | display: flex;
22 | justify-content: center;
23 | align-items: center;
24 | position: relative;
25 | margin-top: -60px;
26 | height: 100vh;
27 | z-index: -1;
28 | margin-top: -60px;
29 | }
30 |
31 | .hero__bg {
32 | position: relative;
33 | top: 0;
34 | left: 0;
35 | width: 100%;
36 | overflow: hidden;
37 | height: 100vh;
38 | }
39 |
40 | .hero__bg__video {
41 | width: 100%;
42 | height: 100%;
43 | background: #232a34;
44 | object-fit: cover;
45 | -o-object-fit: cover;
46 | z-index: -1;
47 | }
48 |
49 | .fade-video {
50 | position: absolute;
51 | top: 0;
52 | left: 0;
53 | width: 100%;
54 | height: 100%;
55 | overflow: hidden;
56 | background-color: hsla(0, 0%, 0%, 0.8);
57 | z-index: 0;
58 | }
59 |
60 | .center-stuff {
61 | position: absolute;
62 | left: 50%;
63 | top: 50%;
64 | transform: translateY(-60%) translateX(-50%);
65 | }
66 |
67 | #canvas {
68 | padding-top: 70px;
69 | }
70 |
71 | .scrollBar::-webkit-scrollbar {
72 | background-color: none;
73 | height: 7px;
74 | }
75 |
76 | .scrollBar::-webkit-scrollbar-thumb {
77 | background-color: #4fd1c5;
78 | border-radius: 100px;
79 | }
80 |
81 | .activeNavLink {
82 | border-bottom: 5px solid orange;
83 | }
84 |
85 | .arrow {
86 | font-size: 3rem;
87 | transition: all 0.2s ease-in-out;
88 | animation: arrow 1s infinite alternate ease-in-out;
89 | }
90 |
91 | .arrow:hover {
92 | color: #58ebe3;
93 | animation-play-state: paused;
94 | opacity: 1;
95 | }
96 |
97 | @keyframes arrow {
98 | 0% {
99 | opacity: 0.3;
100 | transform: translateY(80%);
101 | }
102 | 100% {
103 | opacity: 0.7;
104 | transform: translateY(120%);
105 | }
106 | }
--------------------------------------------------------------------------------
/src/components/App.js:
--------------------------------------------------------------------------------
1 | import './App.css';
2 | import { BrowserRouter as Router, Routes, Route, Navigate } from 'react-router-dom';
3 | import { useMoralis } from 'react-moralis';
4 | import Auth from './pages/Auth';
5 | import Profile from './pages/Profile';
6 | import Home from './pages/Home';
7 | import Settings from './pages/Settings';
8 | import Navbar from './mini/Navbar';
9 | import Mint from './pages/Mint';
10 | import Market from './pages/Market'
11 |
12 | import Games from './pages/Games'
13 | import HangmanApp from './games/Hangman/HangmanApp';
14 | import FloppyApp from './games/Floppy/FloppyApp';
15 | import BrickApp from './games/Brick/breakout/index';
16 | import Tetris from './games/Tetris/Tetris'
17 |
18 | const App = () => {
19 | const { isAuthenticated } = useMoralis();
20 | return ( <>
21 | { isAuthenticated && < Navbar/ > }
22 |
23 | {!isAuthenticated && < Route path = '/'
24 | element = { < Auth/> }
25 | />}
26 | {
27 | isAuthenticated && < Route path = '/'
28 | element = { < Home/> }
29 | />}
30 | : }
34 | />
35 | : < Navigate to = '/' /> }
38 | />
39 | : < Navigate to = '/' /> }
42 | />
43 | : < Navigate to = '/' /> }
46 | />
47 | : < Navigate to = '/' /> }
50 | />
51 | : < Navigate to = '/' /> }
54 | />
55 | }
58 | />
59 | }
62 | />
63 | }
66 | />
67 |
68 |
69 |
70 | >
71 | );
72 | };
73 |
74 | export default App;
--------------------------------------------------------------------------------
/src/components/games/Brick/breakout/BallMovement.js:
--------------------------------------------------------------------------------
1 | export function BallMovement(ctx, ballObj) {
2 | let data = new Ball(ballObj.x, ballObj.y, ballObj.rad);
3 | data.draw(ctx);
4 | ballObj.x += ballObj.dx;
5 | ballObj.y += ballObj.dy;
6 | }
7 |
8 | class Ball {
9 | constructor(x, y, rad) {
10 | this.x = x;
11 | this.y = y;
12 | this.rad = rad;
13 | }
14 | draw(ctx) {
15 | ctx.beginPath();
16 | ctx.fillStyle = "red";
17 | ctx.arc(this.x, this.y, this.rad, 0, 2 * Math.PI);
18 | ctx.strokeStyle = "black";
19 | ctx.lineWidth = 2;
20 | ctx.fill();
21 | ctx.stroke();
22 | }
23 | }
--------------------------------------------------------------------------------
/src/components/games/Brick/breakout/Brick.js:
--------------------------------------------------------------------------------
1 | export default function Brick(level, bricks, canvas, brick) {
2 | brick.width = canvas.width / 5 - 1;
3 | let newbricks = [];
4 | if (!bricks) {
5 | return [];
6 | }
7 | // If all the levels are filled
8 | if (bricks.length >= 5 * level) {
9 | return;
10 | }
11 |
12 | // Brick Formation here
13 | for (let i = 0; i < 5 * level; i++) {
14 | let newBrick = new SingleBrick(
15 | brick.x + brick.width,
16 | brick.y,
17 | brick.width,
18 | brick.height,
19 | brick.colors
20 | );
21 | newbricks.push(newBrick);
22 | // newBrick.draw();
23 | brick.x += brick.width + 1;
24 | if (brick.x + brick.width >= canvas.width) {
25 | brick.x = 0.5;
26 | brick.y += brick.height + 1;
27 | }
28 | }
29 | return newbricks;
30 | }
31 |
32 | class SingleBrick {
33 | constructor(x, y, w, h, c) {
34 | this.x = x - w;
35 | this.y = y;
36 | this.width = w;
37 | this.height = h;
38 | this.colors = c;
39 | this.broke = false;
40 | }
41 | draw(ctx) {
42 | ctx.beginPath();
43 | ctx.rect(this.x, this.y, this.width, this.height);
44 | ctx.fillStyle = this.broke ? "rgba(19, 73, 89, 0)" : this.colors[1];
45 |
46 | ctx.lineWidth = 5;
47 | ctx.strokeStyle = this.broke ? "rgba(19, 73, 89, 0)" : "transparent";
48 | // ctx.globalCompositeOperation = "destination-atop";
49 | // ctx.shadowBlur = 0;
50 | // ctx.shadowColor = "blue";
51 | ctx.fill();
52 | ctx.strokeRect(this.x, this.y, this.width, this.height);
53 | }
54 | }
--------------------------------------------------------------------------------
/src/components/games/Brick/breakout/Paddle.js:
--------------------------------------------------------------------------------
1 | export default (ctx, canvas, paddleProps) => {
2 | class Paddle {
3 | constructor(x) {
4 | this.x = x;
5 | this.y = canvas.height - 30;
6 | this.height = 20;
7 | this.width = paddleProps.width;
8 | this.colors = ["red", "#FFA62B"];
9 | }
10 | move() {
11 | ctx.beginPath();
12 | //creates rectangle
13 | ctx.rect(this.x, this.y, this.width, this.height);
14 | ctx.fillStyle = this.broke ? "white" : this.colors[1];
15 | ctx.strokeStyle = this.broke ? "white" : "red";
16 | ctx.lineWidth = 1;
17 | ctx.fillStyle = this.broke ? "white" : this.colors[1];
18 | ctx.shadowBlur = 0;
19 | ctx.shadowColor = "blue";
20 | ctx.strokeRect(this.x, this.y, this.width, this.height);
21 | ctx.fill();
22 | }
23 | }
24 |
25 | let paddle = new Paddle(paddleProps.x);
26 | paddle.move();
27 | if (paddleProps.x <= 0) {
28 | paddleProps.x = 0;
29 | } else if (paddleProps.x + paddleProps.width >= canvas.width) {
30 | paddleProps.x = canvas.width - paddleProps.width;
31 | }
32 | };
--------------------------------------------------------------------------------
/src/components/games/Brick/breakout/PlayerStats.js:
--------------------------------------------------------------------------------
1 | export default function PlayerStats(ctx, player, canvas) {
2 | // Name
3 | ctx.font = "20px Arial";
4 | ctx.fillStyle = "white";
5 | // ctx.fillText(`Name: ${player.name}`, 20, 30);
6 |
7 | // Lives
8 | ctx.font = "20px Arial";
9 | ctx.fillStyle = "red";
10 | let gap = 0;
11 | for (let i = 0; i < player.lives; i++) {
12 | ctx.fillText("❤️", canvas.width / 2 + gap, 30);
13 | gap += 30;
14 | }
15 |
16 | // Score
17 | ctx.font = "20px Arial";
18 | ctx.fillStyle = "white";
19 | ctx.fillText(`Score: ${player.score}`, canvas.width - 140, 30);
20 | }
--------------------------------------------------------------------------------
/src/components/games/Brick/breakout/board.js:
--------------------------------------------------------------------------------
1 | import { React, useRef, useEffect } from "react";
2 | import { BallMovement } from "./BallMovement";
3 | import data from "../data";
4 | import WallCollision from "./util/WallCollision";
5 | import Paddle from "./Paddle";
6 | import Brick from "./Brick";
7 | import BrickCollision from "./util/BrickCollision";
8 | import PaddleHit from "./util/PaddleHit";
9 | import PlayerStats from "./PlayerStats";
10 | import AllBroken from "./util/AllBroken";
11 | import ResetBall from "./util/ResetBall";
12 | import{useNavigate} from 'react-router-dom'
13 | import {useMoralis} from 'react-moralis'
14 |
15 | let { ballObj, paddleProps, brickObj, player } = data;
16 |
17 | let bricks = [];
18 |
19 |
20 |
21 |
22 |
23 | export default function Board() {
24 | const {user,setUserData} = useMoralis()
25 | const canvasRef = useRef(null);
26 | const NavigateBrick = useNavigate();
27 |
28 | useEffect(() => {
29 | const render = () => {
30 | const canvas = canvasRef.current;
31 | if (canvas === null) return null;
32 | const ctx = canvas.getContext("2d");
33 |
34 | paddleProps.y = canvas.height - 30;
35 |
36 | // asign bricks
37 |
38 | let newBrickSet = Brick(2, bricks, canvas, brickObj);
39 |
40 | if (newBrickSet && newBrickSet.length > 0) {
41 | bricks = newBrickSet;
42 | }
43 |
44 | ctx.clearRect(0, 0, canvas.width, canvas.height);
45 |
46 | PlayerStats(ctx, player, canvas);
47 |
48 | //if games is complete
49 |
50 |
51 | if (player.lives === 0) {
52 | alert("GAME OVER");
53 | setUserData({points:(user.attributes.points+(player.score))})
54 | //window.location.href = "/games";
55 | NavigateBrick('/games')
56 | //window.location.reload(true)
57 | window.location.replace('/games')
58 | }
59 | if (player.score === 200) {
60 | alert("Congratulations! You are a true Brick Breaker!")
61 | setUserData({points:(user.attributes.points+(player.score*2))})
62 | //window.location.href = "/games";
63 | NavigateBrick('/games')
64 | //window.location.reload(true)
65 | window.location.replace('/games')
66 | }
67 |
68 |
69 |
70 | bricks.map((brick) => {
71 | return brick.draw(ctx);
72 | });
73 |
74 | BallMovement(ctx, ballObj);
75 |
76 | AllBroken(bricks, player, canvas, ballObj);
77 |
78 | WallCollision(ballObj, canvas, player, paddleProps);
79 |
80 | // Brick Collision
81 | let brickCollision;
82 |
83 | for (let i = 0; i < bricks.length; i++) {
84 | brickCollision = BrickCollision(ballObj, bricks[i]);
85 |
86 | if (brickCollision.hit && !bricks[i].broke) {
87 | if (brickCollision.axis === "X") {
88 | ballObj.dx *= -1;
89 | bricks[i].broke = true;
90 | } else if (brickCollision.axis === "Y") {
91 | ballObj.dy *= -1;
92 | bricks[i].broke = true;
93 | }
94 | player.score += 10;
95 | }
96 | }
97 |
98 | Paddle(ctx, canvas, paddleProps);
99 |
100 | PaddleHit(ballObj, paddleProps);
101 |
102 | requestAnimationFrame(render);
103 | };
104 | render();
105 | }, []);
106 |
107 | return (
108 |
109 | < canvas id = "canvas"
110 | ref = { canvasRef }
111 | onMouseMove = {
112 | (event) =>
113 | (paddleProps.x = event.clientX - paddleProps.width / 2 - 10)
114 | }
115 | height = "500px"
116 | width = { window.innerWidth - 220 }
117 | />
118 |
119 | );
120 | }
--------------------------------------------------------------------------------
/src/components/games/Brick/breakout/index.js:
--------------------------------------------------------------------------------
1 | import React from "react";
2 | import Board from "./board";
3 |
4 | export default function Breakout() {
5 | return (
6 |
7 |
Use your mouse to hit the red ball.
8 |
9 | );
10 | }
--------------------------------------------------------------------------------
/src/components/games/Brick/breakout/util/AllBroken.js:
--------------------------------------------------------------------------------
1 | import data from "../../data";
2 | import ResetBall from "./ResetBall";
3 | export default function AllBroken(bricks, player, canvas, ballObj) {
4 | let { brickObj, paddleProps } = data;
5 | // if (bricks.length === 0) {
6 | // return;
7 | // }
8 |
9 |
10 | let total = 0;
11 |
12 | for (let i = 0; i < bricks.length; i++) {
13 | if (bricks[i].broke === true) {
14 | total++;
15 | }
16 | }
17 |
18 | if (total === bricks.length && player.score === 100) {
19 | alert("Bonus Level unlocked!");
20 | bricks.length = 0;
21 | player.lives = 2;
22 | player.level = 1;
23 | //player.score = 100;
24 | //
25 | ResetBall(ballObj, canvas, paddleProps);
26 | ballObj.speed = 10;
27 | brickObj.y = 50;
28 |
29 |
30 | }
31 |
32 |
33 | }
--------------------------------------------------------------------------------
/src/components/games/Brick/breakout/util/BrickCollision.js:
--------------------------------------------------------------------------------
1 | export default function BrickCollision(circle, rect) {
2 | var distX = Math.abs(circle.x - rect.x - rect.width / 2);
3 | var distY = Math.abs(circle.y - rect.y - rect.height / 2);
4 |
5 | if (distX > rect.width / 2 + circle.rad) {
6 | // return false;
7 | return {
8 | hit: false,
9 | };
10 | }
11 | if (distY > rect.height / 2 + circle.rad) {
12 | // return false;
13 | return {
14 | hit: false,
15 | };
16 | }
17 |
18 | if (distX <= rect.width / 2) {
19 | // return true;
20 | return {
21 | hit: true,
22 | axis: "Y",
23 | };
24 | }
25 | if (distY <= rect.height / 2) {
26 | // return true;
27 | return {
28 | hit: true,
29 | axis: "X",
30 | };
31 | }
32 |
33 | // also test for corner collisions
34 | var dx = distX - rect.width / 2;
35 | var dy = distY - rect.height / 2;
36 | // return dx * dx + dy * dy <= circle.rad * circle.rad;
37 | return {
38 | hit: dx * dx + dy * dy <= circle.rad * circle.rad,
39 | axis: "X",
40 | };
41 | }
--------------------------------------------------------------------------------
/src/components/games/Brick/breakout/util/PaddleHit.js:
--------------------------------------------------------------------------------
1 | export default function PaddleHit(ballObj, paddleProps) {
2 | if (
3 | ballObj.x < paddleProps.x + paddleProps.width &&
4 | ballObj.x > paddleProps.x &&
5 | paddleProps.y < paddleProps.y + paddleProps.height &&
6 | ballObj.y + ballObj.rad > paddleProps.y - paddleProps.height / 2
7 | ) {
8 | // CHECK WHERE THE ballObj HIT THE paddleProps
9 | let collidePoint = ballObj.x - (paddleProps.x + paddleProps.width / 2);
10 |
11 | // NORMALIZE THE VALUES
12 | collidePoint = collidePoint / (paddleProps.width / 2);
13 |
14 | // CALCULATE THE ANGLE OF THE ballObj
15 | let angle = (collidePoint * Math.PI) / 3;
16 |
17 | ballObj.dx = ballObj.speed * Math.sin(angle);
18 | ballObj.dy = -ballObj.speed * Math.cos(angle);
19 | }
20 | }
--------------------------------------------------------------------------------
/src/components/games/Brick/breakout/util/ResetBall.js:
--------------------------------------------------------------------------------
1 | // RESET THE BALL
2 | export default function ResetBall(ballObj, canvas, paddleProps) {
3 | ballObj.x = paddleProps.x;
4 | ballObj.y = paddleProps.y - 80;
5 | ballObj.dx = 6 * (Math.random() * 2 - 1);
6 | ballObj.dy = -6;
7 | }
--------------------------------------------------------------------------------
/src/components/games/Brick/breakout/util/WallCollision.js:
--------------------------------------------------------------------------------
1 | export default function WallCollision(
2 | ballObj,
3 | canvas,
4 | player,
5 | paddleProps,
6 | setLives
7 | ) {
8 | if (ballObj.y + ballObj.rad > canvas.height) {
9 | player.lives--;
10 | ballObj.x = paddleProps.x;
11 | ballObj.y = paddleProps.y - 30;
12 | ballObj.dx = 6 * (Math.random() * 2 - 1);
13 | ballObj.dy = -6;
14 | }
15 | if (ballObj.y - ballObj.rad < 0) {
16 | ballObj.dy *= -1;
17 | }
18 |
19 | if (ballObj.x + ballObj.rad > canvas.width || ballObj.x - ballObj.rad < 0) {
20 | ballObj.dx *= -1;
21 | }
22 | }
--------------------------------------------------------------------------------
/src/components/games/Brick/data.js:
--------------------------------------------------------------------------------
1 | export default {
2 | ballObj: {
3 | x: 20,
4 | y: 200,
5 | dx: 5,
6 | dy: 5,
7 | rad: 15,
8 | speed: 5,
9 | },
10 | brickObj: {
11 | x: 0.5,
12 | y: 50,
13 | width: 800 / 10 - 1,
14 | height: 20,
15 | density: 2,
16 | colors: ["red", "lightblue"],
17 | },
18 | player: {
19 | name: "Zim",
20 | lives: 5,
21 | score: 0,
22 | level: 1,
23 | },
24 | paddleProps: {
25 | height: 20,
26 | width: 100,
27 | x: 100,
28 | color: "blue",
29 | },
30 | };
--------------------------------------------------------------------------------
/src/components/games/Floppy/FloppyApp.css:
--------------------------------------------------------------------------------
1 |
2 | .floppy-container {
3 | /* padding: 100px; */
4 | width: 100vw;
5 | height: 100vh;
6 | }
7 |
8 | .game-container {
9 | width: 100vw;
10 | height: 100vh;
11 | position: absolute;
12 | left: 80px;
13 | }
14 |
15 | .sky {
16 | background-image: url('fb-game-background.png');
17 | width: 10;
18 | height: 580px;
19 | position: absolute;
20 | }
21 |
22 | .ground {
23 | background-image: url('bottom-background.png');
24 | width: 500px;
25 | height: 150px;
26 | position: absolute;
27 | top: 580px;
28 | z-index: +1;
29 | }
30 |
31 | .bird {
32 | background-image: url('flappy-bird.png');
33 | position: absolute;
34 | width: 60px;
35 | height: 45px;
36 | left: 220px;
37 | bottom: 100px;
38 | }
39 |
40 | .obstacle {
41 | background-image: url('flappybird-pipe.png');
42 | width: 60px;
43 | height: 300px;
44 | position: absolute;
45 | }
46 |
47 | .topObstacle {
48 | background-image: url('flappybird-pipe.png');
49 | transform: rotate(180deg);
50 | width: 60px;
51 | height: 175px;
52 | position: absolute;
53 | }
54 |
55 | @keyframes slideright {
56 | from {
57 | background-position: 10000%;
58 | }
59 | to {
60 | background-position: 0%;
61 | }
62 | }
63 |
64 | @-webkit-keyframes slideright {
65 | from {
66 | background-position: 10000%;
67 | }
68 | to {
69 | background-position: 0%;
70 | }
71 | }
72 |
73 | .ground-container {
74 | height: 150px;
75 | width: 580px;
76 | left: 80px;
77 | position: absolute;
78 | }
79 |
80 | .ground-moving {
81 | position: absolute;
82 | top: 580px;
83 | height: 150px;
84 | background-image: url('bottom-background.png');
85 | background-repeat: repeat-x;
86 | animation: slideright 100s infinite linear;
87 | -webkit-animation: slideright 100s infinite linear;
88 | width: 100%;
89 | z-index: +1;
90 | }
--------------------------------------------------------------------------------
/src/components/games/Floppy/FloppyApp.js:
--------------------------------------------------------------------------------
1 | import React, { Component } from 'react'
2 | import './FloppyApp.css'
3 | import { Button } from '@chakra-ui/react';
4 |
5 | export default class FloppyApp extends Component {
6 |
7 | componentDidMount(){
8 | const bird = document.querySelector(".bird");
9 | const gameDisplay = document.querySelector(".game-container");
10 | const ground = document.querySelector(".ground-moving");
11 |
12 | let birdLeft = 220;
13 | let birdBottom = 200;
14 | let gravity = 3;
15 | let isGameOver = false;
16 | let gap = 500;
17 |
18 |
19 | function startGame() {
20 | birdBottom -= gravity;
21 | bird.style.bottom = birdBottom + "px";
22 | bird.style.left = birdLeft + "px";
23 | }
24 | let gameTimerId = setInterval(startGame, 20);
25 |
26 | function control(e) {
27 | if (e.keyCode === 32) {
28 | jump();
29 | }
30 | }
31 |
32 | function jump() {
33 | if (birdBottom < 500) birdBottom += 50;
34 | bird.style.bottom = birdBottom + "px";
35 | }
36 | document.addEventListener("keyup", control);
37 |
38 | function generateObstacle() {
39 | let obstacleLeft = 500;
40 | let randomHeight = Math.random() * 60;
41 | let obstacleBottom = randomHeight;
42 | const obstacle = document.createElement("div");
43 | const topObstacle = document.createElement("div");
44 | if (!isGameOver) {
45 | obstacle.classList.add("obstacle");
46 | topObstacle.classList.add("topObstacle");
47 | }
48 | gameDisplay.appendChild(obstacle);
49 | gameDisplay.appendChild(topObstacle);
50 | obstacle.style.left = obstacleLeft + "px";
51 | topObstacle.style.left = obstacleLeft + "px";
52 | obstacle.style.bottom = obstacleBottom + "px";
53 | topObstacle.style.bottom = obstacleBottom + gap + "px";
54 |
55 | function moveObstacle() {
56 | obstacleLeft -= 2;
57 | obstacle.style.left = obstacleLeft + "px";
58 | topObstacle.style.left = obstacleLeft + "px";
59 |
60 | if (obstacleLeft === -60) {
61 | clearInterval(timerId);
62 | gameDisplay.removeChild(obstacle);
63 | gameDisplay.removeChild(topObstacle);
64 | }
65 | if (
66 | (obstacleLeft > 200 &&
67 | obstacleLeft < 280 &&
68 | birdLeft === 220 &&
69 | (birdBottom < obstacleBottom + 153 ||
70 | birdBottom > obstacleBottom + gap - 200)) ||
71 | birdBottom === 1
72 | ) {
73 | gameOver();
74 | clearInterval(timerId);
75 | }
76 | }
77 | let timerId = setInterval(moveObstacle, 20);
78 | if (!isGameOver) setTimeout(generateObstacle, 3000);
79 | }
80 | generateObstacle();
81 |
82 | function gameOver() {
83 | clearInterval(gameTimerId);
84 | isGameOver = true;
85 | document.removeEventListener("keyup", control);
86 | ground.classList.add("ground");
87 | ground.classList.remove("ground-moving");
88 |
89 | }
90 | }
91 | render() {
92 | return (
93 |
94 |
95 |
96 |
103 |
106 |
107 |
115 |
116 |
117 | )
118 | }
119 | }
120 |
--------------------------------------------------------------------------------
/src/components/games/Floppy/bottom-background.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ehp2021/zims/a6a1bc0e3fa3eda7d1a3930244b7ca76c8a4c9b0/src/components/games/Floppy/bottom-background.png
--------------------------------------------------------------------------------
/src/components/games/Floppy/fb-game-background.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ehp2021/zims/a6a1bc0e3fa3eda7d1a3930244b7ca76c8a4c9b0/src/components/games/Floppy/fb-game-background.png
--------------------------------------------------------------------------------
/src/components/games/Floppy/flappy-bird.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ehp2021/zims/a6a1bc0e3fa3eda7d1a3930244b7ca76c8a4c9b0/src/components/games/Floppy/flappy-bird.png
--------------------------------------------------------------------------------
/src/components/games/Floppy/flappybird-pipe.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ehp2021/zims/a6a1bc0e3fa3eda7d1a3930244b7ca76c8a4c9b0/src/components/games/Floppy/flappybird-pipe.png
--------------------------------------------------------------------------------
/src/components/games/Hangman/HangmanApp.css:
--------------------------------------------------------------------------------
1 | /* * {
2 | box-sizing: border-box;
3 | } */
4 |
5 | .hangman-box {
6 | display: flex;
7 | flex-direction: row;
8 | height: 900px;
9 | }
10 |
11 | .sidebar-box {
12 | position: relative;
13 | margin-top: 60px;
14 | height: 900px;
15 | }
16 |
17 | h1 {
18 | margin: 20px 0 0;
19 | }
20 |
21 | .hangman-container {
22 | /* padding: 20px 30px; */
23 | position: relative;
24 | display: flex;
25 | flex-direction: row;
26 | align-items: center;
27 | }
28 |
29 | .figure-container {
30 | margin-left: 260px;
31 | fill: transparent;
32 | stroke: #fff;
33 | stroke-width: 4px;
34 | stroke-linecap: round;
35 | }
36 |
37 |
38 | /* .figure-part {
39 | display: none;
40 | } */
41 |
42 | .wrong-letters-container {
43 | /* position: relative; */
44 | margin-left: 260px;
45 | /* right: 20px; */
46 | display: flex;
47 | flex-direction: column;
48 | text-align: right;
49 | }
50 |
51 | .wrong-letters-container p {
52 | margin: 0 0 5px;
53 | }
54 |
55 | .wrong-letters-container span {
56 | font-size: 24px;
57 | }
58 |
59 | .word {
60 | display: flex;
61 | position: absolute;
62 | bottom: 10px;
63 | left: 50%;
64 | transform: translateX(-50%);
65 | }
66 |
67 | .letter {
68 | border-bottom: 3px solid #2980b9;
69 | display: inline-flex;
70 | font-size: 30px;
71 | align-items: center;
72 | justify-content: center;
73 | margin: 0 3px;
74 | height: 50px;
75 | width: 20px;
76 | }
77 |
78 | .popup-container {
79 | background-color: rgba(0, 0, 0, 0.3);
80 | position: relative;
81 | top: 0;
82 | bottom: 0;
83 | left: 0;
84 | right: 0;
85 | /* display: flex; */
86 | display: none;
87 | align-items: center;
88 | justify-content: center;
89 | }
90 |
91 | .popup {
92 | background: #2980b9;
93 | border-radius: 5px;
94 | box-shadow: 0 15px 10px 3px rgba(0, 0, 0, 0.1);
95 | padding: 20px;
96 | text-align: center;
97 | }
98 |
99 | .popup button {
100 | cursor: pointer;
101 | background-color: #fff;
102 | color: #2980b9;
103 | border: 0;
104 | margin-top: 20px;
105 | padding: 12px 20px;
106 | font-size: 16px;
107 | }
108 |
109 | .popup button:active {
110 | transform: scale(0.98);
111 | }
112 |
113 | .popup button:focus {
114 | outline: 0;
115 | }
116 |
117 | .notification-container {
118 | background-color: rgba(0, 0, 0, 0.3);
119 | border-radius: 10px 10px 0 0;
120 | padding: 15px 20px;
121 | position: fixed;
122 | /* left: 550px; */
123 | bottom: -250px;
124 | transition: transform 0.3s ease-in-out;
125 | }
126 |
127 |
128 | /*
129 | .notification-container p {
130 | margin: 0;
131 | } */
132 |
133 | .notification-container.show {
134 | transform: translateY(-50px);
135 | }
--------------------------------------------------------------------------------
/src/components/games/Hangman/HangmanApp.js:
--------------------------------------------------------------------------------
1 | import React, { useState, useEffect } from 'react';
2 | import Header from './components/Header';
3 | import Figure from './components/Figure';
4 | import WrongLetters from './components/WrongLetters';
5 | import Word from './components/Word';
6 | import Popup from './components/Popup';
7 | import Notification from './components/Notification';
8 | import { showNotification as show, checkWin } from './helpers/helpers';
9 | import Sidebar from '../../mini/Sidebar';
10 | import './HangmanApp.css';
11 |
12 |
13 | // https://random-word-api.herokuapp.com/word?number=100
14 |
15 | const words = ['application', 'programming', 'interface', 'wizard', 'luxury', 'transplant',
16 | 'vodka', 'wellspring', 'whomever', 'xylophone', 'puffy',
17 | 'each', 'early', 'earn', 'earth', 'east', 'easy', 'education', 'effect', 'egg', 'eight', 'either', 'electric',
18 | 'elephant', 'else', 'empty', 'end', 'enemy', 'equal', 'entrance',
19 | 'escape', 'everyone', 'examination', 'expensive', 'extremely',
20 | 'hundred', 'hungry', 'hour', 'hurry', 'husband',
21 | 'jelly', 'juice', 'machine', 'mention', 'method', 'middle', 'milk',
22 | 'queen', 'question', 'vegetable', "tapeable",
23 | "costless", "exhumed", "horsts", "detesters", "clangs", "uncrating", "medicine", "outbuild", "cosmopolitian",
24 | "monologued", "prioritizations", "climatology", "odoriferously", "outsee",
25 | "trolling", "monarch", "proteolytic", "syndicators", "belted", "thunderbolt", "septal",
26 | "cojoin", "lines", "soppiness", "foilable", "canalize", "ridgling", "objectification", "aground",
27 | "turbulence", "dieseled", "liberalisms",
28 | "curtsy", "devaluates", "glaring", "influentially", "fettucine", "colloquialisms",
29 | "seadog", "chomp", "smudged",
30 | "quintupling",
31 | "directionless",
32 | "capris",
33 | "quantitate",
34 | "official",
35 | "reactively",
36 | "faintly",
37 | "sensualism",
38 | "exosphere",
39 | "reattributed",
40 | "orthochromatic",
41 | "underlings",
42 | "microporosities",
43 | "workshop",
44 | "bellies",
45 | "stockbroker",
46 | "scabbarded",
47 | "unemotional",
48 | "presentative",
49 | "factiousness",
50 | "micrographic",
51 | "assuming",
52 | "opiums",
53 | "gotten",
54 | "crudeness",
55 | "brush",
56 | "thenage",
57 | "humanist",
58 | "sewerlike",
59 | "souslik",
60 | "certify",
61 | "venerations",
62 | "vexillum",
63 | "talapoins",
64 | "variedly",
65 | "curry",
66 | "spatiotemporal",
67 | "thiopental",
68 | "nonpetroleum",
69 | "chromogen",
70 | "orthotist",
71 | "reaccede",
72 | "womanise",
73 | "magnetise",
74 | "whatsits",
75 | "headwaiter",
76 | "stratas",
77 | "unenlightened",
78 | "abulias",
79 | "shooled",
80 | "henbit",
81 | "persecutions",
82 | "exclaimers",
83 | "slatternliness",
84 | "captainships",
85 | "stockholder",
86 | "entomologists",
87 | "ennobler",
88 | "neophilia",
89 | "irrigably",
90 | "neutralisms",
91 | "insisted",
92 | "unclogs",
93 | "stammering",
94 | "isomerized",
95 | "begladding",
96 | "strictly",
97 | "lagged",
98 | "bindweed",
99 | "inaudible",
100 | "galenas",
101 | "sternest",
102 | "corbels",
103 | "quadrupeds",
104 | "cladistic",
105 | "oversimplified",
106 | "treacherousness",
107 | "headstays", "serenely", "elusiveness", "cochairwoman", "frowner", "dayflowers",
108 | "occipital", "reservednesses", "decarboxylating", "percent",
109 | "aloofly", "proscriptions", "charpais", "zebrawoods", "presentees", "acridnesses",
110 | "palliated", "snorkeler", "hairbrush", "unassailability", "prickier", "overestimations", "citational", "supertight",
111 | "nonporous", "disinterests", "sharpened",
112 | ];
113 | let selectedWord = words[Math.floor(Math.random() * words.length)];
114 |
115 | function HangmanApp() {
116 | // const [word, setWord] = useState('');
117 | const [playable, setPlayable] = useState(true);
118 | const [correctLetters, setCorrectLetters] = useState([]);
119 | const [wrongLetters, setWrongLetters] = useState([]);
120 | const [showNotification, setShowNotification] = useState(false);
121 |
122 |
123 | useEffect(() => {
124 | const handleKeydown = event => {
125 | const { key, keyCode } = event;
126 | if (playable && keyCode >= 65 && keyCode <= 90) {
127 | const letter = key.toLowerCase();
128 | if (selectedWord.includes(letter)) {
129 | if (!correctLetters.includes(letter)) {
130 | setCorrectLetters(currentLetters => [...currentLetters, letter]);
131 | } else {
132 | show(setShowNotification);
133 | }
134 | } else {
135 | if (!wrongLetters.includes(letter)) {
136 | setWrongLetters(currentLetters => [...currentLetters, letter]);
137 | } else {
138 | show(setShowNotification);
139 | }
140 | }
141 | }
142 | }
143 | window.addEventListener('keydown', handleKeydown);
144 |
145 | return () => window.removeEventListener('keydown', handleKeydown);
146 | }, [correctLetters, wrongLetters, playable]);
147 |
148 | function playAgain() {
149 | setPlayable(true);
150 |
151 | // Empty Arrays
152 | setCorrectLetters([]);
153 | setWrongLetters([]);
154 |
155 | const random = Math.floor(Math.random() * words.length);
156 | selectedWord = words[random];
157 | }
158 |
159 | return ( <
160 | div className = "hangman-box" >
161 | <
162 | div className = "sidebar-box" >
163 | <
164 | Sidebar / >
165 | <
166 | /div>
167 |
168 | <
169 | Header / >
170 | <
171 | div className = "hangman-container" >
172 | <
173 | Figure wrongLetters = { wrongLetters }
174 | /> < Word selectedWord = { selectedWord }
176 | correctLetters = { correctLetters }
177 | /> < Popup correctLetters = { correctLetters }
178 | wrongLetters = { wrongLetters }
179 | selectedWord = { selectedWord }
180 | setPlayable = { setPlayable }
181 | playAgain = { playAgain }
182 | />
184 | <
185 | /div>
186 | );
187 | }
188 |
189 | export default HangmanApp;
--------------------------------------------------------------------------------
/src/components/games/Hangman/components/Figure.js:
--------------------------------------------------------------------------------
1 | import React from 'react'
2 |
3 | const Figure = ({ wrongLetters }) => {
4 | const errors = wrongLetters.length
5 |
6 | return (
7 |
37 | )
38 | }
39 |
40 | export default Figure
--------------------------------------------------------------------------------
/src/components/games/Hangman/components/Header.js:
--------------------------------------------------------------------------------
1 | import React from 'react'
2 |
3 | // rafce
4 | const Header = () => {
5 | return (
6 | <>
7 | Hangman
8 | Find the hidden word - Enter a letter
9 | >
10 | )
11 | }
12 |
13 | export default Header
--------------------------------------------------------------------------------
/src/components/games/Hangman/components/Notification.js:
--------------------------------------------------------------------------------
1 |
2 |
3 | const Notification = ({ showNotification }) => {
4 | return (
5 |
6 |
You have already entered this letter
7 |
8 | )
9 | }
10 |
11 | export default Notification
--------------------------------------------------------------------------------
/src/components/games/Hangman/components/Popup.js:
--------------------------------------------------------------------------------
1 | import React, { useEffect } from 'react';
2 | import { checkWin } from '../helpers/helpers';
3 | import { useMoralis} from 'react-moralis'
4 | import{useNavigate} from 'react-router-dom'
5 |
6 | const Popup = ({correctLetters, wrongLetters, selectedWord, setPlayable, playAgain}) => {
7 | let finalMessage = '';
8 | let finalMessageRevealWord = '';
9 | let playable = true;
10 | const {user,setUserData} = useMoralis()
11 | const navigate = useNavigate()
12 |
13 | if( checkWin(correctLetters, wrongLetters, selectedWord) === 'win' ) {
14 | alert('You won!')
15 | finalMessage = 'Congratulations! You won! 😃';
16 |
17 | playable = false;
18 | setUserData({points:(user.attributes.points+200)})
19 | navigate('/games')
20 | } else if( checkWin(correctLetters, wrongLetters, selectedWord) === 'lose' ) {
21 | finalMessage = 'Unfortunately you lost. 😕';
22 | finalMessageRevealWord = `...the word was: ${selectedWord}`;
23 | playable = false;
24 | navigate('/games')
25 | }
26 |
27 | useEffect(() => {
28 | setPlayable(playable);
29 | });
30 |
31 | return (
32 |
33 |
34 |
{finalMessage}
35 | {finalMessageRevealWord}
36 |
37 |
38 |
39 | )
40 | }
41 |
42 | export default Popup;
--------------------------------------------------------------------------------
/src/components/games/Hangman/components/Word.js:
--------------------------------------------------------------------------------
1 |
2 |
3 | const Word = ({ selectedWord, correctLetters }) => {
4 |
5 | return (
6 |
7 | {selectedWord.split('').map((letter, i) => {
8 | return (
9 |
10 | {correctLetters.includes(letter) ? letter : ''}
11 |
12 | )
13 | })}
14 |
15 | )
16 | }
17 |
18 | export default Word;
--------------------------------------------------------------------------------
/src/components/games/Hangman/components/WrongLetters.js:
--------------------------------------------------------------------------------
1 |
2 |
3 | const WrongLetters = ({ wrongLetters }) => {
4 |
5 | return (
6 |
7 |
8 | {wrongLetters.length > 0 &&
9 |
Wrong
10 | }
11 | {wrongLetters
12 | .map((letter, i) =>
{letter})
13 | .reduce((prev, curr) => prev === null ? [curr] : [prev, ', ', curr], null)}
14 |
15 |
16 | )
17 | }
18 |
19 | export default WrongLetters
--------------------------------------------------------------------------------
/src/components/games/Hangman/helpers/helpers.js:
--------------------------------------------------------------------------------
1 | export function showNotification(setter) {
2 | setter(true);
3 | setTimeout(() => {
4 | setter(false);
5 | }, 2000);
6 | }
7 |
8 | export function checkWin(correct, wrong, word) {
9 | let status = 'win';
10 |
11 | // Check for win
12 | word.split('').forEach(letter => {
13 | if (!correct.includes(letter)) {
14 | status = '';
15 | }
16 | });
17 |
18 | // Check for lose
19 | if (wrong.length === 6) status = 'lose';
20 |
21 | return status
22 | }
--------------------------------------------------------------------------------
/src/components/games/Tetris/Tetris.css:
--------------------------------------------------------------------------------
1 | .game-block {
2 | margin: 0;
3 | padding: 0;
4 | width: 2rem;
5 | height: 2rem;
6 | border: 1px solid rgba(210, 203, 203, 0.606);
7 | }
8 |
9 | .piece-i {
10 | background-color: #33e1f4;
11 | }
12 |
13 | .piece-j {
14 | background-color: rgb(17, 64, 251);
15 | }
16 |
17 | .piece-l {
18 | background-color: rgb(247, 181, 12);
19 | }
20 |
21 | .piece-o {
22 | background-color: #e0f404;
23 | }
24 |
25 | .piece-s {
26 | background-color: rgb(2, 252, 81);
27 | }
28 |
29 | .piece-t {
30 | background-color: rgb(175, 20, 242);
31 | }
32 |
33 | .piece-z {
34 | background-color: #e32a27;
35 | }
36 |
37 | .piece-preview {
38 | background-color: rgb(247, 247, 247);
39 | opacity: 0.25;
40 | }
41 |
42 | .tetris-container {
43 | display: flex;
44 | flex-direction: row;
45 | gap: 30px
46 | }
47 |
48 | .points {
49 | display: flex;
50 | flex-direction: column;
51 | align-items: flex-start;
52 | justify-content: flex-start;
53 | }
54 |
55 | h1 {
56 | font-weight: 1000;
57 | font-size: 75px;
58 | }
--------------------------------------------------------------------------------
/src/components/games/Tetris/Tetris.js:
--------------------------------------------------------------------------------
1 | import React from 'react'
2 | import Tetris from 'react-tetris';
3 | import './Tetris.css';
4 | import { Flex } from '@chakra-ui/react';
5 | import {useNavigate } from 'react-router-dom'
6 | import {useMoralis} from 'react-moralis'
7 |
8 | const TetrisApp = () => {
9 | const navigate = useNavigate()
10 | const {user,setUserData} = useMoralis()
11 |
12 | function clickHandler(wonPoints){
13 | setUserData({points:(user.attributes.points + wonPoints)})
14 | navigate('/games')
15 | }
16 |
17 | return (
18 |
19 |
20 |
21 | Tetris
22 |
23 |
39 | {({
40 | HeldPiece,
41 | Gameboard,
42 | PieceQueue,
43 | points,
44 | linesCleared,
45 | state,
46 | controller
47 | }) => (
48 |
49 |
50 |
Points: {points}
51 |
Lines Cleared: {linesCleared}
52 |
53 |
54 |
55 | {state === 'LOST' && (
56 |
57 |
Game Over
58 |
59 |
60 | )}
61 |
62 | )}
63 |
64 |
65 |
66 |
67 | )
68 | };
69 |
70 | export default TetrisApp
--------------------------------------------------------------------------------
/src/components/mini/Actions.js:
--------------------------------------------------------------------------------
1 | import React, { useState, useEffect, useLayoutEffect } from 'react';
2 | import Buttons from './Buttons';
3 | import { Center, Text, HStack, VStack, Stack } from '@chakra-ui/react';
4 | import { useMoralis, useMoralisQuery } from 'react-moralis';
5 | import { useSelector, useDispatch } from 'react-redux';
6 | import { enable, disable } from '../../redux/buttons/buttons';
7 | import moment from 'moment';
8 |
9 | const Actions = () => {
10 | const { user, setUserData } = useMoralis();
11 | const [points, setPoints] = useState(user.attributes.points);
12 |
13 | const work = useSelector(state => state.button.work);
14 | const workout = useSelector(state => state.button.workout);
15 | const meditate = useSelector(state => state.button.meditate);
16 | const party = useSelector(state => state.button.party);
17 | const shower = useSelector(state => state.button.shower);
18 | const volunteer = useSelector(state => state.button.volunteer);
19 | const dispatch = useDispatch();
20 |
21 | const clickHandler = (e, type, addedPoints) => {
22 | setPoints(prevState => {
23 | return prevState + addedPoints;
24 | });
25 | storeTimeOfClick(e);
26 | dispatch(disable(`${type}`));
27 | };
28 |
29 | const storeTimeOfClick = e => {
30 | const storageId = 'lastClicked' + e.target.id;
31 | localStorage.setItem(storageId, Date.now());
32 | };
33 |
34 | const calculateTime = (type, time) => {
35 | const storageId = 'lastClicked' + type;
36 | if (localStorage.getItem(storageId)) {
37 | const previousClick = +localStorage.getItem(storageId);
38 | if (Date.now() > previousClick + time) {
39 | dispatch(enable(`${type}`));
40 | localStorage.removeItem(storageId)
41 | }
42 | }
43 | };
44 |
45 | const EVERY_6_HOURS = 21600000
46 | const EVERY_8_HOURS = 28800000
47 | const EVERY_12_HOURS = 43200000
48 | const EVERY_16_HOURS = 57600000
49 | const ONCE_A_DAY = 86400000
50 |
51 | useEffect(() => {
52 | setUserData({ points: points });
53 | const timer = setInterval(() => {
54 | calculateTime('work', ONCE_A_DAY);
55 | calculateTime('workout', EVERY_12_HOURS);
56 | calculateTime('meditate', EVERY_6_HOURS);
57 | calculateTime('volunteer', EVERY_16_HOURS);
58 | calculateTime('shower', EVERY_8_HOURS);
59 | calculateTime('party', ONCE_A_DAY);
60 | // dispatch(enable('work'))
61 | // dispatch(enable('workout'))
62 | // dispatch(enable('meditate'))
63 | // dispatch(enable('volunteer'))
64 | // dispatch(enable('shower'))
65 | // dispatch(enable('party'))
66 | // calculateTime('work', ONCE_A_DAY);
67 | // calculateTime('workout', EVERY_12_HOURS);
68 | // calculateTime('meditate', EVERY_6_HOURS);
69 | // calculateTime('volunteer', EVERY_16_HOURS);
70 | // calculateTime('shower', EVERY_8_HOURS);
71 | // calculateTime('party', ONCE_A_DAY);
72 | }, 1000);
73 | return () => clearInterval(timer);
74 | }, [points]);
75 |
76 | return (
77 | <>
78 |
79 |
85 |
86 |
95 |
104 |
113 |
114 |
115 |
124 |
133 |
142 |
143 |
144 |
145 | >
146 | );
147 | };
148 |
149 | export default Actions;
--------------------------------------------------------------------------------
/src/components/mini/AuthNavBar.js:
--------------------------------------------------------------------------------
1 | import React, { useState, useEffect } from 'react';
2 | import { Flex, Text } from '@chakra-ui/react';
3 | import { Link, animateScroll } from 'react-scroll';
4 |
5 | const AuthNavBar = () => {
6 | const links = ['Getting Started', 'Play Games' , `Mint NFT's`, 'Sign Up'];
7 | const [scrollNav, setScrollNav] = useState(false);
8 |
9 | const changeNav = () =>
10 | window.scrollY >= 80 ? setScrollNav(true) : setScrollNav(false);
11 |
12 | useEffect(() => {
13 | window.addEventListener('scroll', changeNav);
14 | }, []);
15 |
16 | return (
17 |
26 |
27 | animateScroll.scrollToTop()}
33 | py={4}
34 | >
35 | ZIMS
36 |
37 |
38 |
39 | {links.map(link => (
40 |
49 |
50 | {link}
51 |
52 |
53 | ))}
54 |
55 |
56 |
57 | );
58 | };
59 |
60 | export default AuthNavBar;
61 |
--------------------------------------------------------------------------------
/src/components/mini/Buttons.js:
--------------------------------------------------------------------------------
1 | import React, { useState } from 'react';
2 | import { Button } from '@chakra-ui/react';
3 | import Countdown from 'react-countdown';
4 | import moment from 'moment';
5 |
6 | const Buttons = ({ id, name, points, icon, clickHandler, isDisabled, durationTime }) => {
7 | const previousClick = +localStorage.getItem('lastClicked' + name);
8 |
9 | const [timeLeft, setTimeLeft] = useState(Date.now() - previousClick);
10 |
11 |
12 |
13 | // Random component
14 | const Completionist = () => You are good to go!;
15 |
16 | // Renderer callback with condition
17 | const renderer = ({ hours, minutes, seconds, completed }) => {
18 | if (completed) {
19 | // Render a completed state
20 | return {hours}:{minutes}:{seconds};
21 | } else {
22 | // Render a countdown
23 | return {hours}:{minutes}:{seconds};
24 | }
25 | };
26 |
27 | return (
28 |
66 | );
67 | };
68 |
69 | export default Buttons;
70 |
--------------------------------------------------------------------------------
/src/components/mini/Carousel.css:
--------------------------------------------------------------------------------
1 | @import url('https://fonts.googleapis.com/css2?family=Press+Start+2P&display=swap');
2 | .user-container {
3 | display: flex;
4 | flex-direction: row;
5 | justify-content: space-evenly;
6 | align-items: center;
7 | min-width: 650px;
8 | margin-bottom: 1.5rem;
9 | background-color: rgba(135, 131, 131, 0.756);
10 | padding: 15px;
11 | border-radius: 5px;
12 | transition: all 0.2s ease;
13 | border: white;
14 | }
15 |
16 | .user-container:hover {
17 | transform: scale(1.02);
18 | cursor: pointer;
19 | box-shadow: 0 1px 7px 0 rgb(136, 136, 136);
20 | }
21 |
22 | .user-container-title {
23 | font-family: 'Press Start 2P';
24 | font-size: 30px;
25 | color: gold;
26 | text-align: center;
27 | margin-bottom: 20px;
28 | }
29 |
30 | img {
31 | background-size: 200px 200px;
32 | text-align: center;
33 | height: 200px;
34 | width: 200px;
35 | min-height: 200px;
36 | min-width: 200px;
37 | border-radius: 100px;
38 | color: white;
39 | margin-right: 5px;
40 | }
41 |
42 | .user-info {
43 | padding: 0;
44 | margin-top: 20px !important;
45 | }
46 |
47 | .topUserRanking {
48 | font-family: 'Press Start 2P';
49 | font-size: 50px;
50 | color: gold;
51 | padding: 10px;
52 | margin-right: 10px;
53 | text-align: center;
54 | min-width: 300px;
55 | }
56 |
57 | .topUserRanking h4 {
58 | font-size: 15px;
59 | text-align: center;
60 | }
--------------------------------------------------------------------------------
/src/components/mini/Carousel.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import { useMoralisCloudFunction } from 'react-moralis';
3 | import { Flex, Image, Text } from '@chakra-ui/react';
4 |
5 | const Carousel = () => {
6 | const { data } = useMoralisCloudFunction('getUsers');
7 |
8 | return (
9 | <>
10 |
11 |
12 | Top Users
13 |
14 | {data !== null && (
15 | <>
16 | {data.map((user, i) => {
17 | return (
18 |
33 |
41 |
42 | {`#${i + 1}`}
43 |
44 | {user.attributes.username}
45 |
46 | {user.attributes.points.toLocaleString('en-US')} Points
47 |
48 |
49 |
50 |
58 |
59 |
60 | );
61 | })}
62 | >
63 | )}
64 |
65 | >
66 | );
67 | };
68 |
69 | export default Carousel;
70 |
--------------------------------------------------------------------------------
/src/components/mini/GetStarted.css:
--------------------------------------------------------------------------------
1 | .step-number {
2 | background-color: var(--color-basic-3);
3 | border-radius: 8px;
4 | display: flex;
5 | align-items: center;
6 | justify-content: center;
7 | height: var(--space-28);
8 | font-size: var(--font-size-14);
9 | color: var(--color-basic-6);
10 | width: var(--space-28);
11 | }
--------------------------------------------------------------------------------
/src/components/mini/GetStarted.js:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | const GetStarted = () => {
5 | return (
6 |
7 |
1
8 |
Sign In Using Metamask
9 |
10 |
2
11 |
Earn Points Daily By Doing Actions on Your Profile Page
12 |
13 |
3
14 |
Earn Points Daily By Winning Games in the ZIMS Arcade
15 |
16 |
4
17 |
Use Your Points to Mint NFTs
18 |
19 | )
20 |
21 | }
22 |
23 | export default GetStarted;
--------------------------------------------------------------------------------
/src/components/mini/HeroSection.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import { useMoralis } from 'react-moralis';
3 | import { Button, Flex, Text, Box } from '@chakra-ui/react';
4 | import { Link } from 'react-scroll';
5 | import { FaAngleDoubleDown } from 'react-icons/fa';
6 | import Video from '../../assets/videos/bg-video.mp4';
7 |
8 | const HeroSection = () => {
9 | const { authenticate, isAuthenticated, isAuthenticating, logout } = useMoralis();
10 |
11 | return (
12 | <>
13 |
14 |
26 |
27 |
28 |
36 |
44 | ZIMS
45 |
46 |
47 | Play Games · Win Points · Mint NFTs
48 |
49 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 | >
78 | );
79 | };
80 |
81 | export default HeroSection;
82 |
--------------------------------------------------------------------------------
/src/components/mini/HomeInfo.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import { Flex, Text, Image, Button} from '@chakra-ui/react';
3 | import { useMoralis } from 'react-moralis';
4 |
5 |
6 | const HomeInfo = ({ color, title, description, description2, image, row}) => {
7 | const { authenticate, isAuthenticated, isAuthenticating, logout } = useMoralis();
8 |
9 |
10 | return (
11 | <>
12 |
19 |
22 |
28 | {title}
29 |
30 |
31 |
32 |
33 | {description}
38 | {description2 && {description2} }
44 |
45 |
46 | {image && }
47 |
48 | {title === 'Sign Up' &&
49 |
70 | }
71 |
72 |
73 | >
74 | );
75 | };
76 |
77 | export default HomeInfo;
78 |
--------------------------------------------------------------------------------
/src/components/mini/NFTMinter.js:
--------------------------------------------------------------------------------
1 | import React from 'react'
2 | // const { web3 } = useMoralis()
3 | // const web3 = await Moralis.enableWeb3();
4 | // const web3 = await Moralis
5 |
6 | // const contract = new web3.eth.Contract(contractAbi, contractAddress);
7 | // const nft_contract_address = ''
8 |
9 |
10 | const NFTMinter = () => {
11 |
12 | const mintNFT = as
13 |
14 |
15 | return (
16 |
17 |
18 | )
19 | }
20 |
21 | export default NFTMinter
--------------------------------------------------------------------------------
/src/components/mini/Navbar.css:
--------------------------------------------------------------------------------
1 | @import url('https://fonts.googleapis.com/css2?family=Press+Start+2P&display=swap');
2 |
3 | .zims-logo {
4 | font-family: 'Press Start 2P';
5 | font-size: 30px;
6 | color: gold;
7 | }
--------------------------------------------------------------------------------
/src/components/mini/Navbar.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import { useNavigate } from 'react-router-dom';
3 | import { useMoralis } from 'react-moralis';
4 | import { BsPersonFill, BsCaretDownFill } from 'react-icons/bs';
5 | import { HiLogout } from 'react-icons/hi';
6 | import { SiApplearcade } from 'react-icons/si';
7 | import { IoSettings, IoStorefront } from 'react-icons/io5';
8 | import Sidebar from './Sidebar';
9 | import { HamburgerIcon, CloseIcon } from '@chakra-ui/icons';
10 | import {
11 | Box,
12 | Flex,
13 | Text,
14 | IconButton,
15 | Button,
16 | Stack,
17 | Collapse,
18 | useColorMode,
19 | useColorModeValue,
20 | useBreakpointValue,
21 | useDisclosure,
22 | Menu,
23 | MenuList,
24 | MenuButton,
25 | MenuItem,
26 | MenuDivider,
27 | } from '@chakra-ui/react';
28 |
29 | const Navbar = () => {
30 | const { colorMode, toggleColorMode } = useColorMode();
31 | const { isOpen, onToggle, onClose } = useDisclosure();
32 | const { logout } = useMoralis();
33 | const navigate = useNavigate();
34 |
35 | const Logout = () => {
36 | logout();
37 | navigate('/');
38 | };
39 |
40 | const onClick = destination => {
41 | onClose();
42 | navigate('/' + destination);
43 | };
44 |
45 | return (
46 |
47 |
62 |
67 | : }
70 | variant={'ghost'}
71 | aria-label={'Toggle Navigation'}
72 | />
73 |
74 |
75 | {
79 | navigate('/');
80 | }}
81 | >
82 |
87 | ZIMS
88 |
89 |
90 |
98 | navigate('/profile')}>
99 | My Profile
100 |
101 | navigate('/games')}>
102 | Arcade
103 |
104 | navigate('/marketplace')}>
105 | Marketplace
106 |
107 |
108 |
109 |
115 |
126 |
127 |
154 |
155 |
156 |
157 |
158 |
159 |
160 | );
161 | };
162 |
163 | export default Navbar;
164 |
--------------------------------------------------------------------------------
/src/components/mini/NftsBox.js:
--------------------------------------------------------------------------------
1 | import { Box, Flex, Heading, Text, Stack, Image } from '@chakra-ui/react';
2 | import { useMoralis, useMoralisQuery } from 'react-moralis';
3 |
4 |
5 |
6 | const NftsBox = () => {
7 | const { data } = useMoralisQuery('mintedNFTs');
8 | const { user } = useMoralis();
9 |
10 |
11 | return (
12 | <>
13 | {data !== null &&
14 | data
15 | .filter(data => data.attributes.user.id === user.id)
16 | .map((nft, i) => {
17 | return (
18 |
19 |
33 |
56 |
64 |
65 |
66 |
67 | {`NFT #: ${i + 1}`}
68 |
69 |
70 | {nft.attributes.title}
71 |
72 |
73 |
74 | {parseFloat(nft.attributes.initialPrice).toLocaleString('en-US')}{' '}
75 | Points
76 |
77 |
82 | Initial Price
83 |
84 |
85 |
86 |
87 |
88 | );
89 | })}
90 | >
91 | );
92 | };
93 | export default NftsBox;
94 |
--------------------------------------------------------------------------------
/src/components/mini/PointsSummary.js:
--------------------------------------------------------------------------------
1 | import { useMoralis, useMoralisQuery } from "react-moralis";
2 | import Chart from "react-google-charts";
3 | import { useEffect } from 'react';
4 | import moment from 'moment'
5 |
6 |
7 | const PointsSummary = () => {
8 | const { user, Moralis, refetchUserData } = useMoralis();
9 | const PointsSummary = Moralis.Object.extend('PointsSummary');
10 | const pointsSummary = new PointsSummary();
11 | const { data, isLoading } = useMoralisQuery("PointsSummary", query =>
12 | query
13 | .descending('createdAt')
14 | .limit(50));
15 |
16 |
17 |
18 | useEffect(()=>{
19 | pointsSummary.set('points', user.attributes.points)
20 | pointsSummary.set('user', user)
21 | pointsSummary.save()
22 | },[user.attributes.points])
23 |
24 | useEffect(() => {
25 | refetchUserData();
26 | }, [isLoading]);
27 |
28 | return (
29 | Loading Chart
}
34 | data = {
35 | [
36 | ['Time', 'Points'],
37 | ...data.filter(data => (data.attributes.user.id === user.id))
38 | .reverse()
39 | .map((data) => [moment(data.attributes.updatedAt).format('MM/DD h a'), data.attributes.points])
40 | ]
41 | }
42 | options = {
43 | {
44 | title: '',
45 | legend: { position: 'top' },
46 | hAxis: { title: 'Timestamp', titleTextStyle: { color: '#4FD1C5' }, slantedText: true, slantedTextAngle: 80 },
47 | vAxis: { title: 'Points', titleTextStyle: { color: '#4FD1C5' }, minValue: 100000 },
48 | chartArea: { width: '60%', height: '50%' }
49 | }
50 | }
51 | />
52 | )
53 | }
54 |
55 | export default PointsSummary;
--------------------------------------------------------------------------------
/src/components/mini/Sidebar.js:
--------------------------------------------------------------------------------
1 | import React, { useEffect } from 'react';
2 | import { useMoralis } from 'react-moralis';
3 | import { Link } from 'react-router-dom';
4 | import {
5 | Container,
6 | Flex,
7 | Text,
8 | Box,
9 | Heading,
10 | Button,
11 | } from '@chakra-ui/react';
12 | import moment from 'moment';
13 | import { useMoralisCloudFunction } from 'react-moralis';
14 |
15 | const Sidebar = ({ isMobile }) => {
16 | const { user, refetchUserData } = useMoralis();
17 | const { data, isLoading } = useMoralisCloudFunction('getUsers');
18 |
19 | useEffect(() => {
20 | refetchUserData();
21 | }, [isLoading]);
22 |
23 | return (
24 |
36 |
43 |
55 | {!isMobile && (
56 | <>
57 |
58 | Edit Profile
59 |
60 | >
61 | )}
62 |
63 |
64 | {user.attributes.username || 'ZIMUSER'}
65 |
66 |
67 |
68 | Points:
69 |
70 | {data !== null ? user.attributes.points.toLocaleString('en-US') : 0}
71 |
72 |
73 |
74 | Member Since:
75 |
76 | {data !== null
77 | ? moment(user.attributes.createdAt.toString()).format('MM/DD/YYYY')
78 | : moment(Date.now()).format('MM/DD/YYYY')}
79 |
80 |
81 |
82 |
91 |
92 |
93 |
94 | );
95 | };
96 |
97 | export default Sidebar;
98 |
--------------------------------------------------------------------------------
/src/components/pages/Auth.css:
--------------------------------------------------------------------------------
1 | @import url('https://fonts.googleapis.com/css2?family=Press+Start+2P&display=swap');
2 | .zims-logo-main {
3 | font-family: 'Press Start 2P';
4 | transform: skewY(-7deg);
5 | letter-spacing: 14px;
6 | transition: all 0.2s ease;
7 | color: rgb(95, 194, 184);
8 | text-shadow: -10px -10px 0 rgb(189, 223, 219), -10px -10px 0 rgb(189, 223, 219), -3px -3px 0 rgb(189, 223, 219), -4px -4px 0 rgb(189, 223, 219), -5px -5px 0 rgb(189, 223, 219), -6px -6px 0 rgb(189, 223, 219), -7px -7px 0 rgb(189, 223, 219), -8px -8px 0 rgb(189, 223, 219), -30px 20px 40px dimgrey;
9 | }
--------------------------------------------------------------------------------
/src/components/pages/Auth.js:
--------------------------------------------------------------------------------
1 | import React,{ Fragment } from 'react';
2 | import { useMoralis } from 'react-moralis';
3 | import { Button, Link } from '@chakra-ui/react';
4 | import { Element } from 'react-scroll';
5 | // import Video from '../../assets/videos/bg-video.mp4';
6 | import Image1 from '../../assets/images/gettingstarted.png';
7 | import Image2 from '../../assets/images/games.png';
8 | import Image3 from '../../assets/images/mint.png'
9 | import HeroSection from '../mini/HeroSection';
10 | import AuthNavBar from '../mini/AuthNavBar';
11 | import HomeInfo from '../mini/HomeInfo';
12 | import './Auth.css';
13 |
14 | const Auth = () => {
15 | const { authenticate, isAuthenticated, isAuthenticating, logout } = useMoralis();
16 |
17 | return (
18 | <>
19 |
20 |
21 |
22 | Don’t have a Metamask wallet yet?
25 | Get one here.> }
26 | />
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 | >
38 | );
39 | };
40 | export default Auth;
41 |
--------------------------------------------------------------------------------
/src/components/pages/Games.css:
--------------------------------------------------------------------------------
1 | @import url('https://fonts.googleapis.com/css2?family=Press+Start+2P&display=swap');
2 | .chrome {
3 | /* background-image: -webkit-linear-gradient(#378DBC 0%, #B6E8F1 46%, #ffffff 50%, #32120E 54%,rgb(189, 223, 219) 58%, rgb(63, 204, 188)90%, rgb(15, 83, 75) 100%); */
4 | /* -webkit-background-clip: text; */
5 | -webkit-text-fill-color: transparent;
6 | -webkit-text-stroke: 4px #f5f5f5;
7 | font-family: 'Titillium Web', sans-serif;
8 | font-style: italic;
9 | line-height: 1;
10 | }
11 |
12 | .hangman-title {
13 | margin-top: 3rem;
14 | margin-bottom: 2rem;
15 | text-align: center;
16 | font-family: 'Press Start 2P';
17 | transform: skewY(-7deg);
18 | letter-spacing: 4px;
19 | word-spacing: -8px;
20 | transition: all 0.2s ease;
21 | color: rgb(95, 194, 184);
22 | text-shadow: -1px -1px 0 rgb(189, 223, 219), -2px -2px 0 rgb(189, 223, 219), -3px -3px 0 rgb(189, 223, 219), -4px -4px 0 rgb(189, 223, 219), -5px -5px 0 rgb(189, 223, 219), -6px -6px 0 rgb(189, 223, 219), -7px -7px 0 rgb(189, 223, 219), -8px -8px 0 rgb(189, 223, 219), -30px 20px 40px dimgrey
23 | }
24 |
25 | .hangman-title:hover {
26 | transform: skewY(0deg) skewX(7deg) scale(1.1);
27 | }
--------------------------------------------------------------------------------
/src/components/pages/Games.js:
--------------------------------------------------------------------------------
1 | import Sidebar from '../mini/Sidebar';
2 | import { Flex, Text } from '@chakra-ui/react';
3 | import './Games.css'
4 | import { Link } from 'react-router-dom';
5 | import { useMoralis } from 'react-moralis'
6 |
7 | const Games = () => {
8 | const { user, setUserData } = useMoralis()
9 |
10 | function clickHandler(degrade) {
11 | const rename = user.attributes.points - degrade;
12 | setUserData({points:rename})
13 | }
14 |
15 |
16 | return (
17 | <>
18 |
19 |
20 |
24 |
25 |
31 | ARCADE
32 |
33 |
34 |
35 | Click a game below to play. You will need to use some points to play a game.
38 |
39 |
40 | clickHandler(100)}>Hangman
43 |
44 |
45 | Floppy Bird
48 |
49 |
50 | clickHandler(100)}
51 | fontSize={{ sm: '1.8rem', md: '2.5rem' }}
52 | >Brick Breaker
53 |
54 |
55 | clickHandler(100)}
56 | fontSize={{ sm: '1.8rem', md: '2.5rem' }}
57 | >Tetris
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 | >
67 | )
68 |
69 | }
70 |
71 | export default Games;
--------------------------------------------------------------------------------
/src/components/pages/Home.js:
--------------------------------------------------------------------------------
1 | import Carousel from '../mini/Carousel';
2 | import Sidebar from '../mini/Sidebar';
3 | import { Flex } from '@chakra-ui/react';
4 |
5 | const Home = () => {
6 | return (
7 | <>
8 |
9 |
10 | {/* */}
11 |
12 |
13 |
14 |
15 | >
16 | );
17 | };
18 |
19 | export default Home;
20 |
--------------------------------------------------------------------------------
/src/components/pages/Market.css:
--------------------------------------------------------------------------------
1 | @import url('https://fonts.googleapis.com/css2?family=Monoton&display=swap');
2 | .market-container {
3 | display: flex;
4 | flex-direction: row;
5 | }
6 |
7 | .market-right {
8 | border: 2px gold;
9 | color: gold;
10 | display: flex;
11 | flex-direction: column;
12 | justify-content: center;
13 | align-items: center;
14 | position: relative;
15 | }
16 |
17 | .market-title {
18 | -webkit-text-fill-color: transparent;
19 | -webkit-text-stroke: 4px #f5f5f54c;
20 | text-align: center;
21 | font-family: 'Press Start 2P';
22 | font-size: 40px;
23 | letter-spacing: 4px;
24 | word-spacing: -8px;
25 | color: white;
26 | }
27 |
28 | .coming-soon {
29 | display: flex;
30 | flex-direction: column;
31 | align-items: center;
32 | --interval: 1s;
33 | font-family: Monoton;
34 | font-size: 130px;
35 | text-shadow: 0 0 7px #fff, 0 0 10px #fff, 0 0 21px rgb(255, 251, 0), 0 0 42px rgb(255, 251, 0), 0 0 82px rgb(255, 251, 0), 0 0 92px rgb(255, 251, 0), 0 0 102px #0fa, 0 0 151px #0fa;
36 | color: gold;
37 | position: absolute;
38 | top: 50%;
39 | left: 50%;
40 | text-align: center;
41 | }
42 |
43 | .img-fade {
44 | opacity: 0.3;
45 | height: calc(100vh - 8rem);
46 | }
--------------------------------------------------------------------------------
/src/components/pages/Market.js:
--------------------------------------------------------------------------------
1 | import './Market.css';
2 | import Image from '../../assets/images/market.png'
3 | import Sidebar from '../mini/Sidebar';
4 | import {Flex, Text, Box} from '@chakra-ui/react'
5 |
6 | const Market = () => {
7 | return (
8 |
9 |
10 |
11 |
18 |
19 |
Marketplace
20 |
21 |

22 |
23 |
24 | COMING SOON
25 |
26 |
27 |
28 |
29 |
30 | )
31 | }
32 | export default Market;
--------------------------------------------------------------------------------
/src/components/pages/Mint.css:
--------------------------------------------------------------------------------
1 | @import url('https://fonts.googleapis.com/css2?family=Press+Start+2P&display=swap');
2 | .mint-container {
3 | background: radial-gradient(600px at 50% 50%, #fff 20%, #000 100%);
4 | }
5 |
6 | .nft-title {
7 | /* margin-top: 70px; */
8 | /* margin-bottom: 40px; */
9 | text-align: center;
10 | font-family: 'Press Start 2P';
11 | /* font-size: 60px; */
12 | transform: skewY(-7deg);
13 | letter-spacing: 4px;
14 | word-spacing: -8px;
15 | color: rgb(95, 194, 184);
16 | text-shadow: -1px -1px 0 rgb(189, 223, 219), -2px -2px 0 rgb(189, 223, 219), -3px -3px 0 rgb(189, 223, 219), -4px -4px 0 rgb(189, 223, 219), -5px -5px 0 rgb(189, 223, 219), -6px -6px 0 rgb(189, 223, 219), -7px -7px 0 rgb(189, 223, 219), -8px -8px 0 rgb(189, 223, 219), -30px 20px 40px dimgrey
17 | }
--------------------------------------------------------------------------------
/src/components/pages/Mint.js:
--------------------------------------------------------------------------------
1 | import {
2 | Box,
3 | Text,
4 | Stack,
5 | Button,
6 | Image,
7 | Flex,
8 | SimpleGrid,
9 | useToast,
10 | Heading
11 | } from '@chakra-ui/react';
12 |
13 | import './Mint.css';
14 | import Sidebar from '../mini/Sidebar';
15 | import axios from 'axios';
16 | import { useState, useEffect } from 'react';
17 | import {
18 | useMoralis,
19 | } from 'react-moralis';
20 | import contractAbi from '../../abis/ZimCollectables';
21 |
22 | const Mint = () => {
23 | const [NFTs, setNFTs] = useState([]);
24 | const [NFTsFetched, setNFTsFetched] = useState(false);
25 | const { user, Moralis, enableWeb3, setUserData } = useMoralis();
26 | const contractAddress = '0x56F105b7cdC3A0177cf79b2f67C8BA9f6BadE97f'; //zim coll address ganache
27 |
28 | const [newPoints, setNewPoints] = useState(user.attributes.points);
29 |
30 | const MintedNFTs = Moralis.Object.extend('mintedNFTs');
31 | const minted = new MintedNFTs();
32 | const toast = useToast()
33 |
34 | async function ItemNFT(nft) {
35 | minted.set('photo', nft.photo);
36 | minted.set('title', nft.title);
37 | minted.set('initialPrice', nft.price);
38 | minted.set('category', nft.category);
39 | minted.set('user', user);
40 | minted.set('username', user.attributes.username);
41 | await minted.save();
42 | }
43 |
44 | async function getAll() {
45 | const resultAPI = await axios.get('https://zims-nft-api.herokuapp.com/');
46 | setNFTs(resultAPI.data);
47 | setNFTsFetched(true);
48 | }
49 |
50 | useEffect(() => {
51 | enableWeb3();
52 |
53 | }, []);
54 |
55 |
56 | useEffect(() => {
57 | getAll();
58 | }, []);
59 |
60 | useEffect(() => {
61 | setUserData({ points: newPoints });
62 | }, [newPoints]);
63 |
64 |
65 |
66 | const abi = [
67 | {
68 | inputs: [
69 | {
70 | internalType: 'address',
71 | name: 'to',
72 | type: 'address',
73 | },
74 | {
75 | internalType: 'string',
76 | name: 'uri',
77 | type: 'string',
78 | },
79 | ],
80 | name: 'mintToken',
81 | outputs: [
82 | {
83 | internalType: 'uint256',
84 | name: '',
85 | type: 'uint256',
86 | },
87 | ],
88 | stateMutability: 'nonpayable',
89 | type: 'function',
90 | },
91 | ];
92 |
93 |
94 |
95 | const MintNFT = async nft => {
96 | const options = {
97 | contractAddress: contractAddress,
98 | functionName: 'mintToken',
99 | abi: abi,
100 | params: {
101 | to: user.attributes.ethAddress,
102 | uri: JSON.stringify(nft),
103 | },
104 | };
105 | const receipt = await Moralis.executeFunction(options);
106 | const nftPoints = nft.price;
107 | ItemNFT(nft);
108 | setNewPoints(prev => prev - parseInt(nftPoints));
109 | toast({
110 | title: 'You successfully minted tour NFT',
111 | description: "Transaction hash: " + receipt.events[0].transactionHash ,
112 | status: 'success',
113 | duration: 9000,
114 | isClosable: true,});
115 | };
116 |
117 |
118 |
119 | return (
120 | <>
121 |
122 |
123 |
130 |
131 |
137 | Mint New NFTs
138 |
139 |
140 | {NFTsFetched &&
141 | NFTs.sort((a, b) => parseInt(a.price) - parseInt(b.price)).map(nft => {
142 | return (
143 | <>
144 |
152 |
174 |
182 |
183 |
184 |
189 | NFT# {nft.id}
190 |
191 |
192 | {nft.title}
193 |
194 |
195 |
196 | {`${parseFloat(nft.price).toLocaleString('en-US')} Points`}
197 |
198 |
199 |
200 |
212 |
213 |
214 |
215 | >
216 | );
217 | })}
218 |
219 |
220 |
221 |
222 | >
223 | );
224 | };
225 |
226 | export default Mint;
227 |
--------------------------------------------------------------------------------
/src/components/pages/Profile.css:
--------------------------------------------------------------------------------
1 | @import url('https://fonts.googleapis.com/css2?family=Press+Start+2P&display=swap');
2 | .button-id {
3 | font-family: 'Press Start 2P';
4 | box-shadow: 0 1px 7px 0 rgb(136, 136, 136);
5 | background: #4fd1c5;
6 | background: linear-gradient( 90deg, rgba(129, 230, 217, 1) 0%, rgba(79, 209, 197, 1) 100%);
7 | border: none;
8 | border-radius: 1200px;
9 | box-shadow: 12px 12px 24px rgba(79, 209, 197, 0.64);
10 | transition: all 0.3s ease-in-out 0s;
11 | cursor: pointer;
12 | outline: none;
13 | position: relative;
14 | padding: 15px;
15 | margin-bottom: 10px;
16 | text-align: center;
17 | aspect-ratio: 2/1;
18 | }
19 |
20 | .nft-box {
21 | overflow-x: scroll;
22 | padding: 3rem;
23 | }
24 |
25 | .nft-box::-webkit-scrollbar {
26 | background-color: none;
27 | height: 7px;
28 | transform: translateY(-10px);
29 | }
30 |
31 | .nft-box::-webkit-scrollbar-thumb {
32 | background-color: #4fd1c5;
33 | border-radius: 100px;
34 | }
--------------------------------------------------------------------------------
/src/components/pages/Profile.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import { Grid, GridItem } from '@chakra-ui/react';
3 | import Sidebar from '../mini/Sidebar';
4 |
5 | import 'font-awesome/css/font-awesome.min.css';
6 | import PointsSummary from '../mini/PointsSummary';
7 | import NftsBox from '../mini/NftsBox';
8 | import Actions from '../mini/Actions';
9 |
10 | import {
11 | Center,
12 | Text,
13 | Stack,
14 | Flex,
15 | } from '@chakra-ui/react';
16 |
17 | const Profile = () => {
18 |
19 | return (
20 | <>
21 |
22 |
23 |
29 |
30 |
36 |
37 |
38 | NFTs Owned
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 | Actions to Get Points
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 | Points Summary
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 | >
69 | );
70 | };
71 |
72 | export default Profile;
73 |
--------------------------------------------------------------------------------
/src/components/pages/Settings.js:
--------------------------------------------------------------------------------
1 | import React, { useState } from 'react';
2 | import { useForm } from 'react-hook-form';
3 | import { useMoralis } from 'react-moralis';
4 | import FileBase64 from 'react-file-base64';
5 | import {
6 | Flex,
7 | VStack,
8 | FormControl,
9 | Heading,
10 | FormLabel,
11 | Button,
12 | Input,
13 | useToast,
14 | } from '@chakra-ui/react';
15 |
16 | const Settings = () => {
17 | const { handleSubmit, register, reset } = useForm();
18 | const { setUserData } = useMoralis();
19 | const [displayPicture, setDisplayPicture] = useState('');
20 |
21 | const toastSuccess = useToast({
22 | title: 'Submitted!',
23 | status: 'success',
24 | duration: 3000,
25 | isClosable: true,
26 | });
27 |
28 | const onSubmit = data => {
29 | setUserData({
30 | username: data.username,
31 | email: data.email,
32 | });
33 | reset();
34 | toastSuccess();
35 | };
36 |
37 | const onSubmitPhoto = e => {
38 | e.preventDefault();
39 | setUserData({
40 | displayPicture: displayPicture,
41 | });
42 | toastSuccess();
43 | };
44 |
45 | return (
46 | <>
47 |
48 |
49 | Profile Settings
50 |
79 |
80 |
81 |
82 |
83 |
84 |
103 |
104 |
105 |
106 | >
107 | );
108 | };
109 |
110 | export default Settings;
111 |
--------------------------------------------------------------------------------
/src/contracts/Migrations.sol:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: MIT
2 | pragma solidity >=0.4.22 <0.9.0;
3 |
4 | contract Migrations {
5 | address public owner = msg.sender;
6 | uint public last_completed_migration;
7 |
8 | modifier restricted() {
9 | require(
10 | msg.sender == owner,
11 | "This function is restricted to the contract's owner"
12 | );
13 | _;
14 | }
15 |
16 | function setCompleted(uint completed) public restricted {
17 | last_completed_migration = completed;
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/src/contracts/Zim.sol:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: MIT
2 | pragma solidity >=0.8.10 <0.9.0;
3 |
4 | import "../../node_modules/@openzeppelin/contracts/token/ERC721/ERC721.sol";
5 |
6 | // import "github.com/openzeppelin/contracts/token/ERC721/ERC721Full.sol";
7 |
8 | contract Zim is ERC721 {
9 | constructor() ERC721("Zim", "ZIM") {
10 | }
11 | }
--------------------------------------------------------------------------------
/src/contracts/ZimCollectables.sol:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: MIT
2 | pragma solidity >=0.8.10 <0.9.0;
3 |
4 | import "../../node_modules/@openzeppelin/contracts/token/ERC721/ERC721.sol";
5 | import "../../node_modules/@openzeppelin/contracts/token/ERC721/extensions/ERC721URIStorage.sol";
6 | import "../../node_modules/@openzeppelin/contracts/access/Ownable.sol";
7 | import "../../node_modules/@openzeppelin/contracts/utils/Counters.sol";
8 |
9 | contract ZimCollectables is ERC721, ERC721URIStorage, Ownable {
10 | using Counters for Counters.Counter;
11 | Counters.Counter private _tokenIdCounter;
12 |
13 | constructor() ERC721("ZimCollectables", "ZCOL") {}
14 | function mintToken(address to, string memory uri) public {
15 | uint256 tokenId = _tokenIdCounter.current();
16 | _tokenIdCounter.increment();
17 | _safeMint(to, tokenId);
18 | _setTokenURI(tokenId, uri);
19 | }
20 | function _burn(uint256 tokenId) internal override(ERC721, ERC721URIStorage) {
21 | super._burn(tokenId);
22 | }
23 | function tokenURI(uint256 tokenId)
24 | public
25 | view
26 | override(ERC721, ERC721URIStorage)
27 | returns (string memory)
28 | {
29 | return super.tokenURI(tokenId);
30 | }
31 | }
32 |
33 |
34 |
35 | //ayaan code from slack
36 | // contract ZimCollectables is ERC721URIStorage {
37 | // using Counters for Counters.Counter;
38 | // Counters.Counter private _tokenIds;
39 | // constructor() ERC721("ZimCollectables", "ZCOL") {}
40 |
41 | // struct Item {
42 | // uint256 id;
43 | // address creator;
44 | // string uri;
45 | // }
46 |
47 | // mapping (uint256 => Item) public Items;
48 |
49 | // function mintToken(string memory uri) public returns (uint256) {
50 | // _tokenIds.increment();
51 | // uint256 newItemId = _tokenIds.current();
52 | // _safeMint(msg.sender, newItemId);
53 | // Items[newItemId] = Item(newItemId, msg.sender,uri);
54 | // return newItemId;
55 | // }
56 | // function tokenURI(uint256 tokenId) public view override returns (string memory){
57 | // require(_exists(tokenId), "ERC721Metadata: URI query for nonexistent token");
58 | // return Items[tokenId].uri;
59 | // }
60 | // }
61 |
62 | /* NEW CONTRACT */
63 |
64 | // import '@openzeppelin/contracts/token/ERC721/ERC721.sol';
65 | // import '@openzeppelin/contracts/token/ERC721/extensions/ERC721URIStorage.sol';
66 | // import '@openzeppelin/contracts/utils/Counters.sol';
67 | // import '@openzeppelin/contracts/access/Ownable.sol';
68 |
69 | // contract ZimCollectables is ERC721URIStorage {
70 | // using Counters for Counters.Counter;
71 | // Counters.Counter private _tokenIds;
72 |
73 | // constructor() ERC721('ZimCollectables', 'ZCOL') {}
74 |
75 | // function mintToken(address recipient, string memory tokenURI) public returns (uint256) {
76 | // _tokenIds.increment();
77 | // uint256 newItemId = _tokenIds.current();
78 | // _safeMint(recipient, newItemId);
79 | // _setTokenURI(newItemId, tokenURI);
80 | // return newItemId;
81 | // }
82 | // }
83 | /* NEW CONTRACT */
84 |
85 | // pragma solidity ^0.8.0;
86 |
87 | // import '@openzeppelin/contracts/token/ERC721/extensions/ERC721Enumerable.sol';
88 | // import '@openzeppelin/contracts/token/ERC20/IERC20.sol';
89 | // import '@openzeppelin/contracts/access/Ownable.sol';
90 |
91 | // contract CoinracerNFT is ERC721Enumerable, Ownable {
92 | // uint256 public ZCOL;
93 | //uint256 private minBNB;
94 | //uint256 private minCRACE;
95 | //uint256 public mintSupply;
96 | //uint256 maxMintSupply = 5000;
97 | // mapping(uint256 => string) public _data;
98 | // mapping(address => uint256) private _mintAmount;
99 |
100 | //IERC20 crace;
101 |
102 | // constructor(IERC721 zcol)
103 | // ERC721('ZimCollectables', 'ZCOL')
104 | // //uint256 _minBNB,
105 | // //uint256 _minCRACE
106 | // {
107 | // ZCOL = 0;
108 | // //crace = _crace;
109 | // //minBNB = _minBNB;
110 | // //minCRACE = _minCRACE;
111 | // }
112 |
113 | // function updateMinBNB(uint256 _minBNB) external onlyOwner {
114 | // minBNB = _minBNB;
115 | // }
116 |
117 | // function updateMinCRACE(uint256 _minCRACE) external onlyOwner {
118 | // minCRACE = _minCRACE;
119 | // }
120 |
121 | //function mint(
122 | //uint256 amount,
123 | //uint256 craceValue,
124 | //string[] memory data
125 | //) external payable {
126 | //require(amount > 0 && _mintAmount[msg.sender] + amount <= 5, 'NFT amount');
127 | //require(mintSupply + amount <= maxMintSupply, 'Mint Supply');
128 | //require(msg.value >= minBNB * amount, 'Under BNB limit');
129 | //require(craceValue >= minCRACE * amount, 'Under CRACE limit');
130 |
131 | // crace.transferFrom(msg.sender, address(this), craceValue);
132 | // _mintAmount[msg.sender] += amount;
133 | // mintSupply += amount;
134 |
135 | // for (uint256 i = 0; i < amount; i = i + 1) {
136 | // ZCOL = ZCOL + 1;
137 | // _safeMint(msg.sender, ZCOL);
138 | // _data[ZCOL] = data[i];
139 | // }
140 | // }
141 |
142 | // function mintZCol(address addr, string memory data) public {
143 | // ZCOL = ZCOL + 1;
144 | // _safeMint(addr, ZCOL);
145 | // _data[ZCOL] = data;
146 | // }
147 |
148 | // function mintByOwner(address addr, string memory data) external onlyOwner {
149 | // ZCOL = ZCOL + 1;
150 | // _safeMint(addr, ZCOL);
151 | // _data[ZCOL] = data;
152 | // }
153 |
154 | // function tokenURI(uint256 tokenId) public view override returns (string memory) {
155 | // require(_exists(tokenId), 'ERC721Metadata: URI query for nonexistent token');
156 | // return _data[tokenId];
157 | // }
158 | // }
159 |
--------------------------------------------------------------------------------
/src/index.css:
--------------------------------------------------------------------------------
1 | * {
2 | margin: 0;
3 | padding: 0;
4 | box-sizing: border-box;
5 | }
6 |
--------------------------------------------------------------------------------
/src/index.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import ReactDOM from 'react-dom';
3 | import './index.css';
4 | import App from './components/App';
5 | import { MoralisProvider } from 'react-moralis';
6 | import { ChakraProvider } from '@chakra-ui/react';
7 | import '../node_modules/font-awesome/css/font-awesome.min.css';
8 |
9 | import { store } from './redux/store';
10 | import { Provider } from 'react-redux';
11 | import { persistStore } from 'redux-persist';
12 | import { PersistGate } from 'redux-persist/integration/react';
13 |
14 | // const APP_ID = process.env.REACT_APP_MORALIS_APP_ID;
15 | // const SERVER_URL = process.env.REACT_APP_MORALIS_SERVER_URL;
16 | const APP_ID = 'ALj9gFe5KG5PcYPv1Q6u2Roj2aeB4jIBVuYrvW83';
17 | const SERVER_URL = 'https://dfbdma3eilm1.usemoralis.com:2053/server';
18 |
19 | let persistor = persistStore(store);
20 |
21 | ReactDOM.render(
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 | ,
33 | document.getElementById('root')
34 | );
35 |
--------------------------------------------------------------------------------
/src/redux/buttons/buttons.js:
--------------------------------------------------------------------------------
1 | import { createSlice } from '@reduxjs/toolkit';
2 |
3 | const initialState = {
4 | work: false,
5 | workout: false,
6 | meditate: false,
7 | volunteer: false,
8 | party: false,
9 | shower: false,
10 | };
11 |
12 | export const buttonSlice = createSlice({
13 | name: 'button',
14 | initialState,
15 | reducers: {
16 | enable: (state, type) => {
17 | state[type.payload] = false;
18 | },
19 | disable: (state, type) => {
20 | state[type.payload] = true;
21 | },
22 | },
23 | });
24 |
25 | export const { enable, disable } = buttonSlice.actions;
26 | export default buttonSlice.reducer;
27 |
--------------------------------------------------------------------------------
/src/redux/store.js:
--------------------------------------------------------------------------------
1 | import { configureStore } from '@reduxjs/toolkit';
2 | import buttonReducer from './buttons/buttons';
3 | import { persistReducer } from 'redux-persist';
4 | import storage from 'redux-persist/lib/storage';
5 |
6 | const persistConfig = {
7 | key: 'root',
8 | storage,
9 | };
10 |
11 | const persistedReducer = persistReducer(persistConfig, buttonReducer);
12 |
13 | export const store = configureStore({
14 | reducer: {
15 | button: persistedReducer,
16 | },
17 | });
18 |
--------------------------------------------------------------------------------
/src/theme.js:
--------------------------------------------------------------------------------
1 | import { extendTheme } from '@chakra-ui/react';
2 |
3 | const theme = extendTheme({
4 | initialColorMode: 'dark',
5 | useSystemColorMode: false,
6 | });
7 |
8 | export default theme;
--------------------------------------------------------------------------------
/techstack.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ehp2021/zims/a6a1bc0e3fa3eda7d1a3930244b7ca76c8a4c9b0/techstack.png
--------------------------------------------------------------------------------
/test/.gitkeep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ehp2021/zims/a6a1bc0e3fa3eda7d1a3930244b7ca76c8a4c9b0/test/.gitkeep
--------------------------------------------------------------------------------
/truffle-config.js:
--------------------------------------------------------------------------------
1 | /**
2 | * Use this file to configure your truffle project. It's seeded with some
3 | * common settings for different networks and features like migrations,
4 | * compilation and testing. Uncomment the ones you need or modify
5 | * them to suit your project as necessary.
6 | *
7 | * More information about configuration can be found at:
8 | *
9 | * trufflesuite.com/docs/advanced/configuration
10 | *
11 | * To deploy via Infura you'll need a wallet provider (like @truffle/hdwallet-provider)
12 | * to sign your transactions before they're sent to a remote public node. Infura accounts
13 | * are available for free at: infura.io/register.
14 | *
15 | * You'll also need a mnemonic - the twelve word phrase the wallet uses to generate
16 | * public/private key pairs. If you're publishing your code to GitHub make sure you load this
17 | * phrase from a file you've .gitignored so it doesn't accidentally become public.
18 | *
19 | */
20 |
21 | // const HDWalletProvider = require('@truffle/hdwallet-provider');
22 | //
23 | // const fs = require('fs');
24 | // const mnemonic = fs.readFileSync(".secret").toString().trim();
25 |
26 | module.exports = {
27 | /**
28 | * Networks define how you connect to your ethereum client and let you set the
29 | * defaults web3 uses to send transactions. If you don't specify one truffle
30 | * will spin up a development blockchain for you on port 9545 when you
31 | * run `develop` or `test`. You can ask a truffle command to use a specific
32 | * network from the command line, e.g
33 | *
34 | * $ truffle test --network
35 | */
36 |
37 | networks: {
38 | // Useful for testing. The `development` name is special - truffle uses it by default
39 | // if it's defined here and no other network is specified at the command line.
40 | // You should run a client (like ganache-cli, geth or parity) in a separate terminal
41 | // tab if you use this network and you must also set the `host`, `port` and `network_id`
42 | // options below to some value.
43 | //
44 | development: {
45 | host: '127.0.0.1', // Localhost (default: none)
46 | port: 7545, // Standard Ethereum port (default: none)
47 | network_id: '*', // Any network (default: none)
48 | },
49 | // Another network with more advanced options...
50 | // advanced: {
51 | // port: 8777, // Custom port
52 | // network_id: 1342, // Custom network
53 | // gas: 8500000, // Gas sent with each transaction (default: ~6700000)
54 | // gasPrice: 20000000000, // 20 gwei (in wei) (default: 100 gwei)
55 | // from: , // Account to send txs from (default: accounts[0])
56 | // websocket: true // Enable EventEmitter interface for web3 (default: false)
57 | // },
58 | // Useful for deploying to a public network.
59 | // NB: It's important to wrap the provider as a function.
60 | // ropsten: {
61 | // provider: () => new HDWalletProvider(mnemonic, `https://ropsten.infura.io/v3/YOUR-PROJECT-ID`),
62 | // network_id: 3, // Ropsten's id
63 | // gas: 5500000, // Ropsten has a lower block limit than mainnet
64 | // confirmations: 2, // # of confs to wait between deployments. (default: 0)
65 | // timeoutBlocks: 200, // # of blocks before a deployment times out (minimum/default: 50)
66 | // skipDryRun: true // Skip dry run before migrations? (default: false for public nets )
67 | // },
68 | // Useful for private networks
69 | // private: {
70 | // provider: () => new HDWalletProvider(mnemonic, `https://network.io`),
71 | // network_id: 2111, // This network is yours, in the cloud.
72 | // production: true // Treats this network as if it was a public net. (default: false)
73 | // }
74 | },
75 |
76 | contracts_directory: './src/contracts/',
77 | contracts_build_directory: './src/abis/',
78 | // Set default mocha options here, use special reporters etc.
79 | mocha: {
80 | // timeout: 100000
81 | },
82 |
83 | // Configure your compilers
84 | compilers: {
85 | solc: {
86 | version: '0.8.10', // Fetch exact version from solc-bin (default: truffle's version)
87 | // docker: true, // Use "0.5.1" you've installed locally with docker (default: false)
88 | // settings: { // See the solidity docs for advice about optimization and evmVersion
89 | optimizer: {
90 | enabled: false,
91 | runs: 200,
92 | },
93 | // evmVersion: "byzantium"
94 | // }
95 | },
96 | },
97 |
98 | // Truffle DB is currently disabled by default; to enable it, change enabled:
99 | // false to enabled: true. The default storage location can also be
100 | // overridden by specifying the adapter settings, as shown in the commented code below.
101 | //
102 | // NOTE: It is not possible to migrate your contracts to truffle DB and you should
103 | // make a backup of your artifacts to a safe location before enabling this feature.
104 | //
105 | // After you backed up your artifacts you can utilize db by running migrate as follows:
106 | // $ truffle migrate --reset --compile-all
107 | //
108 | // db: {
109 | // enabled: false,
110 | // host: "127.0.0.1",
111 | // adapter: {
112 | // name: "sqlite",
113 | // settings: {
114 | // directory: ".db"
115 | // }
116 | // }
117 | // }
118 | };
119 |
--------------------------------------------------------------------------------
/yt.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ehp2021/zims/a6a1bc0e3fa3eda7d1a3930244b7ca76c8a4c9b0/yt.png
--------------------------------------------------------------------------------