Questions tagged [brownie]
Brownie is a Python-based development and testing framework for smart contracts targeting the Ethereum Virtual Machine.
375
questions
0
votes
0
answers
8
views
What is the importance of `message Hash` generated from signing using private key
when we are signing a message using our private key what's the use case of the message hash ?
Take the example from the eth_accounts module from python.
>>> msg = "I♥SF"
>>>...
0
votes
1
answer
12
views
How to change response from oracle?
I need to test my contract, and to test I need to change data that I recieve from ChainLink Oracle (I get Ethereum price from it). So how can I change price on ETH local for tests using Ganache-Cli or ...
0
votes
0
answers
12
views
Mainnet-fork has different result than mainnet
I'm currently forking Binance Smart Chain using Brownie and Python.
The idea is to use the forked network to test if new BEP20 tokens can be traded (buy and sell) using pancakeswap, and check if the ...
0
votes
0
answers
16
views
ImportError - Python script in Brownie when file is definitely there
I'm writing a script in Python to deploy the smart contract lottery (from the older Brownie/Python course from freecodecamp). I am only trying to deploy on development, so I have saved all the ...
0
votes
1
answer
28
views
ValueError: max fee per gas less than block base fee - Brownie
I am getting the error "ValueError: max fee per gas less than block base fee" when I try to run the following script using Brownie. I think I figured out that when I send a transaction, I ...
0
votes
0
answers
12
views
Is there a way to update block to `latest` in case of a network forked by brownie?
I plan on something such as this:
Fork the network as fork-network
chain.snapshot()
Perform tests
chain.revert()
Update the network to latest state because my next tests will require data from newer ...
0
votes
1
answer
50
views
Having problems installing Brownie
I have been struggling installing brownie for while now and i cant seem to figure it out. I am quite new to all of this so all help is appreciated:) Running python 3.9.11. Using a an m2 mac with ...
1
vote
1
answer
11
views
brownie test results in ValueError: sender account not recognized
I am trying to run curve finance's multi-rewards test suite with brownie test, however, the tests fail with the following error:
accounts = <brownie.network.account.Accounts object at 0x103e0caf0&...
0
votes
0
answers
11
views
Brownie Contract creation takes too long
The function Contract.from_abi in brownie is taking too much time, even after disabling bytecode check with a dirty hack. How can one use Brownie in a meaningful way for a project that loads thousands ...
0
votes
1
answer
157
views
How to call `quoteExactInputSingle` on quoter2 uniswap using python
I'm trying to call like this in ape
def SushiswapV3quoteExactInputSingleV3(
router,
_from,
tokenIn: str,
tokenOut: str,
fee: int,
amountIn: int,
sqrtPriceLimitX96: int = 0,
...
1
vote
0
answers
44
views
How can we get the result of swap in curve.fi like `getAmountsOut` for uniswapV2
I'm trying to get the price for the swap WETH->DAI by calling get_dy but there is no direct pool in curve. I went to the UI & put in this swap & got this. tricypto: WETH -> USDT -> ...
1
vote
0
answers
519
views
has anyone seen this error installing brownie?
Banging my head against a wall trying this. have tried uninstalling cytoolz, pipx, and reinstalling but keep getting this error trying to install brownie.
Collecting click==8.1.3 (from eth-brownie)
...
0
votes
2
answers
74
views
Verification of contract using Brownie
I'm at the point of a solidity course where I need to get the API key token from etherscan.io.
I followed all the steps, but my code breaks when I use Brownies deploy function with "...
0
votes
0
answers
10
views
gas estimation fail when call addLiquidity from UniswapV2Router02.sol contract [duplicate]
I am trying to deploy uniswap V2 contracts using brownie but
I have always an error when I call addLiquidity on UniswapV2Router02.sol
Waht I did so far:
1.- Deploy UniswapV2Factory.sol
def ...
1
vote
0
answers
10
views
Vyper: How to test internal helper functions?
I'm writing a Roulette contract as a learning activity in Vyper. My contract seems to be working through manual testing, and now I'm starting to write unit tests.
I have an internal helper function ...
0
votes
0
answers
9
views
Does Brownie support structs and enums?
Brownie is a seemingly popular framework for testing smart contracts (both solidity and vyper) in python.
I've just gotten started with brownie and my first few tests are working. However, I can't ...
0
votes
1
answer
83
views
Brownie Explorer API not set for this network
I am trying to deploy a solidity contract with the source code to a Sepolia test net, using Brownie. The contract deploys successfully, but the source code does not. I keep getting this error.
File &...
1
vote
1
answer
21
views
Call fundSubcription() chain link vrf v2 using brownie gas fee error?
def addCustomerAndFundsub(_subId, _cunsumerContract):
account = get_account()
if network.show_active() in LOCAL_BLOCKCHIAN_ENVIROMENTS:
VRF_contract = VRFCoordinatorV2Mock[-1]
else:...
1
vote
2
answers
47
views
eth_rlp: AttributeError: module 'rlp' has no attribute 'Serializable'
Brownie won't initialise. Even after clearing paths, pipx, installing new versions.
0
votes
0
answers
41
views
how to estimate gas usage of a view function?
according to this question gas limit of eth_call depends on the node that you use, but still I wanted to have an estimate that how much gas that it use for my view function eth_call to be on safer ...
0
votes
1
answer
30
views
Listening to events using EventWatcher
I am trying to listen to events emitted from a contract using eth-brownie. More specifically I am attempting to use EventWatcher. My contract emit has an event eventI in it. My run.py file looks like,
...
0
votes
0
answers
11
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
81
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 (...
0
votes
1
answer
35
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 ...
0
votes
2
answers
157
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 ...
0
votes
0
answers
105
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, ...
0
votes
0
answers
48
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])
...
0
votes
0
answers
53
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
50
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
12
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
72
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&...
0
votes
1
answer
128
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
0
answers
188
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 ...
2
votes
0
answers
132
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 ...
4
votes
1
answer
448
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
0
answers
70
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 ...
0
votes
1
answer
36
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 ...
1
vote
1
answer
35
views
Having A problem with file directory
I want to verify the contract using the API etherscan token
FundMe.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import"node_modules/@chainlink/contracts/src/v0.8/interfaces/...
0
votes
1
answer
55
views
Problem with brownie
when deploying the contract
it gives me
<function deploy_simple_storage at 0x0000021D6E255670>
What does that mean?
Deploy.py
from brownie import accounts,config,SimpleStorage
def ...
1
vote
1
answer
102
views
Member "swapExactTokensForTokens" not found or not visible - Solidity trading bot
I've been working on a arbitrage solidity bot on Uni- and SushiSwap and I have a strange error:
TypeError: Member "swapExactTokensForTokens" not found or not visible after argument-dependent ...
0
votes
1
answer
22
views
$ brownie compile ; not recieving .json in /build/contracts
Im having an issue compiling my first contract with brownie. I run the following.
mkdir brownie
cd brownie
brownie init
touch contracts/SimpleStorage.sol
Contents of SimpleStorage.sol
pragma ...
1
vote
6
answers
1k
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 ...
2
votes
0
answers
88
views
Use Brownie to send ERC20 tokens to a payable function with the amount of tokens as an argument to the function
I have the following AlgoToken contract:
interface StableCoin {
function balanceOf(address account) external view returns (uint256);
function allowance(address owner, address spender) external ...
1
vote
1
answer
37
views
Deploying Contracts Deterministically using Brownie Console
I am trying to deploy contracts determinsitically using 'salt' via brownie. I would like to be able to do something like this:
>>> helloContract = Hello.deploy({'from':accounts[0],'salt':...
0
votes
0
answers
150
views
ValueError: Gas estimation failed: 'execution reverted'. Gaslimit already set
I'm getting this error when I try to run my Brownie Python script:
myAwesomeGasLimit = 200000
def enter_for_free():
account = get_account()
lottery = Lottery[-1]
tx = lottery....
0
votes
1
answer
74
views
PancakeSwap Error with Brownie, revert: TransferHelper::transferFrom: transferFrom failed
I am in bsc-testnet and have 0.3 WBNB in my wallet and I try to swap 0.1 WBNB for USDT with the function swapExactTokensForTokens()
Token1 = '0xae13d989daC2f0dEbFf460aC112a837C89BAa7cd'
Token2 = '...
0
votes
3
answers
176
views
Brownie private keys
Brownie under the hood use Ganache. Ones we start brownie console accounts are generate automatically (10 by default) for further use.
Question: is there a way to discover private key from account[0] ...
2
votes
1
answer
330
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. ...
1
vote
0
answers
58
views
test transaction call brownie
in brownie, i have a function that calls another one in the same contract, and i want to test if it does it properly :
The function :
function onTokenTransfer(
address _sender,
uint256 _fee,
...
1
vote
0
answers
120
views
Is it possible to get the raw transaction hex of the entire transaction in Brownie?
I am creating unit tests for a smart contract that I am working on using Brownie and pytest. In one of the functions, I need to pass the raw transaction hex of an entire Ethereum transaction (not just ...