Skip to content

VyperContract

Description

A contract instance.

Internal and external contract functions are available as methods on VyperContract instances.

Methods

Properties

  • _storage - Access storage variables with automatic decoding
  • _immutables - Access immutable values
  • _constants - Access contract constants
  • address - The deployed address of the contract
  • created_from - Address that deployed this contract

Examples

>>> import boa
>>> src = """
... @external
... def main():
...     pass
...
... @internal
... def foo() -> uint256:
...     return 123
... """
>>> contract = boa.loads_partial(src, name="Foo").deploy()
>>> type(contract.main)
<class 'boa.vyper.contract.VyperFunction'>
>>> type(contract.internal.foo)
<class 'boa.vyper.contract.VyperInternalFunction'>
>>> contract.internal.foo()
123