forked from primodiumxyz/mud-stateful-fuzzing-bug-repro
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Handler.t.sol
44 lines (35 loc) · 1.39 KB
/
Handler.t.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
// SPDX-License-Identifier: MIT
pragma solidity >=0.8.24;
import { Test } from "forge-std/Test.sol";
import { StoreSwitch } from "@latticexyz/store/src/StoreSwitch.sol";
import { IWorld } from "codegen/world/IWorld.sol";
import { Counter } from "codegen/index.sol";
contract Handler is Test {
/* -------------------------------------------------------------------------- */
/* STORAGE */
/* -------------------------------------------------------------------------- */
/// @dev World contract
IWorld internal world;
/// @dev Mirrored counter value
uint256 private _mirrorCounter;
/* -------------------------------------------------------------------------- */
/* FUNCTIONS */
/* -------------------------------------------------------------------------- */
constructor(address _world) {
world = IWorld(_world);
StoreSwitch.setStoreAddress(_world);
}
/// @dev Increment the counter
function handler_incrementCounter(uint256) public {
world.app__increment();
_mirrorCounter++;
}
/// @dev Get the mirrored counter value
function getCounterMirror() public view returns (uint256) {
return _mirrorCounter;
}
/// @dev Get the counter value
function getCounter() public view returns (uint256) {
return Counter.get();
}
}