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
130
views
Brownie pm is attempting to load .env from installed package
Environment information
brownie Version: 1.18.1
Python Version: 3.8.12
OS: osx
What was wrong?
My tests now fail after adding a .env file to my project and specifying that file in brownie-config.yml....
0
votes
1
answer
121
views
VRF2 createSubscription() help
I am very new to Solidity and Blockchain, have a background of Web Developer though, and as many i am following the Youtube video on these technologies by freeCodeCamp.org channel, where the VRF v1 is ...
0
votes
1
answer
280
views
Can't call existing Solidity function with Brownie due AttributeError
I have deployed a simple contract on the BSC testnet which has a simple function that executes a swap on Pancakeswap.
This is how I call the function with Brownie:
def main():
tx = contract1....
0
votes
1
answer
181
views
[Brownie]: Aave Flashloan - Calling lending.pool.borrow() does not actually borrow
My code run successfully without errors, but it never does actually borrow anything from Aave when i call lending_pool.borrow(). Tried running this on both a mainnet-fork into local environment, as ...
0
votes
1
answer
168
views
i am getting list out of index error while trying to run my lottery smart contract with brownie
PS E:\lottery-smartcontract> brownie run scripts/deploy_lottery.py
INFO: Could not find files for the given pattern(s).
Brownie v1.16.4 - Python development framework for Ethereum
...
0
votes
1
answer
333
views
Brownie: Is it safe to store actual private key?
My question is, is it completely safe to create an account with real funds in Brownie without hardware wallet, only with a password? Is there a possibility the private key stored like that could be ...
1
vote
1
answer
62
views
"returns(function() external fun)" a function can be returned in a call.?
In the solidity documentation I find this example. I'm trying to understand what is going on here. Does it mean that I can return a function?
Is assembly used to make the dynamic return of other ...
0
votes
1
answer
132
views
Unit testing a library with brownie
My question is simple. Is it possible to write a unit test in python (Brownie) for a library using a struct from it?
I found something interesting in another question, but it does not seem working in ...
1
vote
0
answers
124
views
Brownie: replacement transaction underpriced
I have a stuck transaction in brownie, when I try to deploy another contract I have this error:
ValueError: replacement transaction underpriced
my deployment code is like this:
dev = accounts.add(...
0
votes
1
answer
169
views
TypeError while running deploy.py script in brownie
I initialized a new brownie project via the terminal by
$ brownie init
I wrote the following script in python:
def simple_print():
print("Hello World!")
def main():
simple_print()
...
1
vote
0
answers
141
views
Deployed Contract Doesn't Show up
I deploy a smart contract using Brownie to local Ganache blockchain (GUI, not CLI). I can see every transaction that I do and accounts (tx-count). However, the contract tab is always empty and asks me ...
0
votes
1
answer
325
views
"Stack limit reached 1024 (1023)" Error
as you can see in the title, I have the following problem:
I have two different types of NFTs in the same contract and I wanted to make transactions way cheaper using a single mapping for knowing the ...
0
votes
1
answer
135
views
Brownie - TypeError: int() argument must be a string, a bytes-like object or a real number, not 'TransactionReceipt'
I made a simple voting smart contract and got a TypeError when I was testing the function "test_can_endorse_candidate".
Solidity Code:
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.6;...
0
votes
1
answer
360
views
Solidity transaction "reverted" when contract is called by another contract
This deposit function works perfectly. However, when I attempt to call this function from another contract (through an interface), it does all the right transactions, but then reverts at the end, ...
0
votes
1
answer
555
views
Error from brownie compile with IERC721.sol
I am getting an error from brownie compile and I can't figure out why it wont import one of the openzeppelin contracts when all the others import ok.
here is my brownie-config.yaml
# https://eth-...
0
votes
1
answer
94
views
Python: I am getting a syntax error that prevents me from deploying me contract. What is the syntax of format that I need to use for this?
I just created a new API key for Etherscan. I added my key to my .env file, and I added publish_source=True to print(f"Contract deployed to {fund_me.address}"), publish_source=True to be ...
2
votes
1
answer
296
views
Brownie ConnectionResetError on running forks
I am running a test script with mainnet-fork using alchemy.
The test appears to be successfully completed, but during the tear down bit, brownie throws up:
ConnectionResetError: [WinError 10054] An ...
0
votes
1
answer
456
views
I am getting a Source error when importing @Chainlink. My project will compile. How can I avoid this error, or should I just ignore it?
I do not know what the issue is as I am on version 0.6.6 Solidity both in my compiler and in my code, and I am using all of the same versions of the packages that Patrick used. I find it even more ...
0
votes
1
answer
221
views
Call Receive Ether Function from Brownie
Please, how to make a transaction from Brownie to a smart contract which has a receive function like so:
address payable public destination;
event ForwarderDeposited(address from, uint256 value, bytes ...
0
votes
2
answers
497
views
How to interact with deployed contract inside Brownie console
This is how I used to interact with deployed contracts when using truffle console
let contract = await Whitelist.deployed()
contract.getWhitelist()
However, I am now using a brownie console and this ...
0
votes
1
answer
141
views
Brownie having different behavior for library dependencies
When I use my custom library, Brownie complains that the library is not deployed (UndeployedLibrary). But why doesn't it complain about other library files like the ones inside OpenZeppelin?
For ...
3
votes
1
answer
1k
views
How to re-use previously deployed contract with Hardhat?
In brownie there's a very handy syntax to avoid deploying multiple times the same contract on-chain, while developing and iterating fast:
MyContract.deploy()
# somewhere else, sometime later:
...
1
vote
3
answers
1k
views
How to add network to brownie-config.yaml
I know you can add a network to brownie by using a command:
brownie networks add Ethereum ganache-local host=http://127.0.0.1:7545 chainid=5777
or for example:
brownie networks add development ...
0
votes
1
answer
171
views
What is the best way to interact with a smart contract from Django?
I developed a smart contract (ERC721) for minting NFTs.
I want to mint an NFT on a Django server when some specific event occurs. I do know how to mint them using Brownie framework but I don't know ...
2
votes
2
answers
514
views
Passing struct into solidity function from brownie
Similar questions have been asked before, and I have read them but am stuck after using encode_single. If I pass the resulting bytes into my solidity function it says "expected list or tuple, ...
0
votes
0
answers
99
views
Brownie v1.18.1 - testing for onlyOwner method resulting in failed test (ValueError: Gas estimation failed), need exceptions.VirtualMachineError
I am going through the excellent tutorial here https://youtu.be/M576WGiDBdQ?t=21222
at the linked timestamp, the brownie test calling an OnlyOwner from a non valid address resulted in Brownie....
0
votes
1
answer
53
views
How can I properly define a value and call it with .retrieve in Brownie?
transaction = simple_storage.store(15, {"from": account})
transaction.wait(1)
updated_store_value = simple_storage.retrieve()
print(updated_stored_value)
This is the code that I am using in ...
0
votes
1
answer
117
views
My contract is failing to deploy because my code is not reading what address I am deploying from. How can I get this contract to deploy?
from brownie import accounts, config, SimpleStorage
def deploy_simple_storage():
account = accounts[0]
simple_storage = SimpleStorage.deploy({"from: account"})
print(...
1
vote
3
answers
2k
views
Error: Transaction's maxFeePerGas (0) is less than the block's baseFeePerGas (527514873)
Not Able to deploy to Ganache- Local chain,
I have tried using func from Web3.eth , tried to import GasNowStrategy, Redownload the ganache as well and also tried to copy exact same code from GIT. ...
1
vote
0
answers
368
views
UUPS proxy with the Brownie framework
I am trying to implement a UUPS proxy using the OpenZeppelin UUPSUpgradeable abstract contract. I actually succeeded to do so but I think that there may be a better way than the one I found.
In other ...
0
votes
1
answer
77
views
Contract Development: How can I run an entire folder of scripts through Brownie?
I am trying to run my "deploy.py" file, and I was having trouble just deploying that at first, however, I figured that out. Is there a way that I can run every script under a certain folder ...
0
votes
1
answer
47
views
EIP2981 implementation error
I understood that EIP2981 requires the function royaltyInfo override in my smart contract.
I wrote it that way:
function royaltyInfo(uint256 _tokenId, uint256 _salePrice)
external
view
...
1
vote
2
answers
124
views
gas now strategy doesn't work
When I'm using GasNowStrategy("fast") in my contract deployment I get an error:
from brownie.network.gas.strategies import GasNowStrategy
def main():
dev = accounts.add(config["...
0
votes
1
answer
458
views
Execution reverted on token swap on Fantom (Solidly, SpookySwap) using Brownie
I am developing a trading bot, that directly interacts with smart contracts on Fantom, an EVM compatible blockchain. Smart contracts I tried in order to swap TOMB tokens to FTM tokens:
Solidly
...
0
votes
2
answers
180
views
AttributeError: 'NoneType' object has no attribute 'retrieve' #1195
i'm getting this error in simple storage deploy script
here is the deploy.py code
from brownie import accounts, config, SimpleStorage
def deploy_simple_storage():
account = accounts[0]
# ...
0
votes
3
answers
2k
views
Brownie Gas estimation failed: 'execution reverted'
I'm completing the freecodecamp solidity tutorial for the advanced NFT and when deploying to a rinkeby testnet it returns:
ValueError: Gas estimation failed: 'execution reverted'. This transaction ...
0
votes
1
answer
212
views
Exception has occurred: ImportError x cannot import name 'accounts' from 'brownie'
Setup:
Windows 10
Python 3.9.0
Brownie v1.18.1
Ganache CLI v6.12.2 (ganache-core 2.13.2)
I'm currently following Patrick's solidity tutorial. I'm at about 4:39:00. Here is my code and the error ...
0
votes
1
answer
280
views
account not accessible through brownie accounts while using --network ganache-local
(eth-brownie) PS C:\Users\lucky\Desktop\Investing\Courses\Solidity\demos\brownie_fund_me> brownie run scripts/deploy.py --network ganache-local
INFO: Could not find files for the given pattern(s).
...
1
vote
0
answers
306
views
How to pass struct argument in brownie-eth?
I tried to pass list of dicts to an argument like this.
mycontract.myfunction([{"token1": "...", "token2": "..."}], {"from": account}])
it don't work....
0
votes
2
answers
449
views
Cannot Import Lottery from Brownie even after successfull Compilation
I am trying to deploy the Lottery Contract but it doesn't seem to work since Brownie throws an error, ImportError: cannot import name 'Lottery' from 'brownie' . I have already compiled the Contract ...
1
vote
2
answers
210
views
brownie.exceptions.EventLookupError: Event 'xxx' did not fire
I am testing my contracts with brownie on local ganache and hit an issue where my events are not firing. When I call
tx.events['xxx']['param1']
I get error:
brownie.exceptions.EventLookupError: ...
3
votes
3
answers
304
views
How to run a specific unit test in a test script in brownie?
Say I have a python test script in my brownie project's /tests directory with a number of difference test cases, is it possible to pass a flag to only execute a certain test function in brownie?
1
vote
1
answer
76
views
Is property based testing easily setup in a hardhat project?
I've initially started solidity development using the python brownie framework, however I am thinking of transitions over to hardhat to keep all codebases(frontend&backend) language consistent i.e....
1
vote
1
answer
227
views
How to clean or reset brownie build folder
Is there a command to clear/reset the brownie build folder (including the deployments folder)?
It would be a nice feature to have :)
0
votes
1
answer
364
views
Error: Non-hexadecimal digit found - brownie
When i run brownie run scripts/deploy.py the terminal gives me this error :
Brownie v1.16.4 - Python development framework for Ethereum
BrownieSimpleStorageProject is the active project.
Launching '...
0
votes
1
answer
126
views
Having issues compiling my brownie_fund_me
Received this error while trying to compile, codes are exactly the same. CompilerError: solc returned the following errors:
contracts/FundMe.sol:8:1: ParserError: Source "@chainlink/contracts/src/...
0
votes
1
answer
37
views
Brownie does not function after upgrade
What was wrong?
After upgrading Brownie from version 1.17.2 to 1.18.1, Brownie has stoped functioning properly. Once I run commands like brownie compile, brownie console, brownie run scripts/deploy....
1
vote
1
answer
489
views
Brownie testing for reverted transactions does not work with pytest.raises() or brownie.reverts()
disclaimer: this is a duplicate from https://stackoverflow.com/questions/71126128/ I couldn't find out how to move the question, so I copied it here.
Issue description:
Brownie tests containing either
...
1
vote
2
answers
312
views
ValueError: Network is missing required field(s): chainid
When adding another network it doesn't recognize the chainid for some reason.
root@DESKTOP-MIQQV4H:/mnt/c/users/user/documents/Blockchain/brownie_fund_me# brownie networks add Ethereum ganache-local ...
1
vote
0
answers
121
views
ProcessLookupError: Could not attach to RPC process by querying 'proc.net_connections()'
Anyone know the solution to this?
root@DESKTOP-MIQQV4H:/mnt/c/users/user/documents/Blockchain/brownie_fund_me# brownie run scripts/deploy.py
Brownie v1.17.2 - Python development framework for Ethereum
...