0
from brownie import config, network, interface
from scripts.helpful_scripts import get_account
from scripts.get_weth import get_weth


def main():
    account = get_account()
    erc20_address = config["networks"][network.show_active()]["weth_token"]
    # get_weth
    if network.show_active() in ["mainnet-fork"]:
        get_weth()
    # ABI
    # Address
    lending_pool = get_lending_pool()
    print(lending_pool)


def get_lending_pool():
    # ABI
    # Address
    lending_pool_addresses_provider = interface.ILendingPoolAddressesProvider(
        config["networks"][network.show_active()]["lending_pool_addresses_provider"]
    )
    lending_pool_address = lending_pool_addresses_provider.getLendingPool()
    # print(lending_pool_address)
    # ABI
    # Address
    lending_pool = interface.ILendingPool(lending_pool_address)
    # return lending_pool

######### In ILendingPool.sol ########### (link in 1st comment)

I changed the import to:

import {ILendingPoolAddressesProvider} from '@aave/contracts/interfaces/ILendingPoolAddressesProvider.sol';
import {DataTypes} from '@aave/contracts/protocol/libraries/types/DataTypes.sol';

in order to import them from brownie config:

dependencies: 
  - aave/[email protected]
compiler:
  solc:
    remappings:
      - '@aave=aave/[email protected]'
3
  • I am trying to interact with the Aave lending pool (ILendingPool) and keep getting this error: AttributeError: 'InterfaceContainer' object has no attribute 'ILendingPool' ILendingPool interface git: github.com/aave/protocol-v2/blob/master/contracts/interfaces/…
    – PinkyZane
    Jan 28, 2022 at 16:31
  • Where does it say you're getting this error Feb 2, 2022 at 3:54
  • @PatrickCollins Thank you for your reply! 9:16:00 of the tutorial. lending_pool = interface.ILendingPool(lending_pool_address) - this is the line
    – PinkyZane
    Feb 2, 2022 at 11:33

3 Answers 3

0

I had this same issue. I'm assuming you copied/pasted from OpenZeppelin's GitHub. If that's the case, you may have done what I did and included the GitHub copyright info at the end:

© 2022 GitHub, Inc. Terms Privacy Security Status

Because of this, your code won't compile and isn't included in the InterfaceContainer. Check and see if that's your issue, I'd bet it is.

0

Change your ILending.sol interface file, especially where you import the ILendingPoolRegister and DataTypes.sol

YOUR IMPORT IS

import {ILendingPoolAddressesProvider} from '@aave/contracts/interfaces/ILendingPoolAddressesProvider.sol'; import {DataTypes} from '@aave/contracts/protocol/libraries/types/DataTypes.sol';

AND YOUR REMAPPING IN THE CONFIG FILE IS

remappings: - '@aave=aave/[email protected]'

SO THE SOLC COMPILER READS IT AS

import {ILendingPoolAddressesProvider} from 'aave/protocol-v2/contracts/interfaces/ILendingPoolAddressesProvider.sol';

IF THE ABOVE FAILS TRY DOWNLOADING THE AAVE CONTRACTS LOCALLY USING

npm install @aave/protocol-v2

0

The issue is in the following line:

--> lending_pool = interface.ILendingPool(lending_pool_address)

If you look at ILendingPool.sol the name of the interface in the file is actually 'IPool' (you're trying to use the filename, not the interface name).

So change it to:

--> lending_pool = interface.IPool(lending_pool_address)

and it should work.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.