I have a contract Foo with a __default__() method. I have another contract Bar that invokes Foo's __default__() method when it calls send(foo.address, 1).

When running Brownie tests, with both Foo and Bar deployed, Bar is reverting when it calls send(foo.address, 1). Unfortunately, I get no useful info about why Bar's send() fails. Therefore, I want to some how call Foo's __default__() directly in my Brownie test.

  1. Can a Brownie test invoke a contract's __default__() method?
  2. If so, how?

What I tried:

  • In Brownie test, called a non-existent method on a deployed Foo contract object. Was hoping the call would be dispatched to Foo's __default__() method, but it wasn't.

1 Answer 1


Being new to Ethereum smart contracts, I didn't realize how easy it was to send eth from a Brownie test to a deployed contract. For future newbies, here's how:

# deploy contract
myContract = MyContract.deploy({'from': admin})

# transfering from an account to contract calls the contract's __default__() method
accounts[0].transfer(myContract.address, 1) 

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.