class ape.contracts.base.ContractInstance(_address: ChecksumAddress, _converter: ConversionManager, _contract_type: ethpm_types.contract_type.ContractType, _provider: Optional[ape.api.providers.ProviderAPI] = None, **kwargs)

Bases: ape.api.address.AddressAPI

An interactive instance of a smart contract. After you deploy a contract using the deploy method, you get back a contract instance.

Usage example:

from ape import accounts, project

a = accounts.load("alias")  # Load an account by alias
contract = a.deploy(project.MyContract)  # The result of 'deploy()' is a ContractInstance

Display methods to IPython on c.[TAB] tab completion.



__getattr__(attr_name: str)Any

Access a method or property on the contract using . access.

Usage example:

result = contract.vote()  # Implies a method named "vote" exists on the contract.

attr_name (str) – The name of the method or property to access.


The return value from the contract call, or a transaction receipt.

Return type


property address

The address of the contract.



class ape.contracts.base.ContractContainer(contract_type: ethpm_types.contract_type.ContractType, _provider: Optional[ape.api.providers.ProviderAPI], _converter: ConversionManager)

Bases: object

A wrapper around the contract type that has access to the provider. When you import your contracts from the ape.managers.project.ProjectManager, you are using this class.

Usage example:

from ape import project

contract_container = project.MyContract  # Assuming there is a contract named "MyContract"
at(address: str)ape.contracts.base.ContractInstance

Get a contract at the given address.

Usage example:

from ape import project

my_contract = project.MyContract.at("0xAbC1230001112223334445566611855443322111")

address (str) – The address to initialize a contract. NOTE: Things will not work as expected if the contract is not actually deployed to this address or if the contract at the given address has a different ABI than contract_type.



contract_type: ethpm_types.contract_type.ContractType

The type of the contract.