Skip to content
Merged
70 changes: 0 additions & 70 deletions src/AssertWrapper.sol

This file was deleted.

65 changes: 0 additions & 65 deletions src/ClampWrapper.sol

This file was deleted.

25 changes: 14 additions & 11 deletions src/Constants.sol
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

abstract contract Constants {
library Constants {
// https://docs.soliditylang.org/en/latest/control-structures.html#panic-via-assert-and-error-via-require
// 0x00: Used for generic compiler inserted panics.
// 0x01: If you call assert with an argument that evaluates to false.
Expand All @@ -13,14 +13,17 @@ abstract contract Constants {
// 0x32: If you access an array, bytesN or an array slice at an out-of-bounds or negative index (i.e. x[i] where i >= x.length or i < 0).
// 0x41: If you allocate too much memory or create an array that is too large.
// 0x51: If you call a zero-initialized variable of internal function type.
uint256 internal constant PANIC_GENERAL = 0x00;
uint256 internal constant PANIC_ASSERT = 0x01;
uint256 internal constant PANIC_ARITHMETIC = 0x11;
uint256 internal constant PANIC_DIVISION_BY_ZERO = 0x12;
uint256 internal constant PANIC_ENUM_OUT_OF_BOUNDS = 0x21;
uint256 internal constant PANIC_STORAGE_BYTES_ARRAY_ENCODING = 0x22;
uint256 internal constant PANIC_POP_EMPTY_ARRAY = 0x31;
uint256 internal constant PANIC_ARRAY_OUT_OF_BOUNDS = 0x32;
uint256 internal constant PANIC_ALLOC_TOO_MUCH_MEMORY = 0x41;
uint256 internal constant PANIC_ZERO_INIT_INTERNAL_FUNCTION = 0x51;
uint256 public constant PANIC_GENERAL = 0x00;
uint256 public constant PANIC_ASSERT = 0x01;
uint256 public constant PANIC_ARITHMETIC = 0x11;
uint256 public constant PANIC_DIVISION_BY_ZERO = 0x12;
uint256 public constant PANIC_ENUM_OUT_OF_BOUNDS = 0x21;
uint256 public constant PANIC_STORAGE_BYTES_ARRAY_ENCODING = 0x22;
uint256 public constant PANIC_POP_EMPTY_ARRAY = 0x31;
uint256 public constant PANIC_ARRAY_OUT_OF_BOUNDS = 0x32;
uint256 public constant PANIC_ALLOC_TOO_MUCH_MEMORY = 0x41;
uint256 public constant PANIC_ZERO_INIT_INTERNAL_FUNCTION = 0x51;

address public constant ADDRESS_CHEATS =
0x7109709ECfa91a80626fF3989D68f67F5b1DD12D;
}
26 changes: 8 additions & 18 deletions src/FuzzBase.sol
Original file line number Diff line number Diff line change
@@ -1,23 +1,13 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

import "./AssertWrapper.sol";
import "./ClampWrapper.sol";
import "./MathHelper.sol";
import "./RandomHelper.sol";
import "./Logging.sol";
import "./Constants.sol";
import "./IHevm.sol";
import "./IStdCheats.sol";
import {Fuzzlib} from "./Fuzzlib.sol";
import {PlatformCrytic} from "./platform/PlatformCrytic.sol";

abstract contract FuzzBase is
AssertWrapper,
ClampWrapper,
MathHelper,
RandomHelper,
Logging,
Constants
{
IHevm internal vm = IHevm(0x7109709ECfa91a80626fF3989D68f67F5b1DD12D); // for echidna
IStdCheats internal mvm = IStdCheats(0x7109709ECfa91a80626fF3989D68f67F5b1DD12D); // for medusa
abstract contract FuzzBase {
Fuzzlib internal fl = new Fuzzlib();

constructor() {
fl.setPlatform(address(new PlatformCrytic()));
}
}
14 changes: 14 additions & 0 deletions src/Fuzzlib.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

import {HelperBase} from "./helpers/HelperBase.sol";
import {HelperAssert} from "./helpers/HelperAssert.sol";
import {HelperCheats} from "./helpers/HelperCheats.sol";
import {HelperClamp} from "./helpers/HelperClamp.sol";

contract Fuzzlib is
HelperBase,
HelperAssert,
HelperCheats,
HelperClamp
{}
Loading