File size: 42,438 Bytes
f998fcd
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
// This contract is part of Zellic’s smart contract dataset, which is a collection of publicly available contract code gathered as of March 2023.

pragma solidity ^0.8.0;
interface IERC165 {
	function supportsInterface(bytes4 interfaceId) external view returns(bool);
}

pragma solidity ^0.8.0;
interface IERC721 is IERC165 {
	event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);
	event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);
	event ApprovalForAll(address indexed owner, address indexed operator, bool approved);

	function balanceOf(address owner) external view returns(uint256 balance);
	function ownerOf(uint256 tokenId) external view returns(address owner);
	function safeTransferFrom(address from, address to, uint256 tokenId) external;
	function transferFrom(address from, address to, uint256 tokenId) external;
	function approve(address to, uint256 tokenId) external;
	function getApproved(uint256 tokenId) external view returns(address operator);
	function setApprovalForAll(address operator, bool _approved) external;
	function isApprovedForAll(address owner, address operator) external view returns(bool);
	function safeTransferFrom(address from, address to, uint256 tokenId, bytes calldata data) external;
}

pragma solidity ^0.8.0;
interface IERC721Receiver {
	function onERC721Received(address operator, address from, uint256 tokenId, bytes calldata data) external returns(bytes4);
}

pragma solidity ^0.8.0;
interface IERC721Metadata is IERC721 {
	function name() external view returns(string memory);
	function symbol() external view returns(string memory);
	function tokenURI(uint256 tokenId) external view returns(string memory);
}

pragma solidity ^0.8.0;
library Address {
	function isContract(address account) internal view returns(bool) {
		uint256 size;
		assembly {
			size := extcodesize(account)
		}
		return size > 0;
	}

	function sendValue(address payable recipient, uint256 amount) internal {
		require(address(this).balance >= amount, "Insufficient balance");
		(bool success, ) = recipient.call{value: amount}("");
		require(success, "Address: unable to send value, recipient may have reverted");
	}

	function functionCall(address target, bytes memory data) internal returns(bytes memory) {
		return functionCall(target, data, "Address: low-level call failed");
	}

	function functionCall(address target, bytes memory data, string memory errorMessage) internal returns(bytes memory) {
		return functionCallWithValue(target, data, 0, errorMessage);
	}

	function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns(bytes memory) {
		return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
	}

	function functionCallWithValue(address target, bytes memory data, uint256 value, string memory errorMessage) internal returns(bytes memory) {
		require(address(this).balance >= value, "Insufficient balance!");
		require(isContract(target), "Address: call to non-contract");

		(bool success, bytes memory returndata) = target.call{value: value}(data);

		return verifyCallResult(success, returndata, errorMessage);

	}



	function functionStaticCall(address target, bytes memory data) internal view returns(bytes memory) {

		return functionStaticCall(target, data, "Address: low-level static call failed");

	}



	function functionStaticCall( address target, bytes memory data, string memory errorMessage) internal view returns(bytes memory) {

		require(isContract(target), "Address: static call to non-contract");

		(bool success, bytes memory returndata) = target.staticcall(data);

		return verifyCallResult(success, returndata, errorMessage);

	}



	function functionDelegateCall(address target, bytes memory data) internal returns(bytes memory) {

		return functionDelegateCall(target, data, "Address: low-level delegate call failed");

	}



	function functionDelegateCall(address target, bytes memory data, string memory errorMessage) internal returns(bytes memory) {

		require(isContract(target), "Address: delegate call to non-contract");

		(bool success, bytes memory returndata) = target.delegatecall(data);

		return verifyCallResult(success, returndata, errorMessage);

	}



	function verifyCallResult(bool success, bytes memory returndata, string memory errorMessage) internal pure returns(bytes memory) {

		if(success) {

			return returndata;

		}

		else {

			if(returndata.length > 0) {

				assembly {

					let returndata_size := mload(returndata)

					revert(add(32, returndata), returndata_size)

				}

			}

			else {

				revert(errorMessage);

			}

		}

	}

}



pragma solidity ^0.8.0;

abstract contract Context {

	function _msgSender() internal view virtual returns(address) {

		return msg.sender;

	}



	function _msgData() internal view virtual returns(bytes calldata) {

		return msg.data;

	}

}



pragma solidity ^0.8.0;

library Strings {

	bytes16 private constant _HEX_SYMBOLS = "0123456789abcdef";



	function toString(uint256 value) internal pure returns(string memory) {

		if(value == 0) {

			return "0";

		}

		uint256 temp = value;

		uint256 digits;

		while (temp != 0) {

			digits++;

			temp /= 10;

		}

		bytes memory buffer = new bytes(digits);

		while (value != 0) {

			digits -= 1;

			buffer[digits] = bytes1(uint8(48 + uint256(value % 10)));

			value /= 10;

		}

		return string(buffer);

	}



	function toHexString(uint256 value) internal pure returns(string memory) {

		if(value == 0) {

			return "0x00";

		}

		uint256 temp = value;

		uint256 length = 0;

		while (temp != 0) {

			length++;

			temp >>= 8;

		}

		return toHexString(value, length);

	}



	function toHexString(uint256 value, uint256 length) internal pure returns(string memory) {

		bytes memory buffer = new bytes(2 * length + 2);

		buffer[0] = "0";

		buffer[1] = "x";

		for (uint256 i = 2 * length + 1; i > 1; --i) {

			buffer[i] = _HEX_SYMBOLS[value & 0xf];

			value >>= 4;

		}

		require(value == 0, "Strings: hex length insufficient");

		return string(buffer);

	}

}



pragma solidity ^0.8.0;

abstract contract ERC165 is IERC165 {

	function supportsInterface(bytes4 interfaceId) public view virtual override returns(bool) {

		return interfaceId == type(IERC165).interfaceId;

	}

}



pragma solidity ^0.8.0;

contract ERC721 is Context, ERC165, IERC721, IERC721Metadata {

	using Address for address;

	using Strings for uint256;



	string private _name;

	string private _symbol;

	string private _description;

	mapping(uint256 => address) private _owners;

	mapping(address => uint256) private _balances;

	mapping(uint256 => address) private _tokenApprovals;

	mapping(address => mapping(address => bool)) private _operatorApprovals;



	constructor(string memory name_, string memory symbol_, string memory description_) {

		//_name = name_;

		//_symbol = symbol_;

		//_description = description_;

	}



	function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165, IERC165) returns(bool) {

		return

		interfaceId == type(IERC721).interfaceId ||

		interfaceId == type(IERC721Metadata).interfaceId ||

		super.supportsInterface(interfaceId);

	}



	function balanceOf(address owner) public view virtual override returns(uint256) {

		require(owner != address(0), "ERC721: balance query for the zero address");

		return _balances[owner];

	}



	function ownerOf(uint256 tokenId) public view virtual override returns(address) {

		address owner = _owners[tokenId];

		require(owner != address(0), "Not minted yet!");

		return owner;

	}



	function name() public view virtual override returns(string memory) {

		// Overriden

		return "";

	}



	function symbol() public view virtual override returns(string memory) {

		// Overriden

		return "";

	}



	function tokenURI(uint256 tokenId) public view virtual override returns(string memory) {

		//Overriden

		return "";

	}



	function _baseURI() internal view virtual returns(string memory) {

		// Overriden

		return "";

	}



	function approve(address to, uint256 tokenId) public virtual override {

		address owner = ERC721.ownerOf(tokenId);

		require(to != owner, "Not authorized!");

		require(

			_msgSender() == owner || isApprovedForAll(owner, _msgSender()),

				"Not authorized!"

		);

		_approve(to, tokenId);

	}



	function getApproved(uint256 tokenId) public view virtual override returns(address) {

		require(_exists(tokenId), "Nonexistent token!");

		return _tokenApprovals[tokenId];

	}



	function setApprovalForAll(address operator, bool approved) public virtual override {

		require(operator != _msgSender(), "ERC721: approve to caller");

		_operatorApprovals[_msgSender()][operator] = approved;

		emit ApprovalForAll(_msgSender(), operator, approved);

	}



	function isApprovedForAll(address owner, address operator) public view virtual override returns(bool) {

		return _operatorApprovals[owner][operator];

	}



	function transferFrom(address from, address to, uint256 tokenId) public virtual override {

		//solhint-disable-next-line max-line-length

		require(_isApprovedOrOwner(_msgSender(), tokenId), "Not authorized!");

		_transfer(from, to, tokenId);

	}



	function safeTransferFrom(address from, address to, uint256 tokenId) public virtual override {

		safeTransferFrom(from, to, tokenId, "");

	}



	function safeTransferFrom(address from, address to, uint256 tokenId, bytes memory _data) public virtual override {

		require(_isApprovedOrOwner(_msgSender(), tokenId), "Not authorized!");

		_safeTransfer(from, to, tokenId, _data);

	}



	function _safeTransfer(address from, address to, uint256 tokenId, bytes memory _data) internal virtual {

		_transfer(from, to, tokenId);

		require(_checkOnERC721Received(from, to, tokenId, _data), "Attempted transfer to non ERC721Receiver implementer!");

	}



	function _exists(uint256 tokenId) internal view virtual returns(bool) {

		return _owners[tokenId] != address(0);

	}



	function _isApprovedOrOwner(address spender, uint256 tokenId) internal view virtual returns(bool) {

		require(_exists(tokenId), "Token does not exist!");

		address owner = ERC721.ownerOf(tokenId);

		return (spender == owner || getApproved(tokenId) == spender || isApprovedForAll(owner, spender));

	}



	function _safeMint(address to, uint256 tokenId) internal virtual {

		_safeMint(to, tokenId, "");

	}



	function _safeMint(address to, uint256 tokenId, bytes memory _data) internal virtual {

		_mint(to, tokenId);

		require(

			_checkOnERC721Received(address(0), to, tokenId, _data),

				"ERC721: transfer to non ERC721Receiver implementer"

		);

	}



	function _mint(address to, uint256 tokenId) internal virtual {

		_balances[to] += 1;

		_owners[tokenId] = to;

		emit Transfer(address(0), to, tokenId);

	}



	function _burn(uint256 tokenId) internal virtual {

		require(tokenId != tokenId, "Disabled!");

	}



	function _transfer(address from, address to, uint256 tokenId) internal virtual {

		require(ERC721.ownerOf(tokenId) == from, "Not authorized!");

		require(to != address(0), "Cannot transfer to zero addy!");

		require(to != address(0), "Cannot transfer to zero addy!");

		_approve(address(0), tokenId);

		_balances[from] -= 1;

		_balances[to] += 1;

		_owners[tokenId] = to;

		emit Transfer(from, to, tokenId);

	}



	function _approve(address to, uint256 tokenId) internal virtual {

		_tokenApprovals[tokenId] = to;

		emit Approval(ERC721.ownerOf(tokenId), to, tokenId);

	}



	function _checkOnERC721Received(address from, address to, uint256 tokenId, bytes memory _data) private returns(bool) {

		if(to.isContract()) {

			try IERC721Receiver(to).onERC721Received(_msgSender(), from, tokenId, _data) returns(bytes4 retval) {

				return retval == IERC721Receiver.onERC721Received.selector;

			} catch (bytes memory reason) {

				if(reason.length == 0) {

					revert("ERC721: transfer to non ERC721Receiver implementer");

				} else {

					assembly {

						revert(add(32, reason), mload(reason))

					}

				}

			}

		}

		else {

			return true;

		}

	}

}



pragma solidity ^0.8.0;

abstract contract ERC721Burnable is Context, ERC721 {

	function burn(uint256 tokenId) public virtual {

		//solhint-disable-next-line max-line-length

		require(_isApprovedOrOwner(_msgSender(), tokenId), "Not authorized!");

		_burn(tokenId);

	}

}



pragma solidity ^0.8.0;



pragma solidity ^0.8.0;

library SafeMath {

	function add(uint256 a, uint256 b) internal pure returns(uint256) {

		uint256 c = a + b;

		require(c >= a, "Addition overflow!");



		return c;

	}



	function sub(uint256 a, uint256 b) internal pure returns(uint256) {

		require(b <= a, "Subtraction overflow!");

		uint256 c = a - b;



		return c;

	}



	function mul(uint256 a, uint256 b) internal pure returns(uint256) {

		// Gas optimization: this is cheaper than requiring 'a' not being zero, but the

		// benefit is lost if 'b' is also tested.

		// See: https://github.com/OpenZeppelin/openzeppelin-solidity/pull/522

		if(a == 0) {

			return 0;

		}



		uint256 c = a * b;

		require(c / a == b, "Multiplication overflow!");



		return c;

	}



	function div(uint256 a, uint256 b) internal pure returns(uint256) {

		// Solidity only automatically asserts when dividing by 0

		require(b > 0, "Division by zero!");

		uint256 c = a / b;

		// assert(a == b * c + a % b); // There is no case in which this doesn't hold



		return c;

	}



	function mod(uint256 a, uint256 b) internal pure returns(uint256) {

		require(b != 0, "Modulo by zero!");

		return a % b;

	}

}



pragma solidity ^0.8.0;



/**

 * @dev The contract has an owner address, and provides basic authorization control whitch

 * simplifies the implementation of user permissions. This contract is based on the source code at:

 * https://github.com/OpenZeppelin/openzeppelin-solidity/blob/master/contracts/ownership/Ownable.sol

 */

contract Ownable {



	/**

	 * @dev Error constants.

	 */

	string public constant NOT_CURRENT_OWNER = "018001";

	string public constant CANNOT_TRANSFER_TO_ZERO_ADDRESS = "018002";



	/**

	 * @dev Current owner address.

	 */

	address public owner;



	/**

	 * @dev An event which is triggered when the owner is changed.

	 * @param previousOwner The address of the previous owner.

	 * @param newOwner The address of the new owner.

	 */

	event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);



	/**

	 * @dev The constructor sets the original `owner` of the contract to the sender account.

	 */

	constructor() {

		owner = msg.sender;

	}



	/**

	 * @dev Throws if called by any account other than the owner.

	 */

	modifier onlyOwner() {

		require(msg.sender == owner, NOT_CURRENT_OWNER);

		_;

	}



	/**

	 * @dev Allows the current owner to transfer control of the contract to a newOwner.

	 * @param _newOwner The address to transfer ownership to.

	 */

	function transferOwnership(address _newOwner) public onlyOwner {

		require(_newOwner != address(0), CANNOT_TRANSFER_TO_ZERO_ADDRESS);

		emit OwnershipTransferred(owner, _newOwner);

		owner = _newOwner;

	}

}



pragma solidity ^0.8.0;



/**

 * @dev Interface of the ERC20 standard as defined in the EIP.

 */

interface IERC20 {

	/**

	 * @dev Emitted when `value` tokens are moved from one account (`from`) to

	 * another (`to`).

	 *

	 * Note that `value` may be zero.

	 */

	event Transfer(address indexed from, address indexed to, uint256 value);

	

	/**

	 * @dev Emitted when the allowance of a `spender` for an `owner` is set by

	 * a call to {approve}. `value` is the new allowance.

	 */

	event Approval(address indexed owner, address indexed spender, uint256 value);

	

	/**

	 * @dev Returns the amount of tokens in existence.

	 */

	function totalSupply() external view returns (uint256);

	

	/**

	 * @dev Returns the amount of tokens owned by `account`.

	 */

	function balanceOf(address account) external view returns (uint256);

	

	/**

	 * @dev Moves `amount` tokens from the caller's account to `to`.

	 *

	 * Returns a boolean value indicating whether the operation succeeded.

	 *

	 * Emits a {Transfer} event.

	 */

	function transfer(address to, uint256 amount) external returns (bool);

	

	/**

	 * @dev Returns the remaining number of tokens that `spender` will be

	 * allowed to spend on behalf of `owner` through {transferFrom}. This is

	 * zero by default.

	 *

	 * This value changes when {approve} or {transferFrom} are called.

	 */

	function allowance(address owner, address spender) external view returns (uint256);

	

	/**

	 * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.

	 *

	 * Returns a boolean value indicating whether the operation succeeded.

	 *

	 * IMPORTANT: Beware that changing an allowance with this method brings the risk

	 * that someone may use both the old and the new allowance by unfortunate

	 * transaction ordering. One possible solution to mitigate this race

	 * condition is to first reduce the spender's allowance to 0 and set the

	 * desired value afterwards:

	 * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729

	 *

	 * Emits an {Approval} event.

	 */

	function approve(address spender, uint256 amount) external returns (bool);

	

	/**

	 * @dev Moves `amount` tokens from `from` to `to` using the

	 * allowance mechanism. `amount` is then deducted from the caller's

	 * allowance.

	 *

	 * Returns a boolean value indicating whether the operation succeeded.

	 *

	 * Emits a {Transfer} event.

	 */

	function transferFrom(

		address from,

		address to,

		uint256 amount

	) external returns (bool);

}





pragma solidity ^0.8.0;



contract BURNER is Context, ERC721Burnable {

	event ReceivedRoyalties(address indexed creator, address indexed buyer, uint256 indexed amount);

	using SafeMath for uint256;

	bytes4 public constant _INTERFACE_ID_ERC2981 = 0x2a55205a;



	uint256 private _royaltiesPercentage = 7;

	uint256 private _mintFee = 10000000000000000; //0.01 ETH

	uint256 private _maxCap = 256;

	uint256 private _maxMintPerWallet = 25;

	uint256 private _mintedTokens = 0;

	address private _smartContractOwner = 0x4DaE7E6c0Ca196643012cDc526bBc6b445A2ca59;

	address private _smartContractCopilot = 0x4DaE7E6c0Ca196643012cDc526bBc6b445A2ca59;

	string private _name = "";

	string private _symbol = "";

	string private _description = "";

	string private _basePath = "https://crashblossom.co/burner/"; //returns the base path.

	string private _projectURI = ""; // Home web page, please leave it empty unless it's stored on a new path.

	string private _contractURI = "contract.php"; //return a JSON with the metadata of the contract.

	string private _baseTokenURI = "token.php"; //return a JSON with the metadata of any given token.

	string private _animationURI = "presentation.php"; //animation_url, it mixes and shows the final image dynamically.

	string private _tokenStaticImagePath = "assets/covers/";

	string private _banner_collection_URI = "assets/img/banner.jpg"; //Collection's banner.

	string private _contractImageURI = "assets/img/icon.jpg"; //Collection's icon.

	uint[16] _arrayGasTiers = [0, 3, 6, 9, 12, 15, 20, 65535]; //Tiers for layers 1-7. Layer 0 is base layer, always on. Layers 8 and 9 are special.

	mapping(uint => uint) private _tokenIdTracker;

	bool private _paused = false;

	bool private _frozen = false;



	string private _strNotAuthorized = "Not authorized!";

	string private _strIDOutBounds = "ID out of bounds!";

	string private _strIndexOutOfBounds = "Index out of bounds!";

	string private _strNotMintedYet = "Not minted yet!";

	string private _strPaused = "Contract is paused!";

	string private _strFrozen = "Contract is frozen!";



	string private _str1Block = "High Speed";

	string private _str2Block = "Medium Speed";

	string private _str4Block = "Low Speed";



	string private _jsCode = "";

	string private _ipfsLayers = "";

	string private _serverRepo = "";



	// CONSTRUCTOR

	constructor(string memory name, string memory symbol, string memory description) ERC721(name, symbol, description) {

		_name = name;

		_symbol = symbol;

		_description = description;

		_smartContractOwner = _msgSender();

	}



	// INTERNAL AUX FUNCTIONS



	function char(bytes1 b) internal pure returns(bytes1 c) {

		if(uint8(b) < 10) return bytes1(uint8(b) + 0x30);

		else return bytes1(uint8(b) + 0x57);

	}



	function _getGasTier(uint gasCost) private view returns(uint) {

		uint retValue = 7;

		for(uint i = 0; i < 7; i++) {

			if(gasCost > _arrayGasTiers[i] && gasCost <= _arrayGasTiers[i + 1]) {

				retValue = i;

				break;

			}

		}



		return retValue;

	}



	function _getTokenTier(uint256 _tokenId) private pure returns(uint256) {

		if(_tokenId > 0 && _tokenId < 25) {

			return 3;

		}

		else if(_tokenId > 24 && _tokenId < 77) {

			return 2;

		}

		else {

			return 1;

		}

	}



	function _getTokenTierName(uint256 _tokenId) private pure returns(string memory) {

		if(_tokenId > 0 && _tokenId < 25) {

			return 'Bright';

		}

		else if(_tokenId > 24 && _tokenId < 77) {

			return 'Dark';

		}

		else {

			return 'Collective layers';

		}

	}



	function _getBlocksTierName(uint256 _tokenId) private view returns(string memory) {

		if(_tokenId > 0 && _tokenId < 16) {

			return _str1Block;

		}

		else if(_tokenId > 15 && _tokenId < 22) {

			return _str2Block;

		}

		else if(_tokenId > 21 && _tokenId < 25) {

			return _str4Block;

		}

		else if(_tokenId > 24 && _tokenId < 60) {

			return _str1Block;

		}

		else if(_tokenId > 59 && _tokenId < 72) {

			return _str2Block;

		}

		else if(_tokenId > 71 && _tokenId < 77) {

			return _str4Block;

		}

		else if(_tokenId > 76 && _tokenId < 205) {

			return _str1Block;

		}

		else if(_tokenId > 204 && _tokenId < 246) {

			return _str2Block;

		}

		else if(_tokenId > 245 && _tokenId < 257) {

			return _str4Block;

		}

	}



	function toAsciiString(address x) internal pure returns(string memory) {

		bytes memory s = new bytes(40);

		for (uint i = 0; i < 20; i++) {

			bytes1 b = bytes1(uint8(uint(uint160(x)) / (2**(8*(19 - i)))));

			bytes1 hi = bytes1(uint8(b) / 16);

			bytes1 lo = bytes1(uint8(b) - 16 * uint8(hi));

			s[2*i] = char(hi);

			s[2*i+1] = char(lo);

		}

		return string(s);

	}



	function _uint2str(uint256 _i) internal pure returns(string memory str) {

		if (_i == 0)  {

			return "0";

		}

		uint256 j = _i;

		uint256 length;

		while (j != 0) {

			length++;

			j /= 10;

		}

		bytes memory bstr = new bytes(length);

		uint256 k = length;

		j = _i;

		while (j != 0) {

			bstr[--k] = bytes1(uint8(48 + j % 10));

			j /= 10;

		}

		str = string(bstr);



		return str;

	}



	// GETTERS



	/// @dev Returns the base URL (root folder) of the server storing all the scripts.

	function _basePathURI() internal view virtual returns(string memory) {

		return _basePath;

	}

	

	/// @dev Returns a URI pointing to the token-level JSON.

	function _baseURI() internal view virtual override returns(string memory) {

		return string(abi.encodePacked(_basePath, _baseTokenURI));

	}



	/// @dev Returns a URI pointing to the collection's icon.

	function contractImageURI() public view returns(string memory) {

		return string(abi.encodePacked(_basePath, _contractImageURI));

	}



	/// @dev Returns a URI pointing to the contract-level JSON.

	function contractURI() public view returns(string memory) {

		return string(abi.encodePacked(_basePath, _contractURI));

	}

	

	/// @dev Returns the description of the project.

	function description() public view returns(string memory) {

		return _description;

	}



	/// @dev Returns the max amount of allowed mints per wallet.

	function _getMaxMintsPerWallet() public view returns(uint) {

		return _maxMintPerWallet;

	}

	

	/// @dev Returns a string that can be the actual JSON listing of all the IPFS layers, or a URI pointing at it.

	function getIPFSJSON() public view returns(string memory) {

		return _ipfsLayers;

	}

	

	/// @dev Returns a string that can be the actual JS code or a URI pointing at it.

	function getJSCode() public view returns(string memory) {

		return _jsCode;

	}

	

	/// @dev Returns a URI pointing to a remote repo holding all the server-side scripts.

	function getRemoteRepo() public view returns(string memory) {

		return _serverRepo;

	}



	/// @dev Returns a boolean telling whether this contract has royalties or not.

	function hasRoyalties() public pure returns(bool) {

		return true;

	}



	/// @dev Returns the max amount of tokens this contract can hold (256).

	function maxCap() public view returns(uint256) {

		return _maxCap;

	}



	/// @dev Returns the mint fee, expressed in wei.

	function mintfee() public view returns(uint256) {

		return _mintFee;

	}



	/// @dev Returns the name of the project (BURNER).

	function name() public view override returns(string memory) {

		return _name;

	}



	/// @dev Returns a JSON containing all the contract-level data.

	function retrieveContractMetadata() public view returns(string memory data) {

		bytes memory json;

		uint royalties = _royaltiesPercentage * 100;



		json = abi.encodePacked('{', '"name": "');

		json = abi.encodePacked(json, _name);

		json = abi.encodePacked(json, '"');



		json = abi.encodePacked(json, ', ');

		json = abi.encodePacked(json, '"description": "');

		json = abi.encodePacked(json, _description);

		json = abi.encodePacked(json, '"');



		json = abi.encodePacked(json, ', ');

		json = abi.encodePacked(json, '"image": "');

		json = abi.encodePacked(json, _basePath);

		json = abi.encodePacked(json, _contractImageURI);

		json = abi.encodePacked(json, '"');



		json = abi.encodePacked(json, ', ');

		json = abi.encodePacked(json, '"external_link": "');

		json = abi.encodePacked(json, _basePath);

		json = abi.encodePacked(json, _projectURI);

		json = abi.encodePacked(json, '"');



		json = abi.encodePacked(json, ', ');

		json = abi.encodePacked(json, '"banner_image_url": "');

		json = abi.encodePacked(json, _basePath);

		json = abi.encodePacked(json, _banner_collection_URI);

		json = abi.encodePacked(json, '"');



		json = abi.encodePacked(json, ', ');

		json = abi.encodePacked(json, '"seller_fee_basis_points": ');

		json = abi.encodePacked(json, _uint2str(royalties));



		json = abi.encodePacked(json, ', ');

		json = abi.encodePacked(json, '"fee_recipient": "');

		json = abi.encodePacked(json, toAsciiString(_smartContractOwner));

		json = abi.encodePacked(json, '"');



		json = abi.encodePacked(json, '}');



		return string(json);

	}



	/// @dev Returns a list of all the minted tokens so far.

	///      Note: Return value is an array containing all the tokenIDs stored onchain. Unconfirmed tx will not show up here.

	function retrieveTokenIDList() public view returns(string memory data) {

		bytes memory json;



		json = abi.encodePacked('[');



		if(_mintedTokens > 0) {

			for(uint i = 1; i <= _mintedTokens; i++) {

				if(i == 1) {

					json = abi.encodePacked(json, _uint2str(_tokenIdTracker[i]));

				}

				else {

					json = abi.encodePacked(json, ',', _uint2str(_tokenIdTracker[i]));

				}

			}

		}



		json = abi.encodePacked(json, ']');



		return string(json);

	}



	/// @dev Returns a JSON containing all the associated data to a given token.

	/// @param _tokenId Token ID.

	function retrieveData(uint256 _tokenId) external view returns(string memory data) {

		// This function returns the metadata of a given token.

		require(_tokenId > 0, _strIDOutBounds);

		require(_tokenId <= _maxCap, _strIDOutBounds);

		require(_exists(_tokenId), _strNotMintedYet);



		uint256 rarity = 0;

		bytes memory json;



		rarity = _getTokenTier(_tokenId);



		json = abi.encodePacked('{', '"name": "');

		json = abi.encodePacked(json, _symbol);

		json = abi.encodePacked(json, ' #');

		json = abi.encodePacked(json, _uint2str(_tokenId));

		json = abi.encodePacked(json, '"');

		json = abi.encodePacked(json, ', ');

		json = abi.encodePacked(json, '"description": "');

		json = abi.encodePacked(json, _description);

		json = abi.encodePacked(json, ' Artist: crashblossom, Dev: Ariel Becker.');

		json = abi.encodePacked(json, '"');

		json = abi.encodePacked(json, ', ');

		json = abi.encodePacked(json, '"owner": "0x');

		json = abi.encodePacked(json, toAsciiString(ownerOf(_tokenId)));

		json = abi.encodePacked(json, '"');

		json = abi.encodePacked(json, ', ');

		json = abi.encodePacked(json, '"external_url": "');

		json = abi.encodePacked(json, _basePath);

		json = abi.encodePacked(json, _animationURI);

		json = abi.encodePacked(json, '?t=0&local=1&id=');

		json = abi.encodePacked(json, _uint2str(_tokenId));

		json = abi.encodePacked(json, '"');

		json = abi.encodePacked(json, ', ');

		json = abi.encodePacked(json, '"animation_url": "');

		json = abi.encodePacked(json, _basePath);

		json = abi.encodePacked(json, _animationURI);

		json = abi.encodePacked(json, '?t=1&id=');

		json = abi.encodePacked(json, _uint2str(_tokenId));

		json = abi.encodePacked(json, '"');

		json = abi.encodePacked(json, ', ');

		json = abi.encodePacked(json, '"image": "');

		json = abi.encodePacked(json, _basePath);

		json = abi.encodePacked(json, _tokenStaticImagePath);

		json = abi.encodePacked(json, _uint2str(_tokenId));

		json = abi.encodePacked(json, '.jpg');

		json = abi.encodePacked(json, '"');

		json = abi.encodePacked(json, ', ');

		json = abi.encodePacked(json, '"attributes": [');



		json = abi.encodePacked(json, '{');

		json = abi.encodePacked(json, '"trait_type": "Speed"');

		json = abi.encodePacked(json, ', ');

		json = abi.encodePacked(json, '"value": "');

		json = abi.encodePacked(json, _getBlocksTierName(_tokenId));

		json = abi.encodePacked(json, '"');

		json = abi.encodePacked(json, '},');



		json = abi.encodePacked(json, '{');

		json = abi.encodePacked(json, '"trait_type": "Layer"');

		json = abi.encodePacked(json, ', ');

		json = abi.encodePacked(json, '"value": "Shared"');

		json = abi.encodePacked(json, '}');



		if(rarity == 2 || rarity == 3) {

			json = abi.encodePacked(json, ', ');

			json = abi.encodePacked(json, '{');

			json = abi.encodePacked(json, '"trait_type": "Layer"');

			json = abi.encodePacked(json, ', ');

			json = abi.encodePacked(json, '"value": "Dark"');

			json = abi.encodePacked(json, '}');

		}

		if(rarity == 3) {

			json = abi.encodePacked(json, ', ');

			json = abi.encodePacked(json, '{');

			json = abi.encodePacked(json, '"trait_type": "Layer"');

			json = abi.encodePacked(json, ', ');

			json = abi.encodePacked(json, '"value": "Bright"');

			json = abi.encodePacked(json, '}');

		}



		json = abi.encodePacked(json, ']');

		json = abi.encodePacked(json, '}');



		return string(json);

	}



	/// @dev Returns a URI pointing to the server-side script that will display the animation for any token.

	function _renderURI() internal view virtual returns(string memory) {

		return string(abi.encodePacked(_basePath, _animationURI));

	}



	/// @dev Returns the royalties' percentage assigned to the project.

	function royaltyAmount() public view returns(uint256) {

		return _royaltiesPercentage;

	}



	/// @dev Returns the royalties that will be paid according to token ID and sale price.

	///      Note: Return value is expressed in wei.

	/// @param _tokenId Token ID.

	/// @param _salePrice Sale price, in wei.

	function royaltyInfo(uint256 _tokenId, uint256 _salePrice) external view returns(address receiver, uint256 royaltiesAmount) {

		require(_tokenId > 0, _strIDOutBounds);

		require(_tokenId <= _maxCap, _strIDOutBounds);

		require(_exists(_tokenId), _strNotMintedYet);

		require(_salePrice > 99, "Price is too small!");



		uint256 retValue = _salePrice.div(100).mul(_royaltiesPercentage);

		return(_smartContractOwner, retValue);

	}



	/// @dev Returns a URI pointing to the token's JSON.

	/// @param _tokenId Token ID.

	function tokenURI(uint256 _tokenId) public view virtual override returns(string memory) {

		// Example: https://opensea-creatures-api.herokuapp.com/api/creature/3

		require(_tokenId > 0, _strIDOutBounds);

		require(_tokenId <= _maxCap, _strIDOutBounds);

		require(_exists(_tokenId), _strNotMintedYet);



		string memory baseURI = _baseURI();

		return bytes(baseURI).length > 0 ? string(abi.encodePacked(baseURI, "?id=", Strings.toString(_tokenId))) : "";

	}



	function supportsInterface(bytes4 interfaceId) public view virtual override(ERC721) returns(bool) {

		return interfaceId == 0x2a55205a || super.supportsInterface(interfaceId);

	}



	/// @dev Returns the contract's symbol (BURNER).

	function symbol() public view override returns(string memory) {

		return _symbol;

	}



	/// @dev Returns a URI pointing to the folder containing all the layers images.

	function tokenImageURI() public view returns(string memory) {

		return string(abi.encodePacked(_basePath, _tokenStaticImagePath));

	}



	/// @dev Returns the animation's renderer URI (the one that initializes the JS script).

	/// @param _tokenId Token ID.

	function tokenShowcaseURI(uint _tokenId) public view returns(string memory) {

		require(_tokenId > 0, _strIDOutBounds);

		require(_tokenId <= _maxCap, _strIDOutBounds);

		require(_exists(_tokenId), _strNotMintedYet);

		string memory uri = string(abi.encodePacked(_basePath, _animationURI));

		return bytes(uri).length > 0 ? string(abi.encodePacked(uri, "?t=0&id=", Strings.toString(_tokenId))) : "";

	}



	// SETTERS



	/// @dev Changes the contract's description.

	/// @param _desc New description.

	function changeDescription(string memory _desc) public {

		require(_msgSender() == _smartContractOwner, _strNotAuthorized);

		require(!_frozen, _strFrozen);

		_description = _desc;

	}

	

	/// @dev Freezes the contract, disabling some functions forever.

	///      WARNING: ONCE SET, THIS STATE CANNOT BE REVERSED.

	///      This is the list of functions that will be disabled by it:

	///      changeDescription, setMaxMintsPerWallet, setMintFee, setRoyaltyAmount, setIPFSLayers, setJS, setServerRepoURI.

	function freeze() public virtual {

		require(_msgSender() == _smartContractOwner, _strNotAuthorized);

		require(!_frozen, _strFrozen);

		_frozen = true;

	}



	/// @dev Pauses some functions of the contract, like minting.

	function pause() public virtual {

		require(_msgSender() == _smartContractOwner, _strNotAuthorized);

		require(!_paused, _strPaused);

		_paused = true;

	}



	/// @dev Sets the admin's address.

	/// @param _newAddress New address.

	function setAdmin(address _newAddress) public {

		require((_msgSender() == _smartContractOwner || _msgSender() == _smartContractCopilot), _strNotAuthorized);

		_smartContractOwner = _newAddress;

	}



	/// @dev Sets the base URI for all the relative paths.

	/// @param _uri Base URI.

	function setBasePath(string memory _uri) public {

		require(_msgSender() == _smartContractOwner, _strNotAuthorized);

		_basePath = _uri;

	}



	/// @dev Sets the relative path to token.php (or any other server-side script responsible for rendering the token's JSON).

	/// @param _relativePath Relative path and filename.

	function setBaseTokenURI(string memory _relativePath) public {

		require(_msgSender() == _smartContractOwner, _strNotAuthorized);

		_baseTokenURI = _relativePath;

	}



	/// @dev Sets the relative path to the contract's image.

	/// @param _relativePath Relative path and filename.

	function setContractImage(string memory _relativePath) public {

		require(_msgSender() == _smartContractOwner, _strNotAuthorized);

		_contractImageURI = _relativePath;

	}



	/// @dev Sets the relative path to contract.php (or any other server-side script responsible for rendering the contract's JSON).

	/// @param _relativePath Relative path and filename.

	function setContractURI(string memory _relativePath) public {

		require(_msgSender() == _smartContractOwner, _strNotAuthorized);

		_contractURI = _relativePath;

	}



	/// @dev Sets the maximum amount of tokens a single wallet can mint.

	///      Note: default value is 25.

	/// @param _maxAmount New value, expressed in percent points.

	function setMaxMintsPerWallet(uint256 _maxAmount) public {

		require(_msgSender() == _smartContractOwner, _strNotAuthorized);

		require(!_frozen, _strFrozen);

		require(_maxAmount < 257, "Cannot exceed total supply!");

		require(_maxAmount > 0, "Must be 1 or higher!");

		_maxMintPerWallet = _maxAmount;

	}



	/// @dev Changes the value of the minting fee. Expressed in wei.

	///      Note: default value is 0.01 ETH.

	/// @param _newfee New value, expressed in wei.

	function setMintFee(uint256 _newfee) public {

		require(_msgSender() == _smartContractOwner, _strNotAuthorized);

		require(!_frozen, _strFrozen);

		_mintFee = _newfee;

	}



	/// @dev Relative path for the webpage.

	///      Note: Relative to base URI.

	/// @param _relativePath New relative path.

	function setProjectURI(string memory _relativePath) public {

		require(_msgSender() == _smartContractOwner, _strNotAuthorized);

		_projectURI = _relativePath;

	}



	/// @dev Changes the value of the royalty percentage. Expressed in percent points.

	///      Note: default value is 7.

	/// @param _percentage New value, expressed in percent points.

	function setRoyaltyAmount(uint256 _percentage) public {

		require(_msgSender() == _smartContractOwner, _strNotAuthorized);

		require(!_frozen, _strFrozen);

		_royaltiesPercentage = _percentage;

	}

	

	/// @dev Sets the relative path where all the static imagery (gallery images) for each token is stored.

	/// @param _relativePath Path relative to base URL.

	function setTokenStaticImageURI(string memory _relativePath) public {

		require(_msgSender() == _smartContractOwner, _strNotAuthorized);

		_tokenStaticImagePath = _relativePath;

	}



	/// @dev Sets the relative path where all the dynamic imagery for each token is stored.

	/// @param _relativePath Path relative to base URL.

	function setTokenImageURI(string memory _relativePath) public {

		require(_msgSender() == _smartContractOwner, _strNotAuthorized);

		_animationURI = _relativePath;

	}

	

	/// @dev Stores a JSON containing the list of all the imagery used for the token layers.

	///      Note: It can store the list itself or a URI pointing to the actual list.

	/// @param _json A JSON object containing the list of all the hashes for both full-size and thumbnails, or a URI pointing to a valid JSON.

	function setIPFSLayers(string memory _json) public {

		require(_msgSender() == _smartContractOwner, _strNotAuthorized);

		require(!_frozen, _strFrozen);

		_ipfsLayers = _json;

	}

	

	/// @dev Stores the code of the contract, or a URI pointing to it.

	///      Note: You can minify then ZIP and base64 it to reduce the amount of data. Remember to modify the PHP on the gateway to reflect this.

	/// @param _str URI to the code, or the code itself.

	function setJS(string memory _str) public {

		require(_msgSender() == _smartContractOwner, _strNotAuthorized);

		require(!_frozen, _strFrozen);

		_jsCode = _str;

	}

	

	/// @dev Stores a URI pointing to the server-side code of the project.

	/// @param _uri URI to the repository.

	function setServerRepoURI(string memory _uri) public {

		require(_msgSender() == _smartContractOwner, _strNotAuthorized);

		require(!_frozen, _strFrozen);

		_serverRepo = _uri;

	}

	

	/// @dev Unpauses the contract, allowing some functions to operate again.

	function unpause() public virtual {

		require(_msgSender() == _smartContractOwner, _strNotAuthorized);

		require(_paused, "Contract is already unpaused!");

		_paused = false;

	}



	// MINT AND OTHER FUNCTIONS

	function royaltiesReceived(address _creator, address _buyer, uint256 _amount) external {

		emit ReceivedRoyalties(_creator, _buyer, _amount);

	}



	/// @dev Allows to withdraw any ETH available on this contract.

	///      Note: Only the contract's owner can withdraw.

	function withdraw() public payable {

		require(!_paused, _strPaused);

		require(_msgSender() == _smartContractOwner, _strNotAuthorized);

		uint balance = address(this).balance;

		require(balance > 0, "No ether left to withdraw");

		(bool success, ) = (msg.sender).call{value: balance}("");

		require(success, "Transfer failed.");

	}

	

	/// @dev Allows to withdraw any ERC-20 token sent by error to this contract.

	///      Note: Only the contract's owner can withdraw.

	function withdrawERC20(IERC20 token) public payable {

		require(!_paused, _strPaused);

		require(_msgSender() == _smartContractOwner, _strNotAuthorized);

		require(token.transfer(msg.sender, token.balanceOf(address(this))), "Transfer failed");

	}

	

	/// @dev Mints a random token. Non-admins must pay a fee for it.

	///      Note: The fees are always transferred, even if the user transaction fails.

	function mint() public payable {

		// Shouldn't be paused.

		require(!_paused, _strPaused);

		// Shouldn't attempt to mint more tokens than allowed per address.

		require(ERC721.balanceOf(_msgSender()) < (_maxMintPerWallet), "More than max mints allowed for this addy!");

		// Shouldn't attempt to mint more tokens than the allowed by the contract.

		require(ERC721.balanceOf(_msgSender()) < (_maxCap - _mintedTokens), "This action will surpass the mint cap!");

		// Shouldn't be minted by the zero addy.

		require(_msgSender() != address(0), "Zero address");



		if(_msgSender() != _smartContractOwner) {

			require(msg.value >= _mintFee, "Not enough ETH!");

		}



		bool boolBreakLoop = false;



		while(!boolBreakLoop) {

			//Create a pseudorandom seed in the form of a hash

			bytes32 seed = keccak256(abi.encodePacked(block.timestamp, block.difficulty, _msgSender()));

			// Extract the last byte.

			uint8 _index = uint8(bytes1(seed[0]));

			// Add one so it goes from 1 to 256.

			uint index = _index + 1;



			// And use that index to mint a pseudorandom tokenID.

			if(!_exists(index)) {

				if(index > 0 && index <= _maxCap) {

					_mint(_msgSender(), index);

					_mintedTokens++;

					_tokenIdTracker[_mintedTokens] = index;

					boolBreakLoop = true;

				}

			}

		}

	}

}