Questions tagged [brownie]
Brownie is a Python-based development and testing framework for smart contracts targeting the Ethereum Virtual Machine.
387
questions
0
votes
1
answer
136
views
In Brownie, Do you need always need .address to use a contract as an contract address variable
new to Brownie as I have been using mostly tutorials. I am trying to use a contract address as a variable to deploy another one, and want to know does adding the ".address" e.g : ContractXY....
0
votes
0
answers
19
views
I am having issue using @chainlinkcontracts with brownie
Actually i am just trying to compile this fundme.sol but the imports are giving errors
This is my fundMe.sol
this is yaml file and IDE
this is the error i am getting
0
votes
1
answer
50
views
Please Help AttributeError: Final argument must be a dict of transaction parameters that includes a `from` field specifying the address to deploy from
I get this error when I try run my brownie deploy_lottery.py scripts --- network rinkeby. Do anyone have an idea on how to solve this? Thanks.
Here's the script:
from scripts.helpful_script import ...
2
votes
1
answer
155
views
ValueError: Unknown URI
I'm following a solidity tutorial from Patrick Collins and when trying to run the following:
brownie run scripts/get_weth.py --network mainnet-fork
I get an error:
INFO: Could not find files for the ...
0
votes
1
answer
124
views
How to connect already running ganache-cli from brownie
I have a local ganache running at port X. I want to deploy my contract to this already running local ganache rather than spinning a new one. In other words, once the local ganache is started, I want ...
0
votes
1
answer
75
views
HTTPError: 401 Client Error: Unauthorized for url: https://rinkeby.infura.io/v3/$WEB3_INFURA_PROJECT_ID
I'm following this solidity tutorial from Patrick Collins and when running a script:
brownie run scripts/1_deploy_token.py --network rinkeby
I get this error:
INFO: Could not find files for the given ...
0
votes
0
answers
361
views
how to interact with uniswap quoter contract?
what I want to do is to get the quote of the exchange rate between wETH and wBTC in uniswap.
from brownie import interface, network, config, chain
from scripts.token_scripts import approve_token, ...
0
votes
1
answer
145
views
Access deployed contracts on Ganache local blockchain - BrownieEnvironmentError: Functionality not available in local environment
Using a generic SimpleStorage.sol contract and a deploy.py I'm able to create a contract on a Ganache local blockchain and access it during execution. On brownie console is possible to do the same ...
0
votes
0
answers
106
views
Please Help ValueError: execution reverted: VM Exception while processing transaction: revert
Hi am learning brownie fundme What I tried to do here, is use brownie to deploy a contract(FundMe) using ganache-local then after running (deploy.py),i write a new script fund_and_withdraw.py i got ...
0
votes
0
answers
98
views
ValueError: The private key must be exactly 32 bytes long, instead of 32 bytes
I am trying to run a brownie script in Visual Studio Code on a git bash terminal,
I have set up environment variables WEB3_INFURA_PROJECT_ID and PRIVATE_KEY. within a .env file
When I run my code I ...
2
votes
1
answer
176
views
Obtaining human readable ABI from Brownie package
I am implementing an app in react-native using ethers.js to interact with blockchain. I needed human readable ABI to create a new instance of a smart contract. But I initially deployed my smart ...
1
vote
0
answers
29
views
How to add all the EVM chains to brownie?
I am able to add particular RPC url for that particular chain for eg. Binace Smart Chain to brownie using "brownie networks add".
But I want to multiple networks to brownie, how can I ...
0
votes
0
answers
75
views
brownie and flask, how to interact with smart contract in an api?
I have a project that I have developed with brownie and it works in cli mode. But now I want to set restful api and give API.
for example I have a python file like this :
from brownie import accounts,...
0
votes
1
answer
55
views
Brownie Reverting Transactions With No Description Of Error
Getting error on add liquidity function with no description of the error.
Error:
CSAMM.addLiquidity 0:334 [476 / 29510689 gas]
│
└── ERC201.transferFrom [CALL] 123:322 [29510213 gas]
├─...
0
votes
1
answer
68
views
Same solidity contract compiles in Remix but not using brownie: "TypeError: '<' not supported between instances of 'str' and 'NoneType' "
I am new to solidity coding and have been practicing with some basic contracts.
I've made a contract HotelRoom.sol which compiles and runs as intended in Remix, but when attempting to run 'brownie ...
0
votes
0
answers
21
views
Brownie Stateful Testing
I currently decided to up my test game by going into property based tests and stateful tests on brownie using hypothesis and state machines.
In the brownie documentation on stateful tests. In the ...
0
votes
0
answers
19
views
What value does brownie hash for an empty contract?
I am trying to pinpoint what exactly is getting hashed when deploying a contract with no functions or any explicitly defined constructor. My contract is Hash.sol:
pragma solidity ^0.8.0;
contract ...
0
votes
1
answer
162
views
How to access Struct values of Array invoked from solidity file on python brownie?
I look for a way to iterate struct values of Array that is returned from calling method of solidity file on eth-brownie python file.
As I do some research on several topics asked on https://ethereum....
0
votes
0
answers
45
views
Why is the eth/usd contract not marked as a valid ETH address ? I get a Value error constructor when I try to run deploy script on mainnet-fork
I am following Patrick Alpha's brownie tutorial using python visual studio: https://www.youtube.com/watch?v=M576WGiDBdQ (at around the 5:57 mark). I am using brownie and am trying to run my python ...
1
vote
1
answer
78
views
How do I make sure I have enough gas for my transaction to go through. I get a value error whenever I try to deploy a contract in brownie
I am following Patrick Alphas tutorial using brownie https://youtu.be/M576WGiDBdQ
. I have a fund_and_withdrawl script that has been compiled . With that, I am trying to deploy a fundme contract on a ...
2
votes
0
answers
135
views
How to send 3 transactions to 3 different testnets in brownie
I'm trying send 3 transactions on python (using brownie as api) to 3 different testnets (kovan, rinkeby and goerli), and i'm doing this using 3 differents threads.
I have already import inside of ...
0
votes
1
answer
352
views
OpenZeppelin and chainlink not found; the error is probably on the dependencies; The npm I also not working
Lottery.sol file
"
CompilerError: solc returned the following errors:
"contracts/Lottery.sol:4:1: ParserError: Source "@chainlink/contracts/src/v0.6/interfaces/AggregatorV3Interface.sol&...
2
votes
2
answers
112
views
What are the node providers for Genosis Network (xDai)?
Which node provider can be used to fork Genosis Network (xDai) using brownie? Alchemy, infura and moralis does not provide service. I tried getBlock but doesn't work at all.
0
votes
2
answers
72
views
insufficient gas funds error on rinkeby infura using brownie
I have sufficient ether in my testnet account but still the code is showing error. What to do next? I have attached multiple screenshots of my code and metamask rinkeby wallet.. Kindly guide me
enter ...
0
votes
1
answer
319
views
Brownie unable to compile contracts on Apple M1 Mac
I recently got an M1 mac and I'm trying to compile my brownie project's contracts which compiled fine on my previous machine. I've installed Brownie v1.18.2 and when attempting to run brownie compile ...
0
votes
1
answer
271
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 ...
1
vote
0
answers
294
views
Depositing Weth ERC20 from Brownie into Aave Pool in contract
I am tying to do a simple deposit into an Aave V2 pool with Python Brownie and Solidity on a mainnet-fork but my transaction keeps getting reverted and I dont know why.
In brownie, I call my function ...
3
votes
2
answers
357
views
Add a 'from' account to hardhat transaction calls
I recently started learning to use hardhat to interact with and deploy smart contracts and I noticed that while brownie can accept a from address field for chain transactions, hardhat doesn't.
Does ...
0
votes
1
answer
85
views
How to skip blocks on forked mainnet using Brownie
When working on a forked mainnet, you can use the openzeppelin testnet helper called advanceBlockTo to skip x amount of blocks (Forces a block to be mined, incrementing the block height).
However, ...
0
votes
2
answers
309
views
Deploy SmartContract to local Hyperledger-Besu network using Brownie
EDIT: In short, I want to use Brownie to deploy smartContracts to HyperLedger-Besu network on my local machine. For some reason, it doesn't work, so I wanted to ask if anyone here had experience with ...
2
votes
0
answers
83
views
Populating function names in Brownie traces
When I check the traces of a tx, there are a lot of non populated names, e.g <UnknownContract>.0x095ea7b3
It is unclear and hard to trace.
But I know 0x095ea7b3 is the standard erc20 "...
1
vote
1
answer
146
views
Is there a way to import LinkToken, MockV3Aggregator, and all the other Chainlink mocks without adding the interface file?
I'm following the Solidity, Blockchain, and Smart Contract Course lessons from Free Code Camp and I noticed that Patrick sometimes seems to import mock Chainlink aggregators and mock token contracts ...
0
votes
1
answer
2k
views
Having trouble executing swapExactTokensForTokens on a uniswap contract?
I am attempting to use brownie to execute a swap on Quickswap. But I keep getting a Dai/insufficient-balance error. Here is the traceback for the tx: https://dashboard.tenderly.co/tx/mumbai/...
0
votes
1
answer
109
views
Cannot install brownie with pipx
I struggle to install brownie it is impossible to do so even with the command line pipx install eth-brownie. It prints me this error, however I have nothing to to with it because it's an automatic ...
1
vote
2
answers
393
views
ImportError: cannot import name 'MockV3Aggregator' from 'brownie'
I am learning Solidity at the moment and I am facing an error when trying to use MockV3Aggregator:
ImportError: cannot import name 'MockV3Aggregator' from 'brownie'
Here is my bronwie-config.yaml:
...
0
votes
1
answer
282
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.
...
0
votes
1
answer
72
views
How to get smart contract attributes by some block in mainnet?
I want to track some smart contract's attributes in the neighbouring blocks in mainnet. I know hash of the contract and hash of the 'starting' block. I use brownie. How can I get attributes of the ...
0
votes
1
answer
425
views
Brownie does not find @openzeppelin after being installed
Brownie does not find openzeppelin contracts, even if brownie knows that it is installed
(base) andrea@andrea-ThinkPad-S430:~/MEGA/smart_contracts/demos/ERC20-brownie$ brownie pm install OpenZeppelin/...
1
vote
0
answers
96
views
Can I combine Brownie to view events and contracts on Ganache?
It seems that ganache can only work for truffle-config file , if i want to see the events and smart contracts on my local ganache blockchain?
I am developing an app where i want to locally test the ...
0
votes
1
answer
190
views
How do I deploy a contract with payable constructor with Brownie python
I have a constructor in my Smart Contract:
constructor() payable
{
require(msg.value >= 100000000 gwei, "Min == 0.1ETH");
require(msg.value <= 500000000 gwei, "Max == 0....
0
votes
1
answer
574
views
Source "@chainlink/contracts/src/v0.6/interfaces/AggregatorV3Interface.sol" not found: File outside of allowed directories
I'm trying to deploy an interface from Chainlink and I have in my solidity contract the import for the AggregatorV3Interface:
pragma solidity 0.6.6;
import "@chainlink/contracts/src/v0.6/...
1
vote
1
answer
184
views
unbale to import smart contract into brownie scripts
I was trying to run a deploy script with brownie but i couldnt import required .sol smartContract into my scripts
This is my folder structure
My code in deploy.py
from brownie import Fundme, accounts,...
1
vote
1
answer
375
views
How to access Struct values in brownie
//transaction struct of what a tx should have
struct Transaction{
address to;
uint value;
bool executed;
uint numConfirmations;
mapping(address => bool) isConfirmed;
mapping(...
1
vote
1
answer
1k
views
abi.encode() in Python
I am working with brownie and I need to find a way to do what abi.encode() does in Python. Here is a contract:
function fundSubscription(address _linkAddress,bytes calldata _data) {
// _data needs ...
0
votes
1
answer
149
views
Getting " Gas estimation failed" error for pet project - "smart_lottery_contract" project
I am new to blockchain and I am following the tutorial by Patrick based on the project
I have my code here at :https://github.com/shashankvivek/blockchain/tree/main/smartLottery_contract_revisited
...
0
votes
1
answer
97
views
"codec can't encode character" error when I run "pipx install eth-brownie"
When I ran "pipx install eth-brownie", I got this error.
Error:
Traceback (most recent call last):
File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.10_3.10.1264....
1
vote
1
answer
296
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
0
answers
76
views
Has anyone gotten Brownie developer revert comments to work with Vyper?
When I try to use Brownie developer revert comments with a Vyper contract as described in the Brownie documentation here:
Developer Revert Comments
Brownie does not seem to recognize the comments.
...
0
votes
0
answers
1k
views
I am getting "invalid opcode: INVALID" as error when i try to return an array of structures
I am getting error as ValueError: invalid opcode: INVALID. Is it because of use of memory and storage keyword in the function or is it because i can't return an array.
My Solidity Code:-
struct ...
0
votes
1
answer
183
views
Brownie with Jupyter Notebooks
I am trying to use brownie with jupyter notebook. But seems like I am unable to import contracts 'cannot import name 'contractname' from 'brownie.network' (/path/anaconda3/envs/ethereum/lib/python3.9/...