This module provides classes and utilities to convert proto-generated payloads to Vyper
source code.
The converter implements the rules of the Vyper
compiler to avoid compilation issues, ensuring that the generated code is valid and follows Vyper's
syntax and type constraints.
-
typed_converters.py
: ImplementsTypedConverter
, the primary converter class responsible for translatingprotobuf
messages intoVyper
source code. -
typed_converters_4.py
: ExtendsTypedConverter
to handleVyper 0.4.0
source code. -
function_converter.py
: ImplementsFunctionConverter
, which builds call trees for functions and identifies function calls withinprotobuf
statements. -
func_tracker.py
: ContainsFunction
andFuncTracker
classes, which tracks functions in the generated contract and their metadata. -
var_tracker.py
: DefinesVarTracker
, which manages variable IDs and tracks variables within different scopes for correct variable usage. -
parameters_converter.py
: DefinesParametersConverter
, which converts input and output function parameters fromprotobuf
definitions intoVyper
parameter formats. -
utils.py
: Contains utility functions.
The protobuf
generator has no context of Vyper
language constraints. Hence, appropriate mechanisms were implemented to generate valid source code.
Converter utilizes function_converter
to resolve all circular calls and then step-by-step parses the message and generates the function itself.