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
0answers
2 views

How to delay sending a transaction in brownie?

Say I have a contract that has a method that implements a time expiration via a function parameter set by the user, how can I test that the expiration works as expected in brownie by delaying the ...
0
votes
0answers
2 views

Convert an address into a ContractContainer in Brownie

I have a factory contract, that in a transaction: Deploys a contract Emits an event with the address of the contract it deployed I want to be able to use the address returned to interface with the ...
0
votes
0answers
14 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
1answer
16 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
11 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
17 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 ...
0
votes
0answers
10 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.
1
vote
1answer
21 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 ...
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
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
47 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
21 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
31 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....
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
0answers
7 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 ...
0
votes
1answer
26 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
2answers
48 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 ...
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
35 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
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
38 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
13 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") ...
1
vote
2answers
108 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
14 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
39 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....
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 ...
0
votes
0answers
27 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
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
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 :) ...
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 ...
0
votes
0answers
18 views

i am getting unicode decode error while trying to compile my brownie file

brownie compile INFO: Could not find files for the given pattern(s). Brownie v1.16.4 - Python development framework for Ethereum File "C:\Users\scs\AppData\Local\Programs\Python\Python310\lib\...
0
votes
1answer
79 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
36 views

How to sign and verify message with solidity and python?

I am trying to perform a certain action say like selling a token only when the message sent to a contract is signed by the contract owner. I knew how I would do this in js, but I am having a hard time ...
0
votes
0answers
23 views

i am getting file not found error while compiling my file desipte importing files correctly

brownie compile INFO: Could not find files for the given pattern(s). Brownie v1.16.4 - Python development framework for Ethereum New compatible solc version available: 0.8.10 Compiling contracts... ...
1
vote
0answers
27 views

brownie is not reading web3 infura project id even though it's already set in .env

I'm following Patrick Collins' NFT Smart Contract course on YT and I can't get Brownie to read the WEB3 Infura project id This is what the Error looks like Brownie v1.16.4 - Python development ...
0
votes
1answer
22 views

Estimating cost to publish a contract

I'm close to publishing a contract to the Ethereum mainnet after a couple of months of publishing contracts to Rinkeby. I just want to try and estimate how much it will cost me to publish it to ...
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
1answer
40 views

Brownie Contract Interaction

If I deploy open auction contract on ganache with brownie, how can I send a bid into the contract with a brownie command? >>> Openauction[0].bid(Wei(1e18)) is giving me an error, how can I ...
0
votes
0answers
21 views

I am doing this Blockchain course from freecodecamp youtube and Current Price is not showing right

And to check the code here is the code https://github.com/PatrickAlphaC/brownie_fund_me Please help!!!
1
vote
0answers
15 views

Brownie compiler remappings: "@"?

In the doc'n: brownie compiler remappings for the file brownie-config.yaml It gives two examples, ex 1. has no "@" symbol: compiler: solc: remappings: - zeppelin=/usr/local/lib/...
1
vote
0answers
59 views

I am getting virtual machine error while running my brownie fundme contract

PS E:\brownie_fund_me> brownie run scripts/fund_and_withdraw.py --network ganache-local INFO: Could not find files for the given pattern(s). Brownie v1.16.4 - Python development framework for ...
1
vote
0answers
17 views

brownie deploying contract get transaction-receipt

Is there a way to get the transaction-receipt when deploying a contract with contract.deploy()? The method returns the Contract object but i also want the transaction receipt. Background: i want to ...
1
vote
0answers
7 views

Where does brownie save classes generated from Solidity contracts?

Brownie makes available solidity Contracts as Python classes (ContractContainer). Where are those Python source files? I am interested because would like to direct the IDE I use to read and parse ...
0
votes
0answers
26 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 ...
0
votes
0answers
12 views

Brownie Causes Dropped Transactions That Still Go Through

While running my test programs in Brownie, it seems like half the time the transactions are dropped and the script halts. When looking up the transaction hash afterward, the transactions have ...
0
votes
1answer
62 views

Gas estimation failed on run in rinkeby network

ValueError: Gas estimation failed: 'invalid opcode: opcode 0xfe not defined'. This transaction will likely revert. If you wish to broadcast, you must set the gas limit manually. Could someone please ...
0
votes
0answers
11 views

Token transfer sporadically leaves 1 single wei inside the smart contract

It happens with several tokens. Sometimes, when I call a withdrawAll() function from my_contract, 1 token (Yes, I mean only 1 token) remains inside the smart contract. Here is the withdrawAll function ...