-
Notifications
You must be signed in to change notification settings - Fork 1
/
covered.html
3105 lines (3063 loc) · 221 KB
/
covered.html
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
<style> code { white-space: pre-wrap; display: block; background-color: #eee; }.executed { background-color: #afa; }.reverted { background-color: #ffa; }.unexecuted { background-color: #faa; }.neutral { background-color: #eee; }</style><b>/home/rappie/Desktop/targets/origin-dollar/fuzzing-ousd-public/lib/openzeppelin-contracts/contracts/token/ERC20/IERC20.sol</b>
<code>
1 | | <span class='unexecuted'>// SPDX-License-Identifier: MIT</span>
2 | | <span class='neutral'>// OpenZeppelin Contracts v4.4.1 (token/ERC20/IERC20.sol)</span>
3 | | <span class='neutral'></span>
4 | | <span class='neutral'>pragma solidity ^0.8.0;</span>
5 | | <span class='neutral'></span>
6 | | <span class='neutral'>/**</span>
7 | | <span class='neutral'> * @dev Interface of the ERC20 standard as defined in the EIP.</span>
8 | | <span class='neutral'> */</span>
9 | | <span class='neutral'>interface IERC20 {</span>
10 | | <span class='neutral'> /**</span>
11 | | <span class='neutral'> * @dev Returns the amount of tokens in existence.</span>
12 | | <span class='neutral'> */</span>
13 | | <span class='neutral'> function totalSupply() external view returns (uint256);</span>
14 | | <span class='neutral'></span>
15 | | <span class='neutral'> /**</span>
16 | | <span class='neutral'> * @dev Returns the amount of tokens owned by `account`.</span>
17 | | <span class='neutral'> */</span>
18 | | <span class='neutral'> function balanceOf(address account) external view returns (uint256);</span>
19 | | <span class='neutral'></span>
20 | | <span class='neutral'> /**</span>
21 | | <span class='neutral'> * @dev Moves `amount` tokens from the caller's account to `recipient`.</span>
22 | | <span class='neutral'> *</span>
23 | | <span class='neutral'> * Returns a boolean value indicating whether the operation succeeded.</span>
24 | | <span class='neutral'> *</span>
25 | | <span class='neutral'> * Emits a {Transfer} event.</span>
26 | | <span class='neutral'> */</span>
27 | | <span class='neutral'> function transfer(address recipient, uint256 amount) external returns (bool);</span>
28 | | <span class='neutral'></span>
29 | | <span class='neutral'> /**</span>
30 | | <span class='neutral'> * @dev Returns the remaining number of tokens that `spender` will be</span>
31 | | <span class='neutral'> * allowed to spend on behalf of `owner` through {transferFrom}. This is</span>
32 | | <span class='neutral'> * zero by default.</span>
33 | | <span class='neutral'> *</span>
34 | | <span class='neutral'> * This value changes when {approve} or {transferFrom} are called.</span>
35 | | <span class='neutral'> */</span>
36 | | <span class='neutral'> function allowance(address owner, address spender) external view returns (uint256);</span>
37 | | <span class='neutral'></span>
38 | | <span class='neutral'> /**</span>
39 | | <span class='neutral'> * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.</span>
40 | | <span class='neutral'> *</span>
41 | | <span class='neutral'> * Returns a boolean value indicating whether the operation succeeded.</span>
42 | | <span class='neutral'> *</span>
43 | | <span class='neutral'> * IMPORTANT: Beware that changing an allowance with this method brings the risk</span>
44 | | <span class='neutral'> * that someone may use both the old and the new allowance by unfortunate</span>
45 | | <span class='neutral'> * transaction ordering. One possible solution to mitigate this race</span>
46 | | <span class='neutral'> * condition is to first reduce the spender's allowance to 0 and set the</span>
47 | | <span class='neutral'> * desired value afterwards:</span>
48 | | <span class='neutral'> * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729</span>
49 | | <span class='neutral'> *</span>
50 | | <span class='neutral'> * Emits an {Approval} event.</span>
51 | | <span class='neutral'> */</span>
52 | | <span class='neutral'> function approve(address spender, uint256 amount) external returns (bool);</span>
53 | | <span class='neutral'></span>
54 | | <span class='neutral'> /**</span>
55 | | <span class='neutral'> * @dev Moves `amount` tokens from `sender` to `recipient` using the</span>
56 | | <span class='neutral'> * allowance mechanism. `amount` is then deducted from the caller's</span>
57 | | <span class='neutral'> * allowance.</span>
58 | | <span class='neutral'> *</span>
59 | | <span class='neutral'> * Returns a boolean value indicating whether the operation succeeded.</span>
60 | | <span class='neutral'> *</span>
61 | | <span class='neutral'> * Emits a {Transfer} event.</span>
62 | | <span class='neutral'> */</span>
63 | | <span class='neutral'> function transferFrom(</span>
64 | | <span class='neutral'> address sender,</span>
65 | | <span class='neutral'> address recipient,</span>
66 | | <span class='neutral'> uint256 amount</span>
67 | | <span class='neutral'> ) external returns (bool);</span>
68 | | <span class='neutral'></span>
69 | | <span class='neutral'> /**</span>
70 | | <span class='neutral'> * @dev Emitted when `value` tokens are moved from one account (`from`) to</span>
71 | | <span class='neutral'> * another (`to`).</span>
72 | | <span class='neutral'> *</span>
73 | | <span class='neutral'> * Note that `value` may be zero.</span>
74 | | <span class='neutral'> */</span>
75 | | <span class='neutral'> event Transfer(address indexed from, address indexed to, uint256 value);</span>
76 | | <span class='neutral'></span>
77 | | <span class='neutral'> /**</span>
78 | | <span class='neutral'> * @dev Emitted when the allowance of a `spender` for an `owner` is set by</span>
79 | | <span class='neutral'> * a call to {approve}. `value` is the new allowance.</span>
80 | | <span class='neutral'> */</span>
81 | | <span class='neutral'> event Approval(address indexed owner, address indexed spender, uint256 value);</span>
82 | | <span class='neutral'>}</span>
83 | | <span class='neutral'></span>
</code>
<br />
<b>/home/rappie/Desktop/targets/origin-dollar/fuzzing-ousd-public/lib/openzeppelin-contracts/contracts/utils/Address.sol</b>
<code>
1 | | <span class='neutral'>// SPDX-License-Identifier: MIT</span>
2 | | <span class='neutral'>// OpenZeppelin Contracts v4.4.1 (utils/Address.sol)</span>
3 | | <span class='neutral'></span>
4 | | <span class='neutral'>pragma solidity ^0.8.0;</span>
5 | | <span class='neutral'></span>
6 | | <span class='neutral'>/**</span>
7 | | <span class='neutral'> * @dev Collection of functions related to the address type</span>
8 | | <span class='neutral'> */</span>
9 | | <span class='unexecuted'>library Address {</span>
10 | | <span class='neutral'> /**</span>
11 | | <span class='neutral'> * @dev Returns true if `account` is a contract.</span>
12 | | <span class='neutral'> *</span>
13 | | <span class='neutral'> * [IMPORTANT]</span>
14 | | <span class='neutral'> * ====</span>
15 | | <span class='neutral'> * It is unsafe to assume that an address for which this function returns</span>
16 | | <span class='neutral'> * false is an externally-owned account (EOA) and not a contract.</span>
17 | | <span class='neutral'> *</span>
18 | | <span class='neutral'> * Among others, `isContract` will return false for the following</span>
19 | | <span class='neutral'> * types of addresses:</span>
20 | | <span class='neutral'> *</span>
21 | | <span class='neutral'> * - an externally-owned account</span>
22 | | <span class='neutral'> * - a contract in construction</span>
23 | | <span class='neutral'> * - an address where a contract will be created</span>
24 | | <span class='neutral'> * - an address where a contract lived, but was destroyed</span>
25 | | <span class='neutral'> * ====</span>
26 | | <span class='neutral'> */</span>
27 | | <span class='neutral'> function isContract(address account) internal view returns (bool) {</span>
28 | | <span class='neutral'> // This method relies on extcodesize, which returns 0 for contracts in</span>
29 | | <span class='neutral'> // construction, since the code is only stored at the end of the</span>
30 | | <span class='neutral'> // constructor execution.</span>
31 | | <span class='neutral'></span>
32 | | <span class='neutral'> uint256 size;</span>
33 | | <span class='neutral'> assembly {</span>
34 | * | <span class='executed'> size := extcodesize(account)</span>
35 | | <span class='neutral'> }</span>
36 | * | <span class='executed'> return size > 0;</span>
37 | | <span class='neutral'> }</span>
38 | | <span class='neutral'></span>
39 | | <span class='neutral'> /**</span>
40 | | <span class='neutral'> * @dev Replacement for Solidity's `transfer`: sends `amount` wei to</span>
41 | | <span class='neutral'> * `recipient`, forwarding all available gas and reverting on errors.</span>
42 | | <span class='neutral'> *</span>
43 | | <span class='neutral'> * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost</span>
44 | | <span class='neutral'> * of certain opcodes, possibly making contracts go over the 2300 gas limit</span>
45 | | <span class='neutral'> * imposed by `transfer`, making them unable to receive funds via</span>
46 | | <span class='neutral'> * `transfer`. {sendValue} removes this limitation.</span>
47 | | <span class='neutral'> *</span>
48 | | <span class='neutral'> * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].</span>
49 | | <span class='neutral'> *</span>
50 | | <span class='neutral'> * IMPORTANT: because control is transferred to `recipient`, care must be</span>
51 | | <span class='neutral'> * taken to not create reentrancy vulnerabilities. Consider using</span>
52 | | <span class='neutral'> * {ReentrancyGuard} or the</span>
53 | | <span class='neutral'> * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].</span>
54 | | <span class='neutral'> */</span>
55 | | <span class='neutral'> function sendValue(address payable recipient, uint256 amount) internal {</span>
56 | | <span class='neutral'> require(address(this).balance >= amount, "Address: insufficient balance");</span>
57 | | <span class='neutral'></span>
58 | | <span class='neutral'> (bool success, ) = recipient.call{value: amount}("");</span>
59 | | <span class='neutral'> require(success, "Address: unable to send value, recipient may have reverted");</span>
60 | | <span class='neutral'> }</span>
61 | | <span class='neutral'></span>
62 | | <span class='neutral'> /**</span>
63 | | <span class='neutral'> * @dev Performs a Solidity function call using a low level `call`. A</span>
64 | | <span class='neutral'> * plain `call` is an unsafe replacement for a function call: use this</span>
65 | | <span class='neutral'> * function instead.</span>
66 | | <span class='neutral'> *</span>
67 | | <span class='neutral'> * If `target` reverts with a revert reason, it is bubbled up by this</span>
68 | | <span class='neutral'> * function (like regular Solidity function calls).</span>
69 | | <span class='neutral'> *</span>
70 | | <span class='neutral'> * Returns the raw returned data. To convert to the expected return value,</span>
71 | | <span class='neutral'> * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].</span>
72 | | <span class='neutral'> *</span>
73 | | <span class='neutral'> * Requirements:</span>
74 | | <span class='neutral'> *</span>
75 | | <span class='neutral'> * - `target` must be a contract.</span>
76 | | <span class='neutral'> * - calling `target` with `data` must not revert.</span>
77 | | <span class='neutral'> *</span>
78 | | <span class='neutral'> * _Available since v3.1._</span>
79 | | <span class='neutral'> */</span>
80 | | <span class='neutral'> function functionCall(address target, bytes memory data) internal returns (bytes memory) {</span>
81 | | <span class='neutral'> return functionCall(target, data, "Address: low-level call failed");</span>
82 | | <span class='neutral'> }</span>
83 | | <span class='neutral'></span>
84 | | <span class='neutral'> /**</span>
85 | | <span class='neutral'> * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with</span>
86 | | <span class='neutral'> * `errorMessage` as a fallback revert reason when `target` reverts.</span>
87 | | <span class='neutral'> *</span>
88 | | <span class='neutral'> * _Available since v3.1._</span>
89 | | <span class='neutral'> */</span>
90 | | <span class='neutral'> function functionCall(</span>
91 | | <span class='neutral'> address target,</span>
92 | | <span class='neutral'> bytes memory data,</span>
93 | | <span class='neutral'> string memory errorMessage</span>
94 | | <span class='neutral'> ) internal returns (bytes memory) {</span>
95 | | <span class='neutral'> return functionCallWithValue(target, data, 0, errorMessage);</span>
96 | | <span class='neutral'> }</span>
97 | | <span class='neutral'></span>
98 | | <span class='neutral'> /**</span>
99 | | <span class='neutral'> * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],</span>
100 | | <span class='neutral'> * but also transferring `value` wei to `target`.</span>
101 | | <span class='neutral'> *</span>
102 | | <span class='neutral'> * Requirements:</span>
103 | | <span class='neutral'> *</span>
104 | | <span class='neutral'> * - the calling contract must have an ETH balance of at least `value`.</span>
105 | | <span class='neutral'> * - the called Solidity function must be `payable`.</span>
106 | | <span class='neutral'> *</span>
107 | | <span class='neutral'> * _Available since v3.1._</span>
108 | | <span class='neutral'> */</span>
109 | | <span class='neutral'> function functionCallWithValue(</span>
110 | | <span class='neutral'> address target,</span>
111 | | <span class='neutral'> bytes memory data,</span>
112 | | <span class='neutral'> uint256 value</span>
113 | | <span class='neutral'> ) internal returns (bytes memory) {</span>
114 | | <span class='neutral'> return functionCallWithValue(target, data, value, "Address: low-level call with value failed");</span>
115 | | <span class='neutral'> }</span>
116 | | <span class='neutral'></span>
117 | | <span class='neutral'> /**</span>
118 | | <span class='neutral'> * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but</span>
119 | | <span class='neutral'> * with `errorMessage` as a fallback revert reason when `target` reverts.</span>
120 | | <span class='neutral'> *</span>
121 | | <span class='neutral'> * _Available since v3.1._</span>
122 | | <span class='neutral'> */</span>
123 | | <span class='neutral'> function functionCallWithValue(</span>
124 | | <span class='neutral'> address target,</span>
125 | | <span class='neutral'> bytes memory data,</span>
126 | | <span class='neutral'> uint256 value,</span>
127 | | <span class='neutral'> string memory errorMessage</span>
128 | | <span class='neutral'> ) internal returns (bytes memory) {</span>
129 | | <span class='neutral'> require(address(this).balance >= value, "Address: insufficient balance for call");</span>
130 | | <span class='neutral'> require(isContract(target), "Address: call to non-contract");</span>
131 | | <span class='neutral'></span>
132 | | <span class='neutral'> (bool success, bytes memory returndata) = target.call{value: value}(data);</span>
133 | | <span class='neutral'> return verifyCallResult(success, returndata, errorMessage);</span>
134 | | <span class='neutral'> }</span>
135 | | <span class='neutral'></span>
136 | | <span class='neutral'> /**</span>
137 | | <span class='neutral'> * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],</span>
138 | | <span class='neutral'> * but performing a static call.</span>
139 | | <span class='neutral'> *</span>
140 | | <span class='neutral'> * _Available since v3.3._</span>
141 | | <span class='neutral'> */</span>
142 | | <span class='neutral'> function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {</span>
143 | | <span class='neutral'> return functionStaticCall(target, data, "Address: low-level static call failed");</span>
144 | | <span class='neutral'> }</span>
145 | | <span class='neutral'></span>
146 | | <span class='neutral'> /**</span>
147 | | <span class='neutral'> * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],</span>
148 | | <span class='neutral'> * but performing a static call.</span>
149 | | <span class='neutral'> *</span>
150 | | <span class='neutral'> * _Available since v3.3._</span>
151 | | <span class='neutral'> */</span>
152 | | <span class='neutral'> function functionStaticCall(</span>
153 | | <span class='neutral'> address target,</span>
154 | | <span class='neutral'> bytes memory data,</span>
155 | | <span class='neutral'> string memory errorMessage</span>
156 | | <span class='neutral'> ) internal view returns (bytes memory) {</span>
157 | | <span class='neutral'> require(isContract(target), "Address: static call to non-contract");</span>
158 | | <span class='neutral'></span>
159 | | <span class='neutral'> (bool success, bytes memory returndata) = target.staticcall(data);</span>
160 | | <span class='neutral'> return verifyCallResult(success, returndata, errorMessage);</span>
161 | | <span class='neutral'> }</span>
162 | | <span class='neutral'></span>
163 | | <span class='neutral'> /**</span>
164 | | <span class='neutral'> * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],</span>
165 | | <span class='neutral'> * but performing a delegate call.</span>
166 | | <span class='neutral'> *</span>
167 | | <span class='neutral'> * _Available since v3.4._</span>
168 | | <span class='neutral'> */</span>
169 | | <span class='neutral'> function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {</span>
170 | | <span class='neutral'> return functionDelegateCall(target, data, "Address: low-level delegate call failed");</span>
171 | | <span class='neutral'> }</span>
172 | | <span class='neutral'></span>
173 | | <span class='neutral'> /**</span>
174 | | <span class='neutral'> * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],</span>
175 | | <span class='neutral'> * but performing a delegate call.</span>
176 | | <span class='neutral'> *</span>
177 | | <span class='neutral'> * _Available since v3.4._</span>
178 | | <span class='neutral'> */</span>
179 | | <span class='neutral'> function functionDelegateCall(</span>
180 | | <span class='neutral'> address target,</span>
181 | | <span class='neutral'> bytes memory data,</span>
182 | | <span class='neutral'> string memory errorMessage</span>
183 | | <span class='neutral'> ) internal returns (bytes memory) {</span>
184 | | <span class='neutral'> require(isContract(target), "Address: delegate call to non-contract");</span>
185 | | <span class='neutral'></span>
186 | | <span class='neutral'> (bool success, bytes memory returndata) = target.delegatecall(data);</span>
187 | | <span class='neutral'> return verifyCallResult(success, returndata, errorMessage);</span>
188 | | <span class='neutral'> }</span>
189 | | <span class='neutral'></span>
190 | | <span class='neutral'> /**</span>
191 | | <span class='neutral'> * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the</span>
192 | | <span class='neutral'> * revert reason using the provided one.</span>
193 | | <span class='neutral'> *</span>
194 | | <span class='neutral'> * _Available since v4.3._</span>
195 | | <span class='neutral'> */</span>
196 | | <span class='neutral'> function verifyCallResult(</span>
197 | | <span class='neutral'> bool success,</span>
198 | | <span class='neutral'> bytes memory returndata,</span>
199 | | <span class='neutral'> string memory errorMessage</span>
200 | | <span class='neutral'> ) internal pure returns (bytes memory) {</span>
201 | | <span class='neutral'> if (success) {</span>
202 | | <span class='neutral'> return returndata;</span>
203 | | <span class='neutral'> } else {</span>
204 | | <span class='neutral'> // Look for revert reason and bubble it up if present</span>
205 | | <span class='neutral'> if (returndata.length > 0) {</span>
206 | | <span class='neutral'> // The easiest way to bubble the revert reason is using memory via assembly</span>
207 | | <span class='neutral'></span>
208 | | <span class='neutral'> assembly {</span>
209 | | <span class='neutral'> let returndata_size := mload(returndata)</span>
210 | | <span class='neutral'> revert(add(32, returndata), returndata_size)</span>
211 | | <span class='neutral'> }</span>
212 | | <span class='neutral'> } else {</span>
213 | | <span class='neutral'> revert(errorMessage);</span>
214 | | <span class='neutral'> }</span>
215 | | <span class='neutral'> }</span>
216 | | <span class='neutral'> }</span>
217 | | <span class='neutral'>}</span>
218 | | <span class='neutral'></span>
</code>
<br />
<b>/home/rappie/Desktop/targets/origin-dollar/fuzzing-ousd-public/lib/openzeppelin-contracts/contracts/utils/math/SafeMath.sol</b>
<code>
1 | | <span class='neutral'>// SPDX-License-Identifier: MIT</span>
2 | | <span class='neutral'>// OpenZeppelin Contracts v4.4.1 (utils/math/SafeMath.sol)</span>
3 | | <span class='neutral'></span>
4 | | <span class='neutral'>pragma solidity ^0.8.0;</span>
5 | | <span class='neutral'></span>
6 | | <span class='neutral'>// CAUTION</span>
7 | | <span class='neutral'>// This version of SafeMath should only be used with Solidity 0.8 or later,</span>
8 | | <span class='neutral'>// because it relies on the compiler's built in overflow checks.</span>
9 | | <span class='neutral'></span>
10 | | <span class='neutral'>/**</span>
11 | | <span class='neutral'> * @dev Wrappers over Solidity's arithmetic operations.</span>
12 | | <span class='neutral'> *</span>
13 | | <span class='neutral'> * NOTE: `SafeMath` is generally not needed starting with Solidity 0.8, since the compiler</span>
14 | | <span class='neutral'> * now has built in overflow checking.</span>
15 | | <span class='neutral'> */</span>
16 | | <span class='unexecuted'>library SafeMath {</span>
17 | | <span class='neutral'> /**</span>
18 | | <span class='neutral'> * @dev Returns the addition of two unsigned integers, with an overflow flag.</span>
19 | | <span class='neutral'> *</span>
20 | | <span class='neutral'> * _Available since v3.4._</span>
21 | | <span class='neutral'> */</span>
22 | | <span class='neutral'> function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) {</span>
23 | | <span class='neutral'> unchecked {</span>
24 | | <span class='neutral'> uint256 c = a + b;</span>
25 | | <span class='neutral'> if (c < a) return (false, 0);</span>
26 | | <span class='neutral'> return (true, c);</span>
27 | | <span class='neutral'> }</span>
28 | | <span class='neutral'> }</span>
29 | | <span class='neutral'></span>
30 | | <span class='neutral'> /**</span>
31 | | <span class='neutral'> * @dev Returns the substraction of two unsigned integers, with an overflow flag.</span>
32 | | <span class='neutral'> *</span>
33 | | <span class='neutral'> * _Available since v3.4._</span>
34 | | <span class='neutral'> */</span>
35 | | <span class='neutral'> function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) {</span>
36 | | <span class='neutral'> unchecked {</span>
37 | | <span class='neutral'> if (b > a) return (false, 0);</span>
38 | | <span class='neutral'> return (true, a - b);</span>
39 | | <span class='neutral'> }</span>
40 | | <span class='neutral'> }</span>
41 | | <span class='neutral'></span>
42 | | <span class='neutral'> /**</span>
43 | | <span class='neutral'> * @dev Returns the multiplication of two unsigned integers, with an overflow flag.</span>
44 | | <span class='neutral'> *</span>
45 | | <span class='neutral'> * _Available since v3.4._</span>
46 | | <span class='neutral'> */</span>
47 | | <span class='neutral'> function tryMul(uint256 a, uint256 b) internal pure returns (bool, uint256) {</span>
48 | | <span class='neutral'> unchecked {</span>
49 | | <span class='neutral'> // Gas optimization: this is cheaper than requiring 'a' not being zero, but the</span>
50 | | <span class='neutral'> // benefit is lost if 'b' is also tested.</span>
51 | | <span class='neutral'> // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522</span>
52 | | <span class='neutral'> if (a == 0) return (true, 0);</span>
53 | | <span class='neutral'> uint256 c = a * b;</span>
54 | | <span class='neutral'> if (c / a != b) return (false, 0);</span>
55 | | <span class='neutral'> return (true, c);</span>
56 | | <span class='neutral'> }</span>
57 | | <span class='neutral'> }</span>
58 | | <span class='neutral'></span>
59 | | <span class='neutral'> /**</span>
60 | | <span class='neutral'> * @dev Returns the division of two unsigned integers, with a division by zero flag.</span>
61 | | <span class='neutral'> *</span>
62 | | <span class='neutral'> * _Available since v3.4._</span>
63 | | <span class='neutral'> */</span>
64 | | <span class='neutral'> function tryDiv(uint256 a, uint256 b) internal pure returns (bool, uint256) {</span>
65 | | <span class='neutral'> unchecked {</span>
66 | | <span class='neutral'> if (b == 0) return (false, 0);</span>
67 | | <span class='neutral'> return (true, a / b);</span>
68 | | <span class='neutral'> }</span>
69 | | <span class='neutral'> }</span>
70 | | <span class='neutral'></span>
71 | | <span class='neutral'> /**</span>
72 | | <span class='neutral'> * @dev Returns the remainder of dividing two unsigned integers, with a division by zero flag.</span>
73 | | <span class='neutral'> *</span>
74 | | <span class='neutral'> * _Available since v3.4._</span>
75 | | <span class='neutral'> */</span>
76 | | <span class='neutral'> function tryMod(uint256 a, uint256 b) internal pure returns (bool, uint256) {</span>
77 | | <span class='neutral'> unchecked {</span>
78 | | <span class='neutral'> if (b == 0) return (false, 0);</span>
79 | | <span class='neutral'> return (true, a % b);</span>
80 | | <span class='neutral'> }</span>
81 | | <span class='neutral'> }</span>
82 | | <span class='neutral'></span>
83 | | <span class='neutral'> /**</span>
84 | | <span class='neutral'> * @dev Returns the addition of two unsigned integers, reverting on</span>
85 | | <span class='neutral'> * overflow.</span>
86 | | <span class='neutral'> *</span>
87 | | <span class='neutral'> * Counterpart to Solidity's `+` operator.</span>
88 | | <span class='neutral'> *</span>
89 | | <span class='neutral'> * Requirements:</span>
90 | | <span class='neutral'> *</span>
91 | | <span class='neutral'> * - Addition cannot overflow.</span>
92 | | <span class='neutral'> */</span>
93 | * | <span class='executed'> function add(uint256 a, uint256 b) internal pure returns (uint256) {</span>
94 | * | <span class='executed'> return a + b;</span>
95 | | <span class='neutral'> }</span>
96 | | <span class='neutral'></span>
97 | | <span class='neutral'> /**</span>
98 | | <span class='neutral'> * @dev Returns the subtraction of two unsigned integers, reverting on</span>
99 | | <span class='neutral'> * overflow (when the result is negative).</span>
100 | | <span class='neutral'> *</span>
101 | | <span class='neutral'> * Counterpart to Solidity's `-` operator.</span>
102 | | <span class='neutral'> *</span>
103 | | <span class='neutral'> * Requirements:</span>
104 | | <span class='neutral'> *</span>
105 | | <span class='neutral'> * - Subtraction cannot overflow.</span>
106 | | <span class='neutral'> */</span>
107 | * | <span class='executed'> function sub(uint256 a, uint256 b) internal pure returns (uint256) {</span>
108 | * | <span class='executed'> return a - b;</span>
109 | | <span class='neutral'> }</span>
110 | | <span class='neutral'></span>
111 | | <span class='neutral'> /**</span>
112 | | <span class='neutral'> * @dev Returns the multiplication of two unsigned integers, reverting on</span>
113 | | <span class='neutral'> * overflow.</span>
114 | | <span class='neutral'> *</span>
115 | | <span class='neutral'> * Counterpart to Solidity's `*` operator.</span>
116 | | <span class='neutral'> *</span>
117 | | <span class='neutral'> * Requirements:</span>
118 | | <span class='neutral'> *</span>
119 | | <span class='neutral'> * - Multiplication cannot overflow.</span>
120 | | <span class='neutral'> */</span>
121 | * | <span class='executed'> function mul(uint256 a, uint256 b) internal pure returns (uint256) {</span>
122 | * | <span class='executed'> return a * b;</span>
123 | | <span class='neutral'> }</span>
124 | | <span class='neutral'></span>
125 | | <span class='neutral'> /**</span>
126 | | <span class='neutral'> * @dev Returns the integer division of two unsigned integers, reverting on</span>
127 | | <span class='neutral'> * division by zero. The result is rounded towards zero.</span>
128 | | <span class='neutral'> *</span>
129 | | <span class='neutral'> * Counterpart to Solidity's `/` operator.</span>
130 | | <span class='neutral'> *</span>
131 | | <span class='neutral'> * Requirements:</span>
132 | | <span class='neutral'> *</span>
133 | | <span class='neutral'> * - The divisor cannot be zero.</span>
134 | | <span class='neutral'> */</span>
135 | * | <span class='executed'> function div(uint256 a, uint256 b) internal pure returns (uint256) {</span>
136 | * | <span class='executed'> return a / b;</span>
137 | | <span class='neutral'> }</span>
138 | | <span class='neutral'></span>
139 | | <span class='neutral'> /**</span>
140 | | <span class='neutral'> * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),</span>
141 | | <span class='neutral'> * reverting when dividing by zero.</span>
142 | | <span class='neutral'> *</span>
143 | | <span class='neutral'> * Counterpart to Solidity's `%` operator. This function uses a `revert`</span>
144 | | <span class='neutral'> * opcode (which leaves remaining gas untouched) while Solidity uses an</span>
145 | | <span class='neutral'> * invalid opcode to revert (consuming all remaining gas).</span>
146 | | <span class='neutral'> *</span>
147 | | <span class='neutral'> * Requirements:</span>
148 | | <span class='neutral'> *</span>
149 | | <span class='neutral'> * - The divisor cannot be zero.</span>
150 | | <span class='neutral'> */</span>
151 | | <span class='neutral'> function mod(uint256 a, uint256 b) internal pure returns (uint256) {</span>
152 | | <span class='neutral'> return a % b;</span>
153 | | <span class='neutral'> }</span>
154 | | <span class='neutral'></span>
155 | | <span class='neutral'> /**</span>
156 | | <span class='neutral'> * @dev Returns the subtraction of two unsigned integers, reverting with custom message on</span>
157 | | <span class='neutral'> * overflow (when the result is negative).</span>
158 | | <span class='neutral'> *</span>
159 | | <span class='neutral'> * CAUTION: This function is deprecated because it requires allocating memory for the error</span>
160 | | <span class='neutral'> * message unnecessarily. For custom revert reasons use {trySub}.</span>
161 | | <span class='neutral'> *</span>
162 | | <span class='neutral'> * Counterpart to Solidity's `-` operator.</span>
163 | | <span class='neutral'> *</span>
164 | | <span class='neutral'> * Requirements:</span>
165 | | <span class='neutral'> *</span>
166 | | <span class='neutral'> * - Subtraction cannot overflow.</span>
167 | | <span class='neutral'> */</span>
168 | * | <span class='executed'> function sub(</span>
169 | | <span class='neutral'> uint256 a,</span>
170 | | <span class='neutral'> uint256 b,</span>
171 | | <span class='neutral'> string memory errorMessage</span>
172 | * | <span class='executed'> ) internal pure returns (uint256) {</span>
173 | | <span class='neutral'> unchecked {</span>
174 | * | <span class='executed'> require(b <= a, errorMessage);</span>
175 | * | <span class='executed'> return a - b;</span>
176 | | <span class='neutral'> }</span>
177 | | <span class='neutral'> }</span>
178 | | <span class='neutral'></span>
179 | | <span class='neutral'> /**</span>
180 | | <span class='neutral'> * @dev Returns the integer division of two unsigned integers, reverting with custom message on</span>
181 | | <span class='neutral'> * division by zero. The result is rounded towards zero.</span>
182 | | <span class='neutral'> *</span>
183 | | <span class='neutral'> * Counterpart to Solidity's `/` operator. Note: this function uses a</span>
184 | | <span class='neutral'> * `revert` opcode (which leaves remaining gas untouched) while Solidity</span>
185 | | <span class='neutral'> * uses an invalid opcode to revert (consuming all remaining gas).</span>
186 | | <span class='neutral'> *</span>
187 | | <span class='neutral'> * Requirements:</span>
188 | | <span class='neutral'> *</span>
189 | | <span class='neutral'> * - The divisor cannot be zero.</span>
190 | | <span class='neutral'> */</span>
191 | | <span class='neutral'> function div(</span>
192 | | <span class='neutral'> uint256 a,</span>
193 | | <span class='neutral'> uint256 b,</span>
194 | | <span class='neutral'> string memory errorMessage</span>
195 | | <span class='neutral'> ) internal pure returns (uint256) {</span>
196 | | <span class='neutral'> unchecked {</span>
197 | | <span class='neutral'> require(b > 0, errorMessage);</span>
198 | | <span class='neutral'> return a / b;</span>
199 | | <span class='neutral'> }</span>
200 | | <span class='neutral'> }</span>
201 | | <span class='neutral'></span>
202 | | <span class='neutral'> /**</span>
203 | | <span class='neutral'> * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),</span>
204 | | <span class='neutral'> * reverting with custom message when dividing by zero.</span>
205 | | <span class='neutral'> *</span>
206 | | <span class='neutral'> * CAUTION: This function is deprecated because it requires allocating memory for the error</span>
207 | | <span class='neutral'> * message unnecessarily. For custom revert reasons use {tryMod}.</span>
208 | | <span class='neutral'> *</span>
209 | | <span class='neutral'> * Counterpart to Solidity's `%` operator. This function uses a `revert`</span>
210 | | <span class='neutral'> * opcode (which leaves remaining gas untouched) while Solidity uses an</span>
211 | | <span class='neutral'> * invalid opcode to revert (consuming all remaining gas).</span>
212 | | <span class='neutral'> *</span>
213 | | <span class='neutral'> * Requirements:</span>
214 | | <span class='neutral'> *</span>
215 | | <span class='neutral'> * - The divisor cannot be zero.</span>
216 | | <span class='neutral'> */</span>
217 | | <span class='neutral'> function mod(</span>
218 | | <span class='neutral'> uint256 a,</span>
219 | | <span class='neutral'> uint256 b,</span>
220 | | <span class='neutral'> string memory errorMessage</span>
221 | | <span class='neutral'> ) internal pure returns (uint256) {</span>
222 | | <span class='neutral'> unchecked {</span>
223 | | <span class='neutral'> require(b > 0, errorMessage);</span>
224 | | <span class='neutral'> return a % b;</span>
225 | | <span class='neutral'> }</span>
226 | | <span class='neutral'> }</span>
227 | | <span class='neutral'>}</span>
228 | | <span class='neutral'></span>
</code>
<br />
<b>/home/rappie/Desktop/targets/origin-dollar/fuzzing-ousd-public/src/echidna/Debugger.sol</b>
<code>
1 | | <span class='neutral'>// SPDX-License-Identifier: MIT</span>
2 | | <span class='neutral'>pragma solidity ^0.8.0;</span>
3 | | <span class='neutral'></span>
4 | | <span class='unexecuted'>library Debugger {</span>
5 | | <span class='neutral'> event Debug(string debugString);</span>
6 | | <span class='neutral'> event Debug(string description, string data);</span>
7 | | <span class='neutral'> event Debug(string prefix, string description, string data);</span>
8 | | <span class='neutral'> event Debug(string description, bytes32 data);</span>
9 | | <span class='neutral'> event Debug(string prefix, string description, bytes32 data);</span>
10 | | <span class='neutral'> event Debug(string description, uint256 data);</span>
11 | | <span class='neutral'> event Debug(string prefix, string description, uint256 data);</span>
12 | | <span class='neutral'> event Debug(string description, int256 data);</span>
13 | | <span class='neutral'> event Debug(string prefix, string description, int256 data);</span>
14 | | <span class='neutral'> event Debug(string description, address data);</span>
15 | | <span class='neutral'> event Debug(string prefix, string description, address data);</span>
16 | | <span class='neutral'> event Debug(string description, bool data);</span>
17 | | <span class='neutral'> event Debug(string prefix, string description, bool data);</span>
18 | | <span class='neutral'></span>
19 | | <span class='neutral'> function log(string memory debugString) internal {</span>
20 | | <span class='neutral'> emit Debug(debugString);</span>
21 | | <span class='neutral'> }</span>
22 | | <span class='neutral'></span>
23 | | <span class='neutral'> function log(string memory description, string memory data) internal {</span>
24 | | <span class='neutral'> emit Debug(description, data);</span>
25 | | <span class='neutral'> }</span>
26 | | <span class='neutral'></span>
27 | | <span class='neutral'> function log(</span>
28 | | <span class='neutral'> string memory prefix,</span>
29 | | <span class='neutral'> string memory description,</span>
30 | | <span class='neutral'> string memory data</span>
31 | | <span class='neutral'> ) internal {</span>
32 | | <span class='neutral'> emit Debug(prefix, description, data);</span>
33 | | <span class='neutral'> }</span>
34 | | <span class='neutral'></span>
35 | | <span class='neutral'> function log(string memory description, bytes32 data) internal {</span>
36 | | <span class='neutral'> emit Debug(description, data);</span>
37 | | <span class='neutral'> }</span>
38 | | <span class='neutral'></span>
39 | | <span class='neutral'> function log(</span>
40 | | <span class='neutral'> string memory prefix,</span>
41 | | <span class='neutral'> string memory description,</span>
42 | | <span class='neutral'> bytes32 data</span>
43 | | <span class='neutral'> ) internal {</span>
44 | | <span class='neutral'> emit Debug(prefix, description, data);</span>
45 | | <span class='neutral'> }</span>
46 | | <span class='neutral'></span>
47 | * | <span class='executed'> function log(string memory description, uint256 data) internal {</span>
48 | * | <span class='executed'> emit Debug(description, data);</span>
49 | | <span class='neutral'> }</span>
50 | | <span class='neutral'></span>
51 | | <span class='neutral'> function log(</span>
52 | | <span class='neutral'> string memory prefix,</span>
53 | | <span class='neutral'> string memory description,</span>
54 | | <span class='neutral'> uint256 data</span>
55 | | <span class='neutral'> ) internal {</span>
56 | | <span class='neutral'> emit Debug(prefix, description, data);</span>
57 | | <span class='neutral'> }</span>
58 | | <span class='neutral'></span>
59 | * | <span class='executed'> function log(string memory description, int256 data) internal {</span>
60 | * | <span class='executed'> emit Debug(description, data);</span>
61 | | <span class='neutral'> }</span>
62 | | <span class='neutral'></span>
63 | | <span class='neutral'> function log(</span>
64 | | <span class='neutral'> string memory prefix,</span>
65 | | <span class='neutral'> string memory description,</span>
66 | | <span class='neutral'> int256 data</span>
67 | | <span class='neutral'> ) internal {</span>
68 | | <span class='neutral'> emit Debug(prefix, description, data);</span>
69 | | <span class='neutral'> }</span>
70 | | <span class='neutral'></span>
71 | | <span class='neutral'> function log(string memory description, address data) internal {</span>
72 | | <span class='neutral'> emit Debug(description, data);</span>
73 | | <span class='neutral'> }</span>
74 | | <span class='neutral'></span>
75 | | <span class='neutral'> function log(</span>
76 | | <span class='neutral'> string memory prefix,</span>
77 | | <span class='neutral'> string memory description,</span>
78 | | <span class='neutral'> address data</span>
79 | | <span class='neutral'> ) internal {</span>
80 | | <span class='neutral'> emit Debug(prefix, description, data);</span>
81 | | <span class='neutral'> }</span>
82 | | <span class='neutral'></span>
83 | | <span class='neutral'> function log(string memory description, bool data) internal {</span>
84 | | <span class='neutral'> emit Debug(description, data);</span>
85 | | <span class='neutral'> }</span>
86 | | <span class='neutral'></span>
87 | | <span class='neutral'> function log(</span>
88 | | <span class='neutral'> string memory prefix,</span>
89 | | <span class='neutral'> string memory description,</span>
90 | | <span class='neutral'> bool data</span>
91 | | <span class='neutral'> ) internal {</span>
92 | | <span class='neutral'> emit Debug(prefix, description, data);</span>
93 | | <span class='neutral'> }</span>
94 | | <span class='neutral'>}</span>
95 | | <span class='neutral'></span>
</code>
<br />
<b>/home/rappie/Desktop/targets/origin-dollar/fuzzing-ousd-public/src/echidna/Echidna.sol</b>
<code>
1 | | <span class='neutral'>// SPDX-License-Identifier: MIT</span>
2 | | <span class='neutral'>pragma solidity ^0.8.0;</span>
3 | | <span class='neutral'></span>
4 | | <span class='neutral'>import "./EchidnaTestApproval.sol";</span>
5 | | <span class='neutral'></span>
6 | | <span class='neutral'>/**</span>
7 | | <span class='neutral'> * @title Echidna test contract for OUSD</span>
8 | | <span class='neutral'> * @notice Target contract to be tested, containing all mixins</span>
9 | | <span class='neutral'> * @author Rappie</span>
10 | | <span class='neutral'> */</span>
11 | *r | <span class='executed'>contract Echidna is EchidnaTestApproval {</span>
12 | | <span class='neutral'></span>
13 | | <span class='neutral'>}</span>
14 | | <span class='neutral'></span>
</code>
<br />
<b>/home/rappie/Desktop/targets/origin-dollar/fuzzing-ousd-public/src/echidna/EchidnaConfig.sol</b>
<code>
1 | | <span class='neutral'>// SPDX-License-Identifier: MIT</span>
2 | | <span class='neutral'>pragma solidity ^0.8.0;</span>
3 | | <span class='neutral'></span>
4 | | <span class='neutral'>/**</span>
5 | | <span class='neutral'> * @title Top-level mixin for configuring the desired fuzzing setup</span>
6 | | <span class='neutral'> * @author Rappie</span>
7 | | <span class='neutral'> */</span>
8 | | <span class='unexecuted'>contract EchidnaConfig {</span>
9 | * | <span class='executed'> address internal constant ADDRESS_VAULT = address(0x10000);</span>
10 | * | <span class='executed'> address internal constant ADDRESS_OUTSIDER_USER = address(0x20000);</span>
11 | | <span class='neutral'></span>
12 | * | <span class='executed'> address internal constant ADDRESS_USER0 = address(0x30000);</span>
13 | * | <span class='executed'> address internal constant ADDRESS_USER1 = address(0x40000);</span>
14 | | <span class='neutral'></span>
15 | | <span class='neutral'> // Will be set in EchidnaSetup constructor</span>
16 | | <span class='neutral'> address internal ADDRESS_OUTSIDER_CONTRACT;</span>
17 | | <span class='neutral'> address internal ADDRESS_CONTRACT0;</span>
18 | | <span class='neutral'> address internal ADDRESS_CONTRACT1;</span>
19 | | <span class='neutral'></span>
20 | | <span class='neutral'> // Toggle known issues</span>
21 | | <span class='neutral'> //</span>
22 | | <span class='neutral'> // This can be used to skip tests that are known to fail. This is useful</span>
23 | | <span class='neutral'> // when debugging a specific issue, but should be disabled when running</span>
24 | | <span class='neutral'> // the full test suite.</span>
25 | | <span class='neutral'> //</span>
26 | | <span class='neutral'> // True => skip tests that are known to fail</span>
27 | | <span class='neutral'> // False => run all tests</span>
28 | | <span class='neutral'> //</span>
29 | | <span class='unexecuted'> bool internal TOGGLE_KNOWN_ISSUES = false;</span>
30 | | <span class='neutral'></span>
31 | | <span class='neutral'> // Toggle known issues within limits</span>
32 | | <span class='neutral'> //</span>
33 | | <span class='neutral'> // Same as TOGGLE_KNOWN_ISSUES, but also skip tests that are known to fail</span>
34 | | <span class='neutral'> // within limits set by the variables below.</span>
35 | | <span class='neutral'> //</span>
36 | | <span class='neutral'> bool internal TOGGLE_KNOWN_ISSUES_WITHIN_LIMITS = true;</span>
37 | | <span class='neutral'></span>
38 | | <span class='neutral'> // Starting balance</span>
39 | | <span class='neutral'> //</span>
40 | | <span class='neutral'> // Gives OUSD a non-zero starting supply, which can be useful to ignore</span>
41 | | <span class='neutral'> // certain edge cases.</span>
42 | | <span class='neutral'> //</span>
43 | | <span class='neutral'> // The starting balance is given to outsider accounts that are not used as</span>
44 | | <span class='neutral'> // accounts while fuzzing.</span>
45 | | <span class='neutral'> //</span>
46 | | <span class='unexecuted'> bool internal TOGGLE_STARTING_BALANCE = true;</span>
47 | | <span class='unexecuted'> uint256 internal STARTING_BALANCE = 1_000_000e18;</span>
48 | | <span class='neutral'></span>
49 | | <span class='neutral'> // Change supply</span>
50 | | <span class='neutral'> //</span>
51 | | <span class='neutral'> // Set a limit to the amount of change per rebase, which can be useful to</span>
52 | | <span class='neutral'> // ignore certain edge cases.</span>
53 | | <span class='neutral'> //</span>
54 | | <span class='neutral'> // True => limit the amount of change to a percentage of total supply</span>
55 | | <span class='neutral'> // False => no limit</span>
56 | | <span class='neutral'> //</span>
57 | | <span class='unexecuted'> bool internal TOGGLE_CHANGESUPPLY_LIMIT = true;</span>
58 | | <span class='unexecuted'> uint256 internal CHANGESUPPLY_DIVISOR = 10; // 10% of total supply</span>
59 | | <span class='neutral'></span>
60 | | <span class='neutral'> // Mint limit</span>
61 | | <span class='neutral'> //</span>
62 | | <span class='neutral'> // Set a limit the the amount minted per mint, which can be useful to</span>
63 | | <span class='neutral'> // ignore certain edge cases.</span>
64 | | <span class='neutral'> //</span>
65 | | <span class='neutral'> // True => limit the amount of minted tokens</span>
66 | | <span class='neutral'> // False => no limit</span>
67 | | <span class='neutral'> //</span>
68 | | <span class='unexecuted'> bool internal TOGGLE_MINT_LIMIT = true;</span>
69 | | <span class='unexecuted'> uint256 internal MINT_MODULO = 1_000_000_000_000e18;</span>
70 | | <span class='neutral'></span>
71 | | <span class='neutral'> // Known rounding errors</span>
72 | | <span class='unexecuted'> uint256 internal TRANSFER_ROUNDING_ERROR = 1e18 - 1;</span>
73 | | <span class='unexecuted'> uint256 internal OPT_IN_ROUNDING_ERROR = 1e18 - 1;</span>
74 | | <span class='unexecuted'> uint256 internal MINT_ROUNDING_ERROR = 1e18 - 1;</span>
75 | | <span class='neutral'></span>
76 | | <span class='neutral'> /**</span>
77 | | <span class='neutral'> * @notice Modifier to skip tests that are known to fail</span>
78 | | <span class='neutral'> * @dev see TOGGLE_KNOWN_ISSUES for more information</span>
79 | | <span class='neutral'> */</span>
80 | | <span class='neutral'> modifier hasKnownIssue() {</span>
81 | * | <span class='executed'> if (TOGGLE_KNOWN_ISSUES) return;</span>
82 | * | <span class='executed'> _;</span>
83 | | <span class='neutral'> }</span>
84 | | <span class='neutral'></span>
85 | | <span class='neutral'> /**</span>
86 | | <span class='neutral'> * @notice Modifier to skip tests that are known to fail within limits</span>
87 | | <span class='neutral'> * @dev see TOGGLE_KNOWN_ISSUES_WITHIN_LIMITS for more information</span>
88 | | <span class='neutral'> */</span>
89 | | <span class='neutral'> modifier hasKnownIssueWithinLimits() {</span>
90 | * | <span class='executed'> if (TOGGLE_KNOWN_ISSUES_WITHIN_LIMITS) return;</span>
91 | | <span class='neutral'> _;</span>
92 | | <span class='neutral'> }</span>
93 | | <span class='neutral'></span>
94 | | <span class='neutral'> /**</span>
95 | | <span class='neutral'> * @notice Translate an account ID to an address</span>
96 | | <span class='neutral'> * @param accountId The ID of the account</span>
97 | | <span class='neutral'> * @return account The address of the account</span>
98 | | <span class='neutral'> */</span>
99 | * | <span class='executed'> function getAccount(uint8 accountId)</span>
100 | | <span class='neutral'> internal</span>
101 | | <span class='neutral'> view</span>
102 | * | <span class='executed'> returns (address account)</span>
103 | | <span class='neutral'> {</span>
104 | * | <span class='executed'> accountId = accountId / 64;</span>
105 | * | <span class='executed'> if (accountId == 0) return account = ADDRESS_USER0;</span>
106 | * | <span class='executed'> if (accountId == 1) return account = ADDRESS_USER1;</span>
107 | * | <span class='executed'> if (accountId == 2) return account = ADDRESS_CONTRACT0;</span>
108 | * | <span class='executed'> if (accountId == 3) return account = ADDRESS_CONTRACT1;</span>
109 | * | <span class='executed'> require(false, "Unknown account ID");</span>
110 | | <span class='neutral'> }</span>
111 | | <span class='neutral'>}</span>
112 | | <span class='neutral'></span>
</code>
<br />
<b>/home/rappie/Desktop/targets/origin-dollar/fuzzing-ousd-public/src/echidna/EchidnaDebug.sol</b>
<code>
1 | | <span class='neutral'>// SPDX-License-Identifier: MIT</span>
2 | | <span class='neutral'>pragma solidity ^0.8.0;</span>
3 | | <span class='neutral'></span>
4 | | <span class='neutral'>import {Address} from "@openzeppelin/contracts/utils/Address.sol";</span>
5 | | <span class='neutral'></span>
6 | | <span class='neutral'>import "./EchidnaHelper.sol";</span>
7 | | <span class='neutral'>import "./Debugger.sol";</span>
8 | | <span class='neutral'></span>
9 | | <span class='neutral'>import "../token/OUSD.sol";</span>
10 | | <span class='neutral'></span>
11 | | <span class='neutral'>/**</span>
12 | | <span class='neutral'> * @title Room for random debugging functions</span>
13 | | <span class='neutral'> * @author Rappie</span>
14 | | <span class='neutral'> */</span>
15 | | <span class='unexecuted'>contract EchidnaDebug is EchidnaHelper {</span>
16 | | <span class='neutral'> function debugOUSD() public pure {</span>
17 | | <span class='neutral'> // assert(ousd.balanceOf(ADDRESS_USER0) == 1000);</span>
18 | | <span class='neutral'> // assert(ousd.rebaseState(ADDRESS_USER0) != OUSD.RebaseOptions.OptIn);</span>
19 | | <span class='neutral'> // assert(Address.isContract(ADDRESS_CONTRACT0));</span>
20 | | <span class='neutral'> // Debugger.log("nonRebasingSupply", ousd.nonRebasingSupply());</span>
21 | | <span class='neutral'> // assert(false);</span>
22 | | <span class='neutral'> }</span>
23 | | <span class='neutral'>}</span>
24 | | <span class='neutral'></span>
</code>
<br />
<b>/home/rappie/Desktop/targets/origin-dollar/fuzzing-ousd-public/src/echidna/EchidnaHelper.sol</b>
<code>
1 | | <span class='neutral'>// SPDX-License-Identifier: MIT</span>
2 | | <span class='neutral'>pragma solidity ^0.8.0;</span>
3 | | <span class='neutral'></span>
4 | | <span class='neutral'>import "./EchidnaSetup.sol";</span>
5 | | <span class='neutral'>import "./Debugger.sol";</span>
6 | | <span class='neutral'></span>
7 | | <span class='neutral'>/**</span>
8 | | <span class='neutral'> * @title Mixin containing helper functions</span>
9 | | <span class='neutral'> * @author Rappie</span>
10 | | <span class='neutral'> */</span>
11 | | <span class='unexecuted'>contract EchidnaHelper is EchidnaSetup {</span>
12 | | <span class='neutral'> /**</span>
13 | | <span class='neutral'> * @notice Mint tokens to an account</span>
14 | | <span class='neutral'> * @param toAcc Account to mint to</span>
15 | | <span class='neutral'> * @param amount Amount to mint</span>
16 | | <span class='neutral'> * @return Amount minted (in case of capped mint with modulo)</span>
17 | | <span class='neutral'> */</span>
18 | * | <span class='executed'> function mint(uint8 toAcc, uint256 amount) public returns (uint256) {</span>
19 | * | <span class='executed'> address to = getAccount(toAcc);</span>
20 | | <span class='neutral'></span>
21 | * | <span class='executed'> if (TOGGLE_MINT_LIMIT) {</span>
22 | * | <span class='executed'> amount = amount % MINT_MODULO;</span>
23 | | <span class='neutral'> }</span>
24 | | <span class='neutral'></span>
25 | * | <span class='executed'> hevm.prank(ADDRESS_VAULT);</span>
26 | * | <span class='executed'> ousd.mint(to, amount);</span>
27 | | <span class='neutral'></span>
28 | * | <span class='executed'> return amount;</span>
29 | | <span class='neutral'> }</span>
30 | | <span class='neutral'></span>
31 | | <span class='neutral'> /**</span>
32 | | <span class='neutral'> * @notice Burn tokens from an account</span>
33 | | <span class='neutral'> * @param fromAcc Account to burn from</span>
34 | | <span class='neutral'> * @param amount Amount to burn</span>
35 | | <span class='neutral'> */</span>
36 | * | <span class='executed'> function burn(uint8 fromAcc, uint256 amount) public {</span>
37 | * | <span class='executed'> address from = getAccount(fromAcc);</span>
38 | * | <span class='executed'> hevm.prank(ADDRESS_VAULT);</span>
39 | *r | <span class='executed'> ousd.burn(from, amount);</span>
40 | | <span class='neutral'> }</span>
41 | | <span class='neutral'></span>
42 | | <span class='neutral'> /**</span>
43 | | <span class='neutral'> * @notice Change the total supply of OUSD (rebase)</span>
44 | | <span class='neutral'> * @param amount New total supply</span>
45 | | <span class='neutral'> */</span>
46 | * | <span class='executed'> function changeSupply(uint256 amount) public {</span>
47 | * | <span class='executed'> if (TOGGLE_CHANGESUPPLY_LIMIT) {</span>
48 | * | <span class='executed'> amount =</span>
49 | * | <span class='executed'> ousd.totalSupply() +</span>
50 | * | <span class='executed'> (amount % (ousd.totalSupply() / CHANGESUPPLY_DIVISOR));</span>
51 | | <span class='neutral'> }</span>
52 | | <span class='neutral'></span>
53 | * | <span class='executed'> hevm.prank(ADDRESS_VAULT);</span>
54 | * | <span class='executed'> ousd.changeSupply(amount);</span>
55 | | <span class='neutral'> }</span>
56 | | <span class='neutral'></span>
57 | | <span class='neutral'> /**</span>
58 | | <span class='neutral'> * @notice Transfer tokens between accounts</span>
59 | | <span class='neutral'> * @param fromAcc Account to transfer from</span>
60 | | <span class='neutral'> * @param toAcc Account to transfer to</span>
61 | | <span class='neutral'> * @param amount Amount to transfer</span>
62 | | <span class='neutral'> */</span>
63 | * | <span class='executed'> function transfer(</span>
64 | | <span class='neutral'> uint8 fromAcc,</span>
65 | | <span class='neutral'> uint8 toAcc,</span>
66 | | <span class='neutral'> uint256 amount</span>
67 | | <span class='neutral'> ) public {</span>
68 | * | <span class='executed'> address from = getAccount(fromAcc);</span>
69 | * | <span class='executed'> address to = getAccount(toAcc);</span>
70 | * | <span class='executed'> hevm.prank(from);</span>
71 | * | <span class='executed'> ousd.transfer(to, amount);</span>
72 | | <span class='neutral'> }</span>
73 | | <span class='neutral'></span>
74 | | <span class='neutral'> /**</span>
75 | | <span class='neutral'> * @notice Transfer approved tokens between accounts</span>
76 | | <span class='neutral'> * @param authorizedAcc Account that is authorized to transfer</span>
77 | | <span class='neutral'> * @param fromAcc Account to transfer from</span>
78 | | <span class='neutral'> * @param toAcc Account to transfer to</span>
79 | | <span class='neutral'> * @param amount Amount to transfer</span>
80 | | <span class='neutral'> */</span>
81 | * | <span class='executed'> function transferFrom(</span>
82 | | <span class='neutral'> uint8 authorizedAcc,</span>
83 | | <span class='neutral'> uint8 fromAcc,</span>
84 | | <span class='neutral'> uint8 toAcc,</span>
85 | | <span class='neutral'> uint256 amount</span>
86 | * | <span class='executed'> ) public {</span>
87 | * | <span class='executed'> address authorized = getAccount(authorizedAcc);</span>
88 | * | <span class='executed'> address from = getAccount(fromAcc);</span>
89 | * | <span class='executed'> address to = getAccount(toAcc);</span>
90 | * | <span class='executed'> hevm.prank(authorized);</span>
91 | *r | <span class='executed'> ousd.transferFrom(from, to, amount);</span>
92 | | <span class='neutral'> }</span>
93 | | <span class='neutral'></span>
94 | | <span class='neutral'> /**</span>
95 | | <span class='neutral'> * @notice Opt in to rebasing</span>
96 | | <span class='neutral'> * @param targetAcc Account to opt in</span>
97 | | <span class='neutral'> */</span>
98 | * | <span class='executed'> function optIn(uint8 targetAcc) public {</span>
99 | * | <span class='executed'> address target = getAccount(targetAcc);</span>
100 | * | <span class='executed'> hevm.prank(target);</span>
101 | * | <span class='executed'> ousd.rebaseOptIn();</span>
102 | | <span class='neutral'> }</span>
103 | | <span class='neutral'></span>
104 | | <span class='neutral'> /**</span>
105 | | <span class='neutral'> * @notice Opt out of rebasing</span>
106 | | <span class='neutral'> * @param targetAcc Account to opt out</span>
107 | | <span class='neutral'> */</span>
108 | * | <span class='executed'> function optOut(uint8 targetAcc) public {</span>
109 | * | <span class='executed'> address target = getAccount(targetAcc);</span>
110 | * | <span class='executed'> hevm.prank(target);</span>
111 | *r | <span class='executed'> ousd.rebaseOptOut();</span>
112 | | <span class='neutral'> }</span>
113 | | <span class='neutral'></span>
114 | | <span class='neutral'> /**</span>
115 | | <span class='neutral'> * @notice Approve an account to spend OUSD</span>
116 | | <span class='neutral'> * @param ownerAcc Account that owns the OUSD</span>
117 | | <span class='neutral'> * @param spenderAcc Account that is approved to spend the OUSD</span>
118 | | <span class='neutral'> * @param amount Amount to approve</span>
119 | | <span class='neutral'> */</span>
120 | * | <span class='executed'> function approve(</span>
121 | | <span class='neutral'> uint8 ownerAcc,</span>
122 | | <span class='neutral'> uint8 spenderAcc,</span>
123 | | <span class='neutral'> uint256 amount</span>
124 | | <span class='neutral'> ) public {</span>
125 | * | <span class='executed'> address owner = getAccount(ownerAcc);</span>
126 | * | <span class='executed'> address spender = getAccount(spenderAcc);</span>
127 | * | <span class='executed'> hevm.prank(owner);</span>
128 | * | <span class='executed'> ousd.approve(spender, amount);</span>
129 | | <span class='neutral'> }</span>
130 | | <span class='neutral'></span>
131 | | <span class='neutral'> /**</span>
132 | | <span class='neutral'> * @notice Increase the allowance of an account to spend OUSD</span>
133 | | <span class='neutral'> * @param ownerAcc Account that owns the OUSD</span>
134 | | <span class='neutral'> * @param spenderAcc Account that is approved to spend the OUSD</span>
135 | | <span class='neutral'> * @param amount Amount to increase the allowance by</span>
136 | | <span class='neutral'> */</span>
137 | * | <span class='executed'> function increaseAllowance(</span>
138 | | <span class='neutral'> uint8 ownerAcc,</span>
139 | | <span class='neutral'> uint8 spenderAcc,</span>
140 | | <span class='neutral'> uint256 amount</span>
141 | | <span class='neutral'> ) public {</span>
142 | * | <span class='executed'> address owner = getAccount(ownerAcc);</span>
143 | * | <span class='executed'> address spender = getAccount(spenderAcc);</span>
144 | * | <span class='executed'> hevm.prank(owner);</span>
145 | * | <span class='executed'> ousd.increaseAllowance(spender, amount);</span>
146 | | <span class='neutral'> }</span>
147 | | <span class='neutral'></span>
148 | | <span class='neutral'> /**</span>
149 | | <span class='neutral'> * @notice Decrease the allowance of an account to spend OUSD</span>
150 | | <span class='neutral'> * @param ownerAcc Account that owns the OUSD</span>
151 | | <span class='neutral'> * @param spenderAcc Account that is approved to spend the OUSD</span>
152 | | <span class='neutral'> * @param amount Amount to decrease the allowance by</span>
153 | | <span class='neutral'> */</span>
154 | * | <span class='executed'> function decreaseAllowance(</span>
155 | | <span class='neutral'> uint8 ownerAcc,</span>
156 | | <span class='neutral'> uint8 spenderAcc,</span>
157 | | <span class='neutral'> uint256 amount</span>
158 | | <span class='unexecuted'> ) public {</span>
159 | * | <span class='executed'> address owner = getAccount(ownerAcc);</span>
160 | * | <span class='executed'> address spender = getAccount(spenderAcc);</span>
161 | * | <span class='executed'> hevm.prank(owner);</span>
162 | *r | <span class='executed'> ousd.decreaseAllowance(spender, amount);</span>
163 | | <span class='neutral'> }</span>
164 | | <span class='neutral'></span>
165 | | <span class='neutral'> /**</span>
166 | | <span class='neutral'> * @notice Get the sum of all OUSD balances</span>
167 | | <span class='neutral'> * @return total Total balance</span>
168 | | <span class='neutral'> */</span>
169 | * | <span class='executed'> function getTotalBalance() public view returns (uint256 total) {</span>
170 | * | <span class='executed'> total += ousd.balanceOf(ADDRESS_VAULT);</span>
171 | * | <span class='executed'> total += ousd.balanceOf(ADDRESS_OUTSIDER_USER);</span>
172 | * | <span class='executed'> total += ousd.balanceOf(ADDRESS_OUTSIDER_CONTRACT);</span>
173 | * | <span class='executed'> total += ousd.balanceOf(ADDRESS_USER0);</span>
174 | * | <span class='executed'> total += ousd.balanceOf(ADDRESS_USER1);</span>
175 | * | <span class='executed'> total += ousd.balanceOf(ADDRESS_CONTRACT0);</span>
176 | * | <span class='executed'> total += ousd.balanceOf(ADDRESS_CONTRACT1);</span>
177 | | <span class='neutral'> }</span>
178 | | <span class='neutral'></span>
179 | | <span class='neutral'> /**</span>
180 | | <span class='neutral'> * @notice Get the sum of all non-rebasing OUSD balances</span>
181 | | <span class='neutral'> * @return total Total balance</span>
182 | | <span class='neutral'> */</span>