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
1 vote
1 answer
64 views

How to handle two solidity events with asyncio python

Im trying to get every Swap event happens on Uniswap and Sushiswap using python and do stuff based on these Swaps i know how to do it but with one exchange, it means that only one event in time . from ...
noro meb's user avatar
  • 298
0 votes
1 answer
340 views

UniswapV2Router02 swapExactTokensForTokens deadline

im trying to swap some DAI with USDC Using UniswapV2Router02 function swapExactTokensForTokens() with brownie and python by unlocking a DAI token holder account and im getting this error : ...
noro meb's user avatar
  • 298
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 ...
anon2328's user avatar
0 votes
1 answer
87 views

Accessing private data on a blockchain address using Brownie

I'm trying to practice on the private data exploit on ethereum and was wondering if there is a function like web3.eth.getStorageAt() implemented in brownie which would allow me to access the storage ...
Rjey's user avatar
  • 17
0 votes
0 answers
261 views

Flashloan with DyDx on mainnet-fork

I forked the Ethereum mainnet with the ganache-cli using this command below : ganache-cli -f https://eth-mainnet.g.alchemy.com/v2/GsxpURWipc2UTubeBm3Mf-WdEyioVdwV -u ...
noro meb's user avatar
  • 298
0 votes
0 answers
84 views

error: "VirtualMachineError: revert"

I am watching free codecamp's blockchain course by PatrickAlphaC. In the lottery lesson I have this problem: in the lottery.sol file I use AggregatorV3Interface to get eth/usd price and use it to ...
Prongs 713's user avatar
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 ...
Christopherus's user avatar
0 votes
2 answers
181 views

Development Network - Multiple Transactions Same Block - Brownie

I'm trying to setup a test, where multiple transactions interacting with a contract are mined in the same block (from different accounts). However, the default behavior is to mine a block at each ...
Luke Buckny's user avatar
0 votes
0 answers
34 views

eth-brownie: swapAVAXForExactTokens fail to perform a basic swap

I wrote a simple python program whose aim is to swap the native token of the underlying chain, e.g., ETH, AVAX, for other tokens. In this case, my account holds 5+ AVAX and I am trying to do the ...
ultimocanto's user avatar
0 votes
0 answers
72 views

How do we get to know the gas fee of a transaction on Ethereum Blockchain with Brownie

I was recently searching for a way using which I can calculate the gas fee for a transaction in Brownie Ethereum development environment.
pryansh's user avatar
0 votes
1 answer
77 views

Can't seem to filter uniswap transactions?

The following code doesn't print any transactions. What am I missing? def main(): uni_v3_router = Web3.toChecksumAddress('0x68b3465833fb72a70ecdf485e0e4c7bd8665fc45') event_filter = w3.eth.filter({...
user1099123's user avatar
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 ...
Christopherus's user avatar
0 votes
0 answers
12 views

can we use brownie and solidity together, like for framework brownie and for smart contract solidity

I have to create an application using blockchain so while deciding on the tool I got this doubt
VIDHI JAIN's user avatar
0 votes
0 answers
14 views

How to utilize brownie given-strategy testing function. As the website coding specs, it throws error

Here is my example code, but the pytest.mark.parametrize works well. And the given strategy emits error hereinafter.
王翊帆's user avatar
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 ...
Emrah's user avatar
  • 1,434
1 vote
1 answer
181 views

How to calculate AAVE yield on chain

I’m working on a project which involves tracking and withdrawing AAVE yield on chain while maintaining the original deposit balance. I’m confused as to how to accurately calculate AAVE yield at a ...
xde's user avatar
  • 13
0 votes
1 answer
84 views

Withdrawn ETH gets sent as internal transaction to black hole address

I'm trying to withdraw from this contract after funding it. After funding it, i checked the balance on goerli etherscan and there was goerliETH in it that i sent but i noticed that once i called ...
christian olori's user avatar
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 ...
Rjey's user avatar
  • 17
0 votes
1 answer
55 views

Why does my transaction reverts when funding a VRFCoordinatorV2 subscription locally?

I've been following the documentation on docs.chain.link: https://docs.chain.link/docs/vrf/v2/examples/programmatic-subscription/ in order to have a programmatic way to handle a subscription. To fund ...
Davide Pasero's user avatar
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 ...
Shack's user avatar
  • 11
0 votes
0 answers
78 views

Brownie Eth - Changing networks does not change the network.chain.id

I am trying to programatically deploy a Smart Contract via Brownie to multiple test networks. The following code works, however when I switch networks the network.chain.id renames the same as the ...
Luke Byrne's user avatar
0 votes
0 answers
54 views

Forking a Mainnet is showing `Unable to launch local RPC client` error

while running the command brownie console --network mainnet-fork I am getting the following error: RPCProcessError: Unable to launch local RPC client. Command: ganache-cli URI: http://127.0.0.1:8545 ...
FaizanNehal's user avatar
0 votes
0 answers
119 views

Decode input data using Python Brownie

I'm trying to decode the input data from this transaction (https://etherscan.io/tx/0x7dc7cfbc3e4eebdcbc766fa9b34923fbca20d1ad9615ceeb69337bc627dbffd4) using Brownie. What I did so far: tx_hash='...
wisk's user avatar
  • 5
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 ...
FaizanNehal's user avatar
0 votes
0 answers
69 views

How To Make Delegate Call in eth-brownie

I want to make a delegate call in eth-brownie and encode the data using abi.encodeWithSignature but I am not able to figure out a way to do it. There is a proxy contract and implementation contract. ...
FaizanNehal's user avatar
0 votes
0 answers
23 views

I am able to compile my solidity file in brownie, but while deploying, it is generating the following error: Please help. Thanks in advance

Launching 'ganache-cli.cmd --chain.vmErrorsOnRPCResponse true --wallet.totalAccounts 10 --hardfork istanbul --miner.blockGasLimit 12000000 --wallet.mnemonic brownie --server.port 8545'... File "...
Ampolu Maneesha ee18d020's user avatar
0 votes
0 answers
82 views

How to send Ether to a payable function in Brownie

I have a payable external function with parameter and I want to call this function in brownie and send some ether. How should call it in brownie? The function is given below: function air(address ...
FaizanNehal's user avatar
0 votes
0 answers
235 views

Contract verification fails with standard-json-input having linked libraries

I have a simple library and contract using that library as follows: CNTestLib.sol // SPDX-License-Identifier: MIT pragma solidity 0.8.10; library CNTestLib { function doStuff() public { } } ...
Jeevan J's user avatar
1 vote
0 answers
21 views

ValueError(f"Dotenv specified in config but not found at path: {env_path}")

I am trying to run this contract but I get the following error: (base) elly@elly-Lenovo-G50-80:~/demos/web3_py_simple_storage/brownie_fund_me$ brownie run scripts/deploy.py Brownie v1.19.1 - Python ...
Elena 46's user avatar
0 votes
1 answer
109 views

TypeError: string indices must be integers

Hello there I'm currently following this tutorial https://www.youtube.com/watch?v=M576WGiDBdQ by Patrick Collins. I have a problem when I try to deploy the script: (base) elly@elly-Lenovo-G50-80:~/...
Elena 46's user avatar
0 votes
0 answers
30 views

GCP VM startup script cannot install brownie

I am trying to install brownie on a GCP VM instance running ubuntu 18.04 LTS minimal. My startup script is the following: apt-get update -y && apt-get upgrade -y && apt-get install ...
Matt's user avatar
  • 171
1 vote
1 answer
124 views

Encode tuple with brownie

I am trying to encode a struct as bytes with brownie and then pass the bytes as an argument to a smart contract. contract C { struct S { uint256 a; uint256 b; } function f(bytes memory ...
marv's user avatar
  • 13
0 votes
0 answers
64 views

How do I access the public variables of a contract that is initialized in another contract in brownie test

Basically I have two contracts and one test file. Contract A is initialized in Contract B. Now I want to access the public variable of Contract A through the deployed Contract B in Brownie. The ...
FaizanNehal's user avatar
1 vote
0 answers
61 views

Eth-brownie related problem- Error trying to deploy a contract

I’ve run into the following error while deploying a script. The script runs fine until the encode_and_supply function is called. File "brownie/_cli/run.py", line 51, in main ...
Philip's user avatar
  • 11
0 votes
0 answers
176 views

brownie.exceptions.RPCRequestError: Encountered a ReadTimeout while requesting `debug_traceTransaction`. The local RPC client has likely crashed

I am testing a contract that requires interaction with other contracts, after writing the contracts and deploying when I send the initial transaction it successfully sends the transaction but the test ...
Nwa Mfon's user avatar
1 vote
0 answers
55 views

Setting runs in solc options at brownie-config.yaml

My goal is to set the runs key of solc to the value of 100 inside the brownie-config.yaml file. I have found two different solutions and I would like to know what is the difference between the two in ...
rihekopo's user avatar
  • 288
0 votes
0 answers
15 views

How to write the function in Brownie respect to the same function of Smart Contract?

I want to run this solidity line function ( fulfillByteAndUint ) : [![Solidity][1]][1] from my Brownie frame work , but I don’t know how to define variables in the Parentheses , could you tell me ...
Kasra's user avatar
  • 7
0 votes
1 answer
182 views

Brownie Error cannot find contract/file

Hello I was starting to write some solidity code with brownie as eth-environment, I tried to compile the code and the import statement is showing en error - ParserError: Source "@smartcontractkit/...
Priyanshu Jha's user avatar
0 votes
1 answer
57 views

How to fix "Cannot import Lottery from brownie"?

Ran the code as shown and my constructor is public but I keep getting "Cannot import Lottery from brownie" as the error. The Lottery.sol code is below; // SPDX-License-Identifier: MIT ...
Abiodun Abayomi-Jimoh's user avatar
1 vote
0 answers
81 views

Brownie Compile Unicode Decode Error

I am trying to compile this smart contract (fluxAggregator) to setup a Flux-Monitor within VS Code using brownie: Windows 10, Brownie v1.19.0, Python v3.9.13, Node.JS v16.14.2, NPM v8.13.1 Within the ...
Matt's user avatar
  • 171
0 votes
0 answers
49 views

Is it possible to use a custom web3.py middleware with brownie?

I'm trying to use a custom web3.py middleware with brownie to handle the transaction signing and transmission myself.
Orny's user avatar
  • 101
1 vote
1 answer
231 views

Getting the address of a contract before its deployed with brownie

While working with the lens protocol contracts I saw that they were able to precompute the address of a contract using hardhat with the following code import { hexlify, keccak256, RLP } from 'ethers/...
Francis Egboluche 's user avatar
0 votes
0 answers
79 views

eth-brownie works from shell but module not found when called in python script (vscode)

I have eth brownie globally installed but when trying to call a script that imports brownie I get: Traceback (most recent call last): File "...", line 3, in <module> from brownie ...
mojo45's user avatar
  • 1
0 votes
1 answer
486 views

I am creating random accounts on brownie using accounts.add, are the account address "mine" even in the polygon-testnet?

I am creating random accounts on brownie using accounts.add, are the account address "mine" even in the polygon-testnet? if so, how does brownie know that address is a new address. Also how ...
Sandeep Mishra's user avatar
1 vote
1 answer
57 views

Brownie doesnt compile but says it did

if i run brownie compile i get INFO: Could not find files for the given pattern(s). Brownie v1.19.0 - Python development framework for Ethereum Project has been compiled. Build artifacts saved at C:\...
Toshiro Nakamoto's user avatar
0 votes
0 answers
187 views

Encountering "HTTPError: 400 Client Error: Bad Request" when running "brownie test --network polygon-mumbai"

I am trying to do integration testing using brownie and Alchemy on Polygon testnet. However, when I run "brownie test --network polygon-mumbai", I get: HTTPError: 400 Client Error: Bad ...
marv's user avatar
  • 13
0 votes
0 answers
34 views

eth-brownie install fails on Ubuntu 20.04 due to cytoolz

python 3.8 ubuntu 20.04 install fails due to cytoolz Tried various online solutions like using pipx and pip to install cython cytoolz before installing eth-brownie, but no luck Running cytoolz-0.11.2/...
Youli Luo's user avatar
0 votes
1 answer
52 views

Adding dependencies with '@' in version for brownie project

I am trying to add superfluid-finance/protocol-monorepo@ethereum_contracts@v1.3.0 into my brownie project. brownie-config.yaml: dependencies: - superfluid-finance/protocol-monorepo@...
marv's user avatar
  • 13
0 votes
0 answers
33 views

Issue publishing and verifying contracts to Etherscan with brownie, KeyError: 'local' #1579

Environment information brownie Version: 1.16.4 ganache-cli Version: 6.12.2 solc Version: 0.8.14-fixed Python Version: 3.9.9 OS: osx What was wrong? I'm trying to publish a contract to Rinkeby ...
Domini's user avatar
  • 171
1 vote
3 answers
1k views

How to "flatten" imported contracts

I am trying to publish contracts on etherscan on an already deployed address. How would I "flatten" these imported files; import "@openzeppelin/contracts/access/Ownable.sol"; ...
Domini's user avatar
  • 171

1
2
3 4 5
8