-
Notifications
You must be signed in to change notification settings - Fork 4
/
EchidnaReentrancy.sol
52 lines (43 loc) · 1.26 KB
/
EchidnaReentrancy.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
// SPDX-License-Identifier: MIT
import "./EchidnaHelper.sol";
import "./Debugger.sol";
contract EchidnaReentrancy is EchidnaHelper {
bool internal enabled;
uint8 internal callback;
uint256 internal uint0;
function updateReentrancy(
bool _enabled,
uint8 _callback,
uint256 _uint0
) public {
enabled = _enabled;
callback = _callback;
uint0 = _uint0;
}
function setReentrancyEnabled(bool _enabled) public {
enabled = _enabled;
}
function setReentrancyCallback(uint8 _callback) public {
callback = _callback;
}
function setReentrancyUint0(uint256 _uint0) public {
uint0 = _uint0;
}
function performCallback(uint8 accountId) public {
if (!enabled) return;
uint256 functionId = (callback % 6) + 1;
if (functionId == 1) {
mint(accountId, uint0);
} else if (functionId == 2) {
redeem(accountId, uint0);
} else if (functionId == 3) {
borrow(accountId, uint0);
} else if (functionId == 4) {
repay(accountId, uint0);
} else if (functionId == 5) {
exitMarket(accountId);
} else if (functionId == 6) {
accrueInterest();
}
}
}