genlayer.py.calldata package#
This module is responsible for working with genvm calldata
Calldata natively supports following types:
Primitive types:
Composite types:
list
(and any othercollections.abc.Sequence
)dict
withstr
keys (and any othercollections.abc.Mapping
withstr
keys)
For full calldata specification see genvm repo
- class genlayer.py.calldata.CalldataEncodable[source]#
Bases:
object
Abstract class to support calldata encoding for custom types
Can be used to simplify code
- genlayer.py.calldata.decode(mem0: ~collections.abc.Buffer, *, memview2bytes: ~typing.Callable[[memoryview], ~typing.Any] = <class 'bytes'>) Encodable [source]#
Decodes calldata encoded bytes into python DSL
Out of composite types it will contain only
dict
andlist
- Return type:
Encodable
- genlayer.py.calldata.encode(x: EncodableWithDefault, *, default: Callable[[EncodableWithDefault], Encodable] | None = None) bytes [source]#
Encodes python object into calldata bytes
- Parameters:
default (Callable[[EncodableWithDefault], Encodable] | None) – function to be applied to each object recursively, it must return object encodable to calldata
- Return type: