From d99eb3eae0e3bef55c2b148a915955403c74f9aa Mon Sep 17 00:00:00 2001 From: Ben Hauser Date: Tue, 24 Nov 2020 23:26:28 +0400 Subject: [PATCH] style: improve error message when `from` field missing in a contract call --- brownie/network/contract.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/brownie/network/contract.py b/brownie/network/contract.py index 3671374c4..4869e2237 100644 --- a/brownie/network/contract.py +++ b/brownie/network/contract.py @@ -239,8 +239,8 @@ def __call__(self, *args: Tuple) -> Union["Contract", TransactionReceiptType]: args, tx = _get_tx(None, args) if not tx["from"]: raise AttributeError( - "No deployer address given. You must supply a tx dict" - " as the last argument with a 'from' field." + "Final argument must be a dict of transaction parameters that " + "includes a `from` field specifying the address to deploy from" ) return tx["from"].deploy( self._parent, @@ -293,8 +293,8 @@ def estimate_gas(self, *args: Tuple) -> int: args, tx = _get_tx(None, args) if not tx["from"]: raise AttributeError( - "Contract has no owner, you must supply a tx dict" - " as the last argument with a 'from' field." + "Final argument must be a dict of transaction parameters that " + "includes a `from` field specifying the sender of the transaction" ) return tx["from"].estimate_gas( @@ -1076,8 +1076,8 @@ def transact(self, *args: Tuple) -> TransactionReceiptType: args, tx = _get_tx(self._owner, args) if not tx["from"]: raise AttributeError( - "Contract has no owner, you must supply a tx dict" - " as the last argument with a 'from' field." + "Final argument must be a dict of transaction parameters that " + "includes a `from` field specifying the sender of the transaction" ) return tx["from"].transfer( @@ -1166,8 +1166,8 @@ def estimate_gas(self, *args: Tuple) -> int: args, tx = _get_tx(self._owner, args) if not tx["from"]: raise AttributeError( - "Contract has no owner, you must supply a tx dict" - " as the last argument with a 'from' field." + "Final argument must be a dict of transaction parameters that " + "includes a `from` field specifying the sender of the transaction" ) return tx["from"].estimate_gas(