forked from balancer/balancer-core
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathAdvancedTestsUtils.sol
60 lines (45 loc) · 1.41 KB
/
AdvancedTestsUtils.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
// SPDX-License-Identifier: UNLICENSED
pragma solidity 0.8.25;
import {MockERC20} from 'forge-std/mocks/MockERC20.sol';
import {SymTest} from 'halmos-cheatcodes/src/SymTest.sol';
interface IHevm {
function prank(address) external;
}
contract FuzzERC20 is MockERC20 {
function mint(address _to, uint256 _amount) public {
_mint(_to, _amount);
}
function burn(address _from, uint256 _amount) public {
_burn(_from, _amount);
}
}
contract AgentsHandler {
uint256 internal agentsIndex;
address[] internal agents;
address internal currentCaller;
modifier AgentOrDeployer() {
uint256 _currentAgentIndex = agentsIndex;
currentCaller = _currentAgentIndex == 0 ? address(this) : agents[agentsIndex];
_;
}
constructor(uint256 _numAgents) {
for (uint256 i = 0; i < _numAgents; i++) {
agents.push(address(bytes20(keccak256(abi.encodePacked(i)))));
}
}
function nextAgent() public {
agentsIndex = (agentsIndex + 1) % agents.length;
}
function getCurrentAgent() public view returns (address) {
return agents[agentsIndex];
}
}
contract EchidnaTest is AgentsHandler {
event AssertionFailed();
IHevm hevm = IHevm(0x7109709ECfa91a80626fF3989D68f67F5b1DD12D);
constructor() AgentsHandler(5) {}
function clamp(uint256 _value, uint256 _min, uint256 _max) internal returns (uint256) {
return _min + (_value % (_max - _min));
}
}
contract HalmosTest is SymTest {}