-
-
Notifications
You must be signed in to change notification settings - Fork 821
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: support Panic & custom contract errors
- Loading branch information
Showing
30 changed files
with
1,432 additions
and
628 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 |
---|---|---|
|
@@ -18,6 +18,9 @@ bench | |
.env.production.local | ||
.envrc | ||
|
||
# @wagmi/cli | ||
generated.ts | ||
|
||
actions/** | ||
chains/** | ||
clients/** | ||
|
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,3 @@ | ||
[submodule "contracts/lib/forge-std"] | ||
path = contracts/lib/forge-std | ||
url = https://github.com/foundry-rs/forge-std |
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,2 @@ | ||
cache/ | ||
out/ |
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,2 @@ | ||
[profile.ci.fuzz] | ||
runs = 10_000 |
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,50 @@ | ||
// SPDX-License-Identifier: Unlicense | ||
pragma solidity ^0.8.13; | ||
|
||
contract ErrorsExample { | ||
struct Foo { | ||
address sender; | ||
uint256 bar; | ||
} | ||
|
||
error SimpleError(string message); | ||
error ComplexError(Foo foo, string message, uint256 number); | ||
|
||
function revertExample() public pure { | ||
revert("This is a revert message"); | ||
} | ||
|
||
function assertExample() public pure { | ||
assert(false); | ||
} | ||
|
||
function overflowExample() public pure returns (uint256) { | ||
uint256 a = 2**256 - 1; | ||
uint256 b = 1; | ||
uint256 c = a + b; | ||
return c; | ||
} | ||
|
||
function divideByZeroExample() public pure returns (uint256) { | ||
uint256 a = 69; | ||
uint256 b = 0; | ||
uint256 c = a / b; | ||
return c; | ||
} | ||
|
||
function requireExample() public pure { | ||
require(false); | ||
} | ||
|
||
function simpleCustomError() public pure { | ||
revert SimpleError("bugger"); | ||
} | ||
|
||
function complexCustomError() public pure { | ||
revert ComplexError( | ||
Foo({sender: 0x0000000000000000000000000000000000000000, bar: 69}), | ||
"bugger", | ||
69 | ||
); | ||
} | ||
} |
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
Oops, something went wrong.