verbs.abi.Constructor#

class Constructor[source]#

ABI constructor class

Class representing contracts constructor with functionality to encode arguments and to deploy the contract.

Parameters:
  • name (str) – ABI name (used for debugging/logging).

  • abi (dict) – Parsed ABI JSON of the constructor.

__init__(name: str, abi: Dict)[source]#
deploy(env, deployer: bytes, bytecode: str, args: List | None = None) bytes[source]#

Deploy a contract

Parameters:
  • env (verbs.types.Env) – Simulation environment.

  • bytecode (str) – Contract bytecode hex string.

  • args (list, optional) – Optional list of constructor argument values

Returns:

bytes – Address the contract was deployed to.

encode(args: List[Any]) bytes[source]#

ABI encode constructor arguments

Parameters:

args (list) – List of argument values to the constructor.

Returns:

bytes – ABI encoded constructor arguments