Category : solidity

I am trying to deploy my SimpleStorage.sol contract to a ganache local chain by making a transaction using python. It seems to have trouble connecting to the chain. from solcx import compile_standard from web3 import Web3 import json import os from dotenv import load_dotenv load_dotenv() with open("./SimpleStorage.sol", "r") as file: simple_storage_file = file.read() compiled_sol = ..

Read more

I write the code below. It seems it has a problem with the "signed_txn = w3.eth.account.sign_transaction(transaction, private_key=private_key" part. I face to the error below every time I deploy: "Traceback (most recent call last): File "E:Blockchain-Developingdeploy.py", line 81, in signed_txn = w3.eth.account.sign_transaction(transaction, private_key=private_key) File "C:UsersRezliAppDataLocalProgramsPythonPython310libsite-packageseth_utilsdecorators.py", line 18, in _wrapper return self.method(obj, *args, **kwargs) File "C:UsersRezliAppDataLocalProgramsPythonPython310libsite-packageseth_accountaccount.py", line ..

Read more

Macbook Pro : Monterey Intel Core i7 Brownie v1.17.2 I am learning solidity according to reference(https://www.youtube.com/watch?v=M576WGiDBdQ&t=25510s). What I tried to do here, is use brownie to deploy a contract(FundMe) in a script (deploy.py),then write a test script(test_can_fund_and_withdraw.py) The error occurs when I run the test script.I think it’s because in the testing script import the ..

Read more

I’m working from brownie/python trying to do a smart contract When I try to swap from PancakeSwap on BNB testnet (https://pancake.kiemtienonline360.com) calling the function swapExactTokensForTokens from a interface it returns me "Gas estimation failed: ‘execution reverted’. This transaction will likely revert." but I know probably it’s nothing related to gas Here it’s my approve function: ..

Read more

I’m working from brownie/python trying to do a smart contract When I try to swap from PancakeSwap on BNB testnet (https://pancake.kiemtienonline360.com) calling the function swapExactTokensForTokens from a interface it returns me "Gas estimation failed: ‘execution reverted’. This transaction will likely revert." but I know probably it’s nothing related to gas Here it’s my approve function ..

Read more

ParserError: Source "@openzeppelin/contracts/token/ERC20/ERC20.sol" not found: File not found. while I’m deploying with brownie on default local ganache-cli. Command: $ brownie compile gets: Brownie v1.17.2 – Python development framework for Ethereum Compiling contracts… Solc version: 0.8.11 Optimizer: Enabled Runs: 200 EVM Version: Istanbul CompilerError: solc returned the following errors: ParserError: Source "@openzeppelin/contracts/token/ERC20/ERC20.sol" not found: File not ..

Read more

I would like to get the latest transactions of ShibaInu with this python script I’m using this code here but it doesn’t work contractA = web3.toChecksumAddress(‘0x95ad61b0a150d79219dcf64e1e6cc01f0b64c4ce’) contractAbi = ‘abi’ myContract = web3.eth.contract(address=contractA, abi=contractAbi) def handle_event(event): print(event) # and whatever async def log_loop(event_filter, poll_interval): while True: for event in event_filter.get_new_entries(): handle_event(event) await asyncio.sleep(poll_interval) def main(): block_filter ..

Read more

I’m new to programming and currently following a brownie tutorial. While interacting with smart contracts, my tutor puts a tx.wait(1) after every transaction that requires a state change of the contract. I’m guessing tx.wait(1) means that we tell brownie to wait for at least one confirmation of the transaction before proceeding further. But tx.wait(1) is ..

Read more

I wrote a script to interact with etherscan kovan weth contract to get weth: https://kovan.etherscan.io/token/0xd0a1e359811322d97991e03f863a0c30c2cf029c This is the script: from scripts.helpful_scripts import get_account from brownie import interface,network,config def main(): get_weth() def get_weth(): account=get_account() weth = interface.IWeth(config["networks"][network.show_active()]["weth_token"]) tx = weth.deposit({"from": account, "value": 0.1 * 10 ** 18}) tx.wait(1) print("Received 0.1 weth") return tx this runs successfully. ..

Read more