full-blockchain-solidity-course-py icon indicating copy to clipboard operation
full-blockchain-solidity-course-py copied to clipboard

Aave lesson: Final argument must be a dict of transaction parameters that includes a `from` field specifying the sender of the transaction

Open kjones86 opened this issue 2 years ago • 1 comments

I've tried deploying on both RInkeby and Kovan and received the same error: Here is my code.

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.
    """
    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`
Here is my helpful scripts`from brownie import accounts, network, config

from dotenv import load_dotenv

LOCAL_BLOCKCHAIN_ENVIRONMENTS = ["development", "ganache-local", "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`

and here is my config file `dependencies:

- aave/[email protected]
compiler: 
 solc:
   remappings:
    - '@aave=aave/[email protected]'
dotenv: .env
networks:
 kovan:
   weth_token: '0xd0A1E359811322d97991E03f863a0C30C2cF029C'
 mainnet-fork:
   weth_token: '0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2'
wallets: 
 from_key: ${PRIVATE_KEY}`

kjones86 avatar Jun 07 '22 02:06 kjones86

Hello @kjones86 tx = weth.deposit()({"from": account, "value": 0.1 * 10 ** 18}) you have an error here, the "from" and "value" should be inside deposit parenthesis.

cromewar avatar Jun 22 '22 14:06 cromewar

Thanks for your response @cromewar the tx line was correct but it looks like I was missing a () from get_account

kjones86 avatar Sep 01 '22 01:09 kjones86