AaveDeployer

Documentation for eth_defi.aave_v3.deployer.AaveDeployer Python class.

class AaveDeployer[source]

Aave v3 deployer wrapper.

  • Install Aave v3 deployer locally

  • Run the deployment command against the local Anvil installation

Methods summary

__init__([repo_path, abi_path])

Create Aave deployer.

checkout([echo])

Clone aave-v3-deploy repo.

deploy_local(web3[, echo])

Deploy Aave v3 at Anvil.

get_contract(web3, name)

Get Aave deployer ABI file.

get_contract_address(contract_name)

Get a deployed contract address.

get_contract_at_address(web3, ...)

Get a singleton Aave deployed contract.

install([echo])

Make sure we have Aave deployer installed.

is_checked_out()

Check if we have a Github repo of the deployer.

is_deployed(web3)

Check if Aave is deployed on chain

is_installed()

Check if we have a complete Aave deployer installation.

__init__(repo_path=PosixPath('/home/docs/checkouts/readthedocs.org/user_builds/web3-ethereum-defi/checkouts/latest/contracts/aave-v3-deploy'), abi_path=PosixPath('/home/docs/checkouts/readthedocs.org/user_builds/web3-ethereum-defi/checkouts/latest/eth_defi/abi/aave_v3'))[source]

Create Aave deployer.

Parameters
  • repo_path (pathlib.Path) – Path to aave-v3-deploy git checkout.

  • abi_path (pathlib.Path) – Path to Aave v3 compiled ABI.

is_checked_out()[source]

Check if we have a Github repo of the deployer.

Return type

bool

is_installed()[source]

Check if we have a complete Aave deployer installation.

Return type

bool

checkout(echo=False)[source]

Clone aave-v3-deploy repo.

install(echo=False)[source]

Make sure we have Aave deployer installed.

Note

Running this function takes long time on the first attempt, as it downloads 1000+ NPM packages and few versions of Solidity compiler.

  • Aave v3 deployer is a NPM/Javascript package we need to checkout with git clone

  • We install it via NPM modules and run programmatically using subprocesses

  • If already installed do nothing

Parameters

echo – Mirror NPM output live to stdout

Returns

False is already installed, True if we did perform the installation.

Return type

bool

deploy_local(web3, echo=False)[source]

Deploy Aave v3 at Anvil.

Deploys all infrastructure mentioned in the eth_defi.aave_v3.deployer documentation, in those fixed addresses.

Note

Currently Aave v3 deployer is hardcoded to deploy at localhost:8545 Anvil cannot run in other ports.

Parameters
  • echo – Mirror NPM output live to stdout

  • web3 (web3.main.Web3) –

is_deployed(web3)[source]

Check if Aave is deployed on chain

Parameters

web3 (web3.main.Web3) –

Return type

bool

get_contract(web3, name)[source]

Get Aave deployer ABI file.

ABI files contain hardcoded library addresses from the deployment and cannot be reused.

This function links the contract against other deployed contracts.

See get_contract_at_address().

Returns

A Contract proxy class

Parameters
  • web3 (web3.main.Web3) –

  • name (str) –

Return type

Type[web3.contract.contract.Contract]

get_contract_address(contract_name)[source]

Get a deployed contract address.

See HARDHAT_CONTRACTS for the list.

See get_contract_at_address().

Parameters

contract_name (str) –

Return type

eth_typing.evm.ChecksumAddress

get_contract_at_address(web3, contract_fname, address_name)[source]

Get a singleton Aave deployed contract.

Example:

pool = aave_deployer.get_contract_at_address(web3, "Pool.json", "Pool")
assert pool.functions.POOL_REVISION().call() == 1
Parameters
  • web3 (web3.main.Web3) –

  • contract_fname (str) –

  • address_name (str) –

Return type

web3.contract.contract.Contract