You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am trying to run the script in the terminal but I get this error TypeError: argument of type 'NoneType' is not iterable.
Can anyone help me with this issue?
Thank you in advance.
Below is the entire code.
1.Get-weth.py
from scripts.helpful_scripts import get_account
from brownie import interface, config, network
def main():
get_weth()
def get_weth():
"""
Mints WETH by depositing ETH
"""
#ABI&Address
account=get_account()
weth=interface.IWeth(config["networks"][network.show_active()]["weth_token"])
tx=weth.deposit({"from": account, "value":0.1*10**18})
print("Received 0.1 WETH")
return tx
2.Helpful-scripts.py
from brownie import accounts, network, config
def get_account(index=None, id=None):
if index:
return accounts[index]
if network.show_active() in LOCAL_BLOCKCHAIN_ENVIRONMENTS:
return accounts[0]
if id:
return accounts.load(id)
if network.show_active() in config["networks"]:
return accounts.add(config["wallets"]["from_key"])
return None
I am trying to run the script in the terminal but I get this error TypeError: argument of type 'NoneType' is not iterable.
Can anyone help me with this issue?
Thank you in advance.
Below is the entire code.
1.Get-weth.py
from scripts.helpful_scripts import get_account
from brownie import interface, config, network
def main():
get_weth()
def get_weth():
"""
Mints WETH by depositing ETH
"""
#ABI&Address
account=get_account()
weth=interface.IWeth(config["networks"][network.show_active()]["weth_token"])
tx=weth.deposit({"from": account, "value":0.1*10**18})
print("Received 0.1 WETH")
return tx
2.Helpful-scripts.py
from brownie import accounts, network, config
LOCAL_BLOCKCHAIN_ENVIRONMENTS = [
"development",
"ganache",
"hardhat",
"local-ganache",
"mainnet-fork",
]
def get_account(index=None, id=None):
if index:
return accounts[index]
if network.show_active() in LOCAL_BLOCKCHAIN_ENVIRONMENTS:
return accounts[0]
if id:
return accounts.load(id)
if network.show_active() in config["networks"]:
return accounts.add(config["wallets"]["from_key"])
return None
3.Brownie-config.yaml
dependencies:
compiler:
solc:
remappings:
dotenv: .env
networks:
default: mainnet-fork
goerli:
weth_token: "0xB4FBF271143F4FBf7B91A5ded31805e42b2208d6"
mainnet-fork:
weth_token: "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2"
wallets:
from_key: ${PRIVATE_KEY}
4.env
export PRIVATE_KEY = "0x753aa243016b908fc6f7c21964201f11c1bf46cca2fe2ba2359cfeff9bbed00e"
export WEB3_ALCHEMY_PROJECT_ID = "gP4XRpmUZxWsPV7gbb6X0EViwq9tnzCO"
export ETHERSCAN_TOKEN = DPGZQ3V1B593F8FX4X1YETVU7WKY8PG9BV
pragma solidity ^0.4.19;
interface IWeth {
function allowance(address owner, address spender) external view returns (uint256 remaining);
function approve(address spender, uint256 value) external returns (bool success);
function balanceOf(address owner) external view returns (uint256 balance);
function decimals() external view returns (uint8 decimalPlaces);
function name() external view returns (string memory tokenName);
function symbol() external view returns (string memory tokenSymbol);
function totalSupply() external view returns (uint256 totalTokensIssued);
function transfer(address to, uint256 value) external returns (bool success);
function transferFrom(address from, address to, uint256 value) external returns (bool success);
function deposit() external;
function withdraw(uint wad) external;
}
The text was updated successfully, but these errors were encountered: