As of May 31, 2023, we have updated our Code of Conduct.

Questions tagged [brownie]

Brownie is a Python-based development and testing framework for smart contracts targeting the Ethereum Virtual Machine.

Filter by
Sorted by
Tagged with
0 votes
1 answer
142 views

Adding subscription address to chainlink vrf v2 inside of the contract

So I'm writing this lottery smart contract which is pretty straight forward, and since I want to test this on the goerli test net, I want to be able to add the contract as a subscriber to my VRF every ...
0 votes
2 answers
360 views

Brownie : Contract Functionality not available in local environment

I have set up a new brownie project (brownie bake yearn strategy mix). When I try running tests I get this error : brownie.exceptions.BrownieEnvironmentError: Functionality not available in local ...
1 vote
1 answer
441 views

Cant compile contracts with brownie because of this error: which: no solc in $PATH (on Gnu/Linux boxes) after a fresh install

After following the instructions to install Brownie using pipx (https://eth-brownie.readthedocs.io/en/stable/install.html#installing-brownie) I was able to execute brownie (after adding ~/.local/bin ...
1 vote
1 answer
303 views

Brownie: TransactionReceipt from a reverted tx inside a script

In the Brownie-documentation it says: Debugging Tools When using the console, transactions that revert still return a TransactionReceipt object. This object provides access to various attributes and ...
2 votes
1 answer
296 views

Brownie ConnectionResetError on running forks

I am running a test script with mainnet-fork using alchemy. The test appears to be successfully completed, but during the tear down bit, brownie throws up: ConnectionResetError: [WinError 10054] An ...
2 votes
1 answer
150 views

Adding viaIR: true option Brownie

I'm getting CompilerError: Stack too deep. Try compiling with `--via-ir` (cli) or the equivalent `viaIR: true` (standard JSON) while enabling the optimizer. Otherwise, try removing local variables. ...
0 votes
3 answers
372 views

AttributeError - 'InterfaceContainer' object has no attribute

from brownie import config, network, interface from scripts.helpful_scripts import get_account from scripts.get_weth import get_weth def main(): account = get_account() erc20_address = config[...
2 votes
1 answer
669 views

Setup brownie to run certain test in a specific network

I am using brownie to run tests and right now my project is using two networks, development and mainnet-fork. I have a test which only runs in mainnet-fork and I am trying to figure out a way to tell ...
3 votes
2 answers
456 views

How to run Chainlink Project using eth-brownie python

I had installed eth-brownie using command pip install eth-brownie after Brownie installed.I had bake existing Brownie project into a new directory. mkdir MyChainlinkProject cd MyChainlinkProject/ ...
4 votes
4 answers
2k views

Brownie Chainlink Import Error VSCode - 'File import callback not supported'

The code seems to have successfully compiled, but VSCode keeps showing this error - "@chainlink/contracts/src/v0.8/interfaces/AggregatorV3Interface.sol" not found. File import callback not ...
0 votes
1 answer
280 views

account not accessible through brownie accounts while using --network ganache-local

(eth-brownie) PS C:\Users\lucky\Desktop\Investing\Courses\Solidity\demos\brownie_fund_me> brownie run scripts/deploy.py --network ganache-local INFO: Could not find files for the given pattern(s). ...
0 votes
0 answers
44 views

Sepolia Unauthorized URL

Good day, Ive constantly been getting errors while working with Sepolia Test Eth with Brownie, I've checked for errors in my .envfile as well as in my brownie-config and still havent seen a ny issues, ...
2 votes
2 answers
792 views

How to get a contracts emitted events in brownie?

Say I have a contract that emits multiple events, how do I to get a list of all events emitted in brownie and sort them by event type? contract SimpleContract { event Deposit(address indexed ...
0 votes
0 answers
5 views

Brownie map.json is empty need to restore it

My map.json got corrupted and i had build folder not in sync with github. Is there a way to recreate the map.json for an already deployed contract? File "brownie/_cli/__main__.py", line 64, ...
0 votes
1 answer
23 views

Brownie not returning Mapping Values

Good day to everyone, I've been working with brownie for sometime now and have been running into a lot of challenges. I created a struct basically and a mapping to that struct, however when I deploy ...
1 vote
2 answers
404 views

How to do `abi.encodeWithSignature` in Python and eth-brownie

I want to encode data using abi.encodeWithSignature in Python, and send the output from this into a contract function parameter. Now the problem is I can't figure out how should I do it. The function ...
3 votes
1 answer
157 views

How do I automatically verify my contracts on etherscan using brownie?

I discovered truffle has truffle-plugin-verify that help you verify your contracts on etherscan. I wonder if similar functionality can be done with brownie ?
0 votes
1 answer
22 views

What version of web3py does ApeWorX support and does it also support account impersonation (unlock account) without needing the private key?

What is the most recent web3py version that ApeWorX supports? I need to have support for unlocking random eth accounts on a local test network (ex: http localhost 8545) through something like hardhat (...
2 votes
0 answers
59 views

Using Brownie to verify contract error

I added sepolia with my infura api key to deploy my contract it works fine. Until I try to verify my contract with publish_source=True in FundMe.deploy function: from brownie import FundMe from ...
1 vote
1 answer
812 views

SolcInstallationError: Downloaded binary would not execute, or returned unexpected output

I am attempting to do the 'brownie compile' but each time it processes I am provided with 'SolcInstallation Error' - Downloaded Library would not execute or returned unexpected output. I have gone ...
0 votes
1 answer
259 views

Solidity Brownie pytest - tests are failing when connecting to ETH forked mainnet but work when running locally

I'm working through FreeCodeCamp.org's YT Solidity tutorial and I'm up to the part where I'm trying to run pytest on an ETH Mainnet Fork. When I run the tests using brownie test --network mainnet-fork-...
0 votes
1 answer
270 views

Unable to install Ganache

I am learning Solidity from this tutorial: https://www.youtube.com/watch?v=M576WGiDBdQ And there is a section about ganache cli and brownie. Brownie doesn't run scripts because I am unable to install ...
0 votes
1 answer
41 views

Does eth-brownie require using web3py below version 6?

I need to use the Async features found in web3py 6+ as the features I need are not in pre v6 web3py. I manage my env's using anaconda, but eth-brownie is not available via anaconda to my knowledge ...
1 vote
3 answers
1k views

How to add network to brownie-config.yaml

I know you can add a network to brownie by using a command: brownie networks add Ethereum ganache-local host=http://127.0.0.1:7545 chainid=5777 or for example: brownie networks add development ...
0 votes
0 answers
13 views

What is the equivalent of Brownie's (Pytest) "Contract.from_abi()" in Foundry test?

There is a test that uses brownie (pytest) where it creates a new contract using two contracts' abi: Contract.from_abi("mock", mock.address, Contract1.abi + Contract2.abi, owner=accounts[0]) ...
1 vote
5 answers
463 views

Infura network support for sepollia in Brownie

I have been trying to get testnet LINK for Goerli from chain.link. But it looks like it is no longer providing that for Goerli but Sepolia only. I am using the latest version of Brownie and it only ...
0 votes
1 answer
60 views

See Balances on mainnet-fork?

I'm currently watching my first smart contracts tutorial by freecodecamp and it works fine but, I have one question: How can I check the balance of my mainnet-fork account(s)? When I work with Rinkeby ...
1 vote
1 answer
3k views

How do I execute the withdraw function to withdraw token from smart contract?

Total newbie here. So I deployed a contract and already did the flash loan, but now I want to withdraw the remaining funds that I deposited into the smart contract (for the premium fee). How do I ...
0 votes
0 answers
34 views

Dependency Conflict Between Slither And Brownie

I have encountered strange issue and I'm not sure how can I fix it permanently. I had brownie (similar to hardhat) tool installed and once I have installed slither those 2 seems to have some conflicts,...
0 votes
0 answers
43 views

Callable: Caller is not the owner (onlyOwner protected function call fails on upgradable contract)

I follow this https://github.com/brownie-mix/upgrades-mix repository to create transparent upgradable contract. It worked fine. Then I edited my contract and restricted some of the functions to ...
0 votes
0 answers
9 views

How do I turn off the "Transaction Sent" logging on Brownie?

Everytime I send a transaction via Brownie, it prints a "Transaction sent" log. Is there any way to turn this off?
0 votes
0 answers
32 views

ValueError: Gas estimation failed: 'execution reverted'. This transaction will likely revert

Im building an DEFIAPP (AAVE)V3 I do have enough eth function deposit(address asset, uint256 amount, address onBehalfOf, uint16 referralCode) external Added settings: gas_limit: "100000000000&...
1 vote
1 answer
730 views

How to add polygon fork network to brownie with correct chain-id

I want to add a forked network to brownie. If i do it like this: brownie networks add development polygon-main-fork-dev cmd=ganache-cli host=http://127.0.0.1 chainid=137 fork='https://polygon-mainnet....
0 votes
1 answer
32 views

Send bytes32 data to a smart contract using python

How to send data to a function which takes bytes32 as the input parameter.
1 vote
1 answer
794 views

Brownie: CompilerError: File outside of allowed directories

I'm trying to import "@chainlink/contracts/src/v0.6/interfaces/AggregatorV3Interface.sol" to my contract but i encountered this error. CompilerError: solc returned the following errors: ...
2 votes
1 answer
99 views

How to dump/access contract storage in Brownie console?

In Brownie console, for a deployed contract, public contract attributes can be accessed with contract.nameOfAttribute(). This does not work for private attributes - how can one access private ...
1 vote
0 answers
40 views

How to find the Bytecode of Ethereum Smart Contract by just it's address

Hi actually I found the answer & I just wanted to share this with the community You can use the web3.py or brownie module of Python to achieve this web3.py from web3 import Web3 # Connect to ...
0 votes
1 answer
280 views

Can't call existing Solidity function with Brownie due AttributeError

I have deployed a simple contract on the BSC testnet which has a simple function that executes a swap on Pancakeswap. This is how I call the function with Brownie: def main(): tx = contract1....
0 votes
1 answer
279 views

Brownie contract Interface not working on mainnet-fork

I'm following Patric Collins youtube video and trying to deposit wETH in the wETH contract using an interface and working using a fork of mainnet. I am trying to deposit eth in the next contract. ...
1 vote
1 answer
312 views

Brownie package manager: pm or ethpm

I have read several documentations about brownie. I have find 2 ways to install a package like openzeppelin-contracts: $ brownie pm install OpenZeppelin/openzeppelin-contracts@3.0.0 and $ brownie ...
0 votes
2 answers
339 views

ImportError: cannot import name 'LinkToken' from 'brownie'

I am working with the tutorial by freecodecamp.org and have the following error: ImportError: cannot import name 'LinkToken' from 'brownie It is also not able to import VRFCoordinatorMock which I am ...
2 votes
1 answer
132 views

Cannot install eth-brownie with pipx

I have an MacBook Air M2 with python version 3.11.2 I am getting this error message when I follow the pipx instructions to install brownie I tried using pip to install each of these packages ...
2 votes
2 answers
351 views

how to deploy the smart contract in brownie

Error: Final argument must be a dict of transaction parameters that includes a `from` field specifying the address to deploy from Terminating local RPC client... smart contract: pragma solidity ^0.5....
0 votes
2 answers
59 views

How to link deployed library to contract in brownie?

As far as I know, brownie automatically links the library to contract. Is there a way to do this manually? I have bunch of contracts in different projects where some use library and some don't. So I ...
0 votes
1 answer
1k views

ParserError: Source file requires different compiler version

I am a beginner working on brownie using vscode related to a lottery smart contract. Please don't mind if I am doing any rookie mistakes I am still trying my best to understand it as much as I can :) ...
2 votes
0 answers
42 views

Brownie <> SolcInstallationError, I've tried everything I can find -- nothing has worked!

Everytime I try brownie compile I see this: SolcInstallationError: Downloaded binary would not execute, or returned unexpected output. If this issue persists, you can try to compile from source code ...
1 vote
1 answer
292 views

Approve and dis-approve ownership of erc721 tokens

I have created a contract which takes care of buy and sell of NFT's or ERC721 tokens. So i have approved the contract to sell the NFT. Now my questions are:- Once I have transferred the contract to a ...
1 vote
1 answer
296 views

How do I tell which solidity version eth-brownie is using to compile my contracts?

I'm not specifying a solidity version so I'm not sure which solidity version brownie is using to compile my contract. I'm using pragma solidity ^0.8.0; so I'm not sure which version above 0.8.0 ...
0 votes
1 answer
28 views

return from none view function a transaction id rather than the result data

Using Brownie, Python in VSCode: I am trying to combine getNumbers and findNumbers into findNumbers2. But findNumbers2 returned a transaction id rather than the result data. Any suggestions? Solidity ...
0 votes
1 answer
653 views

Gas estimation failed: execution reverted on goerli with brownie

I'm trying to test an onlyOwner function on goerli testnet which's expected to be passed with pytest.raises(exceptions.VirtualMachineError) but it keeps getting below error. I added priority_fee and ...

1
2 3 4 5
8