-
Notifications
You must be signed in to change notification settings - Fork 5
/
ERC20Harness.sol
64 lines (55 loc) · 3.02 KB
/
ERC20Harness.sol
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
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.0;
/// --------------------------------------------------------------------
/// @notice This file was automatically generated using fuzz-utils
///
/// -- [ Prerequisites ]
/// 1. The generated contracts depend on crytic/properties utilities
/// which need to be installed, this can be done by running:
/// `forge install crytic/properties`
/// 2. Absolute paths are used for contract inheritance, requiring
/// the main directory that contains the contracts to be added to
/// the Foundry remappings. This can be done by adding:
/// `directoryName/=directoryName/` to foundry.toml or remappings.txt
///
/// -- [ Running the fuzzers ]
/// * The below commands contain example values which you can modify based
/// on your needs. For further information on the configuration options
/// please reference the fuzzer documentation *
/// Echidna: echidna --contract ERC20Harness --test-mode assertion --test-limit 100000 --corpus-dir echidna-corpora/corpus-ERC20Harness
/// Medusa: medusa fuzz --target --assertion-mode --test-limit 100000 --deployment-order "ERC20Harness" --corpus-dir medusa-corpora/corpus-ERC20Harness
/// Foundry: forge test --match-contract ERC20Harness
/// --------------------------------------------------------------------
import "properties/util/PropertiesHelper.sol";
import "src/TestERC20.sol";
import "../actors/ActorDefault.sol";
contract ERC20Harness is PropertiesAsserts {
TestERC20 testerc20;
ActorDefault[] Default_actors;
constructor() {
testerc20 = new TestERC20();
for(uint256 i; i < 3; i++) {
Default_actors.push(new ActorDefault(address(testerc20)));
}
}
// -------------------------------------
// ActorDefault functions
// test/fuzzing/actors/ActorDefault.sol
// -------------------------------------
function approve(uint256 actorIndex, address payable spender, uint256 amount) public returns (bool) {
ActorDefault selectedActor = Default_actors[clampBetween(actorIndex, 0, Default_actors.length - 1)];
selectedActor.approve(spender, amount);
}
function transfer(uint256 actorIndex, address payable to, uint256 amount) public returns (bool) {
ActorDefault selectedActor = Default_actors[clampBetween(actorIndex, 0, Default_actors.length - 1)];
selectedActor.transfer(to, amount);
}
function transferFrom(uint256 actorIndex, address payable from, address payable to, uint256 amount) public returns (bool) {
ActorDefault selectedActor = Default_actors[clampBetween(actorIndex, 0, Default_actors.length - 1)];
selectedActor.transferFrom(from, to, amount);
}
function permit(uint256 actorIndex, address payable owner, address payable spender, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s) public {
ActorDefault selectedActor = Default_actors[clampBetween(actorIndex, 0, Default_actors.length - 1)];
selectedActor.permit(owner, spender, value, deadline, v, r, s);
}
}