generated from Kwenta/foundry-scaffold
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
bb01477
commit 2f62829
Showing
1 changed file
with
60 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
example | ||
|
||
```solidity | ||
// SPDX-License-Identifier: GPL-3.0-or-later | ||
pragma solidity ^0.8.13; | ||
import {Test} from "forge-std/Test.sol"; | ||
contract ExampleTypeHandler is Test { | ||
function canResultInOverflow(bytes memory x) public pure { | ||
// logic that can result in overflow given x | ||
} | ||
function canResultInUnderflow(bytes memory x) public pure { | ||
// logic that can result in underflow given x | ||
} | ||
} | ||
contract ExampleHandler is Test { | ||
ExampleTypeHandler public exampleTypeHandler; | ||
constructor(ExampleTypeHandler _exampleTypeHandler) { | ||
exampleTypeHandler = _exampleTypeHandler; | ||
} | ||
function ghost_overflow(bytes memory x) public view { | ||
exampleTypeHandler.canResultInOverflow(x); | ||
} | ||
function ghost_underflow(bytes memory x) public view { | ||
exampleTypeHandler.canResultInUnderflow(x); | ||
} | ||
} | ||
contract ExampleInvariantOverflow is Test { | ||
ExampleHandler public exampleHandler; | ||
constructor(ExampleHandler _exampleHandler) { | ||
exampleHandler = _exampleHandler; | ||
} | ||
function invariant_overflow() public view { | ||
bytes memory x; | ||
exampleHandler.ghost_overflow(x); | ||
} | ||
} | ||
contract ExampleInvariantUnderflow is Test { | ||
ExampleHandler public exampleHandler; | ||
constructor(ExampleHandler _exampleHandler) { | ||
exampleHandler = _exampleHandler; | ||
} | ||
function invariant_underflow() public view { | ||
bytes memory x; | ||
exampleHandler.ghost_underflow(x); | ||
} | ||
} | ||
``` |