Questions tagged [brownie]
Brownie is a Python-based development and testing framework for smart contracts targeting the Ethereum Virtual Machine.
387
questions
1
vote
0
answers
43
views
Expected in: flat namespace after install brownie
i installed brownie with pipx but when i type any command i get this:
Traceback (most recent call last):
File "/Users/lorisfacchinetti/.local/bin/brownie", line 5, in <module>
...
2
votes
2
answers
298
views
Issue with brownie
When I run brownie, I get the following error message.
root@DESKTOP-MIQQV4H:/mnt/c/users/user/documents/blockchain/brownie_simple_storage# nvm install 16.13.2
v16.13.2 is already installed.
Now using ...
0
votes
1
answer
529
views
How to import uniswap contracts to Brownie projects
I would like to work with uniswap contracts but the problem is that I'm using brownie so I can't just use their npm package like this:
npm i --save-dev @uniswap/v3-sdk
npm i --save-dev @uniswap/sdk-...
0
votes
1
answer
260
views
Is there any way to upload a list or array of addresses on ipfs, and access it from a smart contract?
I am planning to make a decentralized voting application. The addresses of eligible voters should be uploaded on IPFS for anyone to access.
This file on IPFS will be used in the contract to make sure ...
0
votes
1
answer
450
views
from brownie import Token, accounts
Error is cannot find Token
Exception has occurred: ImportError cannot import name 'Token' from 'brownie
However Token JSON file exists
brownie bake token worked
1
vote
1
answer
296
views
How do I tell which solidity version eth-brownie is using to compile my contracts?
I'm not specifying a solidity version so I'm not sure which solidity version brownie is using to compile my contract.
I'm using pragma solidity ^0.8.0; so I'm not sure which version above 0.8.0 ...
0
votes
1
answer
76
views
Fix: ValueError: Unable to expand environment variable in host setting: 'https://rinkeby.infura.io/v3/$WEB3_INFURA_PROJECT_ID' [duplicate]
This error seems to come up to several people doing Patrick Collins' freeCodeCamp tutorial. Just thought I'd give you the answer I finally found.
0
votes
1
answer
571
views
cannot deploy contract to polygon mumbai if it imports ChainlinkClient.sol
I have a contract that is deploying fine to rinkeby and kovan. I want to put it on polygon-main but thought I'd test with polygon-test (ie. mumbai) first. I'm using brownie. My deploy looks like this:
...
0
votes
1
answer
306
views
Brownie test skips over a function
So I wanted to test my lottery contract and python scripts. I have three functions namely test_get_entrance_fee() , test_cant_enter_unless_started() and can_start_and_enter_lottery()
Out of these ...
0
votes
0
answers
507
views
Upgradable Proxy to ERC1155
I want to upgrade my ERC1155 game from Game.sol to GameV2.sol using Openzeppelin's contracts ProxyAdmin and TransparentUpgradeableProxy. I have implemented ERC1155PresetMinterPauser to Game/GameV2 ...
0
votes
2
answers
360
views
Brownie : Contract Functionality not available in local environment
I have set up a new brownie project (brownie bake yearn strategy mix). When I try running tests I get this error :
brownie.exceptions.BrownieEnvironmentError: Functionality not available in local ...
1
vote
1
answer
205
views
Brownie "No Module named"Users"" error
I keep on getting this error, following the Freecodecamp solidity tutorial. Brownie seems to be fine when making the accounts and adding private key like seen in video, and ganache-cli is installed ...
0
votes
3
answers
372
views
AttributeError - 'InterfaceContainer' object has no attribute
from brownie import config, network, interface
from scripts.helpful_scripts import get_account
from scripts.get_weth import get_weth
def main():
account = get_account()
erc20_address = config[...
1
vote
1
answer
759
views
Import brownie cannot be resolved
I try running this script
from brownie import Token, accounts
def main():
return Token.deploy("Test Token", "TST", 18, 1e21, {'from': accounts[0]})
Then error message is an issue ...
2
votes
2
answers
792
views
How to get a contracts emitted events in brownie?
Say I have a contract that emits multiple events, how do I to get a list of all events emitted in brownie and sort them by event type?
contract SimpleContract {
event Deposit(address indexed ...
0
votes
1
answer
419
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 ...
2
votes
2
answers
387
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
1
answer
259
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
1
answer
95
views
File import callback not supported [duplicate]
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 ...
3
votes
0
answers
197
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 ...
3
votes
1
answer
231
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
0
answers
27
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
1
answer
267
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
0
answers
42
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
1
answer
149
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
2
answers
377
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
1
answer
228
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 ...
2
votes
2
answers
351
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....
2
votes
1
answer
539
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 ...
3
votes
3
answers
2k
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
1
answer
702
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 ...
1
vote
0
answers
227
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
0
answers
152
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
1
answer
168
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
0
answers
84
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 ...
2
votes
3
answers
2k
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 = ...
1
vote
1
answer
480
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
1
answer
297
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
...
2
votes
2
answers
1k
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 ...
2
votes
2
answers
138
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
1
answer
1k
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 :) ...
1
vote
0
answers
34
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 ...
1
vote
0
answers
384
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 ...
1
vote
0
answers
236
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
1
answer
50
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
1
answer
78
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
1
answer
257
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 ...
2
votes
1
answer
160
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/...
2
votes
1
answer
301
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
1
answer
156
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 ...