Skip to content

Commit

Permalink
Merge pull request #1218 from eth-brownie/fix/hardhat-reverts
Browse files Browse the repository at this point in the history
Hardhat revert reasons
  • Loading branch information
iamdefinitelyahuman committed Aug 24, 2021
2 parents 7e34be7 + 5928b8f commit 8b60ca1
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions brownie/network/middlewares/hardhat.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import re
from typing import Callable, Dict, List, Optional

from web3 import Web3
Expand Down Expand Up @@ -35,6 +36,8 @@ def process_request(self, make_request: Callable, method: str, params: List) ->
data.update({"error": "revert", "reason": None})
elif message.startswith("revert"):
data.update({"error": "revert", "reason": message[7:]})
elif "reverted with reason string '" in message:
data.update(error="revert", reason=re.findall(".*?'(.*)'$", message)[0])
else:
data["error"] = message
return result

0 comments on commit 8b60ca1

Please sign in to comment.