smartcontractkit / full-blockchain-solidity-course-py

Ultimate Solidity, Blockchain, and Smart Contract - Beginner to Expert Full Course | Python Edition
MIT License
10.67k stars 2.89k forks source link

Lesson 10: Defi & Aave--TypeError: argument of type 'NoneType' is not iterable #1767

Open ellyblueeyes opened 1 year ago

ellyblueeyes commented 1 year ago

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:

4.env export PRIVATE_KEY = "0x753aa243016b908fc6f7c21964201f11c1bf46cca2fe2ba2359cfeff9bbed00e" export WEB3_ALCHEMY_PROJECT_ID = "gP4XRpmUZxWsPV7gbb6X0EViwq9tnzCO" export ETHERSCAN_TOKEN = DPGZQ3V1B593F8FX4X1YETVU7WKY8PG9BV

  1. IWeth.sol 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; }

Parviz666 commented 5 months ago

How is it possible to find the forgotten TrustVolt code?