Skip to main content
Version: 2.0.0

contract

ContractInterface Objects

class ContractInterface(ABC)

ContractInterface The ContractInterface is the interface that is made available to the agent or protocol to interact with a contract.

initialize

@abstractmethod
def initialize(address: str | None = None)

Initialize the contract A dynamic contract can be initialized manually by providing the address you want to use. An example is a contract that is deployed multiple times on chain and you want to interact with a specific one of them, by providing the address you can specify which one you want to interact with.

Arguments:


  • address str | None, optional - Address of the contract if you're using a dynamic contract. Defaults to None.

name

@property
@abstractmethod
def name() -> str

The name of the contract

Returns

str: The name of the contract

address

@property
@abstractmethod
def address() -> str

The address of the contract

Returns

str: The address of the contract

is_dynamic

@property
@abstractmethod
def is_dynamic() -> bool

Whether the contract is dynamic or not A contract is considered dynamic when you specify an ABI but don't specify the address, in this case the address is determined at runtime.

Returns

bool: Whether the contract is dynamic or not

is_installable

@property
@abstractmethod
def is_installable() -> bool

Whether the contract is installable or not A contract is considered installable when you specify an ABI and the installable bytecode. The address of the contract is determined at runtime as part of the environment initialization.

Returns

bool: Whether the contract is installable or not

functions

@property
@abstractmethod
def functions() -> object

The functions of the contract

Returns

object: The functions of the contract

events

@property
@abstractmethod
def events() -> object

The events of the contract

Returns

object: The events of the contract