Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
ellyblueeyes opened this issue Nov 3, 2022 · 1 comment

Comments

@ellyblueeyes
Copy link

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:

  • aave/protocol-v2@1.0.1
    compiler:
    solc:
    remappings:
    • '@aave=aave/protocol-v2@1.0.1'
      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

  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
Copy link

How is it possible to find the forgotten TrustVolt code?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants