From cc4a68cf70079cfc6d9df4069294bcc90fbbbe03 Mon Sep 17 00:00:00 2001 From: Yosuke Otosu Date: Sun, 3 Jul 2022 05:38:18 +0900 Subject: [PATCH 1/2] fix: "to" field is null during contract creation, e.g. in receipt from anvil it is not present --- brownie/network/transaction.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/brownie/network/transaction.py b/brownie/network/transaction.py index f6334db84..71215b223 100644 --- a/brownie/network/transaction.py +++ b/brownie/network/transaction.py @@ -546,7 +546,7 @@ def _await_confirmation(self, block_number: int = None, required_confs: int = 1) def _set_from_tx(self, tx: Dict) -> None: if not self.sender: self.sender = EthAddress(tx["from"]) - self.receiver = EthAddress(tx["to"]) if tx["to"] else None + self.receiver = EthAddress(tx["to"]) if tx.get("to", None) else None self.value = Wei(tx["value"]) self.gas_price = tx.get("gasPrice") self.max_fee = tx.get("maxFeePerGas") @@ -560,7 +560,7 @@ def _set_from_tx(self, tx: Dict) -> None: if self.fn_name: return try: - contract = state._find_contract(tx["to"]) + contract = state._find_contract(tx.get("to")) if contract is not None: self.contract_name = contract._name self.fn_name = contract.get_method(tx["input"]) From aa605363db585c3c259761de18f2e49d496e5847 Mon Sep 17 00:00:00 2001 From: Yosuke Otosu Date: Sun, 3 Jul 2022 05:51:14 +0900 Subject: [PATCH 2/2] add: CHANGELOG --- CHANGELOG.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7b4462976..39295212d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased](https://github.com/eth-brownie/brownie) +### Fixed +- Handle null value of `to` field in transaction receipt so that contract deploying with Anvil works properly ([#1573](https://github.com/eth-brownie/brownie/pull/1573)) + ## [1.19.0](https://github.com/eth-brownie/brownie/tree/v1.19.0) - 2022-05-29 ### Added - Initial support for [Anvil](https://github.com/foundry-rs/foundry/tree/master/anvil), a blazing-fast local testnet node implementation in Rust ([#1541](https://github.com/eth-brownie/brownie/pull/1541))