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
2
votes
3answers
1k views

Brownie: PRIVATE_KEY issue: ValueError: The private key must be exactly 32 bytes long, instead of 0 bytes

I am trying to run a script in brownie, but I'm running into this error: ValueError: The private key must be exactly 32 bytes long, instead of 0 bytes. Terminating local RPC client... I'm using a ....
0
votes
1answer
18 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
1answer
14 views

File import callback not supported

I have a YAML file configured but when I compile the code, it does not create dependencies directory and neither the json files. The sources I import mentions: File import callback not supported. Any ...
0
votes
0answers
5 views

Brownie runs just one test instead of two

I have two functions in my test file; test_simple_storage.py, but when I run brownie test only the first one runs. I tried to elect just the second function to be tested and it simply returned 1 ...
0
votes
0answers
6 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-...
1
vote
1answer
135 views

Unable to transfer funds to contract address using Brownie

I have deployed a contract, testContract, onto bsc testnet I have a test wallet with sufficient funds and can seemingly make transfers to other wallet addresses without any issues. I am just trying to ...
0
votes
0answers
9 views

I'm using brownie for testing contracts but its stuck like that in the image

I made a project folder using brownie. I can deploy the contract from the scripts folder but when I test it it's stuck I can't find anything that solves the problem.
0
votes
0answers
4 views

Does brownie have functionality to analyze gas costs for all function calls?

Does brownie have any sort of functionality that gives a breakdown of the cost to deploy all contracts and execute all function calls within a brownie project with min, max and average gas cost ...
2
votes
1answer
15 views

delegatecall in Brownie

I am trying to perform delegatecall in Brownie solving the Delegation task in the Ethernaut app in order to claim ownership of the Delegate contract (see below). What is the equivalent of the ...
1
vote
1answer
19 views

How to add back default Rinkeby Testnet network in brownie networks list back?

I accidentally deleted the default rinkeby network that comes with brownie and wanted to know how to add it back? I tried with the below cmd by creating an infura project but I'm getting the ...
1
vote
2answers
297 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
0answers
234 views

Gas estimation failed -- flashloans -- solidity

I am able to deploy a smart contract, and even fund it with WETH from my metamask wallet without any gas estimation failures. When I try to execute my flashloan on this smart contract, however, I get ...
0
votes
2answers
175 views

i am getting attribute error while running erc20 brownie project on rinkeby testnet

PS E:\ERC20-BROWNIE> brownie run scripts/1_deploy_token.py --network rinkeby INFO: Could not find files for the given pattern(s). Brownie v1.16.4 - Python development framework for Ethereum ...
2
votes
1answer
267 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 ...
0
votes
1answer
9 views

Solidity: Storing and returning array in struct

Trying to store array directly in a struct however when I call the struct the array is not returned. Not sure whether this is just a return problem or a storage problem? struct LockRoundData { ...
1
vote
2answers
43 views

Error publishing source code

Here's my deploy.py: from brownie import FundMe from scripts.helpful_scripts import get_account def deploy_fund_me(): account = get_account() fund_me = FundMe.deploy({"from": ...
0
votes
1answer
23 views

How to test internal members of solidity library or contract in brownie?

Say I have the following SimpleMath solidity library defined as follows: library SimpleMath { function add(uint a, uint b) internal pure returns(uint) { return a + b; } } How do I import ...
1
vote
1answer
133 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 ...
0
votes
1answer
20 views

Get a state variable from unverified contract

Is it possible to get a variable state from existing contract which was not verified but I know what variables, functions etc. the contract contains? Assume, we have the following script (using ...
0
votes
0answers
29 views

Gas estimation failed: 'execution reverted' | Brownie | Rinkeby

I have created a smart contract in order to hack Coin Flip on Ethernaut: // SPDX-License-Identifier: MIT pragma solidity ^0.6.0; import '@openzeppelin/contracts/math/SafeMath.sol'; import './CoinFlip....
1
vote
3answers
574 views

Unable to Compile Contract in Brownie (not receiving a .json file in "build" folder )

I'm currently running Brownie in Studio Visual Code. My problem is that when I write a smart contract and try to compile it using command "Brownie Compile" I don't' receive a .json file in ...
1
vote
2answers
104 views

raise ValueError("Explorer API not set for this network") ValueError: Explorer API not set for this network

I run this code in brownie: brownie run scripts/deploy.py --networks Rinkeby deploy.py: from brownie import network, config, accounts from brownie import FundMe def deploy_fund_me(): account = ...
0
votes
0answers
40 views

No such file or directory: brownie-config.yaml

I am deploying the deploy.py script # from brownie import FundMe, accounts, config from brownie import FundMe, accounts import yaml import json from scripts.helpful_scripts import get_account # here ...
0
votes
0answers
6 views

How to enforce relative constraints on brownie hypothesis strategy?

Say I have the the following 2 strategies for 2 variables smaller and bigger. How can I enforce a constraint on either strategy such that the randomly selected smaller is always less than than bigger ...
3
votes
6answers
1k views

LINK1120 error when attempting to install Brownie with 'pipx install eth-brownie'

I'm having some issues with my installation process for Brownie and wanted to reach out for some help. After getting pipx installed, my attempt to use 'pipx install eth-brownie' in the terminal of VSS ...
1
vote
2answers
42 views

Brownie: Unable to launch local RPC client

I was trying to run brownie for ganachi-cli, but it keeps giving me this error. My node is up to date and I have changed my host in the ganachi-cli UI. What do I do? Brownie v1.17.2 - Python ...
2
votes
3answers
871 views

Brownie cannot locate deploy.py script

I have python installed on my system (Windows) with Anaconda from a prior course I had taken which may be the root cause of the issue. I'm at the stage where I need to run a deploy.py script to deploy ...
0
votes
0answers
32 views

How can I fix this Uniswap Router bot?? It's making me put a time.sleep(40) just before buy() function?

This uniswap router bot triggers a swapExactETHForTokens transaction but it always fails with an "out of gas" error unless I put a time.sleep(40) just before the buy() function. I tried to ...
1
vote
2answers
416 views

Brownie - Constructor Sequence has incorrect length, expected 1 but got 0

I am trying to deploy a contract on Rinkeby by running brownie run scripts/deploy.py --network rinkeby but I get following error: Constructor Sequence has incorrect length, expected 1 but got 0 I ...
0
votes
1answer
63 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
1answer
170 views

Does anyone know how to fork a chain at a particular block on Brownie?

I am trying to fork the ethereum mainnet at a past block number on brownie. But I dont see any way to do that in the brownie docs .
1
vote
0answers
13 views

Working with Brownie scripts using Flask

My projects is built like this: React frontend -> Flask server to interact, save to SQL etc.. -> Brownie project. Now when trying to use a script from brownie in my flask file: from ...
0
votes
0answers
150 views

AttributeError: Module 'Users' Has No Method 'Main'

In Brownie I'm running a script which sends me this error "AttributeError: Module 'Users' Has No Method 'Main'. Do you have any suggestions on how I can fix this? import os from brownie import ...
0
votes
0answers
37 views

How can I fix a ValueError revert transaction on a sniper bot that reverts only when triggered by an event(PairCreated)..otherwise swap goes through?

THIS IS A BOT TO SWAP ON UNISWAP WHEN NEW PAIR IS CREATED BUT WHEN BUY FUNCTION IS TRIGGERED BY AN EVENT THE TRANSACTION REVERTS BUT BUY FUNCTION GOES THROUGH WHEN TESTING JUST THE buy() ...
0
votes
0answers
7 views

Contract size in brownie

What is the best way to get a contract size in Brownie? Looking at the json in build/contract, I can see deployedBytecode. Is this what must be constrained in the 24k main net limit?
0
votes
0answers
16 views

Python Brownie: Import statement does not import solidity contract when run from python

I am trying to run the below script from python but it does not find the ADAI contract that I just compiled. It works fine when I do brownie run scripts/interact.py from the command line. Looks like ...
0
votes
0answers
11 views

Getting "ValueError: invalid sender" in brownie and python when sending ERC721, eventhough the scripts does work on test-net

I'm using the following code: from brownie import myContract from brownie.network import max_fee, priority_fee from scripts.scripts import get_account import pandas as pd max_fee("50 gwei") ...
2
votes
2answers
501 views

File outside of allowed directories on brownie compile command

trying to import to files from openzeppelin and chainlink in my contract file like so: import "@openzeppelin/contracts/token/ERC721/ERC721.sol"; import "@chainlink/contracts/src/v0.6/...
2
votes
1answer
100 views

how do i solve KeyError: 'wallets'?

I followed the answer to a similar question posted on here by adding dotenv: .env to the top of my brownie-config.yaml file but still having the same issue. This is my code in the brownie-config.yaml ...
0
votes
1answer
76 views

Brownie test error with local fork

When trying to run the test at 6:29:30 in the FreeCodeCamp tutorial with Patrick Collins, I get a brownie.exceptions.VirtualMachineError: revert when it tries to call my Lottery.getEntranceFee ...
0
votes
0answers
13 views

Brownie run error ImportError: functoolz.cpython-310-x86_64-linux-gnu.so: undefined symbol: _PyGen_Send (Arch linux)

I had a problem installing brownie using pipx, so I used python3 setup.py install brownie now that I try to run 'brownie' I get import error Traceback (most recent call last): File "/home/...
0
votes
0answers
36 views

How to install Brownie on Windows 10? pipx fails trying to build bitarray, cytoolz and lru-dict packages: "The system cannot find the file specified"

I am trying to follow the tutorial but while following the tutorial I keep getting stuck on installing brownie. Fatal error from pip prevented installation. Full pip output in file: C:\Users\dante....
2
votes
1answer
157 views

Can’t Install Eth-Brownie on Windows 10: pipx fails to build cytoolz, saying that "Microsoft Visual C++ 14.0 or greater is required"

Good evening! I'm going through the Free Code Camp Solidity/Blockchain tutorial and for the life of me, I cannot get Brownie to install properly. When I try and install through pipx I get the ...
0
votes
1answer
20 views

Why does `brownie run <script>` fail with FileNotFoundError even though the script does exist? [duplicate]

I have been trying to run a python "Hello" code using brownie run scripts/deploy.py I am obtaining the following output: Brownie v1.17.2 - Python development framework for Ethereum ...
1
vote
1answer
172 views

Getting `No Python at ...` error trying to install Brownie with pipx on Windows

When I try and pipx install eth-brownie I get the following error: PS C:\Users\karee\web3_py_simple_storage> pipx install eth-brownie No Python at 'C:\Users\karee\AppData\Local\Programs\Python\...
0
votes
0answers
26 views

How can I check how much gas I'll need to deploy a contract with eth-brownie?

I kind of accidentally deployed an ERC20 token contract on the mainnet and brownie didn't even ask me to confirm so I ended up spending $700+ worth of ETH to practice. I didn't think it would cost ...
0
votes
1answer
14 views

What happens if a function that is not defined as a view, doesn't change the data of the contract?

example: function addAllowedTokens(address _token) public onlyOwner { if (!tokenIsAllowed(_token)) { allowedTokens[_token] = true; } } In this code, the allowedTokens ...
0
votes
0answers
22 views

How to use vyper's external_interface in brownie?

An external interface can be generated by vyper as such: vyper -f external_interface contracts/CurveCryptoSwap.vy Doing that results in the following output: # External Interfaces interface ...
0
votes
0answers
12 views

How to get data from contract in brownie python script?

Say I have a contract Box that has a public state variable: mapping(address => mapping(address => uint)) public addressToAddressToUint; now in my python brownie script I would like to read a ...
0
votes
0answers
10 views

Problem installing eth-brownie on windows 10 [duplicate]

I'm trying to use pipx to install brownie, and was successful installing pipx. The problem I run into is when trying to use pipx to install brownie it gives me a 'no python at ' error. When looking at ...