├── projects
├── .keep
├── CryptoKitties
│ ├── docs
│ │ └── .keep
│ └── README.md
└── dAes
│ ├── contest1
│ ├── src
│ │ ├── components
│ │ │ ├── App1.css
│ │ │ ├── App1.js
│ │ │ ├── show.css
│ │ │ └── show.js
│ │ ├── 提示.png
│ │ ├── backgrounf.png
│ │ ├── setupTests.js
│ │ ├── App.test.js
│ │ ├── index.css
│ │ ├── reportWebVitals.js
│ │ ├── index.js
│ │ ├── App.css
│ │ ├── App.js
│ │ ├── logo.svg
│ │ └── abi
│ │ │ └── index.js
│ ├── public
│ │ ├── robots.txt
│ │ ├── favicon.ico
│ │ ├── logo192.png
│ │ ├── logo512.png
│ │ ├── manifest.json
│ │ └── index.html
│ ├── .gitignore
│ ├── package.json
│ └── README.md
│ ├── .gitignore
│ ├── Introduce.md
│ ├── dAes
│ ├── hardhat.config.js
│ ├── scripts
│ │ └── deploy.js
│ ├── package.json
│ ├── contracts
│ │ ├── extensions
│ │ │ ├── ICanvas.sol
│ │ │ └── IERC721ExMetadata.sol
│ │ └── Canvas.sol
│ ├── test
│ │ └── Canvas.js
│ └── tasks
│ │ └── faucet.js
│ └── README.md
├── .gitignore
├── README.md
└── LICENSE
/projects/.keep:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/projects/CryptoKitties/docs/.keep:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/projects/dAes/contest1/src/components/App1.css:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | /.vscode/
2 | .DS_Store
3 | yarn.lock
4 |
--------------------------------------------------------------------------------
/projects/dAes/.gitignore:
--------------------------------------------------------------------------------
1 | **/node_modules/
2 | **/cache/
3 | **/artifacts/
--------------------------------------------------------------------------------
/projects/dAes/contest1/public/robots.txt:
--------------------------------------------------------------------------------
1 | # https://www.robotstxt.org/robotstxt.html
2 | User-agent: *
3 | Disallow:
4 |
--------------------------------------------------------------------------------
/projects/dAes/contest1/src/提示.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lite/2021Q2-hackathon/main/projects/dAes/contest1/src/提示.png
--------------------------------------------------------------------------------
/projects/dAes/contest1/public/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lite/2021Q2-hackathon/main/projects/dAes/contest1/public/favicon.ico
--------------------------------------------------------------------------------
/projects/dAes/contest1/public/logo192.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lite/2021Q2-hackathon/main/projects/dAes/contest1/public/logo192.png
--------------------------------------------------------------------------------
/projects/dAes/contest1/public/logo512.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lite/2021Q2-hackathon/main/projects/dAes/contest1/public/logo512.png
--------------------------------------------------------------------------------
/projects/dAes/contest1/src/backgrounf.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lite/2021Q2-hackathon/main/projects/dAes/contest1/src/backgrounf.png
--------------------------------------------------------------------------------
/projects/dAes/contest1/src/setupTests.js:
--------------------------------------------------------------------------------
1 | // jest-dom adds custom jest matchers for asserting on DOM nodes.
2 | // allows you to do things like:
3 | // expect(element).toHaveTextContent(/react/i)
4 | // learn more: https://github.com/testing-library/jest-dom
5 | import '@testing-library/jest-dom';
6 |
--------------------------------------------------------------------------------
/projects/dAes/contest1/src/App.test.js:
--------------------------------------------------------------------------------
1 | import { render, screen } from '@testing-library/react';
2 | import App from './App';
3 |
4 | test('renders learn react link', () => {
5 | render(
120 |
121 |
122 | ## 过往信息
123 | [报名文章](https://mp.weixin.qq.com/s/-DeOn_mElWTK0p3jcKI7ww)
124 | [进展汇报一](https://mp.weixin.qq.com/s/5_4uGEvtfvxqqTBrUQD9og)
125 | [进展汇报二](https://mp.weixin.qq.com/s/QItthGYHAEKEYkWiAmo1MA)
126 | [参赛手册](https://mp.weixin.qq.com/s/ZWcd2LQm_PBwvOFuevpdIw)
127 |
128 |
--------------------------------------------------------------------------------
/projects/dAes/contest1/src/components/show.css:
--------------------------------------------------------------------------------
1 |
2 | .board-row{
3 | display: flex;
4 | flex-direction: row;
5 | }
6 | .center{
7 | width:calc(60vw + 147px);
8 | height:600px;
9 | margin:20px 0px 0px 50px;
10 | background-color: #8c7c64;
11 | border-radius: 10px;
12 | padding:20px;
13 | background-image: radial-gradient(#a39277 2px,transparent 0),radial-gradient(#a39277 2px,transparent 0);
14 | background-position: 0 0,50px 50px;
15 | background-size: 20px 20px;
16 | background-repeat: repeat;
17 | box-shadow: 0 10px 20px rgba(0,0,0,.2);
18 |
19 | }
20 | .center::before{
21 | position: absolute;
22 | content: 'Welcome To Pixel';
23 | width:300px;
24 | height: 50px;
25 | background-color: #f7f4e6;
26 | left: 100px;
27 | top:-30px;
28 | border-radius: 5px 5px 0 0;
29 | font-size: 25px;
30 | font-weight: 800;
31 | line-height: 50px;
32 | color:#503c35;
33 | }
34 | .box{
35 | min-width:calc(60vw / 36) ;
36 | min-height:calc(60vw / 36);
37 | margin-right:2px;
38 | margin-bottom: 2px;
39 | background-color: rgb(127, 255, 212);
40 | border:solid 1px
41 | }
42 | .box:hover{
43 | border:solid 1px #feab88!important;
44 | cursor: pointer;
45 | }
46 |
47 |
48 | .text{
49 | font-size: 20px;
50 | font-weight: 600;
51 | }
52 | .value{
53 | font-size: 20px;
54 | font-weight: 800;
55 | }
56 | .right{
57 | margin-top:40px;
58 | margin-left:40px;
59 | background-color:#ffcad2;
60 | width:210px;
61 | height: 210px;
62 | padding:15px;
63 | box-sizing: border-box;
64 | border-radius: 23px;
65 | box-shadow: 0 10px 20px rgba(0,0,0,.2);
66 | }
67 | .Board{
68 | position: relative;
69 | height:100%;
70 | width:100%;
71 | display: flex;
72 | z-index: 10;
73 |
74 | }
75 |
76 |
77 | .flex-row{
78 | display: flex;
79 | flex-direction: row;
80 | justify-content: center;
81 | margin-bottom: 15px;
82 | color:#cdeddf;
83 | font-weight: 800;
84 | font-size: 22px;
85 |
86 | }
87 | .btn{
88 | /*background-image: linear-gradient(180deg, #6536FB 0%, rgba(109,72,226,0.27) 100%);*/
89 | border :5px solid #cdeddf;
90 |
91 | border-radius: 30px;
92 | width:100px;
93 | height:30px;
94 | font-size: 16px;
95 | line-height: 30px;
96 | color:#cdeddf;
97 | font-weight: 600;
98 |
99 |
100 |
101 | }
102 | .btn ,.btn1:hover{
103 | cursor: pointer;
104 | }
105 | .flex-row12{
106 |
107 | display: flex;
108 | flex-direction: row;
109 | justify-content: space-between;
110 | width:240px;
111 | margin:0 auto;
112 | }
113 |
114 | .dialog{
115 | z-index: 5;
116 | height:178px;
117 | position:absolute;
118 | width: 288px;
119 | top:350px;
120 |
121 | right:25px;
122 | background-color:#00d2c2;
123 | border-radius: 30px;
124 |
125 | font-size: 16px;
126 | color: #FFFFFF;
127 | line-height: 16px;
128 | display: flex;
129 | flex-direction:column;
130 | justify-content: center;
131 | box-shadow: 0 10px 20px rgba(0,0,0,.2);
132 |
133 |
134 | }
135 | .dialog::after{
136 | position:absolute;
137 | content:'';
138 | height:50px;
139 | width: 25px;
140 | background-color: #8c7c64;
141 | border-radius: 5px;
142 | top: -10px;
143 | transform: rotate(-45deg);
144 | background-image: radial-gradient(#a39277 2px,transparent 0),radial-gradient(#a39277 2px,transparent 0);
145 | background-size: 20px 20px;
146 | background-repeat: repeat;
147 |
148 |
149 | }
150 | .dialog::before{
151 | position:absolute;
152 | content:'';
153 | height:50px;
154 | width: 25px;
155 | background-color: #8c7c64;
156 | border-radius: 5px;
157 | top: -10px;
158 | right:0;
159 | transform: rotate(45deg);
160 | background-image: radial-gradient(#a39277 2px,transparent 0),radial-gradient(#a39277 2px,transparent 0);
161 | background-size: 20px 20px;
162 | background-repeat: repeat;
163 | box-shadow: 0 10px 20px rgba(0,0,0,.2);
164 |
165 |
166 | }
167 | .btn1{
168 |
169 |
170 | border-radius: 5px;
171 | width:calc(100% - 100px);
172 | height:30px;
173 | font-size: 16px;
174 | line-height: 30px;
175 | background: #8c7c64;
176 | background-image: url('../backgrounf.png');
177 | background-size: cover;
178 | margin:0 auto;
179 | margin-top:10px;
180 | position: absolute;
181 | bottom:-10px;
182 | right: 30px;
183 | font-weight: 800;
184 | color:#f7f4e6;
185 | background-image: radial-gradient(#a39277 2px,transparent 0),radial-gradient(#a39277 2px,transparent 0);
186 | background-size: 20px 20px;
187 | background-repeat: repeat;
188 | box-shadow: 0 10px 20px rgba(0,0,0,.2);
189 |
190 |
191 | }
192 |
193 | .btn1:hover::after{
194 | position: absolute;
195 | left: -10px;
196 | top: 50px;
197 | padding: 5px;
198 | background-color: #b4bdfd;
199 | border-radius: 15px;
200 | color: #fff;
201 | height:100px;
202 | width:200px;
203 | color:#4d3d36;
204 | font-size: 15px;
205 | font-weight: 800;
206 | padding:20px;
207 | line-height: 30px;
208 |
209 |
210 |
211 | content: attr(title);
212 | box-shadow: 0 10px 20px rgba(0,0,0,.2);
213 |
214 |
215 | }
216 |
217 | .btn1:hover::before{
218 | position: absolute;
219 |
220 |
221 | background-color: #f7f4e5;
222 | background-image: url('../提示.png');
223 | background-size:28px 28px ;
224 | background-repeat: no-repeat;
225 | content: '';
226 | box-shadow: 0 10px 20px rgba(0,0,0,.2);
227 | height: 30px;
228 | width: 30px;
229 | left:-15px;
230 | top: 40px;
231 | border-radius: 15px;
232 | z-index:4;
233 |
234 | }
235 |
236 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | Creative Commons Legal Code
2 |
3 | CC0 1.0 Universal
4 |
5 | CREATIVE COMMONS CORPORATION IS NOT A LAW FIRM AND DOES NOT PROVIDE
6 | LEGAL SERVICES. DISTRIBUTION OF THIS DOCUMENT DOES NOT CREATE AN
7 | ATTORNEY-CLIENT RELATIONSHIP. CREATIVE COMMONS PROVIDES THIS
8 | INFORMATION ON AN "AS-IS" BASIS. CREATIVE COMMONS MAKES NO WARRANTIES
9 | REGARDING THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS
10 | PROVIDED HEREUNDER, AND DISCLAIMS LIABILITY FOR DAMAGES RESULTING FROM
11 | THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS PROVIDED
12 | HEREUNDER.
13 |
14 | Statement of Purpose
15 |
16 | The laws of most jurisdictions throughout the world automatically confer
17 | exclusive Copyright and Related Rights (defined below) upon the creator
18 | and subsequent owner(s) (each and all, an "owner") of an original work of
19 | authorship and/or a database (each, a "Work").
20 |
21 | Certain owners wish to permanently relinquish those rights to a Work for
22 | the purpose of contributing to a commons of creative, cultural and
23 | scientific works ("Commons") that the public can reliably and without fear
24 | of later claims of infringement build upon, modify, incorporate in other
25 | works, reuse and redistribute as freely as possible in any form whatsoever
26 | and for any purposes, including without limitation commercial purposes.
27 | These owners may contribute to the Commons to promote the ideal of a free
28 | culture and the further production of creative, cultural and scientific
29 | works, or to gain reputation or greater distribution for their Work in
30 | part through the use and efforts of others.
31 |
32 | For these and/or other purposes and motivations, and without any
33 | expectation of additional consideration or compensation, the person
34 | associating CC0 with a Work (the "Affirmer"), to the extent that he or she
35 | is an owner of Copyright and Related Rights in the Work, voluntarily
36 | elects to apply CC0 to the Work and publicly distribute the Work under its
37 | terms, with knowledge of his or her Copyright and Related Rights in the
38 | Work and the meaning and intended legal effect of CC0 on those rights.
39 |
40 | 1. Copyright and Related Rights. A Work made available under CC0 may be
41 | protected by copyright and related or neighboring rights ("Copyright and
42 | Related Rights"). Copyright and Related Rights include, but are not
43 | limited to, the following:
44 |
45 | i. the right to reproduce, adapt, distribute, perform, display,
46 | communicate, and translate a Work;
47 | ii. moral rights retained by the original author(s) and/or performer(s);
48 | iii. publicity and privacy rights pertaining to a person's image or
49 | likeness depicted in a Work;
50 | iv. rights protecting against unfair competition in regards to a Work,
51 | subject to the limitations in paragraph 4(a), below;
52 | v. rights protecting the extraction, dissemination, use and reuse of data
53 | in a Work;
54 | vi. database rights (such as those arising under Directive 96/9/EC of the
55 | European Parliament and of the Council of 11 March 1996 on the legal
56 | protection of databases, and under any national implementation
57 | thereof, including any amended or successor version of such
58 | directive); and
59 | vii. other similar, equivalent or corresponding rights throughout the
60 | world based on applicable law or treaty, and any national
61 | implementations thereof.
62 |
63 | 2. Waiver. To the greatest extent permitted by, but not in contravention
64 | of, applicable law, Affirmer hereby overtly, fully, permanently,
65 | irrevocably and unconditionally waives, abandons, and surrenders all of
66 | Affirmer's Copyright and Related Rights and associated claims and causes
67 | of action, whether now known or unknown (including existing as well as
68 | future claims and causes of action), in the Work (i) in all territories
69 | worldwide, (ii) for the maximum duration provided by applicable law or
70 | treaty (including future time extensions), (iii) in any current or future
71 | medium and for any number of copies, and (iv) for any purpose whatsoever,
72 | including without limitation commercial, advertising or promotional
73 | purposes (the "Waiver"). Affirmer makes the Waiver for the benefit of each
74 | member of the public at large and to the detriment of Affirmer's heirs and
75 | successors, fully intending that such Waiver shall not be subject to
76 | revocation, rescission, cancellation, termination, or any other legal or
77 | equitable action to disrupt the quiet enjoyment of the Work by the public
78 | as contemplated by Affirmer's express Statement of Purpose.
79 |
80 | 3. Public License Fallback. Should any part of the Waiver for any reason
81 | be judged legally invalid or ineffective under applicable law, then the
82 | Waiver shall be preserved to the maximum extent permitted taking into
83 | account Affirmer's express Statement of Purpose. In addition, to the
84 | extent the Waiver is so judged Affirmer hereby grants to each affected
85 | person a royalty-free, non transferable, non sublicensable, non exclusive,
86 | irrevocable and unconditional license to exercise Affirmer's Copyright and
87 | Related Rights in the Work (i) in all territories worldwide, (ii) for the
88 | maximum duration provided by applicable law or treaty (including future
89 | time extensions), (iii) in any current or future medium and for any number
90 | of copies, and (iv) for any purpose whatsoever, including without
91 | limitation commercial, advertising or promotional purposes (the
92 | "License"). The License shall be deemed effective as of the date CC0 was
93 | applied by Affirmer to the Work. Should any part of the License for any
94 | reason be judged legally invalid or ineffective under applicable law, such
95 | partial invalidity or ineffectiveness shall not invalidate the remainder
96 | of the License, and in such case Affirmer hereby affirms that he or she
97 | will not (i) exercise any of his or her remaining Copyright and Related
98 | Rights in the Work or (ii) assert any associated claims and causes of
99 | action with respect to the Work, in either case contrary to Affirmer's
100 | express Statement of Purpose.
101 |
102 | 4. Limitations and Disclaimers.
103 |
104 | a. No trademark or patent rights held by Affirmer are waived, abandoned,
105 | surrendered, licensed or otherwise affected by this document.
106 | b. Affirmer offers the Work as-is and makes no representations or
107 | warranties of any kind concerning the Work, express, implied,
108 | statutory or otherwise, including without limitation warranties of
109 | title, merchantability, fitness for a particular purpose, non
110 | infringement, or the absence of latent or other defects, accuracy, or
111 | the present or absence of errors, whether or not discoverable, all to
112 | the greatest extent permissible under applicable law.
113 | c. Affirmer disclaims responsibility for clearing rights of other persons
114 | that may apply to the Work or any use thereof, including without
115 | limitation any person's Copyright and Related Rights in the Work.
116 | Further, Affirmer disclaims responsibility for obtaining any necessary
117 | consents, permissions or other rights required for any use of the
118 | Work.
119 | d. Affirmer understands and acknowledges that Creative Commons is not a
120 | party to this document and has no duty or obligation with respect to
121 | this CC0 or use of the Work.
122 |
--------------------------------------------------------------------------------
/projects/dAes/contest1/src/abi/index.js:
--------------------------------------------------------------------------------
1 | const abi = [
2 | {
3 | "inputs": [
4 | {
5 | "internalType": "string",
6 | "name": "name_",
7 | "type": "string"
8 | },
9 | {
10 | "internalType": "string",
11 | "name": "symbol_",
12 | "type": "string"
13 | },
14 | {
15 | "internalType": "uint16",
16 | "name": "width_",
17 | "type": "uint16"
18 | },
19 | {
20 | "internalType": "uint16",
21 | "name": "height_",
22 | "type": "uint16"
23 | }
24 | ],
25 | "stateMutability": "nonpayable",
26 | "type": "constructor"
27 | },
28 | {
29 | "anonymous": false,
30 | "inputs": [
31 | {
32 | "indexed": true,
33 | "internalType": "address",
34 | "name": "owner",
35 | "type": "address"
36 | },
37 | {
38 | "indexed": true,
39 | "internalType": "address",
40 | "name": "approved",
41 | "type": "address"
42 | },
43 | {
44 | "indexed": true,
45 | "internalType": "uint256",
46 | "name": "tokenId",
47 | "type": "uint256"
48 | }
49 | ],
50 | "name": "Approval",
51 | "type": "event"
52 | },
53 | {
54 | "anonymous": false,
55 | "inputs": [
56 | {
57 | "indexed": true,
58 | "internalType": "address",
59 | "name": "owner",
60 | "type": "address"
61 | },
62 | {
63 | "indexed": true,
64 | "internalType": "address",
65 | "name": "operator",
66 | "type": "address"
67 | },
68 | {
69 | "indexed": false,
70 | "internalType": "bool",
71 | "name": "approved",
72 | "type": "bool"
73 | }
74 | ],
75 | "name": "ApprovalForAll",
76 | "type": "event"
77 | },
78 | {
79 | "inputs": [
80 | {
81 | "internalType": "address",
82 | "name": "to",
83 | "type": "address"
84 | },
85 | {
86 | "internalType": "uint256",
87 | "name": "tokenId",
88 | "type": "uint256"
89 | }
90 | ],
91 | "name": "approve",
92 | "outputs": [],
93 | "stateMutability": "nonpayable",
94 | "type": "function"
95 | },
96 | {
97 | "inputs": [
98 | {
99 | "internalType": "address",
100 | "name": "claimer",
101 | "type": "address"
102 | },
103 | {
104 | "internalType": "uint16",
105 | "name": "xAxis",
106 | "type": "uint16"
107 | },
108 | {
109 | "internalType": "uint16",
110 | "name": "yAxis",
111 | "type": "uint16"
112 | }
113 | ],
114 | "name": "claim",
115 | "outputs": [
116 | {
117 | "internalType": "uint256",
118 | "name": "",
119 | "type": "uint256"
120 | }
121 | ],
122 | "stateMutability": "nonpayable",
123 | "type": "function"
124 | },
125 | {
126 | "anonymous": false,
127 | "inputs": [
128 | {
129 | "indexed": true,
130 | "internalType": "address",
131 | "name": "operator",
132 | "type": "address"
133 | },
134 | {
135 | "indexed": true,
136 | "internalType": "uint16",
137 | "name": "xAxis",
138 | "type": "uint16"
139 | },
140 | {
141 | "indexed": true,
142 | "internalType": "uint16",
143 | "name": "yAxis",
144 | "type": "uint16"
145 | },
146 | {
147 | "indexed": false,
148 | "internalType": "uint8",
149 | "name": "r",
150 | "type": "uint8"
151 | },
152 | {
153 | "indexed": false,
154 | "internalType": "uint8",
155 | "name": "g",
156 | "type": "uint8"
157 | },
158 | {
159 | "indexed": false,
160 | "internalType": "uint8",
161 | "name": "b",
162 | "type": "uint8"
163 | },
164 | {
165 | "indexed": false,
166 | "internalType": "uint8",
167 | "name": "a",
168 | "type": "uint8"
169 | }
170 | ],
171 | "name": "Color",
172 | "type": "event"
173 | },
174 | {
175 | "inputs": [
176 | {
177 | "internalType": "address",
178 | "name": "from",
179 | "type": "address"
180 | },
181 | {
182 | "internalType": "address",
183 | "name": "to",
184 | "type": "address"
185 | },
186 | {
187 | "internalType": "uint256",
188 | "name": "tokenId",
189 | "type": "uint256"
190 | }
191 | ],
192 | "name": "safeTransferFrom",
193 | "outputs": [],
194 | "stateMutability": "nonpayable",
195 | "type": "function"
196 | },
197 | {
198 | "inputs": [
199 | {
200 | "internalType": "address",
201 | "name": "from",
202 | "type": "address"
203 | },
204 | {
205 | "internalType": "address",
206 | "name": "to",
207 | "type": "address"
208 | },
209 | {
210 | "internalType": "uint256",
211 | "name": "tokenId",
212 | "type": "uint256"
213 | },
214 | {
215 | "internalType": "bytes",
216 | "name": "_data",
217 | "type": "bytes"
218 | }
219 | ],
220 | "name": "safeTransferFrom",
221 | "outputs": [],
222 | "stateMutability": "nonpayable",
223 | "type": "function"
224 | },
225 | {
226 | "inputs": [
227 | {
228 | "internalType": "address",
229 | "name": "operator",
230 | "type": "address"
231 | },
232 | {
233 | "internalType": "bool",
234 | "name": "approved",
235 | "type": "bool"
236 | }
237 | ],
238 | "name": "setApprovalForAll",
239 | "outputs": [],
240 | "stateMutability": "nonpayable",
241 | "type": "function"
242 | },
243 | {
244 | "inputs": [
245 | {
246 | "internalType": "uint16",
247 | "name": "xAxis_",
248 | "type": "uint16"
249 | },
250 | {
251 | "internalType": "uint16",
252 | "name": "yAxis_",
253 | "type": "uint16"
254 | },
255 | {
256 | "internalType": "uint8",
257 | "name": "r_",
258 | "type": "uint8"
259 | },
260 | {
261 | "internalType": "uint8",
262 | "name": "g_",
263 | "type": "uint8"
264 | },
265 | {
266 | "internalType": "uint8",
267 | "name": "b_",
268 | "type": "uint8"
269 | },
270 | {
271 | "internalType": "uint8",
272 | "name": "a_",
273 | "type": "uint8"
274 | }
275 | ],
276 | "name": "setColor",
277 | "outputs": [],
278 | "stateMutability": "nonpayable",
279 | "type": "function"
280 | },
281 | {
282 | "anonymous": false,
283 | "inputs": [
284 | {
285 | "indexed": true,
286 | "internalType": "address",
287 | "name": "from",
288 | "type": "address"
289 | },
290 | {
291 | "indexed": true,
292 | "internalType": "address",
293 | "name": "to",
294 | "type": "address"
295 | },
296 | {
297 | "indexed": true,
298 | "internalType": "uint256",
299 | "name": "tokenId",
300 | "type": "uint256"
301 | }
302 | ],
303 | "name": "Transfer",
304 | "type": "event"
305 | },
306 | {
307 | "inputs": [
308 | {
309 | "internalType": "address",
310 | "name": "from",
311 | "type": "address"
312 | },
313 | {
314 | "internalType": "address",
315 | "name": "to",
316 | "type": "address"
317 | },
318 | {
319 | "internalType": "uint256",
320 | "name": "tokenId",
321 | "type": "uint256"
322 | }
323 | ],
324 | "name": "transferFrom",
325 | "outputs": [],
326 | "stateMutability": "nonpayable",
327 | "type": "function"
328 | },
329 | {
330 | "inputs": [
331 | {
332 | "internalType": "address",
333 | "name": "owner",
334 | "type": "address"
335 | }
336 | ],
337 | "name": "balanceOf",
338 | "outputs": [
339 | {
340 | "internalType": "uint256",
341 | "name": "",
342 | "type": "uint256"
343 | }
344 | ],
345 | "stateMutability": "view",
346 | "type": "function"
347 | },
348 | {
349 | "inputs": [
350 | {
351 | "internalType": "uint256",
352 | "name": "tokenId",
353 | "type": "uint256"
354 | }
355 | ],
356 | "name": "getApproved",
357 | "outputs": [
358 | {
359 | "internalType": "address",
360 | "name": "",
361 | "type": "address"
362 | }
363 | ],
364 | "stateMutability": "view",
365 | "type": "function"
366 | },
367 | {
368 | "inputs": [
369 | {
370 | "internalType": "uint16",
371 | "name": "xAxis_",
372 | "type": "uint16"
373 | },
374 | {
375 | "internalType": "uint16",
376 | "name": "yAxis_",
377 | "type": "uint16"
378 | }
379 | ],
380 | "name": "getColor",
381 | "outputs": [
382 | {
383 | "internalType": "uint8",
384 | "name": "",
385 | "type": "uint8"
386 | },
387 | {
388 | "internalType": "uint8",
389 | "name": "",
390 | "type": "uint8"
391 | },
392 | {
393 | "internalType": "uint8",
394 | "name": "",
395 | "type": "uint8"
396 | },
397 | {
398 | "internalType": "uint8",
399 | "name": "",
400 | "type": "uint8"
401 | }
402 | ],
403 | "stateMutability": "view",
404 | "type": "function"
405 | },
406 | {
407 | "inputs": [],
408 | "name": "height",
409 | "outputs": [
410 | {
411 | "internalType": "uint16",
412 | "name": "",
413 | "type": "uint16"
414 | }
415 | ],
416 | "stateMutability": "view",
417 | "type": "function"
418 | },
419 | {
420 | "inputs": [
421 | {
422 | "internalType": "address",
423 | "name": "owner",
424 | "type": "address"
425 | },
426 | {
427 | "internalType": "address",
428 | "name": "operator",
429 | "type": "address"
430 | }
431 | ],
432 | "name": "isApprovedForAll",
433 | "outputs": [
434 | {
435 | "internalType": "bool",
436 | "name": "",
437 | "type": "bool"
438 | }
439 | ],
440 | "stateMutability": "view",
441 | "type": "function"
442 | },
443 | {
444 | "inputs": [],
445 | "name": "name",
446 | "outputs": [
447 | {
448 | "internalType": "string",
449 | "name": "",
450 | "type": "string"
451 | }
452 | ],
453 | "stateMutability": "view",
454 | "type": "function"
455 | },
456 | {
457 | "inputs": [
458 | {
459 | "internalType": "uint256",
460 | "name": "tokenId",
461 | "type": "uint256"
462 | }
463 | ],
464 | "name": "ownerOf",
465 | "outputs": [
466 | {
467 | "internalType": "address",
468 | "name": "",
469 | "type": "address"
470 | }
471 | ],
472 | "stateMutability": "view",
473 | "type": "function"
474 | },
475 | {
476 | "inputs": [
477 | {
478 | "internalType": "bytes4",
479 | "name": "interfaceId",
480 | "type": "bytes4"
481 | }
482 | ],
483 | "name": "supportsInterface",
484 | "outputs": [
485 | {
486 | "internalType": "bool",
487 | "name": "",
488 | "type": "bool"
489 | }
490 | ],
491 | "stateMutability": "view",
492 | "type": "function"
493 | },
494 | {
495 | "inputs": [],
496 | "name": "symbol",
497 | "outputs": [
498 | {
499 | "internalType": "string",
500 | "name": "",
501 | "type": "string"
502 | }
503 | ],
504 | "stateMutability": "view",
505 | "type": "function"
506 | },
507 | {
508 | "inputs": [],
509 | "name": "width",
510 | "outputs": [
511 | {
512 | "internalType": "uint16",
513 | "name": "",
514 | "type": "uint16"
515 | }
516 | ],
517 | "stateMutability": "view",
518 | "type": "function"
519 | }
520 | ]
521 |
522 | export default abi
523 |
--------------------------------------------------------------------------------
/projects/dAes/dAes/contracts/Canvas.sol:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: MIT
2 |
3 | pragma solidity ^0.8.0;
4 |
5 | import "@openzeppelin/contracts/token/ERC721/IERC721.sol";
6 | import "@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol";
7 | import "@openzeppelin/contracts/utils/Counters.sol";
8 | import "@openzeppelin/contracts/utils/Address.sol";
9 | import "@openzeppelin/contracts/utils/Context.sol";
10 | import "@openzeppelin/contracts/utils/Strings.sol";
11 | import "@openzeppelin/contracts/utils/introspection/ERC165.sol";
12 | import "./extensions/IERC721ExMetadata.sol";
13 | import "./extensions/ICanvas.sol";
14 |
15 | contract Canvas is Context, ERC165, IERC721, IERC721ExMetadata, ICanvas{
16 | using Address for address;
17 | using Strings for uint256;
18 |
19 | // Token name
20 | string private _name;
21 |
22 | // Token symbol
23 | string private _symbol;
24 |
25 | // Canvas's width
26 | uint16 private _width;
27 |
28 | // Canvas's height
29 | uint16 private _height;
30 |
31 | struct Pixel {
32 | uint8 R;
33 | uint8 G;
34 | uint8 B;
35 | uint8 A;
36 | }
37 |
38 | // Mapping all pixels in canvas
39 | mapping (uint256 => Pixel) private _canvas;
40 |
41 | // Mapping from token ID to owner address
42 | mapping (uint256 => address) private _owners;
43 |
44 | // Mapping owner address to token count
45 | mapping (address => uint256) private _balances;
46 |
47 | // Mapping from token ID to approved address
48 | mapping (uint256 => address) private _tokenApprovals;
49 |
50 | // Mapping from owner to operator approvals
51 | mapping (address => mapping (address => bool)) private _operatorApprovals;
52 |
53 | constructor (string memory name_, string memory symbol_, uint16 width_, uint16 height_) {
54 | _name = name_;
55 | _symbol = symbol_;
56 | _width = width_;
57 | _height = height_;
58 | }
59 |
60 | /**
61 | * @dev See {IERC165-supportsInterface}.
62 | */
63 | function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165, IERC165) returns (bool) {
64 | return interfaceId == type(IERC721).interfaceId
65 | || interfaceId == type(IERC721ExMetadata).interfaceId
66 | || super.supportsInterface(interfaceId);
67 | }
68 |
69 | /**
70 | * @dev See {IERC721-balanceOf}.
71 | */
72 | function balanceOf(address owner) public view virtual override returns (uint256) {
73 | require(owner != address(0), "ERC721: balance query for the zero address");
74 | return _balances[owner];
75 | }
76 |
77 | /**
78 | * @dev See {IERC721-ownerOf}.
79 | */
80 | function ownerOf(uint256 tokenId) public view virtual override returns (address) {
81 | address owner = _owners[tokenId];
82 | require(owner != address(0), "ERC721: owner query for nonexistent token");
83 | return owner;
84 | }
85 |
86 | /**
87 | * @dev See {IERC721Metadata-name}.
88 | */
89 | function name() public view virtual override returns (string memory) {
90 | return _name;
91 | }
92 |
93 | /**
94 | * @dev See {IERC721Metadata-symbol}.
95 | */
96 | function symbol() public view virtual override returns (string memory) {
97 | return _symbol;
98 | }
99 |
100 | function width() public view virtual override returns (uint16) {
101 | return _width;
102 | }
103 |
104 | function height() public view virtual override returns (uint16) {
105 | return _height;
106 | }
107 |
108 | /**
109 | * @dev See {IERC721-approve}.
110 | */
111 | function approve(address to, uint256 tokenId) public virtual override {
112 | address owner = Canvas.ownerOf(tokenId);
113 | require(to != owner, "ERC721: approval to current owner");
114 |
115 | require(_msgSender() == owner || isApprovedForAll(owner, _msgSender()),
116 | "ERC721: approve caller is not owner nor approved for all"
117 | );
118 |
119 | _approve(to, tokenId);
120 | }
121 |
122 | /**
123 | * @dev See {IERC721-getApproved}.
124 | */
125 | function getApproved(uint256 tokenId) public view virtual override returns (address) {
126 | require(_exists(tokenId), "ERC721: approved query for nonexistent token");
127 |
128 | return _tokenApprovals[tokenId];
129 | }
130 |
131 | /**
132 | * @dev See {IERC721-setApprovalForAll}.
133 | */
134 | function setApprovalForAll(address operator, bool approved) public virtual override {
135 | require(operator != _msgSender(), "ERC721: approve to caller");
136 |
137 | _operatorApprovals[_msgSender()][operator] = approved;
138 | emit ApprovalForAll(_msgSender(), operator, approved);
139 | }
140 |
141 | /**
142 | * @dev See {IERC721-isApprovedForAll}.
143 | */
144 | function isApprovedForAll(address owner, address operator) public view virtual override returns (bool) {
145 | return _operatorApprovals[owner][operator];
146 | }
147 |
148 | /**
149 | * @dev See {IERC721-transferFrom}.
150 | */
151 | function transferFrom(address from, address to, uint256 tokenId) public virtual override {
152 | //solhint-disable-next-line max-line-length
153 | require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: transfer caller is not owner nor approved");
154 |
155 | _transfer(from, to, tokenId);
156 | }
157 |
158 | /**
159 | * @dev See {IERC721-safeTransferFrom}.
160 | */
161 | function safeTransferFrom(address from, address to, uint256 tokenId) public virtual override {
162 | safeTransferFrom(from, to, tokenId, "");
163 | }
164 |
165 | /**
166 | * @dev See {IERC721-safeTransferFrom}.
167 | */
168 | function safeTransferFrom(address from, address to, uint256 tokenId, bytes memory _data) public virtual override {
169 | require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: transfer caller is not owner nor approved");
170 | _safeTransfer(from, to, tokenId, _data);
171 | }
172 |
173 | /**
174 | * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients
175 | * are aware of the ERC721 protocol to prevent tokens from being forever locked.
176 | *
177 | * `_data` is additional data, it has no specified format and it is sent in call to `to`.
178 | *
179 | * This internal function is equivalent to {safeTransferFrom}, and can be used to e.g.
180 | * implement alternative mechanisms to perform token transfer, such as signature-based.
181 | *
182 | * Requirements:
183 | *
184 | * - `from` cannot be the zero address.
185 | * - `to` cannot be the zero address.
186 | * - `tokenId` token must exist and be owned by `from`.
187 | * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
188 | *
189 | * Emits a {Transfer} event.
190 | */
191 | function _safeTransfer(address from, address to, uint256 tokenId, bytes memory _data) internal virtual {
192 | _transfer(from, to, tokenId);
193 | require(_checkOnERC721Received(from, to, tokenId, _data), "ERC721: transfer to non ERC721Receiver implementer");
194 | }
195 |
196 | /**
197 | * @dev Returns whether `tokenId` exists.
198 | *
199 | * Tokens can be managed by their owner or approved accounts via {approve} or {setApprovalForAll}.
200 | *
201 | * Tokens start existing when they are minted (`_mint`),
202 | * and stop existing when they are burned (`_burn`).
203 | */
204 | function _exists(uint256 tokenId) internal view virtual returns (bool) {
205 | return _owners[tokenId] != address(0);
206 | }
207 |
208 | /**
209 | * @dev Returns whether `spender` is allowed to manage `tokenId`.
210 | *
211 | * Requirements:
212 | *
213 | * - `tokenId` must exist.
214 | */
215 | function _isApprovedOrOwner(address spender, uint256 tokenId) internal view virtual returns (bool) {
216 | require(_exists(tokenId), "ERC721: operator query for nonexistent token");
217 | address owner = Canvas.ownerOf(tokenId);
218 | return (spender == owner || getApproved(tokenId) == spender || isApprovedForAll(owner, spender));
219 | }
220 |
221 | /**
222 | * @dev Safely mints `tokenId` and transfers it to `to`.
223 | *
224 | * Requirements:
225 | *
226 | * - `tokenId` must not exist.
227 | * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
228 | *
229 | * Emits a {Transfer} event.
230 | */
231 | function _safeMint(address to, uint256 tokenId) internal virtual {
232 | _safeMint(to, tokenId, "");
233 | }
234 |
235 | /**
236 | * @dev Same as {xref-ERC721-_safeMint-address-uint256-}[`_safeMint`], with an additional `data` parameter which is
237 | * forwarded in {IERC721Receiver-onERC721Received} to contract recipients.
238 | */
239 | function _safeMint(address to, uint256 tokenId, bytes memory _data) internal virtual {
240 | _mint(to, tokenId);
241 | require(_checkOnERC721Received(address(0), to, tokenId, _data), "ERC721: transfer to non ERC721Receiver implementer");
242 | }
243 |
244 | /**
245 | * @dev Mints `tokenId` and transfers it to `to`.
246 | *
247 | * WARNING: Usage of this method is discouraged, use {_safeMint} whenever possible
248 | *
249 | * Requirements:
250 | *
251 | * - `tokenId` must not exist.
252 | * - `to` cannot be the zero address.
253 | *
254 | * Emits a {Transfer} event.
255 | */
256 | function _mint(address to, uint256 tokenId) internal virtual {
257 | require(to != address(0), "ERC721: mint to the zero address");
258 | require(!_exists(tokenId), "ERC721: token already minted");
259 |
260 | _beforeTokenTransfer(address(0), to, tokenId);
261 |
262 | _balances[to] += 1;
263 | _canvas[tokenId] = Pixel(255, 255, 255, 10);
264 | _owners[tokenId] = to;
265 |
266 | emit Transfer(address(0), to, tokenId);
267 | }
268 |
269 | /**
270 | * @dev Destroys `tokenId`.
271 | * The approval is cleared when the token is burned.
272 | *
273 | * Requirements:
274 | *
275 | * - `tokenId` must exist.
276 | *
277 | * Emits a {Transfer} event.
278 | */
279 | function _burn(uint256 tokenId) internal virtual {
280 | address owner = Canvas.ownerOf(tokenId);
281 |
282 | _beforeTokenTransfer(owner, address(0), tokenId);
283 |
284 | // Clear approvals
285 | _approve(address(0), tokenId);
286 |
287 | _balances[owner] -= 1;
288 | delete _owners[tokenId];
289 |
290 | emit Transfer(owner, address(0), tokenId);
291 | }
292 |
293 | /**
294 | * @dev Transfers `tokenId` from `from` to `to`.
295 | * As opposed to {transferFrom}, this imposes no restrictions on msg.sender.
296 | *
297 | * Requirements:
298 | *
299 | * - `to` cannot be the zero address.
300 | * - `tokenId` token must be owned by `from`.
301 | *
302 | * Emits a {Transfer} event.
303 | */
304 | function _transfer(address from, address to, uint256 tokenId) internal virtual {
305 | require(Canvas.ownerOf(tokenId) == from, "ERC721: transfer of token that is not own");
306 | require(to != address(0), "ERC721: transfer to the zero address");
307 |
308 | _beforeTokenTransfer(from, to, tokenId);
309 |
310 | // Clear approvals from the previous owner
311 | _approve(address(0), tokenId);
312 |
313 | _balances[from] -= 1;
314 | _balances[to] += 1;
315 | _owners[tokenId] = to;
316 |
317 | emit Transfer(from, to, tokenId);
318 | }
319 |
320 | /**
321 | * @dev Approve `to` to operate on `tokenId`
322 | *
323 | * Emits a {Approval} event.
324 | */
325 | function _approve(address to, uint256 tokenId) internal virtual {
326 | _tokenApprovals[tokenId] = to;
327 | emit Approval(Canvas.ownerOf(tokenId), to, tokenId);
328 | }
329 |
330 | /**
331 | * @dev Internal function to invoke {IERC721Receiver-onERC721Received} on a target address.
332 | * The call is not executed if the target address is not a contract.
333 | *
334 | * @param from address representing the previous owner of the given token ID
335 | * @param to target address that will receive the tokens
336 | * @param tokenId uint256 ID of the token to be transferred
337 | * @param _data bytes optional data to send along with the call
338 | * @return bool whether the call correctly returned the expected magic value
339 | */
340 | function _checkOnERC721Received(address from, address to, uint256 tokenId, bytes memory _data)
341 | private returns (bool)
342 | {
343 | if (to.isContract()) {
344 | try IERC721Receiver(to).onERC721Received(_msgSender(), from, tokenId, _data) returns (bytes4 retval) {
345 | return retval == IERC721Receiver(to).onERC721Received.selector;
346 | } catch (bytes memory reason) {
347 | if (reason.length == 0) {
348 | revert("ERC721: transfer to non ERC721Receiver implementer");
349 | } else {
350 | // solhint-disable-next-line no-inline-assembly
351 | assembly {
352 | revert(add(32, reason), mload(reason))
353 | }
354 | }
355 | }
356 | } else {
357 | return true;
358 | }
359 | }
360 |
361 | /**
362 | * @dev Hook that is called before any token transfer. This includes minting
363 | * and burning.
364 | *
365 | * Calling conditions:
366 | *
367 | * - When `from` and `to` are both non-zero, ``from``'s `tokenId` will be
368 | * transferred to `to`.
369 | * - When `from` is zero, `tokenId` will be minted for `to`.
370 | * - When `to` is zero, ``from``'s `tokenId` will be burned.
371 | * - `from` and `to` are never both zero.
372 | *
373 | * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
374 | */
375 | function _beforeTokenTransfer(address from, address to, uint256 tokenId) internal virtual { }
376 |
377 | function claim(address claimer, uint16 xAxis, uint16 yAxis)
378 | public virtual override
379 | returns (uint256)
380 | {
381 | uint256 tokenId = _mappingPositionToTokenId(xAxis, yAxis);
382 | if (_owners[tokenId] == address(0)) {
383 | _mint(claimer, tokenId);
384 | return tokenId;
385 | } else {
386 | return 0;
387 | }
388 | }
389 |
390 | function _overflowXAxis(uint16 xAxis_) private view returns (bool) {
391 | if (xAxis_ >= _width) {
392 | return true;
393 | } else {
394 | return false;
395 | }
396 | }
397 |
398 | function _overflowYAxis(uint16 yAxis_) private view returns (bool) {
399 | if (yAxis_ >= _height) {
400 | return true;
401 | } else {
402 | return false;
403 | }
404 | }
405 |
406 | function _validPixel(Pixel memory pixel_) private returns (bool) {
407 | return pixel_.A <= 100;
408 | }
409 |
410 | function _mappingPositionToTokenId(uint16 xAxis_, uint16 yAxis_) private view returns (uint256) {
411 | require(!_overflowXAxis(xAxis_), "X axis overflow");
412 | require(!_overflowYAxis(yAxis_), "Y axis overflow");
413 | return xAxis_ + yAxis_ * _width;
414 | }
415 |
416 | function setColor(uint16 xAxis_, uint16 yAxis_, uint8 r_, uint8 g_, uint8 b_, uint8 a_) public virtual override {
417 | uint256 tokenId = _mappingPositionToTokenId(xAxis_, yAxis_);
418 | _color(tokenId, r_, g_, b_, a_);
419 | emit Color(_msgSender(), xAxis_, yAxis_, r_, g_, b_, a_);
420 | }
421 |
422 | function _color(uint256 tokenId_, uint8 r_, uint8 g_, uint8 b_, uint8 a_) internal virtual {
423 | Pixel memory pixel = Pixel(r_, g_, b_, a_);
424 | require(_validPixel(pixel), "invalid rgba string");
425 | _canvas[tokenId_] = Pixel(r_, g_, b_, a_);
426 | }
427 |
428 | function getColor(uint16 xAxis_, uint16 yAxis_) public view override returns (uint8, uint8, uint8, uint8) {
429 | uint256 tokenId = _mappingPositionToTokenId(xAxis_, yAxis_);
430 | Pixel memory color = _canvas[tokenId];
431 | return (color.R, color.G, color.B, color.A);
432 | }
433 |
434 | // function lock(uint16 xAxis_, uint16 yAxis_) public {
435 | // uint256 tokenId = _mappingPositionToTokenId(xAxis_, yAxis_);
436 | // require(_exists(tokenId), "ERC721: lock nonexistent token");
437 |
438 | // address owner = Canvas.ownerOf(tokenId);
439 |
440 | // require(_msgSender() == owner , "need owner to lock");
441 | // _lock(xAxis_, yAxis_);
442 | // }
443 |
444 | // function _lock(uint16 xAxis_, uint16 yAxis_) internal virtual {
445 |
446 | // }
447 | }
--------------------------------------------------------------------------------
/projects/dAes/contest1/src/components/show.js:
--------------------------------------------------------------------------------
1 |
2 | import './show.css';
3 | import InputColor from 'react-input-color';
4 | import {CountdownCircleTimer } from 'react-countdown-circle-timer'
5 | import React, { useState ,useContext } from 'react';
6 | import {Web3Context} from "../App.js";
7 |
8 | //import Claim from './artifacts/contracts/Greeter.sol/Greeter.json'
9 | const v =['#1bb86b', '#1bb86b', '#1bb86b', '#1bb86b', '#1bb86b', '#1bb86b', '#1bb86b', '#1bb86b', '#1bb86b', '#1bb86b', '#1bb86b', '#1bb86b', '#1bb86b', '#1bb86b', '#1bb86b', '#1bb86b', '#1bb86b', '#1bb86b', '#1bb86b', '#1bb86b', '#1bb86b', '#1bb86b', '#1bb86b', '#1bb86b', '#1bb86b', '#1bb86b', '#1bb86b', '#1bb86b', '#1bb86b', '#1bb86b', '#1bb86b', '#1bb86b', '#1bb86b', '#1bb86b', '#1bb86b', '#1bb86b', '#1bb86b', '#1bb86b', '#1bb86b', '#1bb86b', '#1bb86b', '#1bb86b', '#1bb86b', '#1bb86b', '#1bb86b', '#1bb86b', '#1bb86b', '#1bb86b', '#1bb86b', '#1bb86b', '#1bb86b', '#1bb86b', '#1bb86b', '#1bb86b', '#1bb86b', '#1bb86b', '#1bb86b', '#1bb86b', '#1bb86b', '#1bb86b', '#1bb86b', '#1bb86b', '#1bb86b', '#1bb86b', '#1bb86b', '#1bb86b', '#1bb86b', '#1bb86b', '#1bb86b', '#1bb86b', '#1bb86b', '#1bb86b', '#1bb86b', '#1bb86b', '#1bb86b', '#1bb86b', '#1bb86b', '#1bb86b', '#1bb86b', '#1bb86b', '#1bb86b', '#1bb86b', '#50514d', '#50514d', '#1bb86b', '#1bb86b', '#1bb86b', '#1bb86b', '#1bb86b', '#1bb86b', '#1bb86b', '#1bb86b', '#1bb86b', '#50514d', '#1bb86b', '#1bb86b', '#1bb86b', '#1bb86b', '#1bb86b', '#1bb86b', '#1bb86b', '#1bb86b', '#1bb86b', '#1bb86b', '#1bb86b', '#1bb86b', '#1bb86b', '#1bb86b', '#1bb86b', '#1bb86b', '#1bb86b', '#1bb86b', '#1bb86b', '#1bb86b', '#1bb86b', '#1bb86b', '#1bb86b', '#50514d', '#50514d', '#50514d', '#50514d', '#ffffff', '#ffffff', '#ffffff', '#ffffff', '#ffffff', '#ffffff', '#1bb86b', '#50514d', '#50514d', '#50514d', '#1bb86b', '#1bb86b', '#1bb86b', '#1bb86b', '#1bb86b', '#1bb86b', '#1bb86b', '#1bb86b', '#1bb86b', '#1bb86b', '#1bb86b', '#1bb86b', '#1bb86b', '#1bb86b', '#1bb86b', '#1bb86b', '#1bb86b', '#1bb86b', '#1bb86b', '#1bb86b', '#ffffff', '#ffffff', '#50514d', '#50514d', '#50514d', '#50514d', '#ffffff', '#ffffff', '#ffffff', '#ffffff', '#ffffff', '#ffffff', '#ffffff', '#50514d', '#50514d', '#50514d', '#1bb86b', '#1bb86b', '#1bb86b', '#1bb86b', '#1bb86b', '#1bb86b', '#1bb86b', '#1bb86b', '#1bb86b', '#1bb86b', '#1bb86b', '#1bb86b', '#1bb86b', '#1bb86b', '#1bb86b', '#1bb86b', '#1bb86b', '#50514d', '#ffffff', '#ffffff', '#ffffff', '#ffffff', '#ffffff', '#50514d', '#ffffff', '#ffffff', '#ffffff', '#ffffff', '#ffffff', '#ffffff', '#ffffff', '#ffffff', '#ffffff', '#ffffff', '#50514d', '#50514d', '#1bb86b', '#1bb86b', '#1bb86b', '#1bb86b', '#1bb86b', '#1bb86b', '#1bb86b', '#1bb86b', '#1bb86b', '#1bb86b', '#1bb86b', '#1bb86b', '#1bb86b', '#1bb86b', '#1bb86b', '#1bb86b', '#50514d', '#50514d', '#ffffff', '#ffffff', '#ffffff', '#ffffff', '#50514d', '#ffffff', '#ffffff', '#ffffff', '#ffffff', '#ffffff', '#ffffff', '#ffffff', '#ffffff', '#ffffff', '#ffffff', '#ffffff', '#ffffff', '#1bb86b', '#1bb86b', '#1bb86b', '#1bb86b', '#1bb86b', '#1bb86b', '#1bb86b', '#1bb86b', '#1bb86b', '#1bb86b', '#1bb86b', '#1bb86b', '#1bb86b', '#1bb86b', '#1bb86b', '#1bb86b', '#a2a49f', '#50514d', '#ffffff', '#ffffff', '#ffffff', '#ffffff', '#50514d', '#ffffff', '#ffffff', '#ffffff', '#ffffff', '#ffffff', '#ffffff', '#ffffff', '#ffffff', '#ffffff', '#ffffff', '#ffffff', '#ffffff', '#ffffff', '#ffffff', '#1bb86b', '#1bb86b', '#1bb86b', '#1bb86b', '#1bb86b', '#1bb86b', '#1bb86b', '#1bb86b', '#1bb86b', '#1bb86b', '#1bb86b', '#1bb86b', '#1bb86b', '#1bb86b', '#1bb86b', '#50514d', '#50514d', '#ffffff', '#ffffff', '#ffffff', '#ffffff', '#50514d', '#ffffff', '#ffffff', '#ffffff', '#ffffff', '#ffffff', '#ffffff', '#ffffff', '#ffffff', '#ffffff', '#ffffff', '#ffffff', '#ffffff', '#ffffff', '#ffffff', '#50514d', '#1bb86b', '#1bb86b', '#1bb86b', '#1bb86b', '#1bb86b', '#1bb86b', '#1bb86b', '#1bb86b', '#1bb86b', '#1bb86b', '#1bb86b', '#1bb86b', '#1bb86b', '#1bb86b', '#a2a49f', '#50514d', '#ffffff', '#ffffff', '#ffffff', '#50514d', '#50514d', '#ffffff', '#ffffff', '#ffffff', '#ffffff', '#50514d', '#a2a49f', '#ffffff', '#ffffff', '#ffffff', '#50514d', '#ffffff', '#ffffff', '#ffffff', '#ffffff', '#50514d', '#50514d', '#50514d', '#1bb86b', '#1bb86b', '#1bb86b', '#1bb86b', '#1bb86b', '#1bb86b', '#1bb86b', '#1bb86b', '#1bb86b', '#1bb86b', '#1bb86b', '#1bb86b', '#1bb86b', '#50514d', '#50514d', '#ffffff', '#50514d', '#50514d', '#50514d', '#ffffff', '#ffffff', '#50514d', '#50514d', '#50514d', '#50514d', '#ffffff', '#ffffff', '#50514d', '#50514d', '#50514d', '#50514d', '#ffffff', '#ffffff', '#50514d', '#50514d', '#50514d', '#50514d', '#50514d', '#1bb86b', '#1bb86b', '#1bb86b', '#1bb86b', '#1bb86b', '#1bb86b', '#1bb86b', '#1bb86b', '#1bb86b', '#1bb86b', '#1bb86b', '#50514d', '#50514d', '#50514d', '#50514d', '#50514d', '#ffffff', '#ffffff', '#ffffff', '#50514d', '#50514d', '#50514d', '#ffffff', '#ffffff', '#ffffff', '#ffffff', '#50514d', '#50514d', '#50514d', '#ffffff', '#ffffff', '#50514d', '#50514d', '#50514d', '#50514d', '#50514d', '#50514d', '#1bb86b', '#1bb86b', '#1bb86b', '#1bb86b', '#1bb86b', '#1bb86b', '#1bb86b', '#1bb86b', '#50514d', '#50514d', '#50514d', '#50514d', '#50514d', '#50514d', '#50514d', '#ffffff', '#ffffff', '#facDC7', '#facDC7', '#facDC7', '#ffffff', '#ffffff', '#50514d', '#74eefd', '#74eefd', '#74eefd', '#facDC7', '#facDC7', '#facDC7', '#ffffff', '#ffffff', '#50514d', '#50514d', '#50514d', '#50514d', '#50514d', '#1bb86b', '#1bb86b', '#1bb86b', '#1bb86b', '#1bb86b', '#1bb86b', '#1bb86b', '#1bb86b', '#50514d', '#50514d', '#50514d', '#50514d', '#50514d', '#50514d', '#50514d', '#a2a49f', '#ffffff', '#ffffff', '#facDC7', '#ffffff', '#ffffff', '#ffffff', '#ffffff', '#74eefd', '#74eefd', '#74eefd', '#ffffff', '#facDC7', '#ffffff', '#ffffff', '#a2a49f', '#50514d', '#50514d', '#50514d', '#50514d', '#50514d', '#1bb86b', '#1bb86b', '#1bb86b', '#1bb86b', '#1bb86b', '#1bb86b', '#1bb86b', '#1bb86b', '#50514d', '#50514d', '#50514d', '#50514d', '#50514d', '#50514d', '#50514d', '#50514d', '#ffffff', '#ffffff', '#ffffff', '#ffffff', '#ffffff', '#ffffff', '#ffffff', '#ffffff', '#74eefd', '#ffffff', '#ffffff', '#ffffff', '#ffffff', '#ffffff', '#1bb86b', '#1bb86b', '#1bb86b', '#1bb86b', '#1bb86b', '#1bb86b', '#1bb86b', '#1bb86b', '#1bb86b', '#1bb86b', '#1bb86b', '#1bb86b', '#1bb86b', '#1bb86b', '#1bb86b', '#1bb86b', '#1bb86b', '#1bb86b', '#1bb86b', '#1bb86b', '#1bb86b', '#1bb86b', '#1bb86b', '#1bb86b', '#ffffff', '#ffffff', '#ffffff', '#ffffff', '#ffffff', '#ffffff', '#ffffff', '#ffffff', '#ffffff', '#ffffff', '#1bb86b', '#1bb86b', '#1bb86b', '#1bb86b', '#1bb86b', '#1bb86b', '#1bb86b', '#1bb86b', '#1bb86b', '#1bb86b', '#1bb86b', '#1bb86b', '#1bb86b', '#1bb86b', '#1bb86b', '#1bb86b', '#1bb86b', '#1bb86b', '#1bb86b', '#1bb86b', '#1bb86b', '#1bb86b', '#1bb86b', '#1bb86b', '#1bb86b', '#1bb86b', '#1bb86b', '#1bb86b', '#1bb86b', '#1bb86b', '#1bb86b', '#1bb86b', '#1bb86b', '#1bb86b', '#1bb86b', '#1bb86b', '#1bb86b', '#1bb86b', '#1bb86b', '#1bb86b', '#1bb86b', '#1bb86b', '#1bb86b', '#1bb86b', '#1bb86b', '#1bb86b', '#1bb86b', '#1bb86b', '#1bb86b', '#1bb86b', '#1bb86b', '#1bb86b', '#1bb86b', '#1bb86b', '#1bb86b', '#1bb86b', '#1bb86b', '#1bb86b', '#1bb86b', '#1bb86b', '#1bb86b', '#1bb86b', '#1bb86b', '#1bb86b', '#1bb86b', '#1bb86b', '#1bb86b', '#1bb86b', '#1bb86b', '#1bb86b', '#1bb86b', '#1bb86b', '#1bb86b', '#1bb86b', '#1bb86b', '#1bb86b', '#1bb86b', '#1bb86b', '#1bb86b', '#1bb86b', '#1bb86b', '#1bb86b', '#1bb86b', '#1bb86b', '#1bb86b', '#1bb86b', '#1bb86b', '#1bb86b', '#1bb86b', '#1bb86b', '#1bb86b', '#1bb86b', '#1bb86b', '#1bb86b', '#1bb86b', '#1bb86b', '#1bb86b', '#1bb86b', '#1bb86b', '#1bb86b', '#1bb86b', '#1bb86b', '#1bb86b', '#1bb86b', '#1bb86b', '#1bb86b', '#1bb86b', '#1bb86b', '#1bb86b', '#1bb86b', '#1bb86b', '#1bb86b', '#1bb86b', '#1bb86b', '#1bb86b', '#1bb86b', '#1bb86b', '#1bb86b', '#1bb86b', '#1bb86b', '#1bb86b', '#1bb86b', '#1bb86b', '#1bb86b', '#1bb86b', '#1bb86b', '#1bb86b', '#1bb86b', '#1bb86b', '#1bb86b', '#1bb86b', '#1bb86b', '#1bb86b', '#1bb86b', '#1bb86b', '#1bb86b', '#1bb86b', '#1bb86b', '#1bb86b', '#1bb86b', '#1bb86b', '#1bb86b', '#1bb86b', '#1bb86b', '#1bb86b', '#1bb86b', '#1bb86b', '#1bb86b', '#1bb86b', '#1bb86b', '#1bb86b', '#1bb86b', '#1bb86b', '#1bb86b', '#1bb86b', '#1bb86b', '#1bb86b', '#1bb86b', '#1bb86b']
10 | const v1=[]
11 | const shuffleIndex = [...Array(720).keys()].sort(function() {
12 | return .5 - Math.random();
13 | })
14 |
15 | /* 用户染色 setcolor 函数然后就染色 getcolor */
16 |
17 | /*claim 获取方框所有权*/
18 |
19 | /* 应该是是像充值购买一样的东西吧,我充值购买代币然后可以花钱控制一个色块多久不变色 话题停留多久吧 这样才会好写一点*/
20 | /*最后要截图,要重新开始,页面要刷新,色块颜色变化,*/
21 | /* 把之前方块之前的颜色去掉 不按确定就不正式修改*/
22 | function Board(props){
23 |
24 | const lockTime=10000
25 | const rows = props.rows
26 | const cols = props.cols
27 | const [visible,setVisible] = useState(false)
28 | const [colors, setColors] = useState(Array(rows*cols).fill('#FFFFFF'))
29 | //const [colors, setColors] = useState(v)
30 | const [choosei,setChoosei]=useState(0)
31 | const [chooser,setChooser]=useState(0)
32 | const [choosec,setChoosec]=useState(0)
33 | const [org,setOrg]=useState('#FFFFFF')
34 | const [lock,setLock]=useState(Array(rows*cols).fill(false))
35 | //var show_board=[]
36 | /* function painting(){
37 | [...Array(720).keys()].forEach((i)=>{setTimeout(()=>{const colors1=colors.slice();
38 | //console.log('第几个',chooser*cols+choosec,chooser,choosec)
39 | colors1[shuffleIndex[i]] = v[shuffleIndex[i]];
40 | setColors(colors1);setColors()},1000*i)})
41 |
42 | }*/
43 |
44 | function lockUp(index){
45 | const lock1=lock.slice();
46 |
47 | lock1[index] = !lock[index]
48 | setLock(lock1)
49 | setTimeout(()=>{
50 | const lock1=lock.slice()
51 | lock1[index] = !lock[index]
52 | },lockTime)
53 |
54 | }
55 | function changeColor(color){
56 | var c=false
57 | if (!lock[chooser*cols+choosec]){
58 | const colors1=colors.slice();
59 | //console.log('第几个',chooser*cols+choosec,chooser,choosec)
60 | colors1[chooser*cols+choosec] = color;
61 | setColors(colors1);
62 | //console.log('changecolor',colors)
63 | }else{
64 | alert('The square is locked and cannot be changed in color')
65 | return 'close'
66 | }
67 |
68 | }
69 |
70 | function restart(){
71 | /*保存现在数据发送*/
72 | setColors(Array(rows*cols).fill('#FFFFFF'))
73 | setLock(Array(rows*cols).fill(false))
74 | }
75 |
76 | function handleClick(r,j){
77 |
78 | console.log('点击',r,j,visible)
79 |
80 | if (!visible){
81 | console.log('点击',r,j,visible)
82 | setOrg(colors[chooser*cols+choosec])
83 | setVisible(!visible)
84 | setChooser(r)
85 | setChoosec(j)
86 | setChoosei(r*cols+j)
87 | }
88 |
89 |
90 | }
91 | function close(){
92 | console.log(11);
93 | if (visible){
94 | setVisible(!visible)}
95 | }
96 | function BoardRow(props){
97 | const r=props.r
98 | const cols=props.cols
99 | const colors=props.colors
100 | const handleClick = props.handleClick
101 | const choosei =props.choosei
102 | //console.log(handleClick)
103 |
104 | const listItem= [...Array(cols).keys()].map((index,j)=>{return