Package genlayer.std.genvm_contracts#
Warning
This is an internal module
- class genlayer.std.genvm_contracts.ContractAt[source]#
Provides a way to call view methods and send transactions to GenVM contracts
- emit(**data: Unpack[TransactionDataKwArgs])[source]#
Namespace with write message
- Returns:
object supporting
.name(*args, **kwargs)
that emits a message and returnsNone
- emit_transfer(**data: Unpack[TransactionDataKwArgs])[source]#
Method to emit a message that transfers native tokens
- class genlayer.std.genvm_contracts.DeploymentTransactionDataKwArgs[source]#
Class for representing parameters of
deploy_contract
- salt_nonce: NotRequired[u256 | Literal[0]]#
iff it is provided and does not equal to \(0\) then
Address
of deployed contract will be known ahead of time. It will depend on this field
- class genlayer.std.genvm_contracts.TransactionDataKwArgs[source]#
Built-in parameters of all transaction messages that a contract can emit
Warning
parameters are subject to change!
- genlayer.std.genvm_contracts.contract_interface(_contr: GenVMContractDeclaration) Callable[[Address], GenVMContractProxy] [source]#
This decorator produces an “interface” for other GenVM contracts. It has no semantical value, but can be used for auto completion and type checks
@gl.contract_interface class MyContract: class View: def view_meth(self, i: int) -> int: ... class Write: def write_meth(self, i: int) -> None: ...
- genlayer.std.genvm_contracts.deploy_contract(*, code: bytes, args: Sequence[Any] = [], kwargs: Mapping[str, Any] = {}) None [source]#
- genlayer.std.genvm_contracts.deploy_contract(*, code: bytes, args: Sequence[Any] = [], kwargs: Mapping[str, Any] = {}, salt_nonce: Literal[0], **rest: Unpack[TransactionDataKwArgs]) None
- genlayer.std.genvm_contracts.deploy_contract(*, code: bytes, args: Sequence[Any] = [], kwargs: Mapping[str, Any] = {}, salt_nonce: u256, **rest: Unpack[TransactionDataKwArgs]) Address
Function for deploying new genvm contracts
- Parameters:
code – code (i.e. contents of a python file) of the contract
args – arguments to be encoded into calldata
kwargs – keyword arguments to be encoded into calldata
- Returns:
address of new contract iff non-zero
salt_nonce
was provided