diff --git a/examples/box_storage/out/contract.awst b/examples/box_storage/out/contract.awst index 46a15aae9f..a4d10e1914 100644 --- a/examples/box_storage/out/contract.awst +++ b/examples/box_storage/out/contract.awst @@ -4,9 +4,7 @@ contract BoxContract ['BOX_A']: algopy.UInt64 ['b']: algopy.Bytes ['BOX_C']: algopy.arc4.String - } - box_maps { - ['']: algopy.String + ['']: algopy.UInt64 => algopy.String } constructor() @@ -33,7 +31,7 @@ contract BoxContract abimethod slice_box(): None { - box_0: algopy.Box = Box('0') + box_0: algopy.Box[algopy.Bytes] = Box('0') box_0.value: algopy.Bytes = 'Testing testing 123' assert(box_extract(box_0.key, select(SINGLE_EVAL(id=0, source=len(box_0.key)), 0u, 0u < SINGLE_EVAL(id=0, source=len(box_0.key))), select(SINGLE_EVAL(id=0, source=len(box_0.key)), 7u, 7u < SINGLE_EVAL(id=0, source=len(box_0.key))) - select(SINGLE_EVAL(id=0, source=len(box_0.key)), 0u, 0u < SINGLE_EVAL(id=0, source=len(box_0.key)))) == 'Testing') this.box_c.value: algopy.arc4.String = arc4_encode('Hello', algopy.arc4.String) @@ -42,7 +40,7 @@ contract BoxContract abimethod arc4_box(): None { - box_d: algopy.Box = Box('d') + box_d: algopy.Box[algopy.arc4.StaticArray[algopy.arc4.UInt8, typing.Literal[4]]] = Box('d') box_d.value: algopy.arc4.StaticArray[algopy.arc4.UInt8, typing.Literal[4]] = new algopy.arc4.StaticArray[algopy.arc4.UInt8, typing.Literal[4]](0arc4u8, 1arc4u8, 2arc4u8, 3arc4u8) assert(reinterpret_cast(box_d.value[0u]) == reinterpret_cast(0arc4u8)) assert(reinterpret_cast(box_d.value[1u]) == reinterpret_cast(1arc4u8)) diff --git a/examples/voting/out/voting.awst b/examples/voting/out/voting.awst index 4cb3f0d495..13dff59a3a 100644 --- a/examples/voting/out/voting.awst +++ b/examples/voting/out/voting.awst @@ -28,11 +28,9 @@ contract VotingRoundApp ['total_options']: algopy.UInt64 ['close_time']: algopy.UInt64 } - box_refs { + boxes { ['V']: algopy.Bytes - } - box_maps { - ['']: algopy.arc4.DynamicArray[algopy.arc4.UInt8] + ['']: algopy.Account => algopy.arc4.DynamicArray[algopy.arc4.UInt8] } constructor() diff --git a/pyproject.toml b/pyproject.toml index 9774bbb82e..0bdd19a454 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -264,6 +264,9 @@ allow-star-arg-any = true suppress-none-returning = true mypy-init-return = true +[tool.ruff.lint.flake8-comprehensions] +allow-dict-calls-with-keyword-arguments = true + [tool.ruff.lint.isort] combine-as-imports = true force-wrap-aliases = true diff --git a/scripts/generate_stubs.py b/scripts/generate_stubs.py index 6e2b75f4be..2c9c125a17 100755 --- a/scripts/generate_stubs.py +++ b/scripts/generate_stubs.py @@ -11,12 +11,8 @@ import attrs from puya import log -from puya.awst import wtypes -from puya.awst_build.intrinsic_models import ( - FunctionOpMapping, - ImmediateArgMapping, - StackArgMapping, -) +from puya.awst_build import pytypes +from puya.awst_build.intrinsic_models import FunctionOpMapping from puya.awst_build.utils import snake_case from scripts.transform_lang_spec import ( @@ -34,45 +30,45 @@ VCS_ROOT = Path(__file__).parent.parent -def _get_imported_name(typ: wtypes.WType) -> str: - return typ.stub_name.rsplit(".")[-1] +def _get_imported_name(typ: pytypes.PyType) -> str: + return typ.name.rsplit(".", maxsplit=1)[-1] -WTYPE_REFERENCES = [ - wtypes.account_wtype, - wtypes.application_wtype, - wtypes.asset_wtype, - wtypes.biguint_wtype, - wtypes.bytes_wtype, - wtypes.uint64_wtype, +PYTYPE_REFERENCES = [ + pytypes.AccountType, + pytypes.ApplicationType, + pytypes.AssetType, + pytypes.BigUIntType, + pytypes.BytesType, + pytypes.UInt64Type, ] -WTYPE_TO_LITERAL: dict[wtypes.WType, type[int | str | bytes] | None] = { - wtypes.bytes_wtype: bytes, - wtypes.uint64_wtype: int, - wtypes.account_wtype: None, # could be str - wtypes.biguint_wtype: int, - wtypes.bool_wtype: None, # already a Python type +PYTYPE_TO_LITERAL: dict[pytypes.PyType, type[int | str | bytes] | None] = { + pytypes.BytesType: bytes, + pytypes.UInt64Type: int, + pytypes.AccountType: None, # could be str + pytypes.BigUIntType: int, + pytypes.BoolType: None, # already a Python type # below are covered transitively with respect to STACK_TYPE_MAPPING - wtypes.application_wtype: None, # maybe could be int? but also covered transitively anyway - wtypes.asset_wtype: None, # same as above + pytypes.ApplicationType: None, # maybe could be int? but also covered transitively anyway + pytypes.AssetType: None, # same as above } -STACK_TYPE_MAPPING: dict[StackType, Sequence[wtypes.WType]] = { - StackType.address_or_index: [wtypes.account_wtype, wtypes.uint64_wtype], - StackType.application: [wtypes.application_wtype, wtypes.uint64_wtype], - StackType.asset: [wtypes.asset_wtype, wtypes.uint64_wtype], - StackType.bytes: [wtypes.bytes_wtype], - StackType.bytes_8: [wtypes.bytes_wtype], - StackType.bytes_32: [wtypes.bytes_wtype], - StackType.bytes_33: [wtypes.bytes_wtype], - StackType.bytes_64: [wtypes.bytes_wtype], - StackType.bytes_80: [wtypes.bytes_wtype], - StackType.bool: [wtypes.bool_wtype, wtypes.uint64_wtype], - StackType.uint64: [wtypes.uint64_wtype], - StackType.any: [wtypes.bytes_wtype, wtypes.uint64_wtype], - StackType.box_name: [wtypes.bytes_wtype], - StackType.address: [wtypes.account_wtype], - StackType.bigint: [wtypes.biguint_wtype], - StackType.state_key: [wtypes.bytes_wtype], +STACK_TYPE_MAPPING: dict[StackType, Sequence[pytypes.PyType]] = { + StackType.address_or_index: [pytypes.AccountType, pytypes.UInt64Type], + StackType.application: [pytypes.ApplicationType, pytypes.UInt64Type], + StackType.asset: [pytypes.AssetType, pytypes.UInt64Type], + StackType.bytes: [pytypes.BytesType], + StackType.bytes_8: [pytypes.BytesType], + StackType.bytes_32: [pytypes.BytesType], + StackType.bytes_33: [pytypes.BytesType], + StackType.bytes_64: [pytypes.BytesType], + StackType.bytes_80: [pytypes.BytesType], + StackType.bool: [pytypes.BoolType, pytypes.UInt64Type], + StackType.uint64: [pytypes.UInt64Type], + StackType.any: [pytypes.BytesType, pytypes.UInt64Type], + StackType.box_name: [pytypes.BytesType], # TODO: should this be another type..? + StackType.address: [pytypes.AccountType], + StackType.bigint: [pytypes.BigUIntType], + StackType.state_key: [pytypes.BytesType], # TODO: should this be another type..? } BYTES_LITERAL = "bytes" @@ -421,16 +417,16 @@ def main() -> None: output_awst_data(lang_spec, enum_names, function_defs, class_defs) -def sub_types(type_name: StackType, *, covariant: bool) -> Sequence[wtypes.WType]: +def sub_types(type_name: StackType, *, covariant: bool) -> Sequence[pytypes.PyType]: try: - wtypes_ = STACK_TYPE_MAPPING[type_name] + typs = STACK_TYPE_MAPPING[type_name] except KeyError as ex: raise NotImplementedError( f"Could not map stack type {type_name} to an algopy type" ) from ex else: last_index = None if covariant else 1 - return wtypes_[:last_index] + return typs[:last_index] def is_simple_op(op: Op) -> bool: @@ -462,11 +458,11 @@ def get_python_type( case StackType() as stack_type: if any_as and stack_type == StackType.any: return any_as - wtypes_ = sub_types(stack_type, covariant=covariant) - names = [_get_imported_name(wt) for wt in wtypes_] + ptypes_ = sub_types(stack_type, covariant=covariant) + names = [_get_imported_name(wt) for wt in ptypes_] if covariant: - for wt in wtypes_: - lit_t = WTYPE_TO_LITERAL[wt] + for pt in ptypes_: + lit_t = PYTYPE_TO_LITERAL[pt] if lit_t is not None: lit_name = lit_t.__name__ if lit_name not in names: @@ -569,12 +565,12 @@ def build_stub_class(klass: ClassDef) -> Iterable[str]: yield "" if klass.has_any_methods: yield ( - f"class {klass.name}Bytes(_{klass.name}[{_get_imported_name(wtypes.bytes_wtype)}," + f"class {klass.name}Bytes(_{klass.name}[{_get_imported_name(pytypes.BytesType)}," f" {BYTES_LITERAL}]):" ) yield INDENT + docstring yield ( - f"class {klass.name}UInt64(_{klass.name}[{_get_imported_name(wtypes.uint64_wtype)}," + f"class {klass.name}UInt64(_{klass.name}[{_get_imported_name(pytypes.UInt64Type)}," f" {UINT64_LITERAL}]):" ) yield INDENT + docstring @@ -743,39 +739,44 @@ def build_function_op_mapping( else: arg_name_map = {n.name.upper(): n.name for n in signature_args} # replace immediate reference to arg enum with a constant enum value + result_ptypes = [ + sub_types( + any_as if o.stack_type == StackType.any and any_as else o.stack_type, + covariant=False, + )[0] + for o in op.stack_outputs + ] + if not result_ptypes: + result_typ = pytypes.NoneType + elif len(op.stack_outputs) == 1: + (result_typ,) = result_ptypes + else: + result_typ = pytypes.GenericTupleType.parameterise(result_ptypes, source_location=None) return FunctionOpMapping( op_code=op.name, - immediates=[ + immediates={ ( const_immediate_value[1].name - if const_immediate_value and const_immediate_value[0] == arg - else ImmediateArgMapping( - arg_name=arg_name_map[arg.name], - literal_type=immediate_kind_to_type(arg.immediate_type), - ) + if (const_immediate_value and const_immediate_value[0] == arg) + else arg_name_map[arg.name] + ): ( + None + if (const_immediate_value and const_immediate_value[0] == arg) + else immediate_kind_to_type(arg.immediate_type) ) for arg in op.immediate_args - ], - stack_inputs=[ - StackArgMapping( - arg_name=arg_name_map[arg.name], - allowed_types=list( - sub_types( - any_as if arg.stack_type == StackType.any and any_as else arg.stack_type, - covariant=True, - ) - ), + }, + stack_inputs={ + arg_name_map[arg.name]: tuple( + sub_types( + any_as if arg.stack_type == StackType.any and any_as else arg.stack_type, + covariant=True, + ) ) for arg in op.stack_inputs - ], - stack_outputs=[ - sub_types( - any_as if o.stack_type == StackType.any and any_as else o.stack_type, - covariant=False, - )[0] - for o in op.stack_outputs - ], + }, + result=result_typ, ) @@ -926,72 +927,83 @@ def build_grouped_ops( return class_def -def build_wtype(wtype: wtypes.WType) -> str: - match wtype: - case wtypes.bool_wtype: - return "wtypes.bool_wtype" - case wtypes.uint64_wtype: - return "wtypes.uint64_wtype" - case wtypes.account_wtype: - return "wtypes.account_wtype" - case wtypes.application_wtype: - return "wtypes.application_wtype" - case wtypes.asset_wtype: - return "wtypes.asset_wtype" - case wtypes.bytes_wtype: - return "wtypes.bytes_wtype" - case wtypes.biguint_wtype: - return "wtypes.biguint_wtype" - raise ValueError("Unexpected wtype") - - -def build_stack_arg_mapping(arg_mapping: StackArgMapping) -> Iterable[str]: - yield "StackArgMapping(" - yield f' arg_name="{arg_mapping.arg_name}",' - yield " allowed_types=[" - for allowed_type in arg_mapping.allowed_types: - if isinstance(allowed_type, wtypes.WType): - yield build_wtype(allowed_type) - else: - yield allowed_type.__name__ - yield "," - yield " ]," - yield ")" - - -def build_immediate_arg_mapping(arg_mapping: ImmediateArgMapping) -> Iterable[str]: - yield "ImmediateArgMapping(" - yield f' arg_name="{arg_mapping.arg_name}",' - yield f" literal_type={arg_mapping.literal_type.__name__}," - yield ")" +def pytype_repr(typ: pytypes.PyType) -> str: + match typ: + case pytypes.BoolType: + return "pytypes.BoolType" + case pytypes.UInt64Type: + return "pytypes.UInt64Type" + case pytypes.AccountType: + return "pytypes.AccountType" + case pytypes.ApplicationType: + return "pytypes.ApplicationType" + case pytypes.AssetType: + return "pytypes.AssetType" + case pytypes.BytesType: + return "pytypes.BytesType" + case pytypes.BigUIntType: + return "pytypes.BigUIntType" + case pytypes.TupleType(generic=pytypes.GenericTupleType, items=tuple_items) if len( + tuple_items + ) > 1: + item_strs = [pytype_repr(item) for item in tuple_items] + return ( + f"pytypes.GenericTupleType.parameterise(" + f"({', '.join(item_strs)}), source_location=None)" + ) + raise ValueError(f"Unexpected pytype: {typ}") -def build_op_specification_body(name_suffix: str, function: FunctionDef) -> Iterable[str]: - yield f' "algopy.{STUB_NAMESPACE}.{name_suffix}": [' - for op_mapping in function.op_mappings: - yield "FunctionOpMapping(" - yield f' op_code="{op_mapping.op_code}",' - yield f" is_property={op_mapping.is_property}," - yield " immediates=[" - for immediate in op_mapping.immediates: - if isinstance(immediate, str): - yield f' "{immediate}",' - else: - yield from build_immediate_arg_mapping(immediate) - yield "," - yield " ]," - yield " stack_inputs=[" - for stack_input in op_mapping.stack_inputs: - yield from build_stack_arg_mapping(stack_input) - yield "," - yield " ]," - yield " stack_outputs=[" - for stack_output in op_mapping.stack_outputs: - yield build_wtype(stack_output) - yield "," - yield " ]," +def build_op_specification_body(function: FunctionDef) -> Iterable[str]: + if function.is_property: + assert len(function.op_mappings) == 1 + (op_mapping,) = function.op_mappings + assert len(op_mapping.immediates) == 1 + (immediate,) = op_mapping.immediates + yield ( + f"{function.name}=PropertyOpMapping(" + f"{op_mapping.op_code!r}, {immediate!r}, {pytype_repr(op_mapping.result)}," + f")," + ) + else: + assert len(function.op_mappings) >= 1 + yield f"{function.name}=(" + for op_mapping in function.op_mappings: + yield f"FunctionOpMapping({op_mapping.op_code!r}," + if op_mapping.immediates: + yield " immediates=dict(" + for idx, (name_or_value, literal_type_or_none) in enumerate( + op_mapping.immediates.items() + ): + if idx: + yield ", " + if literal_type_or_none is None: + val_repr = repr(literal_type_or_none) + else: + val_repr = literal_type_or_none.__name__ + + yield f"{name_or_value}={val_repr}" + yield ")," + if op_mapping.stack_inputs: + yield " stack_inputs=dict(" + for idx, (arg_name, allowed_types) in enumerate(op_mapping.stack_inputs.items()): + if idx: + yield ", " + yield f"{arg_name}=" + if len(allowed_types) == 1: + yield f"({pytype_repr(*allowed_types)},)" + else: + yield "(" + for idx2, allowed_type in enumerate(allowed_types): + if idx2: + yield "," + yield pytype_repr(allowed_type) + yield ")" + yield ")," + if op_mapping.result is not pytypes.NoneType: + yield f" result={pytype_repr(op_mapping.result)}," + yield ")," yield ")," - yield " ]," def build_awst_data( @@ -1000,30 +1012,38 @@ def build_awst_data( function_ops: list[FunctionDef], class_ops: list[ClassDef], ) -> Iterable[str]: - yield "from puya.awst import wtypes" + yield "import typing" + yield "from collections.abc import Mapping, Sequence" + yield "from puya.awst_build import pytypes" yield ( "from puya.awst_build.intrinsic_models import" - " FunctionOpMapping, ImmediateArgMapping, StackArgMapping" + " FunctionOpMapping, ImmediateArgMapping, PropertyOpMapping" ) - yield "" - yield "ENUM_CLASSES = {" + yield "ENUM_CLASSES: typing.Final[Mapping[str, Mapping[str, str]]] = dict(" for enum_name in enums: - yield f' "algopy.{STUB_NAMESPACE}.{get_python_enum_class(enum_name)}": {{' + yield f"{get_python_enum_class(enum_name)}=dict(" for enum_value in lang_spec.arg_enums[enum_name]: # enum names currently match enum immediate values - yield f' "{enum_value.name}": "{enum_value.name}",' - yield " }," - yield "}" + yield f'{enum_value.name}="{enum_value.name}",' + yield ")," + yield ")" yield "" - yield "STUB_TO_AST_MAPPER = {" + yield "FUNC_TO_AST_MAPPER: typing.Final[Mapping[str, Sequence[FunctionOpMapping]]] = dict(" for function_op in function_ops: - yield from build_op_specification_body(function_op.name, function_op) + yield "".join(build_op_specification_body(function_op)) + yield ")" + yield ( + "NAMESPACE_CLASSES: " + "typing.Final[Mapping[str, Mapping[str, PropertyOpMapping | Sequence[FunctionOpMapping]]]]" + " = dict(" + ) for class_op in class_ops: + yield f"{class_op.name}=dict(" for method in class_op.methods: - yield from build_op_specification_body(f"{class_op.name}.{method.name}", method) - - yield "}" + yield "".join(build_op_specification_body(method)) + yield ")," + yield ")" def output_stub( @@ -1032,7 +1052,7 @@ def output_stub( function_ops: list[FunctionDef], class_ops: list[ClassDef], ) -> None: - references = ", ".join(map(_get_imported_name, WTYPE_REFERENCES)) + references = ", ".join(map(_get_imported_name, PYTYPE_REFERENCES)) stub: list[str] = [ "import typing", "", @@ -1070,6 +1090,7 @@ def output_awst_data( awst_data_path = VCS_ROOT / "src" / "puya" / "awst_build" / "intrinsic_data.py" awst_data_path.write_text("\n".join(awst_data), encoding="utf-8") subprocess.run(["black", str(awst_data_path)], check=True, cwd=VCS_ROOT) + subprocess.run(["ruff", "check", "--fix", str(awst_data_path)], check=False, cwd=VCS_ROOT) def _get_algorand_doc(op: str) -> str: diff --git a/src/puya/arc4_util.py b/src/puya/arc4_util.py index 1a06a289b3..3e1185c8ce 100644 --- a/src/puya/arc4_util.py +++ b/src/puya/arc4_util.py @@ -6,7 +6,7 @@ nodes as awst_nodes, wtypes, ) -from puya.awst_build import constants +from puya.awst_build import constants, pytypes from puya.errors import CodeError, InternalError from puya.models import ARC4MethodConfig from puya.parse import SourceLocation @@ -62,7 +62,7 @@ def determine_arc4_tuple_head_size( _FIXED_ARRAY_REGEX = re.compile(r"^(?P.+)\[(?P[0-9]+)]$") _DYNAMIC_ARRAY_REGEX = re.compile(r"^(?P.+)\[]$") _TUPLE_REGEX = re.compile(r"^\((?P.+)\)$") -_ARC4_WTYPE_MAPPING = { +_ARC4_WTYPE_MAPPING = { # TODO: YEET ME "bool": wtypes.arc4_bool_wtype, "string": wtypes.arc4_string_wtype, "account": wtypes.account_wtype, @@ -75,6 +75,19 @@ def determine_arc4_tuple_head_size( "byte": wtypes.arc4_byte_type, "byte[]": wtypes.arc4_dynamic_bytes, } +_ARC4_PYTYPE_MAPPING = { + "bool": pytypes.ARC4BoolType, + "string": pytypes.ARC4StringType, + "account": pytypes.AccountType, + "application": pytypes.ApplicationType, + "asset": pytypes.AssetType, + "void": pytypes.NoneType, + "txn": pytypes.GroupTransactionTypes[None], + **{t.name: pytypes.GroupTransactionTypes[t] for t in constants.TransactionType}, + "address": pytypes.ARC4AddressType, + "byte": pytypes.ARC4ByteType, + "byte[]": pytypes.ARC4DynamicBytesType, +} def make_dynamic_array_wtype( @@ -106,6 +119,7 @@ def make_tuple_wtype( def arc4_to_wtype(typ: str, location: SourceLocation | None = None) -> wtypes.WType: + # TODO: YEET ME try: return _ARC4_WTYPE_MAPPING[typ] except KeyError: @@ -132,6 +146,40 @@ def arc4_to_wtype(typ: str, location: SourceLocation | None = None) -> wtypes.WT raise CodeError(f"Unknown ARC4 type '{typ}'", location) +def arc4_to_pytype(typ: str, location: SourceLocation | None = None) -> pytypes.PyType: + try: + return _ARC4_PYTYPE_MAPPING[typ] + except KeyError: + pass + if uint := _UINT_REGEX.match(typ): + n = int(uint.group("n")) + if n <= 64: + return pytypes.GenericARC4UIntNType.parameterise([n], location) + else: + return pytypes.GenericARC4BigUIntNType.parameterise([n], location) + if ufixed := _UFIXED_REGEX.match(typ): + n, m = map(int, ufixed.group("n", "m")) + if n <= 64: + return pytypes.GenericARC4UFixedNxMType.parameterise([n, m], location) + else: + return pytypes.GenericARC4BigUFixedNxMType.parameterise([n, m], location) + if fixed_array := _FIXED_ARRAY_REGEX.match(typ): + arr_type, size_str = fixed_array.group("type", "size") + size = int(size_str) + element_type = arc4_to_pytype(arr_type, location) + return pytypes.GenericARC4StaticArrayType.parameterise([element_type, size], location) + if dynamic_array := _DYNAMIC_ARRAY_REGEX.match(typ): + arr_type = dynamic_array.group("type") + element_type = arc4_to_pytype(arr_type, location) + return pytypes.GenericARC4DynamicArrayType.parameterise([element_type], location) + if tuple_match := _TUPLE_REGEX.match(typ): + tuple_types = [ + arc4_to_pytype(x, location) for x in split_tuple_types(tuple_match.group("types")) + ] + return pytypes.GenericARC4TupleType.parameterise(tuple_types, location) + raise CodeError(f"Unknown ARC4 type '{typ}'", location) + + def split_tuple_types(types: str) -> Iterable[str]: """Splits inner tuple types into individual elements. @@ -150,6 +198,11 @@ def split_tuple_types(types: str) -> Iterable[str]: yield types[last_idx:] +def pytype_to_arc4(typ: pytypes.PyType, loc: SourceLocation | None = None) -> str: + # TODO: implement + return wtype_to_arc4(typ.wtype, loc) + + def wtype_to_arc4(wtype: wtypes.WType, loc: SourceLocation | None = None) -> str: match wtype: case ( diff --git a/src/puya/awst/nodes.py b/src/puya/awst/nodes.py index 3aeeed8f28..329ede15bd 100644 --- a/src/puya/awst/nodes.py +++ b/src/puya/awst/nodes.py @@ -758,14 +758,6 @@ def accept(self, visitor: ExpressionVisitor[T]) -> T: return visitor.visit_checked_maybe(self) -def lvalue_expr_validator(_instance: object, _attribute: object, value: Expression) -> None: - if not value.wtype.lvalue: - raise CodeError( - f'expression with type "{value.wtype}" can not be assigned to a variable', - value.source_location, - ) - - def scalar_expr_validator(_instance: object, _attribute: object, value: Expression) -> None: if not value.wtype.scalar: raise CodeError( @@ -949,7 +941,8 @@ def accept(self, visitor: ExpressionVisitor[T]) -> T: @attrs.frozen class AppStateExpression(Expression): - field_name: str + key: Expression = attrs.field(validator=wtype_is_bytes) + field_name: str | None def accept(self, visitor: ExpressionVisitor[T]) -> T: return visitor.visit_app_state_expression(self) @@ -957,10 +950,11 @@ def accept(self, visitor: ExpressionVisitor[T]) -> T: @attrs.frozen class AppAccountStateExpression(Expression): - field_name: str + key: Expression = attrs.field(validator=wtype_is_bytes) account: Expression = attrs.field( validator=[expression_has_wtype(wtypes.account_wtype, wtypes.uint64_wtype)] ) + field_name: str | None def accept(self, visitor: ExpressionVisitor[T]) -> T: return visitor.visit_app_account_state_expression(self) @@ -1050,7 +1044,7 @@ class AssignmentStatement(Statement): """ target: Lvalue - value: Expression = attrs.field(validator=[lvalue_expr_validator]) + value: Expression def __attrs_post_init__(self) -> None: if self.value.wtype != self.target.wtype: @@ -1059,6 +1053,8 @@ def __attrs_post_init__(self) -> None: f" differs from expression value type {self.value.wtype}", self.source_location, ) + if self.value.wtype == wtypes.void_wtype: + raise CodeError("void type cannot be assigned", self.source_location) def accept(self, visitor: StatementVisitor[T]) -> T: return visitor.visit_assignment_statement(self) @@ -1076,7 +1072,7 @@ class AssignmentExpression(Expression): """ target: Lvalue # annoyingly, we can't do Lvalue "minus" TupleExpression - value: Expression = attrs.field(validator=[lvalue_expr_validator]) + value: Expression def __init__(self, value: Expression, target: Lvalue, source_location: SourceLocation): if isinstance(target, TupleExpression): @@ -1090,6 +1086,8 @@ def __init__(self, value: Expression, target: Lvalue, source_location: SourceLoc f" differs from expression value type {value.wtype}", source_location, ) + if value.wtype == wtypes.void_wtype: + raise CodeError("void type cannot be assigned", self.source_location) self.__attrs_init__( source_location=source_location, target=target, @@ -1614,7 +1612,7 @@ def accept(self, visitor: ModuleStatementVisitor[T]) -> T: ... @attrs.frozen -class BoxProxyField(Expression): +class BoxProxyField(Expression): # TODO: yeet me """ An expression representing a box proxy class instance stored on a contract field. @@ -1725,7 +1723,12 @@ def accept(self, visitor: ModuleStatementVisitor[T]) -> T: @attrs.frozen class SubroutineArgument(Node): name: str - wtype: WType + wtype: WType = attrs.field() + + @wtype.validator + def _wtype_validator(self, _attribute: object, wtype: WType) -> None: + if wtype == wtypes.void_wtype: + raise CodeError("void type arguments are not supported", self.source_location) @attrs.frozen @@ -1765,32 +1768,23 @@ def accept(self, visitor: ModuleStatementVisitor[T]) -> T: @enum.unique -class AppStateKind(enum.Enum): +class AppStorageKind(enum.Enum): app_global = enum.auto() account_local = enum.auto() box = enum.auto() - box_ref = enum.auto() - box_map = enum.auto() @attrs.frozen -class AppStateDefinition(Node): +class AppStorageDefinition(Node): member_name: str - kind: AppStateKind + kind: AppStorageKind storage_wtype: WType - key_override: BytesConstant | None + key_wtype: WType | None + """if not None, then this is a map rather than singular""" + key: BytesConstant + """for maps, this is the prefix""" description: str | None - @property - def key(self) -> BytesConstant: - if self.key_override is not None: - return self.key_override - return BytesConstant( - value=self.member_name.encode("utf8"), - encoding=BytesEncoding.utf8, - source_location=self.source_location, - ) - @attrs.frozen class LogicSignature(ModuleStatement): @@ -1839,18 +1833,18 @@ class ContractFragment(ModuleStatement): approval_program: ContractMethod | None = attrs.field() clear_program: ContractMethod | None = attrs.field() subroutines: Sequence[ContractMethod] = attrs.field(converter=tuple[ContractMethod, ...]) - app_state: Mapping[str, AppStateDefinition] + app_state: Mapping[str, AppStorageDefinition] reserved_scratch_space: StableSet[int] state_totals: StateTotals | None docstring: str | None # note: important that symtable comes last so default factory has access to all other fields - symtable: Mapping[str, ContractMethod | AppStateDefinition] = attrs.field(init=False) + symtable: Mapping[str, ContractMethod | AppStorageDefinition] = attrs.field(init=False) @symtable.default def _symtable_factory( self, - ) -> Mapping[str, ContractMethod | AppStateDefinition]: - result: dict[str, ContractMethod | AppStateDefinition] = {**self.app_state} + ) -> Mapping[str, ContractMethod | AppStorageDefinition]: + result: dict[str, ContractMethod | AppStorageDefinition] = {**self.app_state} all_subs = itertools.chain( filter(None, (self.init, self.approval_program, self.clear_program)), self.subroutines, diff --git a/src/puya/awst/to_code_visitor.py b/src/puya/awst/to_code_visitor.py index 5b3e5f4b8d..61f50eb2da 100644 --- a/src/puya/awst/to_code_visitor.py +++ b/src/puya/awst/to_code_visitor.py @@ -3,7 +3,7 @@ from collections.abc import Iterable from puya.awst import nodes, wtypes -from puya.awst.nodes import AppStateKind +from puya.awst.nodes import AppStorageKind from puya.awst.visitors import ExpressionVisitor, ModuleStatementVisitor, StatementVisitor from puya.errors import InternalError @@ -90,10 +90,16 @@ def visit_single_evaluation(self, expr: nodes.SingleEvaluation) -> str: ) def visit_app_state_expression(self, expr: nodes.AppStateExpression) -> str: - return f"this.{expr.field_name}" + if expr.field_name is not None: + return f"this.{expr.field_name}" + else: + return f"GlobalState[{expr.key.accept(self)}]" def visit_app_account_state_expression(self, expr: nodes.AppAccountStateExpression) -> str: - return f"this.{expr.field_name}[{expr.account.accept(self)}]" + if expr.field_name is not None: + return f"this.{expr.field_name}[{expr.account.accept(self)}]" + else: + return f"LocalState[{expr.key.accept}, {expr.account.accept(self)}]" def visit_box_proxy_field(self, expr: nodes.BoxProxyField) -> str: return f"this.{expr.field_name}" @@ -188,15 +194,13 @@ def visit_subroutine(self, statement: nodes.Subroutine) -> list[str]: def visit_contract_fragment(self, c: nodes.ContractFragment) -> list[str]: body = list[str]() if c.app_state: - state_by_kind = dict[AppStateKind, list[nodes.AppStateDefinition]]() + state_by_kind = dict[AppStorageKind, list[nodes.AppStorageDefinition]]() for state in c.app_state.values(): state_by_kind.setdefault(state.kind, []).append(state) for kind_name, kind in ( - ("globals", AppStateKind.app_global), - ("locals", AppStateKind.account_local), - ("boxes", AppStateKind.box), - ("box_refs", AppStateKind.box_ref), - ("box_maps", AppStateKind.box_map), + ("globals", AppStorageKind.app_global), + ("locals", AppStorageKind.account_local), + ("boxes", AppStorageKind.box), ): state_of_kind = state_by_kind.pop(kind, []) if state_of_kind: @@ -204,7 +208,12 @@ def visit_contract_fragment(self, c: nodes.ContractFragment) -> list[str]: [ f"{kind_name} {{", *_indent( - f"[{s.key.accept(self)}]: {s.storage_wtype}" for s in state_of_kind + ( + f"[{s.key.accept(self)}]: {s.key_wtype} => {s.storage_wtype}" + if s.key_wtype is not None + else f"[{s.key.accept(self)}]: {s.storage_wtype}" + ) + for s in state_of_kind ), "}", ] diff --git a/src/puya/awst/wtypes.py b/src/puya/awst/wtypes.py index 3dcd8a169c..38b53514ec 100644 --- a/src/puya/awst/wtypes.py +++ b/src/puya/awst/wtypes.py @@ -24,7 +24,6 @@ def _all_literals_invalid(_value: object) -> bool: class WType: name: str stub_name: str - lvalue: bool = True # TODO: this is currently just used by void... immutable: bool = True scalar: bool = True # is this a single value on the stack? is_valid_literal: LiteralValidator = attrs.field(default=_all_literals_invalid, eq=False) @@ -77,7 +76,6 @@ def is_valid_utf8_literal(value: object) -> typing.TypeGuard[str]: void_wtype: typing.Final = WType( name="void", stub_name="None", - lvalue=False, ) bool_wtype: typing.Final = WType( @@ -203,21 +201,26 @@ class WBoxProxy(WType): def from_content_type(cls, content_wtype: WType) -> "WBoxProxy": return cls( content_wtype=content_wtype, - name="box_proxy", - stub_name=constants.CLS_BOX_PROXY_ALIAS, + name=f"box_proxy[{content_wtype.name}]", + stub_name=f"{constants.CLS_BOX_PROXY_ALIAS}[{content_wtype.stub_name}]", ) @attrs.define class WBoxMapProxy(WType): - content_wtype: WType = attrs.field() + key_wtype: WType + content_wtype: WType @classmethod - def from_key_and_content_type(cls, content_wtype: WType) -> "WBoxMapProxy": + def from_key_and_content_type(cls, key_wtype: WType, content_wtype: WType) -> "WBoxMapProxy": return cls( + key_wtype=key_wtype, content_wtype=content_wtype, - name="box_map_proxy", - stub_name=constants.CLS_BOX_MAP_PROXY_ALIAS, + name=f"box_map_proxy[{key_wtype.name},{content_wtype.name}]", + stub_name=( + f"{constants.CLS_BOX_MAP_PROXY_ALIAS}" + f"[{key_wtype.stub_name}, {content_wtype.stub_name}]" + ), ) @@ -498,18 +501,24 @@ def __init__( if not fields: raise CodeError("arc4.Struct needs at least one element", source_location) arc4_fields = {} + bad_field_names = [] for field_name, field_wtype in fields.items(): if not isinstance(field_wtype, ARC4Type): - raise CodeError( - f"Invalid ARC4 Struct declaration: {field_name} is not an ARC4 encoded type", - source_location, - ) + bad_field_names.append(field_name) + continue + arc4_fields[field_name] = field_wtype # this seems counterintuitive, but is necessary. # despite the overall collection remaining stable, since ARC4 types # are encoded as a single value, if items within a "frozen" struct can be mutated, # then the overall value is also mutable immutable = immutable and field_wtype.immutable + if bad_field_names: + raise CodeError( + "Invalid ARC4 Struct declaration," + f" the following fields are not ARC4 encoded types: {', '.join(bad_field_names)}", + source_location, + ) name = ( "arc4.struct<" diff --git a/src/puya/awst_build/arc4_utils.py b/src/puya/awst_build/arc4_utils.py index 7ec9b3bf91..def8df16f7 100644 --- a/src/puya/awst_build/arc4_utils.py +++ b/src/puya/awst_build/arc4_utils.py @@ -6,12 +6,12 @@ from immutabledict import immutabledict import puya.models -from puya.arc4_util import wtype_to_arc4 +from puya.arc4_util import pytype_to_arc4 from puya.awst import ( nodes as awst_nodes, wtypes, ) -from puya.awst_build import constants, intrinsic_factory +from puya.awst_build import constants, intrinsic_factory, pytypes from puya.awst_build.context import ASTConversionModuleContext from puya.awst_build.utils import extract_bytes_literal_from_mypy from puya.errors import CodeError, InternalError @@ -21,6 +21,17 @@ ALLOWABLE_OCA = [oca.name for oca in OnCompletionAction if oca != OnCompletionAction.ClearState] +def _is_arc4_struct(typ: pytypes.PyType) -> typing.TypeGuard[pytypes.StructType]: + if pytypes.ARC4StructBaseType not in typ.mro: + return False + if not isinstance(typ, pytypes.StructType): + raise InternalError( + f"Type inherits from {pytypes.ARC4StructBaseType!r}" + f" but structure type is {type(typ).__name__!r}" + ) + return True + + def get_arc4_method_config( context: ASTConversionModuleContext, decorator: mypy.nodes.Expression, @@ -70,11 +81,11 @@ def get_arc4_method_config( structs = immutabledict[str, ARC32StructDef]( { - n: _wtype_to_struct_def(t) - for n, t in get_func_types( + n: _wtype_to_struct_def(pt) + for n, pt in get_func_types( context, func_def, context.node_location(func_def, func_def.info) ).items() - if isinstance(t, wtypes.ARC4Struct) + if _is_arc4_struct(pt) } ) @@ -181,10 +192,10 @@ def visit_set_expr(self, o: mypy.nodes.SetExpr) -> set[object]: return {item.accept(self) for item in o.items} -def _wtype_to_struct_def(wtype: wtypes.ARC4Struct) -> ARC32StructDef: +def _wtype_to_struct_def(typ: pytypes.StructType) -> ARC32StructDef: return ARC32StructDef( - name=wtype.stub_name.rsplit(".", maxsplit=1)[-1], - elements=[(n, wtype_to_arc4(t)) for n, t in wtype.fields.items()], + name=typ.name.rsplit(".", maxsplit=1)[-1], + elements=[(n, pytype_to_arc4(t)) for n, t in typ.fields.items()], ) @@ -332,7 +343,7 @@ def arc4_decode( def get_func_types( context: ASTConversionModuleContext, func_def: mypy.nodes.FuncDef, location: SourceLocation -) -> dict[str, wtypes.WType]: +) -> dict[str, pytypes.PyType]: if not (func_def.arguments and func_def.arguments[0].variable.is_self): raise InternalError( "arc4_utils.get_func_types called with non class method," @@ -352,9 +363,9 @@ def get_func_types( **{ arg.variable.name: context.type_to_pytype( t, source_location=context.node_location(arg, module_src=func_def.info) - ).wtype + ) for t, arg in zip(func_type.arg_types, func_def.arguments, strict=True) if not arg.variable.is_self }, - "output": context.type_to_pytype(func_type.ret_type, source_location=location).wtype, + "output": context.type_to_pytype(func_type.ret_type, source_location=location), } diff --git a/src/puya/awst_build/context.py b/src/puya/awst_build/context.py index fbcdd9ab13..f717edffa5 100644 --- a/src/puya/awst_build/context.py +++ b/src/puya/awst_build/context.py @@ -21,6 +21,7 @@ @attrs.frozen(kw_only=True) class ASTConversionContext(CompileContext): constants: dict[str, ConstantValue] = attrs.field(factory=dict) + _pytypes: dict[str, pytypes.PyType] = attrs.field(factory=pytypes.builtins_registry) state_defs: dict[ContractReference, dict[str, AppStorageDeclaration]] = attrs.field( factory=dict ) @@ -28,6 +29,26 @@ class ASTConversionContext(CompileContext): def for_module(self, current_module: mypy.nodes.MypyFile) -> "ASTConversionModuleContext": return attrs_extend(ASTConversionModuleContext, self, current_module=current_module) + def register_pytype(self, typ: pytypes.PyType, *, alias: str | None = None) -> None: + name = alias or typ.name + existing_entry = self._pytypes.get(name) + if existing_entry is None: + self._pytypes[name] = typ + elif existing_entry is typ: + logger.debug(f"Duplicate registration of {typ}") + else: + raise InternalError(f"Duplicate mapping of {name}") + + def lookup_pytype(self, name: str) -> pytypes.PyType | None: + """Lookup type by the canonical fully qualified name""" + return self._pytypes.get(name) + + def require_ptype(self, name: str, source_location: SourceLocation) -> pytypes.PyType: + try: + return self._pytypes[name] + except KeyError: + raise CodeError(f"Unknown type {name}", source_location) from None + @attrs.frozen(kw_only=True) class ASTConversionModuleContext(ASTConversionContext): @@ -103,6 +124,10 @@ def log_exceptions( def mypy_expr_node_type(self, expr: mypy.nodes.Expression) -> pytypes.PyType: expr_loc = self.node_location(expr) + if isinstance(expr, mypy.nodes.TupleExpr): + # for some reason these don't appear in mypy type tables... + item_types = [self.mypy_expr_node_type(it) for it in expr.items] + return pytypes.GenericTupleType.parameterise(item_types, expr_loc) mypy_type = self.parse_result.manager.all_types.get(expr) if mypy_type is None: raise InternalError(f"mypy expression not present in type table: {expr}", expr_loc) @@ -121,7 +146,7 @@ def type_to_pytype( case mypy.types.TypeAliasType(alias=alias, args=args): if alias is None: raise InternalError("mypy type alias type missing alias reference", loc) - result = pytypes.lookup(alias.fullname) + result = self._pytypes.get(alias.fullname) if result is None: return self.type_to_pytype( mypy.types.get_proper_type(proper_type_or_alias), source_location=loc @@ -129,25 +154,26 @@ def type_to_pytype( if args: result = self._parameterise_pytype(result, args, loc) return result - case mypy.types.NoneType() | mypy.types.PartialType(type=None): - return pytypes.NoneType - case mypy.types.LiteralType(fallback=fallback): - return self.type_to_pytype(fallback, source_location=loc) - case mypy.types.TupleType(items=items, partial_fallback=true_type): - types = [self.type_to_pytype(it, source_location=loc) for it in items] - generic = pytypes.lookup(true_type.type.fullname) - if generic is None: - raise CodeError(f"Unknown tuple base type: {true_type.type.fullname}", loc) - return generic.parameterise(types, loc) case mypy.types.Instance(args=args) as inst: - result = pytypes.lookup(inst.type.fullname) + fullname = inst.type.fullname + result = self._pytypes.get(fullname) if result is None: - raise CodeError(f"Unknown type: {inst.type.fullname}", loc) + if fullname.startswith("builtins."): + msg = f"Unsupported builtin type: {fullname.removeprefix('builtins.')}" + else: + msg = f"Unknown type: {fullname}" + raise CodeError(msg, loc) if args: result = self._parameterise_pytype(result, args, loc) return result - case mypy.types.UninhabitedType(): - raise CodeError("Cannot resolve empty type", loc) + case mypy.types.TupleType(items=items, partial_fallback=true_type): + types = [self.type_to_pytype(it, source_location=loc) for it in items] + generic = self._pytypes.get(true_type.type.fullname) + if generic is None: + raise CodeError(f"Unknown tuple base type: {true_type.type.fullname}", loc) + return generic.parameterise(types, loc) + case mypy.types.LiteralType(fallback=fallback): + return self.type_to_pytype(fallback, source_location=loc) case mypy.types.UnionType(items=items): types = [self.type_to_pytype(it, source_location=loc) for it in items] if not types: @@ -156,9 +182,19 @@ def type_to_pytype( return types[0] else: raise TypeUnionError(types, loc) + case mypy.types.NoneType() | mypy.types.PartialType(type=None): + return pytypes.NoneType + case mypy.types.UninhabitedType(): + raise CodeError("Cannot resolve empty type", loc) case mypy.types.AnyType(): # TODO: look at type_of_any to improve error message raise CodeError("Any type is not supported", loc) + case mypy.types.FunctionLike() as func_like: + if func_like.is_type_obj(): + msg = "References to type objects are not supported" + else: + msg = "Function references are not supported" + raise CodeError(msg, loc) case _: raise CodeError( f"Unable to resolve mypy type {mypy_type!r} to known algopy type", loc diff --git a/src/puya/awst_build/contract.py b/src/puya/awst_build/contract.py index 6938670c03..3806df0ba7 100644 --- a/src/puya/awst_build/contract.py +++ b/src/puya/awst_build/contract.py @@ -7,22 +7,15 @@ from puya import log from puya.awst import wtypes from puya.awst.nodes import ( - AppStateDefinition, - AppStateKind, ContractFragment, ContractMethod, ContractReference, ) -from puya.awst_build import constants +from puya.awst_build import constants, pytypes from puya.awst_build.arc4_utils import get_arc4_method_config, get_func_types from puya.awst_build.base_mypy_visitor import BaseMyPyStatementVisitor from puya.awst_build.context import ASTConversionModuleContext -from puya.awst_build.contract_data import ( - AppStateDeclaration, - AppStateDeclType, - AppStorageDeclaration, - ContractClassOptions, -) +from puya.awst_build.contract_data import AppStorageDeclaration, ContractClassOptions from puya.awst_build.subroutine import ContractMethodInfo, FunctionASTConverter from puya.awst_build.utils import ( get_decorators_by_fullname, @@ -58,21 +51,6 @@ def __init__( self._init_method: ContractMethod | None = None self._subroutines = list[ContractMethod]() self.context.state_defs[self.cref] = _gather_app_storage_recursive(context, class_def) - # this_app_state = list(_gather_app_storage(context, class_def.info)) - # for decl in this_app_state: - # if ( - # isinstance(decl, AppStateDeclaration) - # and decl.decl_type is AppStateDeclType.global_direct - # ): - # context.state_defs[self.cref][decl.member_name] = AppStateDefinition( - # member_name=decl.member_name, - # storage_wtype=decl.storage_wtype, - # key_override=None, - # description=None, - # source_location=decl.source_location, - # kind=decl.kind, - # ) - # _combined_app_state = _gather_app_storage_recursive(context, class_def, this_app_state) # if the class has an __init__ method, we need to visit it first, so any storage # fields cane be resolved to a (static) key @@ -90,17 +68,11 @@ def __init__( stmt.accept(self) # TODO: validation for state proxies being non-conditional - app_state = {} - for name, state_decl in context.state_defs[self.cref].items(): - if state_decl.defined_in == self.cref: - app_state[name] = AppStateDefinition( - key_override=state_decl.key_override, - description=state_decl.description, - storage_wtype=state_decl.storage_wtype, - source_location=state_decl.source_location, - kind=state_decl.kind, - member_name=name, - ) + app_state = { + name: state_decl.definition + for name, state_decl in context.state_defs[self.cref].items() + if state_decl.defined_in == self.cref + } self.result_ = ContractFragment( module_name=self.cref.module_name, @@ -239,9 +211,11 @@ def visit_function( self._error( f"cannot be both a subroutine and {arc4_decorator_name}", subroutine_dec ) - *arg_wtypes, ret_wtype = get_func_types( + *arg_pytypes, ret_pytype = get_func_types( self.context, func_def, location=self._location(func_def) ).values() + ret_wtype = ret_pytype.wtype + arg_wtypes = [a.wtype for a in arg_pytypes] arc4_method_config = get_arc4_method_config(self.context, arc4_decorator, func_def) if arc4_method_config.is_bare: if arg_wtypes or (ret_wtype is not wtypes.void_wtype): @@ -466,26 +440,24 @@ def _gather_global_direct_storages( var_loc, ) pytyp = context.type_to_pytype(sym.type, source_location=sym.node) - storage_wtype = pytyp.wtype - if storage_wtype in (wtypes.box_key, wtypes.state_key): - pass # these are handled on declaration, need to collect constructor arguments too - elif not storage_wtype.lvalue: + + if isinstance(pytyp, pytypes.StorageProxyType | pytypes.StorageMapProxyType): + # these are handled on declaration, need to collect constructor arguments too + continue + + if pytyp is pytypes.NoneType: context.error( - f"Invalid type for Local storage - must be assignable," - f" which type {storage_wtype} is not", + "None is not supported as a value, only a return type", var_loc, ) - else: - yield AppStateDeclaration( - member_name=name, - kind=AppStateKind.app_global, - storage_wtype=storage_wtype, - decl_type=AppStateDeclType.global_direct, - source_location=var_loc, - defined_in=cref, - key_override=None, - description=None, - ) + yield AppStorageDeclaration( + member_name=name, + typ=pytyp, + source_location=var_loc, + defined_in=cref, + key_override=None, + description=None, + ) def _check_class_abstractness( diff --git a/src/puya/awst_build/contract_data.py b/src/puya/awst_build/contract_data.py index ea502be24b..84456b7138 100644 --- a/src/puya/awst_build/contract_data.py +++ b/src/puya/awst_build/contract_data.py @@ -1,41 +1,73 @@ -import enum -import typing +from functools import cached_property import attrs -from puya.awst.nodes import AppStateKind, BytesConstant, ContractReference, StateTotals -from puya.awst.wtypes import WType +from puya.awst.nodes import ( + AppStorageDefinition, + AppStorageKind, + BytesConstant, + BytesEncoding, + ContractReference, + StateTotals, +) +from puya.awst_build import pytypes from puya.parse import SourceLocation from puya.utils import StableSet -@enum.unique -class AppStateDeclType(enum.Enum): - local_proxy = enum.auto() - global_proxy = enum.auto() - global_direct = enum.auto() - box = enum.auto() - box_ref = enum.auto() - box_map = enum.auto() - - @attrs.frozen -class AppStateDeclaration: +class AppStorageDeclaration: member_name: str - kind: AppStateKind - storage_wtype: WType + typ: pytypes.PyType key_override: BytesConstant | None - decl_type: AppStateDeclType + """If a map type, then this is the prefix override""" source_location: SourceLocation defined_in: ContractReference description: str | None + @property + def key(self) -> BytesConstant: + if self.key_override is not None: + return self.key_override + return BytesConstant( + value=self.member_name.encode("utf8"), + encoding=BytesEncoding.utf8, + source_location=self.source_location, + ) + + @cached_property + def definition(self) -> AppStorageDefinition: + key_wtype = None + match self.typ: + case pytypes.StorageProxyType(generic=pytypes.GenericLocalStateType, content=content): + kind = AppStorageKind.account_local + case pytypes.StorageProxyType(generic=pytypes.GenericGlobalStateType, content=content): + kind = AppStorageKind.app_global + case pytypes.BoxRefType: + kind = AppStorageKind.box + content = pytypes.BytesType + case pytypes.StorageProxyType(generic=pytypes.GenericBoxType, content=content): + kind = AppStorageKind.box + case pytypes.StorageMapProxyType( + generic=pytypes.GenericBoxMapType, content=content, key=key_typ + ): + kind = AppStorageKind.box + key_wtype = key_typ.wtype + case _ as content: + kind = AppStorageKind.app_global + return AppStorageDefinition( + key=self.key, + description=self.description, + storage_wtype=content.wtype, + key_wtype=key_wtype, + source_location=self.source_location, + kind=kind, + member_name=self.member_name, + ) + @attrs.define class ContractClassOptions: name_override: str | None scratch_slot_reservations: StableSet[int] state_totals: StateTotals | None - - -AppStorageDeclaration: typing.TypeAlias = AppStateDeclaration diff --git a/src/puya/awst_build/eb/app_account_state.py b/src/puya/awst_build/eb/app_account_state.py index a2898c8c01..dcdbfe4350 100644 --- a/src/puya/awst_build/eb/app_account_state.py +++ b/src/puya/awst_build/eb/app_account_state.py @@ -6,7 +6,6 @@ from puya.awst import wtypes from puya.awst.nodes import ( AppAccountStateExpression, - AppStateKind, BytesConstant, BytesEncoding, Expression, @@ -18,8 +17,8 @@ StateGetEx, Statement, ) -from puya.awst_build import constants -from puya.awst_build.contract_data import AppStateDeclaration, AppStateDeclType +from puya.awst_build import constants, pytypes +from puya.awst_build.contract_data import AppStorageDeclaration from puya.awst_build.eb.base import ( ExpressionBuilder, IntermediateExpressionBuilder, @@ -37,8 +36,8 @@ class AppAccountStateExpressionBuilder(StateProxyMemberBuilder): - def __init__(self, state_decl: AppStateDeclaration, location: SourceLocation): - assert state_decl.kind is AppStateKind.account_local + def __init__(self, state_decl: AppStorageDeclaration, location: SourceLocation): + assert state_decl.typ.generic is pytypes.GenericLocalStateType super().__init__(location) self.state_decl = state_decl @@ -66,7 +65,7 @@ def member_access(self, name: str, location: SourceLocation) -> ExpressionBuilde class AppAccountStateGetMethodBuilder(IntermediateExpressionBuilder): - def __init__(self, state_decl: AppStateDeclaration, location: SourceLocation): + def __init__(self, state_decl: AppStorageDeclaration, location: SourceLocation): super().__init__(location) self.state_decl = state_decl @@ -84,7 +83,7 @@ def call( else: item, default_arg = args default_expr = expect_operand_wtype( - default_arg, target_wtype=self.state_decl.storage_wtype + default_arg, target_wtype=self.state_decl.definition.storage_wtype ) expr = StateGet( field=_build_field(self.state_decl, item, location), @@ -96,7 +95,7 @@ def call( class AppAccountStateMaybeMethodBuilder(IntermediateExpressionBuilder): - def __init__(self, state_decl: AppStateDeclaration, location: SourceLocation): + def __init__(self, state_decl: AppStorageDeclaration, location: SourceLocation): super().__init__(location) self.state_decl = state_decl @@ -220,13 +219,11 @@ def call( class AppAccountStateProxyDefinitionBuilder(StateProxyDefinitionBuilder): - kind = AppStateKind.account_local python_name = constants.CLS_LOCAL_STATE_ALIAS - decl_type = AppStateDeclType.local_proxy def _build_field( - state_decl: AppStateDeclaration, index: ExpressionBuilder | Literal, location: SourceLocation + state_decl: AppStorageDeclaration, index: ExpressionBuilder | Literal, location: SourceLocation ) -> AppAccountStateExpression: index_expr = convert_literal_to_expr(index, wtypes.uint64_wtype) match index_expr: @@ -247,8 +244,9 @@ def _build_field( index.source_location, ) return AppAccountStateExpression( + key=state_decl.key, field_name=state_decl.member_name, account=index_expr, - wtype=state_decl.storage_wtype, + wtype=state_decl.definition.storage_wtype, source_location=location, ) diff --git a/src/puya/awst_build/eb/app_state.py b/src/puya/awst_build/eb/app_state.py index 1a5d4466fd..b83813009a 100644 --- a/src/puya/awst_build/eb/app_state.py +++ b/src/puya/awst_build/eb/app_state.py @@ -7,7 +7,6 @@ from puya.awst import wtypes from puya.awst.nodes import ( AppStateExpression, - AppStateKind, BoolConstant, BytesConstant, BytesEncoding, @@ -21,7 +20,6 @@ Statement, ) from puya.awst_build import constants -from puya.awst_build.contract_data import AppStateDeclType from puya.awst_build.eb.base import ( ExpressionBuilder, IntermediateExpressionBuilder, @@ -41,7 +39,7 @@ import mypy.types - from puya.awst_build.contract_data import AppStateDeclaration + from puya.awst_build.contract_data import AppStorageDeclaration from puya.parse import SourceLocation @@ -149,13 +147,11 @@ def call( class AppStateProxyDefinitionBuilder(StateProxyDefinitionBuilder): - kind = AppStateKind.app_global python_name = constants.CLS_GLOBAL_STATE_ALIAS - decl_type = AppStateDeclType.global_proxy class AppStateExpressionBuilder(StateProxyMemberBuilder): - def __init__(self, state_decl: AppStateDeclaration, location: SourceLocation) -> None: + def __init__(self, state_decl: AppStorageDeclaration, location: SourceLocation) -> None: self.state_decl = state_decl super().__init__(location) @@ -181,8 +177,9 @@ def member_access(self, name: str, location: SourceLocation) -> ExpressionBuilde def _build_field(self, location: SourceLocation) -> AppStateExpression: return AppStateExpression( + key=self.state_decl.key, field_name=self.state_decl.member_name, - wtype=self.state_decl.storage_wtype, + wtype=self.state_decl.definition.storage_wtype, source_location=location, ) diff --git a/src/puya/awst_build/eb/arc4/_utils.py b/src/puya/awst_build/eb/arc4/_utils.py index f119c0fe4f..d7275a8713 100644 --- a/src/puya/awst_build/eb/arc4/_utils.py +++ b/src/puya/awst_build/eb/arc4/_utils.py @@ -5,6 +5,8 @@ import typing import attrs +import mypy.nodes +import mypy.types from puya import arc4_util, log from puya.awst import ( @@ -12,14 +14,16 @@ wtypes, ) from puya.awst.nodes import DecimalConstant, Expression, Literal -from puya.awst_build.arc4_utils import arc4_encode +from puya.awst_build import constants, pytypes +from puya.awst_build.arc4_utils import arc4_encode, get_arc4_method_config, get_func_types from puya.awst_build.eb.base import ExpressionBuilder -from puya.awst_build.utils import convert_literal +from puya.awst_build.utils import convert_literal, get_decorators_by_fullname from puya.errors import CodeError if typing.TYPE_CHECKING: from collections.abc import Sequence + from puya.awst_build.context import ASTConversionModuleContext from puya.parse import SourceLocation logger = log.get_logger(__name__) @@ -116,9 +120,11 @@ def expect_arc4_operand_wtype( if isinstance(literal_or_expr, ExpressionBuilder): literal_or_expr = literal_or_expr.rvalue() - if wtypes.has_arc4_equivalent_type(literal_or_expr.wtype): - new_wtype = wtypes.avm_to_arc4_equivalent_type(literal_or_expr.wtype) - literal_or_expr = arc4_encode(literal_or_expr, new_wtype, literal_or_expr.source_location) + if wtypes.has_arc4_equivalent_type(target_wtype): + target_wtype = wtypes.avm_to_arc4_equivalent_type(target_wtype) + literal_or_expr = arc4_encode( + literal_or_expr, target_wtype, literal_or_expr.source_location + ) if literal_or_expr.wtype != target_wtype: raise CodeError( @@ -131,14 +137,32 @@ def expect_arc4_operand_wtype( @attrs.frozen class ARC4Signature: method_name: str - arg_types: list[wtypes.WType] - return_type: wtypes.WType | None + arg_types: Sequence[pytypes.PyType] = attrs.field(converter=tuple[pytypes.PyType, ...]) + return_type: pytypes.PyType | None @property def method_selector(self) -> str: - args = ",".join(map(arc4_util.wtype_to_arc4, self.arg_types)) - return_type = self.return_type or wtypes.void_wtype - return f"{self.method_name}({args}){arc4_util.wtype_to_arc4(return_type)}" + args = ",".join(map(arc4_util.pytype_to_arc4, self.arg_types)) + return_type = self.return_type or pytypes.NoneType + return f"{self.method_name}({args}){arc4_util.pytype_to_arc4(return_type)}" + + +def get_arc4_signature( + context: ASTConversionModuleContext, + type_info: mypy.nodes.TypeInfo, + member_name: str, + location: SourceLocation, +) -> ARC4Signature: + dec = type_info.get_method(member_name) + if isinstance(dec, mypy.nodes.Decorator): + decorators = get_decorators_by_fullname(context, dec) + abimethod_dec = decorators.get(constants.ABIMETHOD_DECORATOR) + if abimethod_dec is not None: + func_def = dec.func + arc4_method_config = get_arc4_method_config(context, abimethod_dec, func_def) + *arg_types, return_type = get_func_types(context, func_def, location).values() + return ARC4Signature(arc4_method_config.name, arg_types, return_type) + raise CodeError(f"'{type_info.fullname}.{member_name}' is not a valid ARC4 method", location) def get_arc4_args_and_signature( @@ -152,6 +176,8 @@ def get_arc4_args_and_signature( raise CodeError( f"Number of arguments ({num_args}) does not match signature ({num_types})", loc ) + if num_types >= 0: # TODO: remove this + raise CodeError("whoopsie", loc) arc4_args = [ expect_arc4_operand_wtype(arg, wtype) diff --git a/src/puya/awst_build/eb/arc4/abi_call.py b/src/puya/awst_build/eb/arc4/abi_call.py index f85660d9e3..4f1288f209 100644 --- a/src/puya/awst_build/eb/arc4/abi_call.py +++ b/src/puya/awst_build/eb/arc4/abi_call.py @@ -12,7 +12,6 @@ from puya.awst import wtypes from puya.awst.nodes import ( TXN_FIELDS_BY_IMMEDIATE, - ARC4Decode, BytesConstant, BytesEncoding, CreateInnerTransaction, @@ -27,13 +26,14 @@ TxnFields, UInt64Constant, ) -from puya.awst_build import constants -from puya.awst_build.arc4_utils import get_arc4_method_config, get_func_types +from puya.awst_build import constants, pytypes +from puya.awst_build.constants import TransactionType from puya.awst_build.eb.arc4._utils import ( ARC4Signature, arc4_tuple_from_items, expect_arc4_operand_wtype, get_arc4_args_and_signature, + get_arc4_signature, ) from puya.awst_build.eb.arc4.base import ARC4FromLogBuilder from puya.awst_build.eb.base import ( @@ -46,7 +46,6 @@ from puya.awst_build.eb.transaction.fields import get_field_python_name from puya.awst_build.eb.transaction.inner_params import get_field_expr from puya.awst_build.eb.var_factory import var_expression -from puya.awst_build.utils import get_decorators_by_fullname from puya.errors import CodeError, InternalError if typing.TYPE_CHECKING: @@ -158,7 +157,7 @@ class ABICallClassExpressionBuilder(TypeClassExpressionBuilder): def __init__(self, result_wtype: wtypes.WType | None, source_location: SourceLocation) -> None: super().__init__(source_location) self.result_wtype = result_wtype - app_itxn_wtype = wtypes.WInnerTransaction.from_type(constants.TransactionType.appl) + app_itxn_wtype = wtypes.WInnerTransaction.from_type(TransactionType.appl) if _is_typed(result_wtype): self.wtype: wtypes.WInnerTransaction | wtypes.WTuple = wtypes.WTuple( (result_wtype, app_itxn_wtype), source_location @@ -179,18 +178,20 @@ def call( abi_call_expr = _extract_abi_call_args(args, arg_kinds, arg_names, location) method = abi_call_expr.method - declared_result_wtype = self.result_wtype + result_wtype = self.result_wtype match method: case Literal(value=str(method_str)): arc4_args, signature = get_arc4_args_and_signature( method_str, abi_call_expr.abi_args, location ) - if declared_result_wtype is not None: + if result_wtype is not None: # this will be validated against signature below, by comparing # the generated method_selector against the supplied method_str - signature = attrs.evolve(signature, return_type=declared_result_wtype) + if arc4_args: # TODO: remove this + raise CodeError("whoopsie", location) + signature = attrs.evolve(signature, return_type=result_wtype) elif signature.return_type is None: - signature = attrs.evolve(signature, return_type=wtypes.void_wtype) + signature = attrs.evolve(signature, return_type=pytypes.NoneType) if not signature.method_selector.startswith(method_str): raise CodeError( f"Method selector from args '{signature.method_selector}' " @@ -200,9 +201,9 @@ def call( case ( ARC4ClientMethodExpressionBuilder() | BaseClassSubroutineInvokerExpressionBuilder() ) as eb: - # in this case the arc4 signature and declared return type are inferred - signature, declared_result_wtype = _get_arc4_signature_and_return_wtype( - eb.context, eb.type_info, eb.name, location + signature = get_arc4_signature(eb.context, eb.type_info, eb.name, location) + result_wtype = ( + signature.return_type.wtype if signature.return_type is not None else None ) num_args = len(abi_call_expr.abi_args) num_types = len(signature.arg_types) @@ -213,8 +214,8 @@ def call( location, ) arc4_args = [ - expect_arc4_operand_wtype(arg, wtype) - for arg, wtype in zip(abi_call_expr.abi_args, signature.arg_types, strict=True) + expect_arc4_operand_wtype(arg, pt.wtype) + for arg, pt in zip(abi_call_expr.abi_args, signature.arg_types, strict=True) ] case _: raise CodeError( @@ -226,43 +227,13 @@ def call( _create_abi_call_expr( signature, arc4_args, - declared_result_wtype, abi_call_expr.transaction_kwargs, location, + return_inner_txn_only=not _is_typed(result_wtype), ) ) -def _get_arc4_signature_and_return_wtype( - context: ASTConversionModuleContext, - type_info: mypy.nodes.TypeInfo, - member_name: str, - location: SourceLocation, -) -> tuple[ARC4Signature, wtypes.WType]: - dec = type_info.get_method(member_name) - if isinstance(dec, mypy.nodes.Decorator): - decorators = get_decorators_by_fullname(context, dec) - abimethod_dec = decorators.get(constants.ABIMETHOD_DECORATOR) - if abimethod_dec is not None: - func_def = dec.func - arc4_method_config = get_arc4_method_config(context, abimethod_dec, func_def) - func_wtypes = get_func_types(context, func_def, location).values() - *_, return_wtype = func_wtypes - *arc4_arg_types, arc4_return_type = ( - ( - wtypes.avm_to_arc4_equivalent_type(func_type) - if wtypes.has_arc4_equivalent_type(func_type) - else func_type - ) - for func_type in func_wtypes - ) - return ( - ARC4Signature(arc4_method_config.name, arc4_arg_types, arc4_return_type), - return_wtype, - ) - raise CodeError(f"'{type_info.fullname}.{member_name}' is not a valid ARC4 method", location) - - def _is_typed(wtype: wtypes.WType | None) -> typing.TypeGuard[wtypes.WType]: return wtype is not None and wtype is not wtypes.void_wtype @@ -270,9 +241,10 @@ def _is_typed(wtype: wtypes.WType | None) -> typing.TypeGuard[wtypes.WType]: def _create_abi_call_expr( signature: ARC4Signature, abi_args: Sequence[Expression], - declared_result_wtype: wtypes.WType | None, transaction_kwargs: dict[str, ExpressionBuilder | Literal], location: SourceLocation, + *, + return_inner_txn_only: bool, ) -> Expression: if signature.return_type is None: raise InternalError("Expected ARC4Signature.return_type to be defined", location) @@ -363,7 +335,7 @@ def append_ref_arg(ref_list: list[Expression], arg_expr: Expression) -> None: wtype=wtypes.WInnerTransaction.from_type(constants.TransactionType.appl), ) - if not _is_typed(declared_result_wtype): + if return_inner_txn_only: return itxn itxn_tmp = SingleEvaluation(itxn) last_log = InnerTransactionField( @@ -372,25 +344,9 @@ def append_ref_arg(ref_list: list[Expression], arg_expr: Expression) -> None: field=TxnFields.last_log, wtype=TxnFields.last_log.wtype, ) - abi_result = ARC4FromLogBuilder.abi_expr_from_log(signature.return_type, last_log, location) - # the declared result wtype may be different to the arc4 signature return wtype - # due to automatic conversion of ARC4 -> native types - if declared_result_wtype != signature.return_type: - if ( - wtypes.has_arc4_equivalent_type(declared_result_wtype) - and wtypes.avm_to_arc4_equivalent_type(declared_result_wtype) == signature.return_type - ): - abi_result = ARC4Decode( - value=abi_result, - wtype=declared_result_wtype, - source_location=location, - ) - else: - raise InternalError("Return type does not match signature type", location) - return TupleExpression.from_items( ( - abi_result, + ARC4FromLogBuilder.abi_expr_from_log(signature.return_type.wtype, last_log, location), itxn_tmp, ), location, diff --git a/src/puya/awst_build/eb/arc4/emit.py b/src/puya/awst_build/eb/arc4/emit.py index 66b16194a0..1388a18dcb 100644 --- a/src/puya/awst_build/eb/arc4/emit.py +++ b/src/puya/awst_build/eb/arc4/emit.py @@ -4,7 +4,7 @@ import mypy.nodes -from puya.arc4_util import wtype_to_arc4 +from puya.arc4_util import pytype_to_arc4, wtype_to_arc4 from puya.awst import wtypes from puya.awst.nodes import ( Literal, @@ -47,7 +47,7 @@ def call( case [Literal(value=str(event_str)), *event_args]: arc4_args, signature = get_arc4_args_and_signature(event_str, event_args, location) if signature.return_type is not None: - after_args = wtype_to_arc4(signature.return_type) + after_args = pytype_to_arc4(signature.return_type) raise CodeError( f"Invalid event signature, type specified after args {after_args!r}", location, diff --git a/src/puya/awst_build/eb/base.py b/src/puya/awst_build/eb/base.py index fa74b15c33..b305631a91 100644 --- a/src/puya/awst_build/eb/base.py +++ b/src/puya/awst_build/eb/base.py @@ -5,7 +5,6 @@ import typing from puya.awst.nodes import ( - AppStateKind, BytesConstant, ContractReference, Expression, @@ -29,7 +28,7 @@ import mypy.types from puya.awst import wtypes - from puya.awst_build.contract_data import AppStateDeclaration, AppStateDeclType + from puya.awst_build import pytypes from puya.parse import SourceLocation __all__ = [ @@ -250,13 +249,11 @@ def _not_a_value(self, location: SourceLocation) -> typing.Never: class StateProxyMemberBuilder(IntermediateExpressionBuilder): - state_decl: AppStateDeclaration + state_decl: AppStorageDeclaration class StateProxyDefinitionBuilder(ExpressionBuilder, abc.ABC): - kind: AppStateKind python_name: str - decl_type: AppStateDeclType def __init__( self, @@ -273,17 +270,19 @@ def __init__( self.initial_value = initial_value def build_definition( - self, member_name: str, defined_in: ContractReference, location: SourceLocation + self, + member_name: str, + defined_in: ContractReference, + typ: pytypes.PyType, + location: SourceLocation, ) -> AppStorageDeclaration: return AppStorageDeclaration( description=self.description, member_name=member_name, key_override=self.key_override, source_location=location, - storage_wtype=self.storage, - kind=self.kind, + typ=typ, defined_in=defined_in, - decl_type=self.decl_type, ) def rvalue(self) -> Expression: @@ -428,7 +427,7 @@ def contains( def _validate_lvalue(resolved: Expression) -> Lvalue: if isinstance(resolved, TupleItemExpression): raise CodeError("Tuple items cannot be reassigned", resolved.source_location) - if not (isinstance(resolved, Lvalue) and resolved.wtype.lvalue): # type: ignore[arg-type,misc] + if not isinstance(resolved, Lvalue): # type: ignore[arg-type,misc] raise CodeError( f"{resolved.wtype.stub_name} expression is not valid as assignment target", resolved.source_location, diff --git a/src/puya/awst_build/eb/box/box_map.py b/src/puya/awst_build/eb/box/box_map.py index 9046bd0270..bb28b6045d 100644 --- a/src/puya/awst_build/eb/box/box_map.py +++ b/src/puya/awst_build/eb/box/box_map.py @@ -58,10 +58,10 @@ def index_multiple( TypeClassExpressionBuilder() as key_eb, TypeClassExpressionBuilder() as contents_eb, ]: - _key_wtype = key_eb.produces() + key_wtype = key_eb.produces() content_wtype = contents_eb.produces() self.wtype = wtypes.WBoxMapProxy.from_key_and_content_type( - content_wtype=content_wtype + key_wtype=key_wtype, content_wtype=content_wtype ) case _: raise CodeError("Invalid/unhandled arguments", location) @@ -82,9 +82,9 @@ def call( args=zip(arg_names, args, strict=True), location=location, ) - _key_wtype = require_type_class_eb(arg_map.pop("key_type")).produces() + key_wtype = require_type_class_eb(arg_map.pop("key_type")).produces() content_wtype = require_type_class_eb(arg_map.pop("_type")).produces() - wtype = wtypes.WBoxMapProxy.from_key_and_content_type(content_wtype) + wtype = wtypes.WBoxMapProxy.from_key_and_content_type(key_wtype, content_wtype) if not self.wtype: self.wtype = wtype elif self.wtype != wtype: diff --git a/src/puya/awst_build/eb/contracts.py b/src/puya/awst_build/eb/contracts.py index cb7612f097..d1c86969d7 100644 --- a/src/puya/awst_build/eb/contracts.py +++ b/src/puya/awst_build/eb/contracts.py @@ -8,12 +8,9 @@ BoxProxyField, InstanceSubroutineTarget, ) +from puya.awst_build import pytypes from puya.awst_build.context import ASTConversionModuleContext -from puya.awst_build.contract_data import ( - AppStateDeclaration, - AppStateDeclType, - AppStorageDeclaration, -) +from puya.awst_build.contract_data import AppStorageDeclaration from puya.awst_build.eb.app_account_state import AppAccountStateExpressionBuilder from puya.awst_build.eb.app_state import AppStateExpressionBuilder from puya.awst_build.eb.base import ExpressionBuilder, IntermediateExpressionBuilder @@ -28,7 +25,7 @@ ) from puya.awst_build.eb.var_factory import var_expression from puya.awst_build.utils import qualified_class_name -from puya.errors import CodeError +from puya.errors import CodeError, InternalError from puya.parse import SourceLocation logger = log.get_logger(__name__) @@ -92,8 +89,8 @@ def member_access(self, name: str, location: SourceLocation) -> ExpressionBuilde def _builder_for_storage_access( storage_decl: AppStorageDeclaration, location: SourceLocation ) -> ExpressionBuilder: - match storage_decl: - case AppStateDeclaration(decl_type=AppStateDeclType.box_ref): + match storage_decl.typ: + case pytypes.BoxRefType: return BoxRefProxyExpressionBuilder( BoxProxyField( source_location=storage_decl.source_location, @@ -101,35 +98,38 @@ def _builder_for_storage_access( field_name=storage_decl.member_name, ) ) - case AppStateDeclaration(decl_type=AppStateDeclType.box): + case pytypes.PyType(generic=pytypes.GenericBoxType): return BoxProxyExpressionBuilder( BoxProxyField( source_location=storage_decl.source_location, - wtype=wtypes.WBoxProxy.from_content_type(storage_decl.storage_wtype), + wtype=wtypes.WBoxProxy.from_content_type( + storage_decl.definition.storage_wtype + ), field_name=storage_decl.member_name, ) ) - case AppStateDeclaration(decl_type=AppStateDeclType.box_map): + case pytypes.PyType(generic=pytypes.GenericBoxMapType): + if storage_decl.definition.key_wtype is None: + raise InternalError("BoxMap should have key WType", location) return BoxMapProxyExpressionBuilder( BoxProxyField( source_location=storage_decl.source_location, wtype=wtypes.WBoxMapProxy.from_key_and_content_type( - storage_decl.storage_wtype + storage_decl.definition.key_wtype, storage_decl.definition.storage_wtype ), field_name=storage_decl.member_name, ) ) - case AppStateDeclaration(decl_type=AppStateDeclType.local_proxy): + case pytypes.PyType(generic=pytypes.GenericLocalStateType): return AppAccountStateExpressionBuilder(storage_decl, location) - case AppStateDeclaration(decl_type=AppStateDeclType.global_proxy): + case pytypes.PyType(generic=pytypes.GenericGlobalStateType): return AppStateExpressionBuilder(storage_decl, location) - case AppStateDeclaration(decl_type=AppStateDeclType.global_direct): + case _: return var_expression( AppStateExpression( + key=storage_decl.key, field_name=storage_decl.member_name, - wtype=storage_decl.storage_wtype, + wtype=storage_decl.definition.storage_wtype, source_location=location, ) ) - case _: - raise ValueError(f"Unexpected storage declaration {storage_decl}") diff --git a/src/puya/awst_build/eb/intrinsics.py b/src/puya/awst_build/eb/intrinsics.py index ac7d9ab5f6..eaab7cd910 100644 --- a/src/puya/awst_build/eb/intrinsics.py +++ b/src/puya/awst_build/eb/intrinsics.py @@ -6,19 +6,18 @@ import mypy.nodes from puya import log -from puya.awst import wtypes from puya.awst.nodes import Expression, IntrinsicCall, Literal, MethodConstant from puya.awst_build.constants import ARC4_SIGNATURE_ALIAS from puya.awst_build.eb.base import ExpressionBuilder, IntermediateExpressionBuilder from puya.awst_build.eb.bytes import BytesExpressionBuilder from puya.awst_build.eb.var_factory import var_expression -from puya.awst_build.intrinsic_data import ENUM_CLASSES, STUB_TO_AST_MAPPER -from puya.awst_build.intrinsic_models import FunctionOpMapping, ImmediateArgMapping +from puya.awst_build.intrinsic_models import FunctionOpMapping, PropertyOpMapping from puya.awst_build.utils import convert_literal, get_arg_mapping from puya.errors import InternalError +from puya.utils import StableSet if typing.TYPE_CHECKING: - from collections.abc import Sequence + from collections.abc import Mapping, Sequence from puya.parse import SourceLocation @@ -67,37 +66,63 @@ def _member_access( class IntrinsicEnumClassExpressionBuilder(_Namespace): + def __init__( + self, data: Mapping[str, str], type_info: mypy.nodes.TypeInfo, location: SourceLocation + ) -> None: + super().__init__(type_info, location) + self._data = data + @typing.override def _member_access( self, name: str, node: mypy.nodes.SymbolNode, location: SourceLocation ) -> Literal: - value = ENUM_CLASSES.get(self.type_info.fullname, {}).get(name) + value = self._data.get(name) if value is None: raise InternalError( - f"Un-mapped enum value '{name}' for '{self.type_info.fullname}.{name}'", location + f"Un-mapped enum value {name!r} for '{self.type_info.fullname}.{name}'", location ) - return Literal( - source_location=location, - # this works currently because these enums are StrEnum with auto() as their value - value=value, - ) + return Literal(value=value, source_location=location) class IntrinsicNamespaceClassExpressionBuilder(_Namespace): + def __init__( + self, + data: Mapping[str, PropertyOpMapping | Sequence[FunctionOpMapping]], + type_info: mypy.nodes.TypeInfo, + location: SourceLocation, + ) -> None: + super().__init__(type_info, location) + self._data = data + @typing.override def _member_access( self, name: str, node: mypy.nodes.SymbolNode, location: SourceLocation ) -> ExpressionBuilder: + mapping = self._data.get(name) + fullname = ".".join((self.type_info.fullname, name)) + if mapping is None: + raise InternalError(f"Un-mapped class member {name!r} for {fullname!r}", location) match node: # methods are either @staticmethod or @classmethod, so will be wrapped in decorator case mypy.nodes.Decorator(func=func_def): - return IntrinsicFunctionExpressionBuilder(func_def, location) + if isinstance(mapping, PropertyOpMapping): + raise InternalError( + f"Expected function mapping for {fullname!r} but got property", location + ) + return IntrinsicFunctionExpressionBuilder(func_def, mapping, location) # some class members in the stubs that take no arguments are typed # as final class vars, for these get the intrinsic expression by explicitly # mapping the member name as a call with no args - case mypy.nodes.Var(fullname=classvar_fullname): - intrinsic_expr = _map_call( - callee=classvar_fullname, node_location=location, args={} + case mypy.nodes.Var(): + if not isinstance(mapping, PropertyOpMapping): + raise InternalError( + f"Expected property mapping for {fullname!r} but got function", location + ) + intrinsic_expr = IntrinsicCall( + op_code=mapping.op_code, + immediates=[mapping.immediate], + wtype=mapping.typ.wtype, + source_location=location, ) return var_expression(intrinsic_expr) raise InternalError( @@ -108,7 +133,13 @@ def _member_access( class IntrinsicFunctionExpressionBuilder(IntermediateExpressionBuilder): - def __init__(self, func_def: mypy.nodes.FuncDef, location: SourceLocation) -> None: + def __init__( + self, + func_def: mypy.nodes.FuncDef, + mappings: Sequence[FunctionOpMapping], + location: SourceLocation, + ) -> None: + self._mappings = mappings self.func_def = func_def super().__init__(location) @@ -124,7 +155,7 @@ def call( ] arg_mapping = _get_arg_mapping_funcdef(self.func_def, resolved_args, location, arg_names) intrinsic_expr = _map_call( - callee=self.func_def.fullname, node_location=location, args=arg_mapping + self._mappings, callee=self.func_def.fullname, node_location=location, args=arg_mapping ) return var_expression(intrinsic_expr) @@ -147,7 +178,7 @@ def _get_arg_mapping_funcdef( def _best_op_mapping( - op_mappings: list[FunctionOpMapping], args: dict[str, Expression | Literal] + op_mappings: Sequence[FunctionOpMapping], args: dict[str, Expression | Literal] ) -> FunctionOpMapping: """Find op mapping that matches as many arguments to immediate args as possible""" literal_arg_names = {arg_name for arg_name, arg in args.items() if isinstance(arg, Literal)} @@ -158,23 +189,12 @@ def _best_op_mapping( return op_mappings[0] -def _return_types_to_wtype( - types: Sequence[wtypes.WType], source_location: SourceLocation -) -> wtypes.WType: - if not types: - return wtypes.void_wtype - elif len(types) == 1: - return types[0] - else: - return wtypes.WTuple(types, source_location) - - def _map_call( - callee: str, node_location: SourceLocation, args: dict[str, Expression | Literal] + ast_mapper: Sequence[FunctionOpMapping], + callee: str, + node_location: SourceLocation, + args: dict[str, Expression | Literal], ) -> IntrinsicCall: - ast_mapper = STUB_TO_AST_MAPPER.get(callee) - if not ast_mapper: - raise InternalError(f"Un-mapped intrinsic call for {callee}", node_location) if len(ast_mapper) == 1: (op_mapping,) = ast_mapper else: @@ -183,46 +203,46 @@ def _map_call( args = args.copy() # make a copy since we're going to mutate immediates = list[str | int]() - for immediate in op_mapping.immediates: - if not isinstance(immediate, ImmediateArgMapping): - immediates.append(immediate) - else: - arg_in = args.pop(immediate.arg_name, None) - if arg_in is None: - logger.error( - f"Missing expected argument {immediate.arg_name}", location=node_location - ) - elif not ( - isinstance(arg_in, Literal) - and isinstance(arg_value := arg_in.value, immediate.literal_type) - ): - logger.error( - f"Argument must be a literal {immediate.literal_type.__name__} value", - location=arg_in.source_location, - ) - else: - assert isinstance(arg_value, int | str) - immediates.append(arg_value) + for immediate in op_mapping.immediates.items(): + match immediate: + case value, None: + immediates.append(value) + case arg_name, literal_type: + arg_in = args.pop(arg_name, None) + if arg_in is None: + logger.error(f"Missing expected argument {arg_name}", location=node_location) + elif not ( + isinstance(arg_in, Literal) + and isinstance(arg_value := arg_in.value, literal_type) + ): + logger.error( + f"Argument must be a literal {literal_type.__name__} value", + location=arg_in.source_location, + ) + else: + assert isinstance(arg_value, int | str) + immediates.append(arg_value) stack_args = list[Expression]() - for arg_mapping in op_mapping.stack_inputs: - arg_in = args.pop(arg_mapping.arg_name, None) + for arg_name, allowed_pytypes in op_mapping.stack_inputs.items(): + allowed_types = StableSet.from_iter( # TODO: use PyTypes instead + pt.wtype for pt in allowed_pytypes + ) + arg_in = args.pop(arg_name, None) if arg_in is None: - logger.error( - f"Missing expected argument {arg_mapping.arg_name}", location=node_location - ) + logger.error(f"Missing expected argument {arg_name}", location=node_location) elif isinstance(arg_in, Expression): # TODO this is identity based, match types instead? - if arg_in.wtype not in arg_mapping.allowed_types: + if arg_in.wtype not in allowed_types: logger.error( f'Invalid argument type "{arg_in.wtype}"' - f' for argument "{arg_mapping.arg_name}" when calling {callee}', + f' for argument "{arg_name}" when calling {callee}', location=arg_in.source_location, ) stack_args.append(arg_in) else: literal_value = arg_in.value - for allowed_type in arg_mapping.allowed_types: + for allowed_type in allowed_types: if allowed_type.is_valid_literal(literal_value): literal_expr = convert_literal(arg_in, allowed_type) stack_args.append(literal_expr) @@ -238,7 +258,7 @@ def _map_call( return IntrinsicCall( source_location=node_location, - wtype=_return_types_to_wtype(op_mapping.stack_outputs, node_location), + wtype=op_mapping.result.wtype, op_code=op_mapping.op_code, immediates=immediates, stack_args=stack_args, diff --git a/src/puya/awst_build/intrinsic_data.py b/src/puya/awst_build/intrinsic_data.py index fb296cc069..89759b699a 100644 --- a/src/puya/awst_build/intrinsic_data.py +++ b/src/puya/awst_build/intrinsic_data.py @@ -1,10394 +1,4033 @@ -from puya.awst import wtypes +import typing +from collections.abc import Mapping, Sequence + +from puya.awst_build import pytypes from puya.awst_build.intrinsic_models import ( FunctionOpMapping, - ImmediateArgMapping, - StackArgMapping, + PropertyOpMapping, ) -ENUM_CLASSES = { - "algopy.op.Base64": { - "URLEncoding": "URLEncoding", - "StdEncoding": "StdEncoding", - }, - "algopy.op.ECDSA": { - "Secp256k1": "Secp256k1", - "Secp256r1": "Secp256r1", - }, - "algopy.op.VrfVerify": { - "VrfAlgorand": "VrfAlgorand", - }, - "algopy.op.EC": { - "BN254g1": "BN254g1", - "BN254g2": "BN254g2", - "BLS12_381g1": "BLS12_381g1", - "BLS12_381g2": "BLS12_381g2", - }, -} +ENUM_CLASSES: typing.Final[Mapping[str, Mapping[str, str]]] = dict( + Base64=dict( + URLEncoding="URLEncoding", + StdEncoding="StdEncoding", + ), + ECDSA=dict( + Secp256k1="Secp256k1", + Secp256r1="Secp256r1", + ), + VrfVerify=dict( + VrfAlgorand="VrfAlgorand", + ), + EC=dict( + BN254g1="BN254g1", + BN254g2="BN254g2", + BLS12_381g1="BLS12_381g1", + BLS12_381g2="BLS12_381g2", + ), +) -STUB_TO_AST_MAPPER = { - "algopy.op.addw": [ - FunctionOpMapping( - op_code="addw", - is_property=False, - immediates=[], - stack_inputs=[ - StackArgMapping( - arg_name="a", - allowed_types=[ - wtypes.uint64_wtype, - ], - ), - StackArgMapping( - arg_name="b", - allowed_types=[ - wtypes.uint64_wtype, - ], - ), - ], - stack_outputs=[ - wtypes.uint64_wtype, - wtypes.uint64_wtype, - ], - ), - ], - "algopy.op.app_opted_in": [ - FunctionOpMapping( - op_code="app_opted_in", - is_property=False, - immediates=[], - stack_inputs=[ - StackArgMapping( - arg_name="a", - allowed_types=[ - wtypes.account_wtype, - wtypes.uint64_wtype, - ], - ), - StackArgMapping( - arg_name="b", - allowed_types=[ - wtypes.application_wtype, - wtypes.uint64_wtype, - ], - ), - ], - stack_outputs=[ - wtypes.bool_wtype, - ], - ), - ], - "algopy.op.arg": [ - FunctionOpMapping( - op_code="args", - is_property=False, - immediates=[], - stack_inputs=[ - StackArgMapping( - arg_name="a", - allowed_types=[ - wtypes.uint64_wtype, - ], - ), - ], - stack_outputs=[ - wtypes.bytes_wtype, - ], - ), - FunctionOpMapping( - op_code="arg", - is_property=False, - immediates=[ - ImmediateArgMapping( - arg_name="a", - literal_type=int, - ), - ], - stack_inputs=[], - stack_outputs=[ - wtypes.bytes_wtype, - ], - ), - ], - "algopy.op.balance": [ - FunctionOpMapping( - op_code="balance", - is_property=False, - immediates=[], - stack_inputs=[ - StackArgMapping( - arg_name="a", - allowed_types=[ - wtypes.account_wtype, - wtypes.uint64_wtype, - ], - ), - ], - stack_outputs=[ - wtypes.uint64_wtype, - ], - ), - ], - "algopy.op.base64_decode": [ - FunctionOpMapping( - op_code="base64_decode", - is_property=False, - immediates=[ - ImmediateArgMapping( - arg_name="e", - literal_type=str, - ), - ], - stack_inputs=[ - StackArgMapping( - arg_name="a", - allowed_types=[ - wtypes.bytes_wtype, - ], - ), - ], - stack_outputs=[ - wtypes.bytes_wtype, - ], - ), - ], - "algopy.op.bitlen": [ - FunctionOpMapping( - op_code="bitlen", - is_property=False, - immediates=[], - stack_inputs=[ - StackArgMapping( - arg_name="a", - allowed_types=[ - wtypes.bytes_wtype, - wtypes.uint64_wtype, - ], - ), - ], - stack_outputs=[ - wtypes.uint64_wtype, - ], - ), - ], - "algopy.op.bsqrt": [ - FunctionOpMapping( - op_code="bsqrt", - is_property=False, - immediates=[], - stack_inputs=[ - StackArgMapping( - arg_name="a", - allowed_types=[ - wtypes.biguint_wtype, - ], - ), - ], - stack_outputs=[ - wtypes.biguint_wtype, - ], - ), - ], - "algopy.op.btoi": [ - FunctionOpMapping( - op_code="btoi", - is_property=False, - immediates=[], - stack_inputs=[ - StackArgMapping( - arg_name="a", - allowed_types=[ - wtypes.bytes_wtype, - ], - ), - ], - stack_outputs=[ - wtypes.uint64_wtype, - ], - ), - ], - "algopy.op.bzero": [ - FunctionOpMapping( - op_code="bzero", - is_property=False, - immediates=[], - stack_inputs=[ - StackArgMapping( - arg_name="a", - allowed_types=[ - wtypes.uint64_wtype, - ], - ), - ], - stack_outputs=[ - wtypes.bytes_wtype, - ], - ), - ], - "algopy.op.concat": [ - FunctionOpMapping( - op_code="concat", - is_property=False, - immediates=[], - stack_inputs=[ - StackArgMapping( - arg_name="a", - allowed_types=[ - wtypes.bytes_wtype, - ], - ), - StackArgMapping( - arg_name="b", - allowed_types=[ - wtypes.bytes_wtype, - ], - ), - ], - stack_outputs=[ - wtypes.bytes_wtype, - ], - ), - ], - "algopy.op.divmodw": [ - FunctionOpMapping( - op_code="divmodw", - is_property=False, - immediates=[], - stack_inputs=[ - StackArgMapping( - arg_name="a", - allowed_types=[ - wtypes.uint64_wtype, - ], - ), - StackArgMapping( - arg_name="b", - allowed_types=[ - wtypes.uint64_wtype, - ], - ), - StackArgMapping( - arg_name="c", - allowed_types=[ - wtypes.uint64_wtype, - ], - ), - StackArgMapping( - arg_name="d", - allowed_types=[ - wtypes.uint64_wtype, - ], - ), - ], - stack_outputs=[ - wtypes.uint64_wtype, - wtypes.uint64_wtype, - wtypes.uint64_wtype, - wtypes.uint64_wtype, - ], - ), - ], - "algopy.op.divw": [ - FunctionOpMapping( - op_code="divw", - is_property=False, - immediates=[], - stack_inputs=[ - StackArgMapping( - arg_name="a", - allowed_types=[ - wtypes.uint64_wtype, - ], - ), - StackArgMapping( - arg_name="b", - allowed_types=[ - wtypes.uint64_wtype, - ], - ), - StackArgMapping( - arg_name="c", - allowed_types=[ - wtypes.uint64_wtype, - ], - ), - ], - stack_outputs=[ - wtypes.uint64_wtype, - ], - ), - ], - "algopy.op.ecdsa_pk_decompress": [ - FunctionOpMapping( - op_code="ecdsa_pk_decompress", - is_property=False, - immediates=[ - ImmediateArgMapping( - arg_name="v", - literal_type=str, - ), - ], - stack_inputs=[ - StackArgMapping( - arg_name="a", - allowed_types=[ - wtypes.bytes_wtype, - ], - ), - ], - stack_outputs=[ - wtypes.bytes_wtype, - wtypes.bytes_wtype, - ], - ), - ], - "algopy.op.ecdsa_pk_recover": [ - FunctionOpMapping( - op_code="ecdsa_pk_recover", - is_property=False, - immediates=[ - ImmediateArgMapping( - arg_name="v", - literal_type=str, - ), - ], - stack_inputs=[ - StackArgMapping( - arg_name="a", - allowed_types=[ - wtypes.bytes_wtype, - ], - ), - StackArgMapping( - arg_name="b", - allowed_types=[ - wtypes.uint64_wtype, - ], - ), - StackArgMapping( - arg_name="c", - allowed_types=[ - wtypes.bytes_wtype, - ], - ), - StackArgMapping( - arg_name="d", - allowed_types=[ - wtypes.bytes_wtype, - ], - ), - ], - stack_outputs=[ - wtypes.bytes_wtype, - wtypes.bytes_wtype, - ], - ), - ], - "algopy.op.ecdsa_verify": [ - FunctionOpMapping( - op_code="ecdsa_verify", - is_property=False, - immediates=[ - ImmediateArgMapping( - arg_name="v", - literal_type=str, - ), - ], - stack_inputs=[ - StackArgMapping( - arg_name="a", - allowed_types=[ - wtypes.bytes_wtype, - ], - ), - StackArgMapping( - arg_name="b", - allowed_types=[ - wtypes.bytes_wtype, - ], - ), - StackArgMapping( - arg_name="c", - allowed_types=[ - wtypes.bytes_wtype, - ], - ), - StackArgMapping( - arg_name="d", - allowed_types=[ - wtypes.bytes_wtype, - ], - ), - StackArgMapping( - arg_name="e", - allowed_types=[ - wtypes.bytes_wtype, - ], - ), - ], - stack_outputs=[ - wtypes.bool_wtype, - ], - ), - ], - "algopy.op.ed25519verify": [ +FUNC_TO_AST_MAPPER: typing.Final[Mapping[str, Sequence[FunctionOpMapping]]] = dict( + addw=( FunctionOpMapping( - op_code="ed25519verify", - is_property=False, - immediates=[], - stack_inputs=[ - StackArgMapping( - arg_name="a", - allowed_types=[ - wtypes.bytes_wtype, - ], - ), - StackArgMapping( - arg_name="b", - allowed_types=[ - wtypes.bytes_wtype, - ], - ), - StackArgMapping( - arg_name="c", - allowed_types=[ - wtypes.bytes_wtype, - ], - ), - ], - stack_outputs=[ - wtypes.bool_wtype, - ], - ), - ], - "algopy.op.ed25519verify_bare": [ - FunctionOpMapping( - op_code="ed25519verify_bare", - is_property=False, - immediates=[], - stack_inputs=[ - StackArgMapping( - arg_name="a", - allowed_types=[ - wtypes.bytes_wtype, - ], - ), - StackArgMapping( - arg_name="b", - allowed_types=[ - wtypes.bytes_wtype, - ], - ), - StackArgMapping( - arg_name="c", - allowed_types=[ - wtypes.bytes_wtype, - ], - ), - ], - stack_outputs=[ - wtypes.bool_wtype, - ], - ), - ], - "algopy.op.err": [ - FunctionOpMapping( - op_code="err", - is_property=False, - immediates=[], - stack_inputs=[], - stack_outputs=[], - ), - ], - "algopy.op.exit": [ - FunctionOpMapping( - op_code="return", - is_property=False, - immediates=[], - stack_inputs=[ - StackArgMapping( - arg_name="a", - allowed_types=[ - wtypes.uint64_wtype, - ], - ), - ], - stack_outputs=[], - ), - ], - "algopy.op.exp": [ - FunctionOpMapping( - op_code="exp", - is_property=False, - immediates=[], - stack_inputs=[ - StackArgMapping( - arg_name="a", - allowed_types=[ - wtypes.uint64_wtype, - ], - ), - StackArgMapping( - arg_name="b", - allowed_types=[ - wtypes.uint64_wtype, - ], - ), - ], - stack_outputs=[ - wtypes.uint64_wtype, - ], - ), - ], - "algopy.op.expw": [ - FunctionOpMapping( - op_code="expw", - is_property=False, - immediates=[], - stack_inputs=[ - StackArgMapping( - arg_name="a", - allowed_types=[ - wtypes.uint64_wtype, - ], - ), - StackArgMapping( - arg_name="b", - allowed_types=[ - wtypes.uint64_wtype, - ], - ), - ], - stack_outputs=[ - wtypes.uint64_wtype, - wtypes.uint64_wtype, - ], - ), - ], - "algopy.op.extract": [ - FunctionOpMapping( - op_code="extract3", - is_property=False, - immediates=[], - stack_inputs=[ - StackArgMapping( - arg_name="a", - allowed_types=[ - wtypes.bytes_wtype, - ], - ), - StackArgMapping( - arg_name="b", - allowed_types=[ - wtypes.uint64_wtype, - ], - ), - StackArgMapping( - arg_name="c", - allowed_types=[ - wtypes.uint64_wtype, - ], - ), - ], - stack_outputs=[ - wtypes.bytes_wtype, - ], - ), - FunctionOpMapping( - op_code="extract", - is_property=False, - immediates=[ - ImmediateArgMapping( - arg_name="b", - literal_type=int, - ), - ImmediateArgMapping( - arg_name="c", - literal_type=int, - ), - ], - stack_inputs=[ - StackArgMapping( - arg_name="a", - allowed_types=[ - wtypes.bytes_wtype, - ], - ), - ], - stack_outputs=[ - wtypes.bytes_wtype, - ], - ), - ], - "algopy.op.extract_uint16": [ - FunctionOpMapping( - op_code="extract_uint16", - is_property=False, - immediates=[], - stack_inputs=[ - StackArgMapping( - arg_name="a", - allowed_types=[ - wtypes.bytes_wtype, - ], - ), - StackArgMapping( - arg_name="b", - allowed_types=[ - wtypes.uint64_wtype, - ], - ), - ], - stack_outputs=[ - wtypes.uint64_wtype, - ], - ), - ], - "algopy.op.extract_uint32": [ - FunctionOpMapping( - op_code="extract_uint32", - is_property=False, - immediates=[], - stack_inputs=[ - StackArgMapping( - arg_name="a", - allowed_types=[ - wtypes.bytes_wtype, - ], - ), - StackArgMapping( - arg_name="b", - allowed_types=[ - wtypes.uint64_wtype, - ], - ), - ], - stack_outputs=[ - wtypes.uint64_wtype, - ], - ), - ], - "algopy.op.extract_uint64": [ - FunctionOpMapping( - op_code="extract_uint64", - is_property=False, - immediates=[], - stack_inputs=[ - StackArgMapping( - arg_name="a", - allowed_types=[ - wtypes.bytes_wtype, - ], - ), - StackArgMapping( - arg_name="b", - allowed_types=[ - wtypes.uint64_wtype, - ], - ), - ], - stack_outputs=[ - wtypes.uint64_wtype, - ], - ), - ], - "algopy.op.gaid": [ - FunctionOpMapping( - op_code="gaids", - is_property=False, - immediates=[], - stack_inputs=[ - StackArgMapping( - arg_name="a", - allowed_types=[ - wtypes.uint64_wtype, - ], - ), - ], - stack_outputs=[ - wtypes.application_wtype, - ], - ), - FunctionOpMapping( - op_code="gaid", - is_property=False, - immediates=[ - ImmediateArgMapping( - arg_name="a", - literal_type=int, - ), - ], - stack_inputs=[], - stack_outputs=[ - wtypes.application_wtype, - ], - ), - ], - "algopy.op.getbit": [ - FunctionOpMapping( - op_code="getbit", - is_property=False, - immediates=[], - stack_inputs=[ - StackArgMapping( - arg_name="a", - allowed_types=[ - wtypes.bytes_wtype, - wtypes.uint64_wtype, - ], - ), - StackArgMapping( - arg_name="b", - allowed_types=[ - wtypes.uint64_wtype, - ], - ), - ], - stack_outputs=[ - wtypes.uint64_wtype, - ], + "addw", + stack_inputs=dict(a=(pytypes.UInt64Type,), b=(pytypes.UInt64Type,)), + result=pytypes.GenericTupleType.parameterise( + (pytypes.UInt64Type, pytypes.UInt64Type), source_location=None + ), ), - ], - "algopy.op.getbyte": [ - FunctionOpMapping( - op_code="getbyte", - is_property=False, - immediates=[], - stack_inputs=[ - StackArgMapping( - arg_name="a", - allowed_types=[ - wtypes.bytes_wtype, - ], - ), - StackArgMapping( - arg_name="b", - allowed_types=[ - wtypes.uint64_wtype, - ], - ), - ], - stack_outputs=[ - wtypes.uint64_wtype, - ], + ), + app_opted_in=( + FunctionOpMapping( + "app_opted_in", + stack_inputs=dict( + a=(pytypes.AccountType, pytypes.UInt64Type), + b=(pytypes.ApplicationType, pytypes.UInt64Type), + ), + result=pytypes.BoolType, ), - ], - "algopy.op.gload_bytes": [ + ), + arg=( + FunctionOpMapping( + "args", + stack_inputs=dict(a=(pytypes.UInt64Type,)), + result=pytypes.BytesType, + ), + FunctionOpMapping( + "arg", + immediates=dict(a=int), + result=pytypes.BytesType, + ), + ), + balance=( + FunctionOpMapping( + "balance", + stack_inputs=dict(a=(pytypes.AccountType, pytypes.UInt64Type)), + result=pytypes.UInt64Type, + ), + ), + base64_decode=( + FunctionOpMapping( + "base64_decode", + immediates=dict(e=str), + stack_inputs=dict(a=(pytypes.BytesType,)), + result=pytypes.BytesType, + ), + ), + bitlen=( + FunctionOpMapping( + "bitlen", + stack_inputs=dict(a=(pytypes.BytesType, pytypes.UInt64Type)), + result=pytypes.UInt64Type, + ), + ), + bsqrt=( + FunctionOpMapping( + "bsqrt", + stack_inputs=dict(a=(pytypes.BigUIntType,)), + result=pytypes.BigUIntType, + ), + ), + btoi=( + FunctionOpMapping( + "btoi", + stack_inputs=dict(a=(pytypes.BytesType,)), + result=pytypes.UInt64Type, + ), + ), + bzero=( + FunctionOpMapping( + "bzero", + stack_inputs=dict(a=(pytypes.UInt64Type,)), + result=pytypes.BytesType, + ), + ), + concat=( + FunctionOpMapping( + "concat", + stack_inputs=dict(a=(pytypes.BytesType,), b=(pytypes.BytesType,)), + result=pytypes.BytesType, + ), + ), + divmodw=( + FunctionOpMapping( + "divmodw", + stack_inputs=dict( + a=(pytypes.UInt64Type,), + b=(pytypes.UInt64Type,), + c=(pytypes.UInt64Type,), + d=(pytypes.UInt64Type,), + ), + result=pytypes.GenericTupleType.parameterise( + (pytypes.UInt64Type, pytypes.UInt64Type, pytypes.UInt64Type, pytypes.UInt64Type), + source_location=None, + ), + ), + ), + divw=( + FunctionOpMapping( + "divw", + stack_inputs=dict( + a=(pytypes.UInt64Type,), b=(pytypes.UInt64Type,), c=(pytypes.UInt64Type,) + ), + result=pytypes.UInt64Type, + ), + ), + ecdsa_pk_decompress=( + FunctionOpMapping( + "ecdsa_pk_decompress", + immediates=dict(v=str), + stack_inputs=dict(a=(pytypes.BytesType,)), + result=pytypes.GenericTupleType.parameterise( + (pytypes.BytesType, pytypes.BytesType), source_location=None + ), + ), + ), + ecdsa_pk_recover=( + FunctionOpMapping( + "ecdsa_pk_recover", + immediates=dict(v=str), + stack_inputs=dict( + a=(pytypes.BytesType,), + b=(pytypes.UInt64Type,), + c=(pytypes.BytesType,), + d=(pytypes.BytesType,), + ), + result=pytypes.GenericTupleType.parameterise( + (pytypes.BytesType, pytypes.BytesType), source_location=None + ), + ), + ), + ecdsa_verify=( + FunctionOpMapping( + "ecdsa_verify", + immediates=dict(v=str), + stack_inputs=dict( + a=(pytypes.BytesType,), + b=(pytypes.BytesType,), + c=(pytypes.BytesType,), + d=(pytypes.BytesType,), + e=(pytypes.BytesType,), + ), + result=pytypes.BoolType, + ), + ), + ed25519verify=( + FunctionOpMapping( + "ed25519verify", + stack_inputs=dict( + a=(pytypes.BytesType,), b=(pytypes.BytesType,), c=(pytypes.BytesType,) + ), + result=pytypes.BoolType, + ), + ), + ed25519verify_bare=( + FunctionOpMapping( + "ed25519verify_bare", + stack_inputs=dict( + a=(pytypes.BytesType,), b=(pytypes.BytesType,), c=(pytypes.BytesType,) + ), + result=pytypes.BoolType, + ), + ), + err=( FunctionOpMapping( - op_code="gloadss", - is_property=False, - immediates=[], - stack_inputs=[ - StackArgMapping( - arg_name="a", - allowed_types=[ - wtypes.uint64_wtype, - ], - ), - StackArgMapping( - arg_name="b", - allowed_types=[ - wtypes.uint64_wtype, - ], - ), - ], - stack_outputs=[ - wtypes.bytes_wtype, - ], + "err", ), + ), + exit=( FunctionOpMapping( - op_code="gload", - is_property=False, - immediates=[ - ImmediateArgMapping( - arg_name="a", - literal_type=int, - ), - ImmediateArgMapping( - arg_name="b", - literal_type=int, - ), - ], - stack_inputs=[], - stack_outputs=[ - wtypes.bytes_wtype, - ], + "return", + stack_inputs=dict(a=(pytypes.UInt64Type,)), ), + ), + exp=( FunctionOpMapping( - op_code="gloads", - is_property=False, - immediates=[ - ImmediateArgMapping( - arg_name="b", - literal_type=int, - ), - ], - stack_inputs=[ - StackArgMapping( - arg_name="a", - allowed_types=[ - wtypes.uint64_wtype, - ], - ), - ], - stack_outputs=[ - wtypes.bytes_wtype, - ], + "exp", + stack_inputs=dict(a=(pytypes.UInt64Type,), b=(pytypes.UInt64Type,)), + result=pytypes.UInt64Type, ), - ], - "algopy.op.gload_uint64": [ + ), + expw=( FunctionOpMapping( - op_code="gloadss", - is_property=False, - immediates=[], - stack_inputs=[ - StackArgMapping( - arg_name="a", - allowed_types=[ - wtypes.uint64_wtype, - ], - ), - StackArgMapping( - arg_name="b", - allowed_types=[ - wtypes.uint64_wtype, - ], - ), - ], - stack_outputs=[ - wtypes.uint64_wtype, - ], + "expw", + stack_inputs=dict(a=(pytypes.UInt64Type,), b=(pytypes.UInt64Type,)), + result=pytypes.GenericTupleType.parameterise( + (pytypes.UInt64Type, pytypes.UInt64Type), source_location=None + ), ), + ), + extract=( FunctionOpMapping( - op_code="gload", - is_property=False, - immediates=[ - ImmediateArgMapping( - arg_name="a", - literal_type=int, - ), - ImmediateArgMapping( - arg_name="b", - literal_type=int, - ), - ], - stack_inputs=[], - stack_outputs=[ - wtypes.uint64_wtype, - ], + "extract3", + stack_inputs=dict( + a=(pytypes.BytesType,), b=(pytypes.UInt64Type,), c=(pytypes.UInt64Type,) + ), + result=pytypes.BytesType, ), FunctionOpMapping( - op_code="gloads", - is_property=False, - immediates=[ - ImmediateArgMapping( - arg_name="b", - literal_type=int, - ), - ], - stack_inputs=[ - StackArgMapping( - arg_name="a", - allowed_types=[ - wtypes.uint64_wtype, - ], - ), - ], - stack_outputs=[ - wtypes.uint64_wtype, - ], + "extract", + immediates=dict(b=int, c=int), + stack_inputs=dict(a=(pytypes.BytesType,)), + result=pytypes.BytesType, ), - ], - "algopy.op.itob": [ + ), + extract_uint16=( FunctionOpMapping( - op_code="itob", - is_property=False, - immediates=[], - stack_inputs=[ - StackArgMapping( - arg_name="a", - allowed_types=[ - wtypes.uint64_wtype, - ], - ), - ], - stack_outputs=[ - wtypes.bytes_wtype, - ], + "extract_uint16", + stack_inputs=dict(a=(pytypes.BytesType,), b=(pytypes.UInt64Type,)), + result=pytypes.UInt64Type, ), - ], - "algopy.op.keccak256": [ + ), + extract_uint32=( FunctionOpMapping( - op_code="keccak256", - is_property=False, - immediates=[], - stack_inputs=[ - StackArgMapping( - arg_name="a", - allowed_types=[ - wtypes.bytes_wtype, - ], - ), - ], - stack_outputs=[ - wtypes.bytes_wtype, - ], + "extract_uint32", + stack_inputs=dict(a=(pytypes.BytesType,), b=(pytypes.UInt64Type,)), + result=pytypes.UInt64Type, ), - ], - "algopy.op.min_balance": [ + ), + extract_uint64=( FunctionOpMapping( - op_code="min_balance", - is_property=False, - immediates=[], - stack_inputs=[ - StackArgMapping( - arg_name="a", - allowed_types=[ - wtypes.account_wtype, - wtypes.uint64_wtype, - ], - ), - ], - stack_outputs=[ - wtypes.uint64_wtype, - ], + "extract_uint64", + stack_inputs=dict(a=(pytypes.BytesType,), b=(pytypes.UInt64Type,)), + result=pytypes.UInt64Type, ), - ], - "algopy.op.mulw": [ + ), + gaid=( FunctionOpMapping( - op_code="mulw", - is_property=False, - immediates=[], - stack_inputs=[ - StackArgMapping( - arg_name="a", - allowed_types=[ - wtypes.uint64_wtype, - ], - ), - StackArgMapping( - arg_name="b", - allowed_types=[ - wtypes.uint64_wtype, - ], - ), - ], - stack_outputs=[ - wtypes.uint64_wtype, - wtypes.uint64_wtype, - ], - ), - ], - "algopy.op.replace": [ - FunctionOpMapping( - op_code="replace3", - is_property=False, - immediates=[], - stack_inputs=[ - StackArgMapping( - arg_name="a", - allowed_types=[ - wtypes.bytes_wtype, - ], - ), - StackArgMapping( - arg_name="b", - allowed_types=[ - wtypes.uint64_wtype, - ], - ), - StackArgMapping( - arg_name="c", - allowed_types=[ - wtypes.bytes_wtype, - ], - ), - ], - stack_outputs=[ - wtypes.bytes_wtype, - ], + "gaids", + stack_inputs=dict(a=(pytypes.UInt64Type,)), + result=pytypes.ApplicationType, ), FunctionOpMapping( - op_code="replace2", - is_property=False, - immediates=[ - ImmediateArgMapping( - arg_name="b", - literal_type=int, - ), - ], - stack_inputs=[ - StackArgMapping( - arg_name="a", - allowed_types=[ - wtypes.bytes_wtype, - ], - ), - StackArgMapping( - arg_name="c", - allowed_types=[ - wtypes.bytes_wtype, - ], - ), - ], - stack_outputs=[ - wtypes.bytes_wtype, - ], + "gaid", + immediates=dict(a=int), + result=pytypes.ApplicationType, ), - ], - "algopy.op.select_bytes": [ + ), + getbit=( FunctionOpMapping( - op_code="select", - is_property=False, - immediates=[], - stack_inputs=[ - StackArgMapping( - arg_name="a", - allowed_types=[ - wtypes.bytes_wtype, - ], - ), - StackArgMapping( - arg_name="b", - allowed_types=[ - wtypes.bytes_wtype, - ], - ), - StackArgMapping( - arg_name="c", - allowed_types=[ - wtypes.bool_wtype, - wtypes.uint64_wtype, - ], - ), - ], - stack_outputs=[ - wtypes.bytes_wtype, - ], + "getbit", + stack_inputs=dict(a=(pytypes.BytesType, pytypes.UInt64Type), b=(pytypes.UInt64Type,)), + result=pytypes.UInt64Type, ), - ], - "algopy.op.select_uint64": [ + ), + getbyte=( FunctionOpMapping( - op_code="select", - is_property=False, - immediates=[], - stack_inputs=[ - StackArgMapping( - arg_name="a", - allowed_types=[ - wtypes.uint64_wtype, - ], - ), - StackArgMapping( - arg_name="b", - allowed_types=[ - wtypes.uint64_wtype, - ], - ), - StackArgMapping( - arg_name="c", - allowed_types=[ - wtypes.bool_wtype, - wtypes.uint64_wtype, - ], - ), - ], - stack_outputs=[ - wtypes.uint64_wtype, - ], + "getbyte", + stack_inputs=dict(a=(pytypes.BytesType,), b=(pytypes.UInt64Type,)), + result=pytypes.UInt64Type, ), - ], - "algopy.op.setbit_bytes": [ + ), + gload_bytes=( FunctionOpMapping( - op_code="setbit", - is_property=False, - immediates=[], - stack_inputs=[ - StackArgMapping( - arg_name="a", - allowed_types=[ - wtypes.bytes_wtype, - ], - ), - StackArgMapping( - arg_name="b", - allowed_types=[ - wtypes.uint64_wtype, - ], - ), - StackArgMapping( - arg_name="c", - allowed_types=[ - wtypes.uint64_wtype, - ], - ), - ], - stack_outputs=[ - wtypes.bytes_wtype, - ], + "gloadss", + stack_inputs=dict(a=(pytypes.UInt64Type,), b=(pytypes.UInt64Type,)), + result=pytypes.BytesType, ), - ], - "algopy.op.setbit_uint64": [ FunctionOpMapping( - op_code="setbit", - is_property=False, - immediates=[], - stack_inputs=[ - StackArgMapping( - arg_name="a", - allowed_types=[ - wtypes.uint64_wtype, - ], - ), - StackArgMapping( - arg_name="b", - allowed_types=[ - wtypes.uint64_wtype, - ], - ), - StackArgMapping( - arg_name="c", - allowed_types=[ - wtypes.uint64_wtype, - ], - ), - ], - stack_outputs=[ - wtypes.uint64_wtype, - ], + "gload", + immediates=dict(a=int, b=int), + result=pytypes.BytesType, ), - ], - "algopy.op.setbyte": [ FunctionOpMapping( - op_code="setbyte", - is_property=False, - immediates=[], - stack_inputs=[ - StackArgMapping( - arg_name="a", - allowed_types=[ - wtypes.bytes_wtype, - ], - ), - StackArgMapping( - arg_name="b", - allowed_types=[ - wtypes.uint64_wtype, - ], - ), - StackArgMapping( - arg_name="c", - allowed_types=[ - wtypes.uint64_wtype, - ], - ), - ], - stack_outputs=[ - wtypes.bytes_wtype, - ], + "gloads", + immediates=dict(b=int), + stack_inputs=dict(a=(pytypes.UInt64Type,)), + result=pytypes.BytesType, ), - ], - "algopy.op.sha256": [ + ), + gload_uint64=( FunctionOpMapping( - op_code="sha256", - is_property=False, - immediates=[], - stack_inputs=[ - StackArgMapping( - arg_name="a", - allowed_types=[ - wtypes.bytes_wtype, - ], - ), - ], - stack_outputs=[ - wtypes.bytes_wtype, - ], + "gloadss", + stack_inputs=dict(a=(pytypes.UInt64Type,), b=(pytypes.UInt64Type,)), + result=pytypes.UInt64Type, ), - ], - "algopy.op.sha3_256": [ FunctionOpMapping( - op_code="sha3_256", - is_property=False, - immediates=[], - stack_inputs=[ - StackArgMapping( - arg_name="a", - allowed_types=[ - wtypes.bytes_wtype, - ], - ), - ], - stack_outputs=[ - wtypes.bytes_wtype, - ], + "gload", + immediates=dict(a=int, b=int), + result=pytypes.UInt64Type, ), - ], - "algopy.op.sha512_256": [ FunctionOpMapping( - op_code="sha512_256", - is_property=False, - immediates=[], - stack_inputs=[ - StackArgMapping( - arg_name="a", - allowed_types=[ - wtypes.bytes_wtype, - ], - ), - ], - stack_outputs=[ - wtypes.bytes_wtype, - ], + "gloads", + immediates=dict(b=int), + stack_inputs=dict(a=(pytypes.UInt64Type,)), + result=pytypes.UInt64Type, ), - ], - "algopy.op.shl": [ + ), + itob=( FunctionOpMapping( - op_code="shl", - is_property=False, - immediates=[], - stack_inputs=[ - StackArgMapping( - arg_name="a", - allowed_types=[ - wtypes.uint64_wtype, - ], - ), - StackArgMapping( - arg_name="b", - allowed_types=[ - wtypes.uint64_wtype, - ], - ), - ], - stack_outputs=[ - wtypes.uint64_wtype, - ], + "itob", + stack_inputs=dict(a=(pytypes.UInt64Type,)), + result=pytypes.BytesType, ), - ], - "algopy.op.shr": [ + ), + keccak256=( FunctionOpMapping( - op_code="shr", - is_property=False, - immediates=[], - stack_inputs=[ - StackArgMapping( - arg_name="a", - allowed_types=[ - wtypes.uint64_wtype, - ], - ), - StackArgMapping( - arg_name="b", - allowed_types=[ - wtypes.uint64_wtype, - ], - ), - ], - stack_outputs=[ - wtypes.uint64_wtype, - ], + "keccak256", + stack_inputs=dict(a=(pytypes.BytesType,)), + result=pytypes.BytesType, ), - ], - "algopy.op.sqrt": [ + ), + min_balance=( FunctionOpMapping( - op_code="sqrt", - is_property=False, - immediates=[], - stack_inputs=[ - StackArgMapping( - arg_name="a", - allowed_types=[ - wtypes.uint64_wtype, - ], - ), - ], - stack_outputs=[ - wtypes.uint64_wtype, - ], + "min_balance", + stack_inputs=dict(a=(pytypes.AccountType, pytypes.UInt64Type)), + result=pytypes.UInt64Type, ), - ], - "algopy.op.substring": [ + ), + mulw=( FunctionOpMapping( - op_code="substring3", - is_property=False, - immediates=[], - stack_inputs=[ - StackArgMapping( - arg_name="a", - allowed_types=[ - wtypes.bytes_wtype, - ], - ), - StackArgMapping( - arg_name="b", - allowed_types=[ - wtypes.uint64_wtype, - ], - ), - StackArgMapping( - arg_name="c", - allowed_types=[ - wtypes.uint64_wtype, - ], - ), - ], - stack_outputs=[ - wtypes.bytes_wtype, - ], + "mulw", + stack_inputs=dict(a=(pytypes.UInt64Type,), b=(pytypes.UInt64Type,)), + result=pytypes.GenericTupleType.parameterise( + (pytypes.UInt64Type, pytypes.UInt64Type), source_location=None + ), ), + ), + replace=( FunctionOpMapping( - op_code="substring", - is_property=False, - immediates=[ - ImmediateArgMapping( - arg_name="b", - literal_type=int, - ), - ImmediateArgMapping( - arg_name="c", - literal_type=int, - ), - ], - stack_inputs=[ - StackArgMapping( - arg_name="a", - allowed_types=[ - wtypes.bytes_wtype, - ], - ), - ], - stack_outputs=[ - wtypes.bytes_wtype, - ], + "replace3", + stack_inputs=dict( + a=(pytypes.BytesType,), b=(pytypes.UInt64Type,), c=(pytypes.BytesType,) + ), + result=pytypes.BytesType, ), - ], - "algopy.op.vrf_verify": [ - FunctionOpMapping( - op_code="vrf_verify", - is_property=False, - immediates=[ - ImmediateArgMapping( - arg_name="s", - literal_type=str, - ), - ], - stack_inputs=[ - StackArgMapping( - arg_name="a", - allowed_types=[ - wtypes.bytes_wtype, - ], - ), - StackArgMapping( - arg_name="b", - allowed_types=[ - wtypes.bytes_wtype, - ], - ), - StackArgMapping( - arg_name="c", - allowed_types=[ - wtypes.bytes_wtype, - ], - ), - ], - stack_outputs=[ - wtypes.bytes_wtype, - wtypes.bool_wtype, - ], - ), - ], - "algopy.op.AcctParamsGet.acct_balance": [ - FunctionOpMapping( - op_code="acct_params_get", - is_property=False, - immediates=[ - "AcctBalance", - ], - stack_inputs=[ - StackArgMapping( - arg_name="a", - allowed_types=[ - wtypes.account_wtype, - wtypes.uint64_wtype, - ], - ), - ], - stack_outputs=[ - wtypes.uint64_wtype, - wtypes.bool_wtype, - ], - ), - ], - "algopy.op.AcctParamsGet.acct_min_balance": [ - FunctionOpMapping( - op_code="acct_params_get", - is_property=False, - immediates=[ - "AcctMinBalance", - ], - stack_inputs=[ - StackArgMapping( - arg_name="a", - allowed_types=[ - wtypes.account_wtype, - wtypes.uint64_wtype, - ], - ), - ], - stack_outputs=[ - wtypes.uint64_wtype, - wtypes.bool_wtype, - ], - ), - ], - "algopy.op.AcctParamsGet.acct_auth_addr": [ - FunctionOpMapping( - op_code="acct_params_get", - is_property=False, - immediates=[ - "AcctAuthAddr", - ], - stack_inputs=[ - StackArgMapping( - arg_name="a", - allowed_types=[ - wtypes.account_wtype, - wtypes.uint64_wtype, - ], - ), - ], - stack_outputs=[ - wtypes.account_wtype, - wtypes.bool_wtype, - ], - ), - ], - "algopy.op.AcctParamsGet.acct_total_num_uint": [ - FunctionOpMapping( - op_code="acct_params_get", - is_property=False, - immediates=[ - "AcctTotalNumUint", - ], - stack_inputs=[ - StackArgMapping( - arg_name="a", - allowed_types=[ - wtypes.account_wtype, - wtypes.uint64_wtype, - ], - ), - ], - stack_outputs=[ - wtypes.uint64_wtype, - wtypes.bool_wtype, - ], - ), - ], - "algopy.op.AcctParamsGet.acct_total_num_byte_slice": [ - FunctionOpMapping( - op_code="acct_params_get", - is_property=False, - immediates=[ - "AcctTotalNumByteSlice", - ], - stack_inputs=[ - StackArgMapping( - arg_name="a", - allowed_types=[ - wtypes.account_wtype, - wtypes.uint64_wtype, - ], - ), - ], - stack_outputs=[ - wtypes.uint64_wtype, - wtypes.bool_wtype, - ], - ), - ], - "algopy.op.AcctParamsGet.acct_total_extra_app_pages": [ - FunctionOpMapping( - op_code="acct_params_get", - is_property=False, - immediates=[ - "AcctTotalExtraAppPages", - ], - stack_inputs=[ - StackArgMapping( - arg_name="a", - allowed_types=[ - wtypes.account_wtype, - wtypes.uint64_wtype, - ], - ), - ], - stack_outputs=[ - wtypes.uint64_wtype, - wtypes.bool_wtype, - ], - ), - ], - "algopy.op.AcctParamsGet.acct_total_apps_created": [ - FunctionOpMapping( - op_code="acct_params_get", - is_property=False, - immediates=[ - "AcctTotalAppsCreated", - ], - stack_inputs=[ - StackArgMapping( - arg_name="a", - allowed_types=[ - wtypes.account_wtype, - wtypes.uint64_wtype, - ], - ), - ], - stack_outputs=[ - wtypes.uint64_wtype, - wtypes.bool_wtype, - ], - ), - ], - "algopy.op.AcctParamsGet.acct_total_apps_opted_in": [ - FunctionOpMapping( - op_code="acct_params_get", - is_property=False, - immediates=[ - "AcctTotalAppsOptedIn", - ], - stack_inputs=[ - StackArgMapping( - arg_name="a", - allowed_types=[ - wtypes.account_wtype, - wtypes.uint64_wtype, - ], - ), - ], - stack_outputs=[ - wtypes.uint64_wtype, - wtypes.bool_wtype, - ], - ), - ], - "algopy.op.AcctParamsGet.acct_total_assets_created": [ - FunctionOpMapping( - op_code="acct_params_get", - is_property=False, - immediates=[ - "AcctTotalAssetsCreated", - ], - stack_inputs=[ - StackArgMapping( - arg_name="a", - allowed_types=[ - wtypes.account_wtype, - wtypes.uint64_wtype, - ], - ), - ], - stack_outputs=[ - wtypes.uint64_wtype, - wtypes.bool_wtype, - ], - ), - ], - "algopy.op.AcctParamsGet.acct_total_assets": [ - FunctionOpMapping( - op_code="acct_params_get", - is_property=False, - immediates=[ - "AcctTotalAssets", - ], - stack_inputs=[ - StackArgMapping( - arg_name="a", - allowed_types=[ - wtypes.account_wtype, - wtypes.uint64_wtype, - ], - ), - ], - stack_outputs=[ - wtypes.uint64_wtype, - wtypes.bool_wtype, - ], - ), - ], - "algopy.op.AcctParamsGet.acct_total_boxes": [ - FunctionOpMapping( - op_code="acct_params_get", - is_property=False, - immediates=[ - "AcctTotalBoxes", - ], - stack_inputs=[ - StackArgMapping( - arg_name="a", - allowed_types=[ - wtypes.account_wtype, - wtypes.uint64_wtype, - ], - ), - ], - stack_outputs=[ - wtypes.uint64_wtype, - wtypes.bool_wtype, - ], - ), - ], - "algopy.op.AcctParamsGet.acct_total_box_bytes": [ - FunctionOpMapping( - op_code="acct_params_get", - is_property=False, - immediates=[ - "AcctTotalBoxBytes", - ], - stack_inputs=[ - StackArgMapping( - arg_name="a", - allowed_types=[ - wtypes.account_wtype, - wtypes.uint64_wtype, - ], - ), - ], - stack_outputs=[ - wtypes.uint64_wtype, - wtypes.bool_wtype, - ], - ), - ], - "algopy.op.AppGlobal.get_bytes": [ FunctionOpMapping( - op_code="app_global_get", - is_property=False, - immediates=[], - stack_inputs=[ - StackArgMapping( - arg_name="a", - allowed_types=[ - wtypes.bytes_wtype, - ], - ), - ], - stack_outputs=[ - wtypes.bytes_wtype, - ], + "replace2", + immediates=dict(b=int), + stack_inputs=dict(a=(pytypes.BytesType,), c=(pytypes.BytesType,)), + result=pytypes.BytesType, ), - ], - "algopy.op.AppGlobal.get_uint64": [ + ), + select_bytes=( FunctionOpMapping( - op_code="app_global_get", - is_property=False, - immediates=[], - stack_inputs=[ - StackArgMapping( - arg_name="a", - allowed_types=[ - wtypes.bytes_wtype, - ], - ), - ], - stack_outputs=[ - wtypes.uint64_wtype, - ], + "select", + stack_inputs=dict( + a=(pytypes.BytesType,), + b=(pytypes.BytesType,), + c=(pytypes.BoolType, pytypes.UInt64Type), + ), + result=pytypes.BytesType, ), - ], - "algopy.op.AppGlobal.get_ex_bytes": [ - FunctionOpMapping( - op_code="app_global_get_ex", - is_property=False, - immediates=[], - stack_inputs=[ - StackArgMapping( - arg_name="a", - allowed_types=[ - wtypes.application_wtype, - wtypes.uint64_wtype, - ], - ), - StackArgMapping( - arg_name="b", - allowed_types=[ - wtypes.bytes_wtype, - ], - ), - ], - stack_outputs=[ - wtypes.bytes_wtype, - wtypes.bool_wtype, - ], - ), - ], - "algopy.op.AppGlobal.get_ex_uint64": [ + ), + select_uint64=( FunctionOpMapping( - op_code="app_global_get_ex", - is_property=False, - immediates=[], - stack_inputs=[ - StackArgMapping( - arg_name="a", - allowed_types=[ - wtypes.application_wtype, - wtypes.uint64_wtype, - ], - ), - StackArgMapping( - arg_name="b", - allowed_types=[ - wtypes.bytes_wtype, - ], - ), - ], - stack_outputs=[ - wtypes.uint64_wtype, - wtypes.bool_wtype, - ], - ), - ], - "algopy.op.AppGlobal.delete": [ - FunctionOpMapping( - op_code="app_global_del", - is_property=False, - immediates=[], - stack_inputs=[ - StackArgMapping( - arg_name="a", - allowed_types=[ - wtypes.bytes_wtype, - ], - ), - ], - stack_outputs=[], + "select", + stack_inputs=dict( + a=(pytypes.UInt64Type,), + b=(pytypes.UInt64Type,), + c=(pytypes.BoolType, pytypes.UInt64Type), + ), + result=pytypes.UInt64Type, ), - ], - "algopy.op.AppGlobal.put": [ + ), + setbit_bytes=( FunctionOpMapping( - op_code="app_global_put", - is_property=False, - immediates=[], - stack_inputs=[ - StackArgMapping( - arg_name="a", - allowed_types=[ - wtypes.bytes_wtype, - ], - ), - StackArgMapping( - arg_name="b", - allowed_types=[ - wtypes.bytes_wtype, - wtypes.uint64_wtype, - ], - ), - ], - stack_outputs=[], + "setbit", + stack_inputs=dict( + a=(pytypes.BytesType,), b=(pytypes.UInt64Type,), c=(pytypes.UInt64Type,) + ), + result=pytypes.BytesType, ), - ], - "algopy.op.AppLocal.get_bytes": [ + ), + setbit_uint64=( FunctionOpMapping( - op_code="app_local_get", - is_property=False, - immediates=[], - stack_inputs=[ - StackArgMapping( - arg_name="a", - allowed_types=[ - wtypes.account_wtype, - wtypes.uint64_wtype, - ], - ), - StackArgMapping( - arg_name="b", - allowed_types=[ - wtypes.bytes_wtype, - ], - ), - ], - stack_outputs=[ - wtypes.bytes_wtype, - ], + "setbit", + stack_inputs=dict( + a=(pytypes.UInt64Type,), b=(pytypes.UInt64Type,), c=(pytypes.UInt64Type,) + ), + result=pytypes.UInt64Type, ), - ], - "algopy.op.AppLocal.get_uint64": [ + ), + setbyte=( FunctionOpMapping( - op_code="app_local_get", - is_property=False, - immediates=[], - stack_inputs=[ - StackArgMapping( - arg_name="a", - allowed_types=[ - wtypes.account_wtype, - wtypes.uint64_wtype, - ], - ), - StackArgMapping( - arg_name="b", - allowed_types=[ - wtypes.bytes_wtype, - ], - ), - ], - stack_outputs=[ - wtypes.uint64_wtype, - ], + "setbyte", + stack_inputs=dict( + a=(pytypes.BytesType,), b=(pytypes.UInt64Type,), c=(pytypes.UInt64Type,) + ), + result=pytypes.BytesType, ), - ], - "algopy.op.AppLocal.get_ex_bytes": [ - FunctionOpMapping( - op_code="app_local_get_ex", - is_property=False, - immediates=[], - stack_inputs=[ - StackArgMapping( - arg_name="a", - allowed_types=[ - wtypes.account_wtype, - wtypes.uint64_wtype, - ], - ), - StackArgMapping( - arg_name="b", - allowed_types=[ - wtypes.application_wtype, - wtypes.uint64_wtype, - ], - ), - StackArgMapping( - arg_name="c", - allowed_types=[ - wtypes.bytes_wtype, - ], - ), - ], - stack_outputs=[ - wtypes.bytes_wtype, - wtypes.bool_wtype, - ], - ), - ], - "algopy.op.AppLocal.get_ex_uint64": [ - FunctionOpMapping( - op_code="app_local_get_ex", - is_property=False, - immediates=[], - stack_inputs=[ - StackArgMapping( - arg_name="a", - allowed_types=[ - wtypes.account_wtype, - wtypes.uint64_wtype, - ], - ), - StackArgMapping( - arg_name="b", - allowed_types=[ - wtypes.application_wtype, - wtypes.uint64_wtype, - ], - ), - StackArgMapping( - arg_name="c", - allowed_types=[ - wtypes.bytes_wtype, - ], - ), - ], - stack_outputs=[ - wtypes.uint64_wtype, - wtypes.bool_wtype, - ], - ), - ], - "algopy.op.AppLocal.delete": [ + ), + sha256=( + FunctionOpMapping( + "sha256", + stack_inputs=dict(a=(pytypes.BytesType,)), + result=pytypes.BytesType, + ), + ), + sha3_256=( + FunctionOpMapping( + "sha3_256", + stack_inputs=dict(a=(pytypes.BytesType,)), + result=pytypes.BytesType, + ), + ), + sha512_256=( + FunctionOpMapping( + "sha512_256", + stack_inputs=dict(a=(pytypes.BytesType,)), + result=pytypes.BytesType, + ), + ), + shl=( + FunctionOpMapping( + "shl", + stack_inputs=dict(a=(pytypes.UInt64Type,), b=(pytypes.UInt64Type,)), + result=pytypes.UInt64Type, + ), + ), + shr=( + FunctionOpMapping( + "shr", + stack_inputs=dict(a=(pytypes.UInt64Type,), b=(pytypes.UInt64Type,)), + result=pytypes.UInt64Type, + ), + ), + sqrt=( + FunctionOpMapping( + "sqrt", + stack_inputs=dict(a=(pytypes.UInt64Type,)), + result=pytypes.UInt64Type, + ), + ), + substring=( FunctionOpMapping( - op_code="app_local_del", - is_property=False, - immediates=[], - stack_inputs=[ - StackArgMapping( - arg_name="a", - allowed_types=[ - wtypes.account_wtype, - wtypes.uint64_wtype, - ], - ), - StackArgMapping( - arg_name="b", - allowed_types=[ - wtypes.bytes_wtype, - ], - ), - ], - stack_outputs=[], - ), - ], - "algopy.op.AppLocal.put": [ + "substring3", + stack_inputs=dict( + a=(pytypes.BytesType,), b=(pytypes.UInt64Type,), c=(pytypes.UInt64Type,) + ), + result=pytypes.BytesType, + ), + FunctionOpMapping( + "substring", + immediates=dict(b=int, c=int), + stack_inputs=dict(a=(pytypes.BytesType,)), + result=pytypes.BytesType, + ), + ), + vrf_verify=( FunctionOpMapping( - op_code="app_local_put", - is_property=False, - immediates=[], - stack_inputs=[ - StackArgMapping( - arg_name="a", - allowed_types=[ - wtypes.account_wtype, - wtypes.uint64_wtype, - ], - ), - StackArgMapping( - arg_name="b", - allowed_types=[ - wtypes.bytes_wtype, - ], - ), - StackArgMapping( - arg_name="c", - allowed_types=[ - wtypes.bytes_wtype, - wtypes.uint64_wtype, - ], - ), - ], - stack_outputs=[], + "vrf_verify", + immediates=dict(s=str), + stack_inputs=dict( + a=(pytypes.BytesType,), b=(pytypes.BytesType,), c=(pytypes.BytesType,) + ), + result=pytypes.GenericTupleType.parameterise( + (pytypes.BytesType, pytypes.BoolType), source_location=None + ), ), - ], - "algopy.op.AppParamsGet.app_approval_program": [ - FunctionOpMapping( - op_code="app_params_get", - is_property=False, - immediates=[ - "AppApprovalProgram", - ], - stack_inputs=[ - StackArgMapping( - arg_name="a", - allowed_types=[ - wtypes.application_wtype, - wtypes.uint64_wtype, - ], - ), - ], - stack_outputs=[ - wtypes.bytes_wtype, - wtypes.bool_wtype, - ], - ), - ], - "algopy.op.AppParamsGet.app_clear_state_program": [ - FunctionOpMapping( - op_code="app_params_get", - is_property=False, - immediates=[ - "AppClearStateProgram", - ], - stack_inputs=[ - StackArgMapping( - arg_name="a", - allowed_types=[ - wtypes.application_wtype, - wtypes.uint64_wtype, - ], - ), - ], - stack_outputs=[ - wtypes.bytes_wtype, - wtypes.bool_wtype, - ], - ), - ], - "algopy.op.AppParamsGet.app_global_num_uint": [ - FunctionOpMapping( - op_code="app_params_get", - is_property=False, - immediates=[ - "AppGlobalNumUint", - ], - stack_inputs=[ - StackArgMapping( - arg_name="a", - allowed_types=[ - wtypes.application_wtype, - wtypes.uint64_wtype, - ], - ), - ], - stack_outputs=[ - wtypes.uint64_wtype, - wtypes.bool_wtype, - ], - ), - ], - "algopy.op.AppParamsGet.app_global_num_byte_slice": [ - FunctionOpMapping( - op_code="app_params_get", - is_property=False, - immediates=[ - "AppGlobalNumByteSlice", - ], - stack_inputs=[ - StackArgMapping( - arg_name="a", - allowed_types=[ - wtypes.application_wtype, - wtypes.uint64_wtype, - ], - ), - ], - stack_outputs=[ - wtypes.uint64_wtype, - wtypes.bool_wtype, - ], - ), - ], - "algopy.op.AppParamsGet.app_local_num_uint": [ - FunctionOpMapping( - op_code="app_params_get", - is_property=False, - immediates=[ - "AppLocalNumUint", - ], - stack_inputs=[ - StackArgMapping( - arg_name="a", - allowed_types=[ - wtypes.application_wtype, - wtypes.uint64_wtype, - ], - ), - ], - stack_outputs=[ - wtypes.uint64_wtype, - wtypes.bool_wtype, - ], - ), - ], - "algopy.op.AppParamsGet.app_local_num_byte_slice": [ - FunctionOpMapping( - op_code="app_params_get", - is_property=False, - immediates=[ - "AppLocalNumByteSlice", - ], - stack_inputs=[ - StackArgMapping( - arg_name="a", - allowed_types=[ - wtypes.application_wtype, - wtypes.uint64_wtype, - ], - ), - ], - stack_outputs=[ - wtypes.uint64_wtype, - wtypes.bool_wtype, - ], - ), - ], - "algopy.op.AppParamsGet.app_extra_program_pages": [ - FunctionOpMapping( - op_code="app_params_get", - is_property=False, - immediates=[ - "AppExtraProgramPages", - ], - stack_inputs=[ - StackArgMapping( - arg_name="a", - allowed_types=[ - wtypes.application_wtype, - wtypes.uint64_wtype, - ], - ), - ], - stack_outputs=[ - wtypes.uint64_wtype, - wtypes.bool_wtype, - ], - ), - ], - "algopy.op.AppParamsGet.app_creator": [ - FunctionOpMapping( - op_code="app_params_get", - is_property=False, - immediates=[ - "AppCreator", - ], - stack_inputs=[ - StackArgMapping( - arg_name="a", - allowed_types=[ - wtypes.application_wtype, - wtypes.uint64_wtype, - ], - ), - ], - stack_outputs=[ - wtypes.account_wtype, - wtypes.bool_wtype, - ], - ), - ], - "algopy.op.AppParamsGet.app_address": [ - FunctionOpMapping( - op_code="app_params_get", - is_property=False, - immediates=[ - "AppAddress", - ], - stack_inputs=[ - StackArgMapping( - arg_name="a", - allowed_types=[ - wtypes.application_wtype, - wtypes.uint64_wtype, - ], - ), - ], - stack_outputs=[ - wtypes.account_wtype, - wtypes.bool_wtype, - ], - ), - ], - "algopy.op.AssetHoldingGet.asset_balance": [ - FunctionOpMapping( - op_code="asset_holding_get", - is_property=False, - immediates=[ - "AssetBalance", - ], - stack_inputs=[ - StackArgMapping( - arg_name="a", - allowed_types=[ - wtypes.account_wtype, - wtypes.uint64_wtype, - ], - ), - StackArgMapping( - arg_name="b", - allowed_types=[ - wtypes.asset_wtype, - wtypes.uint64_wtype, - ], - ), - ], - stack_outputs=[ - wtypes.uint64_wtype, - wtypes.bool_wtype, - ], - ), - ], - "algopy.op.AssetHoldingGet.asset_frozen": [ - FunctionOpMapping( - op_code="asset_holding_get", - is_property=False, - immediates=[ - "AssetFrozen", - ], - stack_inputs=[ - StackArgMapping( - arg_name="a", - allowed_types=[ - wtypes.account_wtype, - wtypes.uint64_wtype, - ], - ), - StackArgMapping( - arg_name="b", - allowed_types=[ - wtypes.asset_wtype, - wtypes.uint64_wtype, - ], - ), - ], - stack_outputs=[ - wtypes.bool_wtype, - wtypes.bool_wtype, - ], - ), - ], - "algopy.op.AssetParamsGet.asset_total": [ - FunctionOpMapping( - op_code="asset_params_get", - is_property=False, - immediates=[ - "AssetTotal", - ], - stack_inputs=[ - StackArgMapping( - arg_name="a", - allowed_types=[ - wtypes.asset_wtype, - wtypes.uint64_wtype, - ], - ), - ], - stack_outputs=[ - wtypes.uint64_wtype, - wtypes.bool_wtype, - ], - ), - ], - "algopy.op.AssetParamsGet.asset_decimals": [ - FunctionOpMapping( - op_code="asset_params_get", - is_property=False, - immediates=[ - "AssetDecimals", - ], - stack_inputs=[ - StackArgMapping( - arg_name="a", - allowed_types=[ - wtypes.asset_wtype, - wtypes.uint64_wtype, - ], - ), - ], - stack_outputs=[ - wtypes.uint64_wtype, - wtypes.bool_wtype, - ], - ), - ], - "algopy.op.AssetParamsGet.asset_default_frozen": [ - FunctionOpMapping( - op_code="asset_params_get", - is_property=False, - immediates=[ - "AssetDefaultFrozen", - ], - stack_inputs=[ - StackArgMapping( - arg_name="a", - allowed_types=[ - wtypes.asset_wtype, - wtypes.uint64_wtype, - ], - ), - ], - stack_outputs=[ - wtypes.bool_wtype, - wtypes.bool_wtype, - ], - ), - ], - "algopy.op.AssetParamsGet.asset_unit_name": [ - FunctionOpMapping( - op_code="asset_params_get", - is_property=False, - immediates=[ - "AssetUnitName", - ], - stack_inputs=[ - StackArgMapping( - arg_name="a", - allowed_types=[ - wtypes.asset_wtype, - wtypes.uint64_wtype, - ], - ), - ], - stack_outputs=[ - wtypes.bytes_wtype, - wtypes.bool_wtype, - ], - ), - ], - "algopy.op.AssetParamsGet.asset_name": [ - FunctionOpMapping( - op_code="asset_params_get", - is_property=False, - immediates=[ - "AssetName", - ], - stack_inputs=[ - StackArgMapping( - arg_name="a", - allowed_types=[ - wtypes.asset_wtype, - wtypes.uint64_wtype, - ], - ), - ], - stack_outputs=[ - wtypes.bytes_wtype, - wtypes.bool_wtype, - ], - ), - ], - "algopy.op.AssetParamsGet.asset_url": [ - FunctionOpMapping( - op_code="asset_params_get", - is_property=False, - immediates=[ - "AssetURL", - ], - stack_inputs=[ - StackArgMapping( - arg_name="a", - allowed_types=[ - wtypes.asset_wtype, - wtypes.uint64_wtype, - ], - ), - ], - stack_outputs=[ - wtypes.bytes_wtype, - wtypes.bool_wtype, - ], - ), - ], - "algopy.op.AssetParamsGet.asset_metadata_hash": [ - FunctionOpMapping( - op_code="asset_params_get", - is_property=False, - immediates=[ - "AssetMetadataHash", - ], - stack_inputs=[ - StackArgMapping( - arg_name="a", - allowed_types=[ - wtypes.asset_wtype, - wtypes.uint64_wtype, - ], - ), - ], - stack_outputs=[ - wtypes.bytes_wtype, - wtypes.bool_wtype, - ], - ), - ], - "algopy.op.AssetParamsGet.asset_manager": [ - FunctionOpMapping( - op_code="asset_params_get", - is_property=False, - immediates=[ - "AssetManager", - ], - stack_inputs=[ - StackArgMapping( - arg_name="a", - allowed_types=[ - wtypes.asset_wtype, - wtypes.uint64_wtype, - ], - ), - ], - stack_outputs=[ - wtypes.account_wtype, - wtypes.bool_wtype, - ], - ), - ], - "algopy.op.AssetParamsGet.asset_reserve": [ - FunctionOpMapping( - op_code="asset_params_get", - is_property=False, - immediates=[ - "AssetReserve", - ], - stack_inputs=[ - StackArgMapping( - arg_name="a", - allowed_types=[ - wtypes.asset_wtype, - wtypes.uint64_wtype, - ], - ), - ], - stack_outputs=[ - wtypes.account_wtype, - wtypes.bool_wtype, - ], - ), - ], - "algopy.op.AssetParamsGet.asset_freeze": [ - FunctionOpMapping( - op_code="asset_params_get", - is_property=False, - immediates=[ - "AssetFreeze", - ], - stack_inputs=[ - StackArgMapping( - arg_name="a", - allowed_types=[ - wtypes.asset_wtype, - wtypes.uint64_wtype, - ], - ), - ], - stack_outputs=[ - wtypes.account_wtype, - wtypes.bool_wtype, - ], - ), - ], - "algopy.op.AssetParamsGet.asset_clawback": [ - FunctionOpMapping( - op_code="asset_params_get", - is_property=False, - immediates=[ - "AssetClawback", - ], - stack_inputs=[ - StackArgMapping( - arg_name="a", - allowed_types=[ - wtypes.asset_wtype, - wtypes.uint64_wtype, - ], - ), - ], - stack_outputs=[ - wtypes.account_wtype, - wtypes.bool_wtype, - ], - ), - ], - "algopy.op.AssetParamsGet.asset_creator": [ - FunctionOpMapping( - op_code="asset_params_get", - is_property=False, - immediates=[ - "AssetCreator", - ], - stack_inputs=[ - StackArgMapping( - arg_name="a", - allowed_types=[ - wtypes.asset_wtype, - wtypes.uint64_wtype, - ], - ), - ], - stack_outputs=[ - wtypes.account_wtype, - wtypes.bool_wtype, - ], - ), - ], - "algopy.op.Block.blk_seed": [ - FunctionOpMapping( - op_code="block", - is_property=False, - immediates=[ - "BlkSeed", - ], - stack_inputs=[ - StackArgMapping( - arg_name="a", - allowed_types=[ - wtypes.uint64_wtype, - ], - ), - ], - stack_outputs=[ - wtypes.bytes_wtype, - ], - ), - ], - "algopy.op.Block.blk_timestamp": [ - FunctionOpMapping( - op_code="block", - is_property=False, - immediates=[ - "BlkTimestamp", - ], - stack_inputs=[ - StackArgMapping( - arg_name="a", - allowed_types=[ - wtypes.uint64_wtype, - ], - ), - ], - stack_outputs=[ - wtypes.uint64_wtype, - ], - ), - ], - "algopy.op.Box.create": [ - FunctionOpMapping( - op_code="box_create", - is_property=False, - immediates=[], - stack_inputs=[ - StackArgMapping( - arg_name="a", - allowed_types=[ - wtypes.bytes_wtype, - ], - ), - StackArgMapping( - arg_name="b", - allowed_types=[ - wtypes.uint64_wtype, - ], - ), - ], - stack_outputs=[ - wtypes.bool_wtype, - ], - ), - ], - "algopy.op.Box.delete": [ - FunctionOpMapping( - op_code="box_del", - is_property=False, - immediates=[], - stack_inputs=[ - StackArgMapping( - arg_name="a", - allowed_types=[ - wtypes.bytes_wtype, - ], - ), - ], - stack_outputs=[ - wtypes.bool_wtype, - ], - ), - ], - "algopy.op.Box.extract": [ - FunctionOpMapping( - op_code="box_extract", - is_property=False, - immediates=[], - stack_inputs=[ - StackArgMapping( - arg_name="a", - allowed_types=[ - wtypes.bytes_wtype, - ], - ), - StackArgMapping( - arg_name="b", - allowed_types=[ - wtypes.uint64_wtype, - ], - ), - StackArgMapping( - arg_name="c", - allowed_types=[ - wtypes.uint64_wtype, - ], - ), - ], - stack_outputs=[ - wtypes.bytes_wtype, - ], - ), - ], - "algopy.op.Box.get": [ - FunctionOpMapping( - op_code="box_get", - is_property=False, - immediates=[], - stack_inputs=[ - StackArgMapping( - arg_name="a", - allowed_types=[ - wtypes.bytes_wtype, - ], - ), - ], - stack_outputs=[ - wtypes.bytes_wtype, - wtypes.bool_wtype, - ], - ), - ], - "algopy.op.Box.length": [ - FunctionOpMapping( - op_code="box_len", - is_property=False, - immediates=[], - stack_inputs=[ - StackArgMapping( - arg_name="a", - allowed_types=[ - wtypes.bytes_wtype, - ], - ), - ], - stack_outputs=[ - wtypes.uint64_wtype, - wtypes.bool_wtype, - ], - ), - ], - "algopy.op.Box.put": [ - FunctionOpMapping( - op_code="box_put", - is_property=False, - immediates=[], - stack_inputs=[ - StackArgMapping( - arg_name="a", - allowed_types=[ - wtypes.bytes_wtype, - ], - ), - StackArgMapping( - arg_name="b", - allowed_types=[ - wtypes.bytes_wtype, - ], - ), - ], - stack_outputs=[], - ), - ], - "algopy.op.Box.replace": [ - FunctionOpMapping( - op_code="box_replace", - is_property=False, - immediates=[], - stack_inputs=[ - StackArgMapping( - arg_name="a", - allowed_types=[ - wtypes.bytes_wtype, - ], - ), - StackArgMapping( - arg_name="b", - allowed_types=[ - wtypes.uint64_wtype, - ], - ), - StackArgMapping( - arg_name="c", - allowed_types=[ - wtypes.bytes_wtype, - ], - ), - ], - stack_outputs=[], - ), - ], - "algopy.op.Box.resize": [ - FunctionOpMapping( - op_code="box_resize", - is_property=False, - immediates=[], - stack_inputs=[ - StackArgMapping( - arg_name="a", - allowed_types=[ - wtypes.bytes_wtype, - ], - ), - StackArgMapping( - arg_name="b", - allowed_types=[ - wtypes.uint64_wtype, - ], - ), - ], - stack_outputs=[], - ), - ], - "algopy.op.Box.splice": [ - FunctionOpMapping( - op_code="box_splice", - is_property=False, - immediates=[], - stack_inputs=[ - StackArgMapping( - arg_name="a", - allowed_types=[ - wtypes.bytes_wtype, - ], - ), - StackArgMapping( - arg_name="b", - allowed_types=[ - wtypes.uint64_wtype, - ], - ), - StackArgMapping( - arg_name="c", - allowed_types=[ - wtypes.uint64_wtype, - ], - ), - StackArgMapping( - arg_name="d", - allowed_types=[ - wtypes.bytes_wtype, - ], - ), - ], - stack_outputs=[], - ), - ], - "algopy.op.EllipticCurve.add": [ - FunctionOpMapping( - op_code="ec_add", - is_property=False, - immediates=[ - ImmediateArgMapping( - arg_name="g", - literal_type=str, - ), - ], - stack_inputs=[ - StackArgMapping( - arg_name="a", - allowed_types=[ - wtypes.bytes_wtype, - ], - ), - StackArgMapping( - arg_name="b", - allowed_types=[ - wtypes.bytes_wtype, - ], - ), - ], - stack_outputs=[ - wtypes.bytes_wtype, - ], - ), - ], - "algopy.op.EllipticCurve.map_to": [ - FunctionOpMapping( - op_code="ec_map_to", - is_property=False, - immediates=[ - ImmediateArgMapping( - arg_name="g", - literal_type=str, - ), - ], - stack_inputs=[ - StackArgMapping( - arg_name="a", - allowed_types=[ - wtypes.bytes_wtype, - ], - ), - ], - stack_outputs=[ - wtypes.bytes_wtype, - ], - ), - ], - "algopy.op.EllipticCurve.scalar_mul_multi": [ - FunctionOpMapping( - op_code="ec_multi_scalar_mul", - is_property=False, - immediates=[ - ImmediateArgMapping( - arg_name="g", - literal_type=str, - ), - ], - stack_inputs=[ - StackArgMapping( - arg_name="a", - allowed_types=[ - wtypes.bytes_wtype, - ], - ), - StackArgMapping( - arg_name="b", - allowed_types=[ - wtypes.bytes_wtype, - ], - ), - ], - stack_outputs=[ - wtypes.bytes_wtype, - ], - ), - ], - "algopy.op.EllipticCurve.pairing_check": [ - FunctionOpMapping( - op_code="ec_pairing_check", - is_property=False, - immediates=[ - ImmediateArgMapping( - arg_name="g", - literal_type=str, - ), - ], - stack_inputs=[ - StackArgMapping( - arg_name="a", - allowed_types=[ - wtypes.bytes_wtype, - ], - ), - StackArgMapping( - arg_name="b", - allowed_types=[ - wtypes.bytes_wtype, - ], - ), - ], - stack_outputs=[ - wtypes.bool_wtype, - ], - ), - ], - "algopy.op.EllipticCurve.scalar_mul": [ - FunctionOpMapping( - op_code="ec_scalar_mul", - is_property=False, - immediates=[ - ImmediateArgMapping( - arg_name="g", - literal_type=str, - ), - ], - stack_inputs=[ - StackArgMapping( - arg_name="a", - allowed_types=[ - wtypes.bytes_wtype, - ], - ), - StackArgMapping( - arg_name="b", - allowed_types=[ - wtypes.bytes_wtype, - ], - ), - ], - stack_outputs=[ - wtypes.bytes_wtype, - ], - ), - ], - "algopy.op.EllipticCurve.subgroup_check": [ - FunctionOpMapping( - op_code="ec_subgroup_check", - is_property=False, - immediates=[ - ImmediateArgMapping( - arg_name="g", - literal_type=str, - ), - ], - stack_inputs=[ - StackArgMapping( - arg_name="a", - allowed_types=[ - wtypes.bytes_wtype, - ], - ), - ], - stack_outputs=[ - wtypes.bool_wtype, - ], - ), - ], - "algopy.op.GITxn.sender": [ - FunctionOpMapping( - op_code="gitxn", - is_property=False, - immediates=[ - ImmediateArgMapping( - arg_name="t", - literal_type=int, - ), - "Sender", - ], - stack_inputs=[], - stack_outputs=[ - wtypes.account_wtype, - ], - ), - ], - "algopy.op.GITxn.fee": [ - FunctionOpMapping( - op_code="gitxn", - is_property=False, - immediates=[ - ImmediateArgMapping( - arg_name="t", - literal_type=int, - ), - "Fee", - ], - stack_inputs=[], - stack_outputs=[ - wtypes.uint64_wtype, - ], - ), - ], - "algopy.op.GITxn.first_valid": [ - FunctionOpMapping( - op_code="gitxn", - is_property=False, - immediates=[ - ImmediateArgMapping( - arg_name="t", - literal_type=int, - ), - "FirstValid", - ], - stack_inputs=[], - stack_outputs=[ - wtypes.uint64_wtype, - ], - ), - ], - "algopy.op.GITxn.first_valid_time": [ - FunctionOpMapping( - op_code="gitxn", - is_property=False, - immediates=[ - ImmediateArgMapping( - arg_name="t", - literal_type=int, - ), - "FirstValidTime", - ], - stack_inputs=[], - stack_outputs=[ - wtypes.uint64_wtype, - ], - ), - ], - "algopy.op.GITxn.last_valid": [ - FunctionOpMapping( - op_code="gitxn", - is_property=False, - immediates=[ - ImmediateArgMapping( - arg_name="t", - literal_type=int, - ), - "LastValid", - ], - stack_inputs=[], - stack_outputs=[ - wtypes.uint64_wtype, - ], - ), - ], - "algopy.op.GITxn.note": [ - FunctionOpMapping( - op_code="gitxn", - is_property=False, - immediates=[ - ImmediateArgMapping( - arg_name="t", - literal_type=int, - ), - "Note", - ], - stack_inputs=[], - stack_outputs=[ - wtypes.bytes_wtype, - ], - ), - ], - "algopy.op.GITxn.lease": [ - FunctionOpMapping( - op_code="gitxn", - is_property=False, - immediates=[ - ImmediateArgMapping( - arg_name="t", - literal_type=int, - ), - "Lease", - ], - stack_inputs=[], - stack_outputs=[ - wtypes.bytes_wtype, - ], - ), - ], - "algopy.op.GITxn.receiver": [ - FunctionOpMapping( - op_code="gitxn", - is_property=False, - immediates=[ - ImmediateArgMapping( - arg_name="t", - literal_type=int, - ), - "Receiver", - ], - stack_inputs=[], - stack_outputs=[ - wtypes.account_wtype, - ], - ), - ], - "algopy.op.GITxn.amount": [ - FunctionOpMapping( - op_code="gitxn", - is_property=False, - immediates=[ - ImmediateArgMapping( - arg_name="t", - literal_type=int, - ), - "Amount", - ], - stack_inputs=[], - stack_outputs=[ - wtypes.uint64_wtype, - ], - ), - ], - "algopy.op.GITxn.close_remainder_to": [ - FunctionOpMapping( - op_code="gitxn", - is_property=False, - immediates=[ - ImmediateArgMapping( - arg_name="t", - literal_type=int, - ), - "CloseRemainderTo", - ], - stack_inputs=[], - stack_outputs=[ - wtypes.account_wtype, - ], - ), - ], - "algopy.op.GITxn.vote_pk": [ - FunctionOpMapping( - op_code="gitxn", - is_property=False, - immediates=[ - ImmediateArgMapping( - arg_name="t", - literal_type=int, - ), - "VotePK", - ], - stack_inputs=[], - stack_outputs=[ - wtypes.bytes_wtype, - ], - ), - ], - "algopy.op.GITxn.selection_pk": [ - FunctionOpMapping( - op_code="gitxn", - is_property=False, - immediates=[ - ImmediateArgMapping( - arg_name="t", - literal_type=int, - ), - "SelectionPK", - ], - stack_inputs=[], - stack_outputs=[ - wtypes.bytes_wtype, - ], - ), - ], - "algopy.op.GITxn.vote_first": [ - FunctionOpMapping( - op_code="gitxn", - is_property=False, - immediates=[ - ImmediateArgMapping( - arg_name="t", - literal_type=int, - ), - "VoteFirst", - ], - stack_inputs=[], - stack_outputs=[ - wtypes.uint64_wtype, - ], - ), - ], - "algopy.op.GITxn.vote_last": [ - FunctionOpMapping( - op_code="gitxn", - is_property=False, - immediates=[ - ImmediateArgMapping( - arg_name="t", - literal_type=int, - ), - "VoteLast", - ], - stack_inputs=[], - stack_outputs=[ - wtypes.uint64_wtype, - ], - ), - ], - "algopy.op.GITxn.vote_key_dilution": [ - FunctionOpMapping( - op_code="gitxn", - is_property=False, - immediates=[ - ImmediateArgMapping( - arg_name="t", - literal_type=int, - ), - "VoteKeyDilution", - ], - stack_inputs=[], - stack_outputs=[ - wtypes.uint64_wtype, - ], - ), - ], - "algopy.op.GITxn.type": [ - FunctionOpMapping( - op_code="gitxn", - is_property=False, - immediates=[ - ImmediateArgMapping( - arg_name="t", - literal_type=int, - ), - "Type", - ], - stack_inputs=[], - stack_outputs=[ - wtypes.bytes_wtype, - ], - ), - ], - "algopy.op.GITxn.type_enum": [ - FunctionOpMapping( - op_code="gitxn", - is_property=False, - immediates=[ - ImmediateArgMapping( - arg_name="t", - literal_type=int, - ), - "TypeEnum", - ], - stack_inputs=[], - stack_outputs=[ - wtypes.uint64_wtype, - ], - ), - ], - "algopy.op.GITxn.xfer_asset": [ - FunctionOpMapping( - op_code="gitxn", - is_property=False, - immediates=[ - ImmediateArgMapping( - arg_name="t", - literal_type=int, - ), - "XferAsset", - ], - stack_inputs=[], - stack_outputs=[ - wtypes.asset_wtype, - ], - ), - ], - "algopy.op.GITxn.asset_amount": [ - FunctionOpMapping( - op_code="gitxn", - is_property=False, - immediates=[ - ImmediateArgMapping( - arg_name="t", - literal_type=int, - ), - "AssetAmount", - ], - stack_inputs=[], - stack_outputs=[ - wtypes.uint64_wtype, - ], - ), - ], - "algopy.op.GITxn.asset_sender": [ - FunctionOpMapping( - op_code="gitxn", - is_property=False, - immediates=[ - ImmediateArgMapping( - arg_name="t", - literal_type=int, - ), - "AssetSender", - ], - stack_inputs=[], - stack_outputs=[ - wtypes.account_wtype, - ], - ), - ], - "algopy.op.GITxn.asset_receiver": [ - FunctionOpMapping( - op_code="gitxn", - is_property=False, - immediates=[ - ImmediateArgMapping( - arg_name="t", - literal_type=int, - ), - "AssetReceiver", - ], - stack_inputs=[], - stack_outputs=[ - wtypes.account_wtype, - ], - ), - ], - "algopy.op.GITxn.asset_close_to": [ - FunctionOpMapping( - op_code="gitxn", - is_property=False, - immediates=[ - ImmediateArgMapping( - arg_name="t", - literal_type=int, - ), - "AssetCloseTo", - ], - stack_inputs=[], - stack_outputs=[ - wtypes.account_wtype, - ], - ), - ], - "algopy.op.GITxn.group_index": [ - FunctionOpMapping( - op_code="gitxn", - is_property=False, - immediates=[ - ImmediateArgMapping( - arg_name="t", - literal_type=int, - ), - "GroupIndex", - ], - stack_inputs=[], - stack_outputs=[ - wtypes.uint64_wtype, - ], - ), - ], - "algopy.op.GITxn.tx_id": [ - FunctionOpMapping( - op_code="gitxn", - is_property=False, - immediates=[ - ImmediateArgMapping( - arg_name="t", - literal_type=int, - ), - "TxID", - ], - stack_inputs=[], - stack_outputs=[ - wtypes.bytes_wtype, - ], - ), - ], - "algopy.op.GITxn.application_id": [ - FunctionOpMapping( - op_code="gitxn", - is_property=False, - immediates=[ - ImmediateArgMapping( - arg_name="t", - literal_type=int, - ), - "ApplicationID", - ], - stack_inputs=[], - stack_outputs=[ - wtypes.application_wtype, - ], - ), - ], - "algopy.op.GITxn.on_completion": [ - FunctionOpMapping( - op_code="gitxn", - is_property=False, - immediates=[ - ImmediateArgMapping( - arg_name="t", - literal_type=int, - ), - "OnCompletion", - ], - stack_inputs=[], - stack_outputs=[ - wtypes.uint64_wtype, - ], - ), - ], - "algopy.op.GITxn.application_args": [ - FunctionOpMapping( - op_code="gitxnas", - is_property=False, - immediates=[ - ImmediateArgMapping( - arg_name="t", - literal_type=int, - ), - "ApplicationArgs", - ], - stack_inputs=[ - StackArgMapping( - arg_name="a", - allowed_types=[ - wtypes.uint64_wtype, - ], - ), - ], - stack_outputs=[ - wtypes.bytes_wtype, - ], - ), - FunctionOpMapping( - op_code="gitxna", - is_property=False, - immediates=[ - ImmediateArgMapping( - arg_name="t", - literal_type=int, - ), - "ApplicationArgs", - ImmediateArgMapping( - arg_name="a", - literal_type=int, - ), - ], - stack_inputs=[], - stack_outputs=[ - wtypes.bytes_wtype, - ], - ), - ], - "algopy.op.GITxn.num_app_args": [ - FunctionOpMapping( - op_code="gitxn", - is_property=False, - immediates=[ - ImmediateArgMapping( - arg_name="t", - literal_type=int, - ), - "NumAppArgs", - ], - stack_inputs=[], - stack_outputs=[ - wtypes.uint64_wtype, - ], - ), - ], - "algopy.op.GITxn.accounts": [ - FunctionOpMapping( - op_code="gitxnas", - is_property=False, - immediates=[ - ImmediateArgMapping( - arg_name="t", - literal_type=int, - ), - "Accounts", - ], - stack_inputs=[ - StackArgMapping( - arg_name="a", - allowed_types=[ - wtypes.uint64_wtype, - ], - ), - ], - stack_outputs=[ - wtypes.account_wtype, - ], - ), - FunctionOpMapping( - op_code="gitxna", - is_property=False, - immediates=[ - ImmediateArgMapping( - arg_name="t", - literal_type=int, - ), - "Accounts", - ImmediateArgMapping( - arg_name="a", - literal_type=int, - ), - ], - stack_inputs=[], - stack_outputs=[ - wtypes.account_wtype, - ], - ), - ], - "algopy.op.GITxn.num_accounts": [ - FunctionOpMapping( - op_code="gitxn", - is_property=False, - immediates=[ - ImmediateArgMapping( - arg_name="t", - literal_type=int, - ), - "NumAccounts", - ], - stack_inputs=[], - stack_outputs=[ - wtypes.uint64_wtype, - ], - ), - ], - "algopy.op.GITxn.approval_program": [ - FunctionOpMapping( - op_code="gitxn", - is_property=False, - immediates=[ - ImmediateArgMapping( - arg_name="t", - literal_type=int, - ), - "ApprovalProgram", - ], - stack_inputs=[], - stack_outputs=[ - wtypes.bytes_wtype, - ], - ), - ], - "algopy.op.GITxn.clear_state_program": [ - FunctionOpMapping( - op_code="gitxn", - is_property=False, - immediates=[ - ImmediateArgMapping( - arg_name="t", - literal_type=int, - ), - "ClearStateProgram", - ], - stack_inputs=[], - stack_outputs=[ - wtypes.bytes_wtype, - ], - ), - ], - "algopy.op.GITxn.rekey_to": [ - FunctionOpMapping( - op_code="gitxn", - is_property=False, - immediates=[ - ImmediateArgMapping( - arg_name="t", - literal_type=int, - ), - "RekeyTo", - ], - stack_inputs=[], - stack_outputs=[ - wtypes.account_wtype, - ], - ), - ], - "algopy.op.GITxn.config_asset": [ - FunctionOpMapping( - op_code="gitxn", - is_property=False, - immediates=[ - ImmediateArgMapping( - arg_name="t", - literal_type=int, - ), - "ConfigAsset", - ], - stack_inputs=[], - stack_outputs=[ - wtypes.asset_wtype, - ], - ), - ], - "algopy.op.GITxn.config_asset_total": [ - FunctionOpMapping( - op_code="gitxn", - is_property=False, - immediates=[ - ImmediateArgMapping( - arg_name="t", - literal_type=int, - ), - "ConfigAssetTotal", - ], - stack_inputs=[], - stack_outputs=[ - wtypes.uint64_wtype, - ], - ), - ], - "algopy.op.GITxn.config_asset_decimals": [ - FunctionOpMapping( - op_code="gitxn", - is_property=False, - immediates=[ - ImmediateArgMapping( - arg_name="t", - literal_type=int, - ), - "ConfigAssetDecimals", - ], - stack_inputs=[], - stack_outputs=[ - wtypes.uint64_wtype, - ], - ), - ], - "algopy.op.GITxn.config_asset_default_frozen": [ - FunctionOpMapping( - op_code="gitxn", - is_property=False, - immediates=[ - ImmediateArgMapping( - arg_name="t", - literal_type=int, - ), - "ConfigAssetDefaultFrozen", - ], - stack_inputs=[], - stack_outputs=[ - wtypes.bool_wtype, - ], - ), - ], - "algopy.op.GITxn.config_asset_unit_name": [ - FunctionOpMapping( - op_code="gitxn", - is_property=False, - immediates=[ - ImmediateArgMapping( - arg_name="t", - literal_type=int, - ), - "ConfigAssetUnitName", - ], - stack_inputs=[], - stack_outputs=[ - wtypes.bytes_wtype, - ], - ), - ], - "algopy.op.GITxn.config_asset_name": [ - FunctionOpMapping( - op_code="gitxn", - is_property=False, - immediates=[ - ImmediateArgMapping( - arg_name="t", - literal_type=int, - ), - "ConfigAssetName", - ], - stack_inputs=[], - stack_outputs=[ - wtypes.bytes_wtype, - ], - ), - ], - "algopy.op.GITxn.config_asset_url": [ - FunctionOpMapping( - op_code="gitxn", - is_property=False, - immediates=[ - ImmediateArgMapping( - arg_name="t", - literal_type=int, - ), - "ConfigAssetURL", - ], - stack_inputs=[], - stack_outputs=[ - wtypes.bytes_wtype, - ], - ), - ], - "algopy.op.GITxn.config_asset_metadata_hash": [ - FunctionOpMapping( - op_code="gitxn", - is_property=False, - immediates=[ - ImmediateArgMapping( - arg_name="t", - literal_type=int, - ), - "ConfigAssetMetadataHash", - ], - stack_inputs=[], - stack_outputs=[ - wtypes.bytes_wtype, - ], - ), - ], - "algopy.op.GITxn.config_asset_manager": [ - FunctionOpMapping( - op_code="gitxn", - is_property=False, - immediates=[ - ImmediateArgMapping( - arg_name="t", - literal_type=int, - ), - "ConfigAssetManager", - ], - stack_inputs=[], - stack_outputs=[ - wtypes.account_wtype, - ], - ), - ], - "algopy.op.GITxn.config_asset_reserve": [ - FunctionOpMapping( - op_code="gitxn", - is_property=False, - immediates=[ - ImmediateArgMapping( - arg_name="t", - literal_type=int, - ), - "ConfigAssetReserve", - ], - stack_inputs=[], - stack_outputs=[ - wtypes.account_wtype, - ], - ), - ], - "algopy.op.GITxn.config_asset_freeze": [ - FunctionOpMapping( - op_code="gitxn", - is_property=False, - immediates=[ - ImmediateArgMapping( - arg_name="t", - literal_type=int, - ), - "ConfigAssetFreeze", - ], - stack_inputs=[], - stack_outputs=[ - wtypes.account_wtype, - ], - ), - ], - "algopy.op.GITxn.config_asset_clawback": [ - FunctionOpMapping( - op_code="gitxn", - is_property=False, - immediates=[ - ImmediateArgMapping( - arg_name="t", - literal_type=int, - ), - "ConfigAssetClawback", - ], - stack_inputs=[], - stack_outputs=[ - wtypes.account_wtype, - ], - ), - ], - "algopy.op.GITxn.freeze_asset": [ - FunctionOpMapping( - op_code="gitxn", - is_property=False, - immediates=[ - ImmediateArgMapping( - arg_name="t", - literal_type=int, - ), - "FreezeAsset", - ], - stack_inputs=[], - stack_outputs=[ - wtypes.asset_wtype, - ], - ), - ], - "algopy.op.GITxn.freeze_asset_account": [ - FunctionOpMapping( - op_code="gitxn", - is_property=False, - immediates=[ - ImmediateArgMapping( - arg_name="t", - literal_type=int, - ), - "FreezeAssetAccount", - ], - stack_inputs=[], - stack_outputs=[ - wtypes.account_wtype, - ], - ), - ], - "algopy.op.GITxn.freeze_asset_frozen": [ - FunctionOpMapping( - op_code="gitxn", - is_property=False, - immediates=[ - ImmediateArgMapping( - arg_name="t", - literal_type=int, - ), - "FreezeAssetFrozen", - ], - stack_inputs=[], - stack_outputs=[ - wtypes.bool_wtype, - ], - ), - ], - "algopy.op.GITxn.assets": [ - FunctionOpMapping( - op_code="gitxnas", - is_property=False, - immediates=[ - ImmediateArgMapping( - arg_name="t", - literal_type=int, - ), - "Assets", - ], - stack_inputs=[ - StackArgMapping( - arg_name="a", - allowed_types=[ - wtypes.uint64_wtype, - ], - ), - ], - stack_outputs=[ - wtypes.asset_wtype, - ], - ), - FunctionOpMapping( - op_code="gitxna", - is_property=False, - immediates=[ - ImmediateArgMapping( - arg_name="t", - literal_type=int, - ), - "Assets", - ImmediateArgMapping( - arg_name="a", - literal_type=int, - ), - ], - stack_inputs=[], - stack_outputs=[ - wtypes.asset_wtype, - ], - ), - ], - "algopy.op.GITxn.num_assets": [ - FunctionOpMapping( - op_code="gitxn", - is_property=False, - immediates=[ - ImmediateArgMapping( - arg_name="t", - literal_type=int, - ), - "NumAssets", - ], - stack_inputs=[], - stack_outputs=[ - wtypes.uint64_wtype, - ], - ), - ], - "algopy.op.GITxn.applications": [ - FunctionOpMapping( - op_code="gitxnas", - is_property=False, - immediates=[ - ImmediateArgMapping( - arg_name="t", - literal_type=int, - ), - "Applications", - ], - stack_inputs=[ - StackArgMapping( - arg_name="a", - allowed_types=[ - wtypes.uint64_wtype, - ], - ), - ], - stack_outputs=[ - wtypes.application_wtype, - ], - ), - FunctionOpMapping( - op_code="gitxna", - is_property=False, - immediates=[ - ImmediateArgMapping( - arg_name="t", - literal_type=int, - ), - "Applications", - ImmediateArgMapping( - arg_name="a", - literal_type=int, - ), - ], - stack_inputs=[], - stack_outputs=[ - wtypes.application_wtype, - ], - ), - ], - "algopy.op.GITxn.num_applications": [ - FunctionOpMapping( - op_code="gitxn", - is_property=False, - immediates=[ - ImmediateArgMapping( - arg_name="t", - literal_type=int, - ), - "NumApplications", - ], - stack_inputs=[], - stack_outputs=[ - wtypes.uint64_wtype, - ], - ), - ], - "algopy.op.GITxn.global_num_uint": [ - FunctionOpMapping( - op_code="gitxn", - is_property=False, - immediates=[ - ImmediateArgMapping( - arg_name="t", - literal_type=int, - ), - "GlobalNumUint", - ], - stack_inputs=[], - stack_outputs=[ - wtypes.uint64_wtype, - ], - ), - ], - "algopy.op.GITxn.global_num_byte_slice": [ - FunctionOpMapping( - op_code="gitxn", - is_property=False, - immediates=[ - ImmediateArgMapping( - arg_name="t", - literal_type=int, - ), - "GlobalNumByteSlice", - ], - stack_inputs=[], - stack_outputs=[ - wtypes.uint64_wtype, - ], - ), - ], - "algopy.op.GITxn.local_num_uint": [ - FunctionOpMapping( - op_code="gitxn", - is_property=False, - immediates=[ - ImmediateArgMapping( - arg_name="t", - literal_type=int, - ), - "LocalNumUint", - ], - stack_inputs=[], - stack_outputs=[ - wtypes.uint64_wtype, - ], - ), - ], - "algopy.op.GITxn.local_num_byte_slice": [ - FunctionOpMapping( - op_code="gitxn", - is_property=False, - immediates=[ - ImmediateArgMapping( - arg_name="t", - literal_type=int, - ), - "LocalNumByteSlice", - ], - stack_inputs=[], - stack_outputs=[ - wtypes.uint64_wtype, - ], - ), - ], - "algopy.op.GITxn.extra_program_pages": [ - FunctionOpMapping( - op_code="gitxn", - is_property=False, - immediates=[ - ImmediateArgMapping( - arg_name="t", - literal_type=int, - ), - "ExtraProgramPages", - ], - stack_inputs=[], - stack_outputs=[ - wtypes.uint64_wtype, - ], - ), - ], - "algopy.op.GITxn.nonparticipation": [ - FunctionOpMapping( - op_code="gitxn", - is_property=False, - immediates=[ - ImmediateArgMapping( - arg_name="t", - literal_type=int, - ), - "Nonparticipation", - ], - stack_inputs=[], - stack_outputs=[ - wtypes.bool_wtype, - ], - ), - ], - "algopy.op.GITxn.logs": [ - FunctionOpMapping( - op_code="gitxnas", - is_property=False, - immediates=[ - ImmediateArgMapping( - arg_name="t", - literal_type=int, - ), - "Logs", - ], - stack_inputs=[ - StackArgMapping( - arg_name="a", - allowed_types=[ - wtypes.uint64_wtype, - ], - ), - ], - stack_outputs=[ - wtypes.bytes_wtype, - ], - ), - FunctionOpMapping( - op_code="gitxna", - is_property=False, - immediates=[ - ImmediateArgMapping( - arg_name="t", - literal_type=int, - ), - "Logs", - ImmediateArgMapping( - arg_name="a", - literal_type=int, - ), - ], - stack_inputs=[], - stack_outputs=[ - wtypes.bytes_wtype, - ], - ), - ], - "algopy.op.GITxn.num_logs": [ - FunctionOpMapping( - op_code="gitxn", - is_property=False, - immediates=[ - ImmediateArgMapping( - arg_name="t", - literal_type=int, - ), - "NumLogs", - ], - stack_inputs=[], - stack_outputs=[ - wtypes.uint64_wtype, - ], - ), - ], - "algopy.op.GITxn.created_asset_id": [ - FunctionOpMapping( - op_code="gitxn", - is_property=False, - immediates=[ - ImmediateArgMapping( - arg_name="t", - literal_type=int, - ), - "CreatedAssetID", - ], - stack_inputs=[], - stack_outputs=[ - wtypes.asset_wtype, - ], - ), - ], - "algopy.op.GITxn.created_application_id": [ - FunctionOpMapping( - op_code="gitxn", - is_property=False, - immediates=[ - ImmediateArgMapping( - arg_name="t", - literal_type=int, - ), - "CreatedApplicationID", - ], - stack_inputs=[], - stack_outputs=[ - wtypes.application_wtype, - ], - ), - ], - "algopy.op.GITxn.last_log": [ - FunctionOpMapping( - op_code="gitxn", - is_property=False, - immediates=[ - ImmediateArgMapping( - arg_name="t", - literal_type=int, - ), - "LastLog", - ], - stack_inputs=[], - stack_outputs=[ - wtypes.bytes_wtype, - ], - ), - ], - "algopy.op.GITxn.state_proof_pk": [ - FunctionOpMapping( - op_code="gitxn", - is_property=False, - immediates=[ - ImmediateArgMapping( - arg_name="t", - literal_type=int, - ), - "StateProofPK", - ], - stack_inputs=[], - stack_outputs=[ - wtypes.bytes_wtype, - ], - ), - ], - "algopy.op.GITxn.approval_program_pages": [ - FunctionOpMapping( - op_code="gitxnas", - is_property=False, - immediates=[ - ImmediateArgMapping( - arg_name="t", - literal_type=int, - ), - "ApprovalProgramPages", - ], - stack_inputs=[ - StackArgMapping( - arg_name="a", - allowed_types=[ - wtypes.uint64_wtype, - ], - ), - ], - stack_outputs=[ - wtypes.bytes_wtype, - ], - ), - FunctionOpMapping( - op_code="gitxna", - is_property=False, - immediates=[ - ImmediateArgMapping( - arg_name="t", - literal_type=int, - ), - "ApprovalProgramPages", - ImmediateArgMapping( - arg_name="a", - literal_type=int, - ), - ], - stack_inputs=[], - stack_outputs=[ - wtypes.bytes_wtype, - ], - ), - ], - "algopy.op.GITxn.num_approval_program_pages": [ - FunctionOpMapping( - op_code="gitxn", - is_property=False, - immediates=[ - ImmediateArgMapping( - arg_name="t", - literal_type=int, - ), - "NumApprovalProgramPages", - ], - stack_inputs=[], - stack_outputs=[ - wtypes.uint64_wtype, - ], - ), - ], - "algopy.op.GITxn.clear_state_program_pages": [ - FunctionOpMapping( - op_code="gitxnas", - is_property=False, - immediates=[ - ImmediateArgMapping( - arg_name="t", - literal_type=int, - ), - "ClearStateProgramPages", - ], - stack_inputs=[ - StackArgMapping( - arg_name="a", - allowed_types=[ - wtypes.uint64_wtype, - ], - ), - ], - stack_outputs=[ - wtypes.bytes_wtype, - ], - ), - FunctionOpMapping( - op_code="gitxna", - is_property=False, - immediates=[ - ImmediateArgMapping( - arg_name="t", - literal_type=int, - ), - "ClearStateProgramPages", - ImmediateArgMapping( - arg_name="a", - literal_type=int, - ), - ], - stack_inputs=[], - stack_outputs=[ - wtypes.bytes_wtype, - ], - ), - ], - "algopy.op.GITxn.num_clear_state_program_pages": [ - FunctionOpMapping( - op_code="gitxn", - is_property=False, - immediates=[ - ImmediateArgMapping( - arg_name="t", - literal_type=int, - ), - "NumClearStateProgramPages", - ], - stack_inputs=[], - stack_outputs=[ - wtypes.uint64_wtype, - ], - ), - ], - "algopy.op.GTxn.sender": [ - FunctionOpMapping( - op_code="gtxns", - is_property=False, - immediates=[ - "Sender", - ], - stack_inputs=[ - StackArgMapping( - arg_name="a", - allowed_types=[ - wtypes.uint64_wtype, - ], - ), - ], - stack_outputs=[ - wtypes.account_wtype, - ], - ), - FunctionOpMapping( - op_code="gtxn", - is_property=False, - immediates=[ - ImmediateArgMapping( - arg_name="a", - literal_type=int, - ), - "Sender", - ], - stack_inputs=[], - stack_outputs=[ - wtypes.account_wtype, - ], - ), - ], - "algopy.op.GTxn.fee": [ - FunctionOpMapping( - op_code="gtxns", - is_property=False, - immediates=[ - "Fee", - ], - stack_inputs=[ - StackArgMapping( - arg_name="a", - allowed_types=[ - wtypes.uint64_wtype, - ], - ), - ], - stack_outputs=[ - wtypes.uint64_wtype, - ], - ), - FunctionOpMapping( - op_code="gtxn", - is_property=False, - immediates=[ - ImmediateArgMapping( - arg_name="a", - literal_type=int, - ), - "Fee", - ], - stack_inputs=[], - stack_outputs=[ - wtypes.uint64_wtype, - ], - ), - ], - "algopy.op.GTxn.first_valid": [ - FunctionOpMapping( - op_code="gtxns", - is_property=False, - immediates=[ - "FirstValid", - ], - stack_inputs=[ - StackArgMapping( - arg_name="a", - allowed_types=[ - wtypes.uint64_wtype, - ], - ), - ], - stack_outputs=[ - wtypes.uint64_wtype, - ], - ), - FunctionOpMapping( - op_code="gtxn", - is_property=False, - immediates=[ - ImmediateArgMapping( - arg_name="a", - literal_type=int, - ), - "FirstValid", - ], - stack_inputs=[], - stack_outputs=[ - wtypes.uint64_wtype, - ], - ), - ], - "algopy.op.GTxn.first_valid_time": [ - FunctionOpMapping( - op_code="gtxns", - is_property=False, - immediates=[ - "FirstValidTime", - ], - stack_inputs=[ - StackArgMapping( - arg_name="a", - allowed_types=[ - wtypes.uint64_wtype, - ], - ), - ], - stack_outputs=[ - wtypes.uint64_wtype, - ], - ), - FunctionOpMapping( - op_code="gtxn", - is_property=False, - immediates=[ - ImmediateArgMapping( - arg_name="a", - literal_type=int, - ), - "FirstValidTime", - ], - stack_inputs=[], - stack_outputs=[ - wtypes.uint64_wtype, - ], - ), - ], - "algopy.op.GTxn.last_valid": [ - FunctionOpMapping( - op_code="gtxns", - is_property=False, - immediates=[ - "LastValid", - ], - stack_inputs=[ - StackArgMapping( - arg_name="a", - allowed_types=[ - wtypes.uint64_wtype, - ], - ), - ], - stack_outputs=[ - wtypes.uint64_wtype, - ], - ), - FunctionOpMapping( - op_code="gtxn", - is_property=False, - immediates=[ - ImmediateArgMapping( - arg_name="a", - literal_type=int, - ), - "LastValid", - ], - stack_inputs=[], - stack_outputs=[ - wtypes.uint64_wtype, - ], - ), - ], - "algopy.op.GTxn.note": [ - FunctionOpMapping( - op_code="gtxns", - is_property=False, - immediates=[ - "Note", - ], - stack_inputs=[ - StackArgMapping( - arg_name="a", - allowed_types=[ - wtypes.uint64_wtype, - ], - ), - ], - stack_outputs=[ - wtypes.bytes_wtype, - ], - ), - FunctionOpMapping( - op_code="gtxn", - is_property=False, - immediates=[ - ImmediateArgMapping( - arg_name="a", - literal_type=int, - ), - "Note", - ], - stack_inputs=[], - stack_outputs=[ - wtypes.bytes_wtype, - ], - ), - ], - "algopy.op.GTxn.lease": [ - FunctionOpMapping( - op_code="gtxns", - is_property=False, - immediates=[ - "Lease", - ], - stack_inputs=[ - StackArgMapping( - arg_name="a", - allowed_types=[ - wtypes.uint64_wtype, - ], - ), - ], - stack_outputs=[ - wtypes.bytes_wtype, - ], - ), - FunctionOpMapping( - op_code="gtxn", - is_property=False, - immediates=[ - ImmediateArgMapping( - arg_name="a", - literal_type=int, - ), - "Lease", - ], - stack_inputs=[], - stack_outputs=[ - wtypes.bytes_wtype, - ], - ), - ], - "algopy.op.GTxn.receiver": [ - FunctionOpMapping( - op_code="gtxns", - is_property=False, - immediates=[ - "Receiver", - ], - stack_inputs=[ - StackArgMapping( - arg_name="a", - allowed_types=[ - wtypes.uint64_wtype, - ], - ), - ], - stack_outputs=[ - wtypes.account_wtype, - ], - ), - FunctionOpMapping( - op_code="gtxn", - is_property=False, - immediates=[ - ImmediateArgMapping( - arg_name="a", - literal_type=int, - ), - "Receiver", - ], - stack_inputs=[], - stack_outputs=[ - wtypes.account_wtype, - ], - ), - ], - "algopy.op.GTxn.amount": [ - FunctionOpMapping( - op_code="gtxns", - is_property=False, - immediates=[ - "Amount", - ], - stack_inputs=[ - StackArgMapping( - arg_name="a", - allowed_types=[ - wtypes.uint64_wtype, - ], - ), - ], - stack_outputs=[ - wtypes.uint64_wtype, - ], - ), - FunctionOpMapping( - op_code="gtxn", - is_property=False, - immediates=[ - ImmediateArgMapping( - arg_name="a", - literal_type=int, - ), - "Amount", - ], - stack_inputs=[], - stack_outputs=[ - wtypes.uint64_wtype, - ], - ), - ], - "algopy.op.GTxn.close_remainder_to": [ - FunctionOpMapping( - op_code="gtxns", - is_property=False, - immediates=[ - "CloseRemainderTo", - ], - stack_inputs=[ - StackArgMapping( - arg_name="a", - allowed_types=[ - wtypes.uint64_wtype, - ], - ), - ], - stack_outputs=[ - wtypes.account_wtype, - ], - ), - FunctionOpMapping( - op_code="gtxn", - is_property=False, - immediates=[ - ImmediateArgMapping( - arg_name="a", - literal_type=int, - ), - "CloseRemainderTo", - ], - stack_inputs=[], - stack_outputs=[ - wtypes.account_wtype, - ], - ), - ], - "algopy.op.GTxn.vote_pk": [ - FunctionOpMapping( - op_code="gtxns", - is_property=False, - immediates=[ - "VotePK", - ], - stack_inputs=[ - StackArgMapping( - arg_name="a", - allowed_types=[ - wtypes.uint64_wtype, - ], - ), - ], - stack_outputs=[ - wtypes.bytes_wtype, - ], - ), - FunctionOpMapping( - op_code="gtxn", - is_property=False, - immediates=[ - ImmediateArgMapping( - arg_name="a", - literal_type=int, - ), - "VotePK", - ], - stack_inputs=[], - stack_outputs=[ - wtypes.bytes_wtype, - ], - ), - ], - "algopy.op.GTxn.selection_pk": [ - FunctionOpMapping( - op_code="gtxns", - is_property=False, - immediates=[ - "SelectionPK", - ], - stack_inputs=[ - StackArgMapping( - arg_name="a", - allowed_types=[ - wtypes.uint64_wtype, - ], - ), - ], - stack_outputs=[ - wtypes.bytes_wtype, - ], - ), - FunctionOpMapping( - op_code="gtxn", - is_property=False, - immediates=[ - ImmediateArgMapping( - arg_name="a", - literal_type=int, - ), - "SelectionPK", - ], - stack_inputs=[], - stack_outputs=[ - wtypes.bytes_wtype, - ], - ), - ], - "algopy.op.GTxn.vote_first": [ - FunctionOpMapping( - op_code="gtxns", - is_property=False, - immediates=[ - "VoteFirst", - ], - stack_inputs=[ - StackArgMapping( - arg_name="a", - allowed_types=[ - wtypes.uint64_wtype, - ], - ), - ], - stack_outputs=[ - wtypes.uint64_wtype, - ], - ), - FunctionOpMapping( - op_code="gtxn", - is_property=False, - immediates=[ - ImmediateArgMapping( - arg_name="a", - literal_type=int, - ), - "VoteFirst", - ], - stack_inputs=[], - stack_outputs=[ - wtypes.uint64_wtype, - ], - ), - ], - "algopy.op.GTxn.vote_last": [ - FunctionOpMapping( - op_code="gtxns", - is_property=False, - immediates=[ - "VoteLast", - ], - stack_inputs=[ - StackArgMapping( - arg_name="a", - allowed_types=[ - wtypes.uint64_wtype, - ], - ), - ], - stack_outputs=[ - wtypes.uint64_wtype, - ], - ), - FunctionOpMapping( - op_code="gtxn", - is_property=False, - immediates=[ - ImmediateArgMapping( - arg_name="a", - literal_type=int, - ), - "VoteLast", - ], - stack_inputs=[], - stack_outputs=[ - wtypes.uint64_wtype, - ], - ), - ], - "algopy.op.GTxn.vote_key_dilution": [ - FunctionOpMapping( - op_code="gtxns", - is_property=False, - immediates=[ - "VoteKeyDilution", - ], - stack_inputs=[ - StackArgMapping( - arg_name="a", - allowed_types=[ - wtypes.uint64_wtype, - ], - ), - ], - stack_outputs=[ - wtypes.uint64_wtype, - ], - ), - FunctionOpMapping( - op_code="gtxn", - is_property=False, - immediates=[ - ImmediateArgMapping( - arg_name="a", - literal_type=int, - ), - "VoteKeyDilution", - ], - stack_inputs=[], - stack_outputs=[ - wtypes.uint64_wtype, - ], - ), - ], - "algopy.op.GTxn.type": [ - FunctionOpMapping( - op_code="gtxns", - is_property=False, - immediates=[ - "Type", - ], - stack_inputs=[ - StackArgMapping( - arg_name="a", - allowed_types=[ - wtypes.uint64_wtype, - ], - ), - ], - stack_outputs=[ - wtypes.bytes_wtype, - ], - ), - FunctionOpMapping( - op_code="gtxn", - is_property=False, - immediates=[ - ImmediateArgMapping( - arg_name="a", - literal_type=int, - ), - "Type", - ], - stack_inputs=[], - stack_outputs=[ - wtypes.bytes_wtype, - ], - ), - ], - "algopy.op.GTxn.type_enum": [ - FunctionOpMapping( - op_code="gtxns", - is_property=False, - immediates=[ - "TypeEnum", - ], - stack_inputs=[ - StackArgMapping( - arg_name="a", - allowed_types=[ - wtypes.uint64_wtype, - ], - ), - ], - stack_outputs=[ - wtypes.uint64_wtype, - ], - ), - FunctionOpMapping( - op_code="gtxn", - is_property=False, - immediates=[ - ImmediateArgMapping( - arg_name="a", - literal_type=int, - ), - "TypeEnum", - ], - stack_inputs=[], - stack_outputs=[ - wtypes.uint64_wtype, - ], - ), - ], - "algopy.op.GTxn.xfer_asset": [ - FunctionOpMapping( - op_code="gtxns", - is_property=False, - immediates=[ - "XferAsset", - ], - stack_inputs=[ - StackArgMapping( - arg_name="a", - allowed_types=[ - wtypes.uint64_wtype, - ], - ), - ], - stack_outputs=[ - wtypes.asset_wtype, - ], - ), - FunctionOpMapping( - op_code="gtxn", - is_property=False, - immediates=[ - ImmediateArgMapping( - arg_name="a", - literal_type=int, - ), - "XferAsset", - ], - stack_inputs=[], - stack_outputs=[ - wtypes.asset_wtype, - ], - ), - ], - "algopy.op.GTxn.asset_amount": [ - FunctionOpMapping( - op_code="gtxns", - is_property=False, - immediates=[ - "AssetAmount", - ], - stack_inputs=[ - StackArgMapping( - arg_name="a", - allowed_types=[ - wtypes.uint64_wtype, - ], - ), - ], - stack_outputs=[ - wtypes.uint64_wtype, - ], - ), - FunctionOpMapping( - op_code="gtxn", - is_property=False, - immediates=[ - ImmediateArgMapping( - arg_name="a", - literal_type=int, - ), - "AssetAmount", - ], - stack_inputs=[], - stack_outputs=[ - wtypes.uint64_wtype, - ], - ), - ], - "algopy.op.GTxn.asset_sender": [ - FunctionOpMapping( - op_code="gtxns", - is_property=False, - immediates=[ - "AssetSender", - ], - stack_inputs=[ - StackArgMapping( - arg_name="a", - allowed_types=[ - wtypes.uint64_wtype, - ], - ), - ], - stack_outputs=[ - wtypes.account_wtype, - ], - ), - FunctionOpMapping( - op_code="gtxn", - is_property=False, - immediates=[ - ImmediateArgMapping( - arg_name="a", - literal_type=int, - ), - "AssetSender", - ], - stack_inputs=[], - stack_outputs=[ - wtypes.account_wtype, - ], - ), - ], - "algopy.op.GTxn.asset_receiver": [ - FunctionOpMapping( - op_code="gtxns", - is_property=False, - immediates=[ - "AssetReceiver", - ], - stack_inputs=[ - StackArgMapping( - arg_name="a", - allowed_types=[ - wtypes.uint64_wtype, - ], - ), - ], - stack_outputs=[ - wtypes.account_wtype, - ], - ), - FunctionOpMapping( - op_code="gtxn", - is_property=False, - immediates=[ - ImmediateArgMapping( - arg_name="a", - literal_type=int, - ), - "AssetReceiver", - ], - stack_inputs=[], - stack_outputs=[ - wtypes.account_wtype, - ], - ), - ], - "algopy.op.GTxn.asset_close_to": [ - FunctionOpMapping( - op_code="gtxns", - is_property=False, - immediates=[ - "AssetCloseTo", - ], - stack_inputs=[ - StackArgMapping( - arg_name="a", - allowed_types=[ - wtypes.uint64_wtype, - ], - ), - ], - stack_outputs=[ - wtypes.account_wtype, - ], - ), - FunctionOpMapping( - op_code="gtxn", - is_property=False, - immediates=[ - ImmediateArgMapping( - arg_name="a", - literal_type=int, - ), - "AssetCloseTo", - ], - stack_inputs=[], - stack_outputs=[ - wtypes.account_wtype, - ], - ), - ], - "algopy.op.GTxn.group_index": [ - FunctionOpMapping( - op_code="gtxns", - is_property=False, - immediates=[ - "GroupIndex", - ], - stack_inputs=[ - StackArgMapping( - arg_name="a", - allowed_types=[ - wtypes.uint64_wtype, - ], - ), - ], - stack_outputs=[ - wtypes.uint64_wtype, - ], - ), - FunctionOpMapping( - op_code="gtxn", - is_property=False, - immediates=[ - ImmediateArgMapping( - arg_name="a", - literal_type=int, - ), - "GroupIndex", - ], - stack_inputs=[], - stack_outputs=[ - wtypes.uint64_wtype, - ], - ), - ], - "algopy.op.GTxn.tx_id": [ - FunctionOpMapping( - op_code="gtxns", - is_property=False, - immediates=[ - "TxID", - ], - stack_inputs=[ - StackArgMapping( - arg_name="a", - allowed_types=[ - wtypes.uint64_wtype, - ], - ), - ], - stack_outputs=[ - wtypes.bytes_wtype, - ], - ), - FunctionOpMapping( - op_code="gtxn", - is_property=False, - immediates=[ - ImmediateArgMapping( - arg_name="a", - literal_type=int, - ), - "TxID", - ], - stack_inputs=[], - stack_outputs=[ - wtypes.bytes_wtype, - ], - ), - ], - "algopy.op.GTxn.application_id": [ - FunctionOpMapping( - op_code="gtxns", - is_property=False, - immediates=[ - "ApplicationID", - ], - stack_inputs=[ - StackArgMapping( - arg_name="a", - allowed_types=[ - wtypes.uint64_wtype, - ], - ), - ], - stack_outputs=[ - wtypes.application_wtype, - ], - ), - FunctionOpMapping( - op_code="gtxn", - is_property=False, - immediates=[ - ImmediateArgMapping( - arg_name="a", - literal_type=int, - ), - "ApplicationID", - ], - stack_inputs=[], - stack_outputs=[ - wtypes.application_wtype, - ], - ), - ], - "algopy.op.GTxn.on_completion": [ - FunctionOpMapping( - op_code="gtxns", - is_property=False, - immediates=[ - "OnCompletion", - ], - stack_inputs=[ - StackArgMapping( - arg_name="a", - allowed_types=[ - wtypes.uint64_wtype, - ], - ), - ], - stack_outputs=[ - wtypes.uint64_wtype, - ], - ), - FunctionOpMapping( - op_code="gtxn", - is_property=False, - immediates=[ - ImmediateArgMapping( - arg_name="a", - literal_type=int, - ), - "OnCompletion", - ], - stack_inputs=[], - stack_outputs=[ - wtypes.uint64_wtype, - ], - ), - ], - "algopy.op.GTxn.application_args": [ - FunctionOpMapping( - op_code="gtxnsas", - is_property=False, - immediates=[ - "ApplicationArgs", - ], - stack_inputs=[ - StackArgMapping( - arg_name="a", - allowed_types=[ - wtypes.uint64_wtype, - ], - ), - StackArgMapping( - arg_name="b", - allowed_types=[ - wtypes.uint64_wtype, - ], - ), - ], - stack_outputs=[ - wtypes.bytes_wtype, - ], - ), - FunctionOpMapping( - op_code="gtxnsa", - is_property=False, - immediates=[ - "ApplicationArgs", - ImmediateArgMapping( - arg_name="b", - literal_type=int, - ), - ], - stack_inputs=[ - StackArgMapping( - arg_name="a", - allowed_types=[ - wtypes.uint64_wtype, - ], - ), - ], - stack_outputs=[ - wtypes.bytes_wtype, - ], - ), - FunctionOpMapping( - op_code="gtxna", - is_property=False, - immediates=[ - ImmediateArgMapping( - arg_name="a", - literal_type=int, - ), - "ApplicationArgs", - ImmediateArgMapping( - arg_name="b", - literal_type=int, - ), - ], - stack_inputs=[], - stack_outputs=[ - wtypes.bytes_wtype, - ], - ), - FunctionOpMapping( - op_code="gtxnas", - is_property=False, - immediates=[ - ImmediateArgMapping( - arg_name="a", - literal_type=int, - ), - "ApplicationArgs", - ], - stack_inputs=[ - StackArgMapping( - arg_name="b", - allowed_types=[ - wtypes.uint64_wtype, - ], - ), - ], - stack_outputs=[ - wtypes.bytes_wtype, - ], - ), - ], - "algopy.op.GTxn.num_app_args": [ - FunctionOpMapping( - op_code="gtxns", - is_property=False, - immediates=[ - "NumAppArgs", - ], - stack_inputs=[ - StackArgMapping( - arg_name="a", - allowed_types=[ - wtypes.uint64_wtype, - ], - ), - ], - stack_outputs=[ - wtypes.uint64_wtype, - ], - ), - FunctionOpMapping( - op_code="gtxn", - is_property=False, - immediates=[ - ImmediateArgMapping( - arg_name="a", - literal_type=int, - ), - "NumAppArgs", - ], - stack_inputs=[], - stack_outputs=[ - wtypes.uint64_wtype, - ], - ), - ], - "algopy.op.GTxn.accounts": [ - FunctionOpMapping( - op_code="gtxnsas", - is_property=False, - immediates=[ - "Accounts", - ], - stack_inputs=[ - StackArgMapping( - arg_name="a", - allowed_types=[ - wtypes.uint64_wtype, - ], - ), - StackArgMapping( - arg_name="b", - allowed_types=[ - wtypes.uint64_wtype, - ], - ), - ], - stack_outputs=[ - wtypes.account_wtype, - ], - ), - FunctionOpMapping( - op_code="gtxnsa", - is_property=False, - immediates=[ - "Accounts", - ImmediateArgMapping( - arg_name="b", - literal_type=int, - ), - ], - stack_inputs=[ - StackArgMapping( - arg_name="a", - allowed_types=[ - wtypes.uint64_wtype, - ], - ), - ], - stack_outputs=[ - wtypes.account_wtype, - ], - ), - FunctionOpMapping( - op_code="gtxna", - is_property=False, - immediates=[ - ImmediateArgMapping( - arg_name="a", - literal_type=int, - ), - "Accounts", - ImmediateArgMapping( - arg_name="b", - literal_type=int, - ), - ], - stack_inputs=[], - stack_outputs=[ - wtypes.account_wtype, - ], - ), - FunctionOpMapping( - op_code="gtxnas", - is_property=False, - immediates=[ - ImmediateArgMapping( - arg_name="a", - literal_type=int, - ), - "Accounts", - ], - stack_inputs=[ - StackArgMapping( - arg_name="b", - allowed_types=[ - wtypes.uint64_wtype, - ], - ), - ], - stack_outputs=[ - wtypes.account_wtype, - ], - ), - ], - "algopy.op.GTxn.num_accounts": [ - FunctionOpMapping( - op_code="gtxns", - is_property=False, - immediates=[ - "NumAccounts", - ], - stack_inputs=[ - StackArgMapping( - arg_name="a", - allowed_types=[ - wtypes.uint64_wtype, - ], - ), - ], - stack_outputs=[ - wtypes.uint64_wtype, - ], - ), - FunctionOpMapping( - op_code="gtxn", - is_property=False, - immediates=[ - ImmediateArgMapping( - arg_name="a", - literal_type=int, - ), - "NumAccounts", - ], - stack_inputs=[], - stack_outputs=[ - wtypes.uint64_wtype, - ], - ), - ], - "algopy.op.GTxn.approval_program": [ - FunctionOpMapping( - op_code="gtxns", - is_property=False, - immediates=[ - "ApprovalProgram", - ], - stack_inputs=[ - StackArgMapping( - arg_name="a", - allowed_types=[ - wtypes.uint64_wtype, - ], - ), - ], - stack_outputs=[ - wtypes.bytes_wtype, - ], - ), - FunctionOpMapping( - op_code="gtxn", - is_property=False, - immediates=[ - ImmediateArgMapping( - arg_name="a", - literal_type=int, - ), - "ApprovalProgram", - ], - stack_inputs=[], - stack_outputs=[ - wtypes.bytes_wtype, - ], - ), - ], - "algopy.op.GTxn.clear_state_program": [ - FunctionOpMapping( - op_code="gtxns", - is_property=False, - immediates=[ - "ClearStateProgram", - ], - stack_inputs=[ - StackArgMapping( - arg_name="a", - allowed_types=[ - wtypes.uint64_wtype, - ], - ), - ], - stack_outputs=[ - wtypes.bytes_wtype, - ], - ), - FunctionOpMapping( - op_code="gtxn", - is_property=False, - immediates=[ - ImmediateArgMapping( - arg_name="a", - literal_type=int, - ), - "ClearStateProgram", - ], - stack_inputs=[], - stack_outputs=[ - wtypes.bytes_wtype, - ], - ), - ], - "algopy.op.GTxn.rekey_to": [ - FunctionOpMapping( - op_code="gtxns", - is_property=False, - immediates=[ - "RekeyTo", - ], - stack_inputs=[ - StackArgMapping( - arg_name="a", - allowed_types=[ - wtypes.uint64_wtype, - ], - ), - ], - stack_outputs=[ - wtypes.account_wtype, - ], - ), - FunctionOpMapping( - op_code="gtxn", - is_property=False, - immediates=[ - ImmediateArgMapping( - arg_name="a", - literal_type=int, - ), - "RekeyTo", - ], - stack_inputs=[], - stack_outputs=[ - wtypes.account_wtype, - ], - ), - ], - "algopy.op.GTxn.config_asset": [ - FunctionOpMapping( - op_code="gtxns", - is_property=False, - immediates=[ - "ConfigAsset", - ], - stack_inputs=[ - StackArgMapping( - arg_name="a", - allowed_types=[ - wtypes.uint64_wtype, - ], - ), - ], - stack_outputs=[ - wtypes.asset_wtype, - ], - ), - FunctionOpMapping( - op_code="gtxn", - is_property=False, - immediates=[ - ImmediateArgMapping( - arg_name="a", - literal_type=int, - ), - "ConfigAsset", - ], - stack_inputs=[], - stack_outputs=[ - wtypes.asset_wtype, - ], - ), - ], - "algopy.op.GTxn.config_asset_total": [ - FunctionOpMapping( - op_code="gtxns", - is_property=False, - immediates=[ - "ConfigAssetTotal", - ], - stack_inputs=[ - StackArgMapping( - arg_name="a", - allowed_types=[ - wtypes.uint64_wtype, - ], - ), - ], - stack_outputs=[ - wtypes.uint64_wtype, - ], - ), - FunctionOpMapping( - op_code="gtxn", - is_property=False, - immediates=[ - ImmediateArgMapping( - arg_name="a", - literal_type=int, - ), - "ConfigAssetTotal", - ], - stack_inputs=[], - stack_outputs=[ - wtypes.uint64_wtype, - ], - ), - ], - "algopy.op.GTxn.config_asset_decimals": [ - FunctionOpMapping( - op_code="gtxns", - is_property=False, - immediates=[ - "ConfigAssetDecimals", - ], - stack_inputs=[ - StackArgMapping( - arg_name="a", - allowed_types=[ - wtypes.uint64_wtype, - ], - ), - ], - stack_outputs=[ - wtypes.uint64_wtype, - ], - ), - FunctionOpMapping( - op_code="gtxn", - is_property=False, - immediates=[ - ImmediateArgMapping( - arg_name="a", - literal_type=int, - ), - "ConfigAssetDecimals", - ], - stack_inputs=[], - stack_outputs=[ - wtypes.uint64_wtype, - ], - ), - ], - "algopy.op.GTxn.config_asset_default_frozen": [ - FunctionOpMapping( - op_code="gtxns", - is_property=False, - immediates=[ - "ConfigAssetDefaultFrozen", - ], - stack_inputs=[ - StackArgMapping( - arg_name="a", - allowed_types=[ - wtypes.uint64_wtype, - ], - ), - ], - stack_outputs=[ - wtypes.bool_wtype, - ], - ), - FunctionOpMapping( - op_code="gtxn", - is_property=False, - immediates=[ - ImmediateArgMapping( - arg_name="a", - literal_type=int, - ), - "ConfigAssetDefaultFrozen", - ], - stack_inputs=[], - stack_outputs=[ - wtypes.bool_wtype, - ], - ), - ], - "algopy.op.GTxn.config_asset_unit_name": [ - FunctionOpMapping( - op_code="gtxns", - is_property=False, - immediates=[ - "ConfigAssetUnitName", - ], - stack_inputs=[ - StackArgMapping( - arg_name="a", - allowed_types=[ - wtypes.uint64_wtype, - ], - ), - ], - stack_outputs=[ - wtypes.bytes_wtype, - ], - ), - FunctionOpMapping( - op_code="gtxn", - is_property=False, - immediates=[ - ImmediateArgMapping( - arg_name="a", - literal_type=int, - ), - "ConfigAssetUnitName", - ], - stack_inputs=[], - stack_outputs=[ - wtypes.bytes_wtype, - ], - ), - ], - "algopy.op.GTxn.config_asset_name": [ - FunctionOpMapping( - op_code="gtxns", - is_property=False, - immediates=[ - "ConfigAssetName", - ], - stack_inputs=[ - StackArgMapping( - arg_name="a", - allowed_types=[ - wtypes.uint64_wtype, - ], - ), - ], - stack_outputs=[ - wtypes.bytes_wtype, - ], - ), - FunctionOpMapping( - op_code="gtxn", - is_property=False, - immediates=[ - ImmediateArgMapping( - arg_name="a", - literal_type=int, - ), - "ConfigAssetName", - ], - stack_inputs=[], - stack_outputs=[ - wtypes.bytes_wtype, - ], - ), - ], - "algopy.op.GTxn.config_asset_url": [ - FunctionOpMapping( - op_code="gtxns", - is_property=False, - immediates=[ - "ConfigAssetURL", - ], - stack_inputs=[ - StackArgMapping( - arg_name="a", - allowed_types=[ - wtypes.uint64_wtype, - ], - ), - ], - stack_outputs=[ - wtypes.bytes_wtype, - ], - ), - FunctionOpMapping( - op_code="gtxn", - is_property=False, - immediates=[ - ImmediateArgMapping( - arg_name="a", - literal_type=int, - ), - "ConfigAssetURL", - ], - stack_inputs=[], - stack_outputs=[ - wtypes.bytes_wtype, - ], - ), - ], - "algopy.op.GTxn.config_asset_metadata_hash": [ - FunctionOpMapping( - op_code="gtxns", - is_property=False, - immediates=[ - "ConfigAssetMetadataHash", - ], - stack_inputs=[ - StackArgMapping( - arg_name="a", - allowed_types=[ - wtypes.uint64_wtype, - ], - ), - ], - stack_outputs=[ - wtypes.bytes_wtype, - ], - ), - FunctionOpMapping( - op_code="gtxn", - is_property=False, - immediates=[ - ImmediateArgMapping( - arg_name="a", - literal_type=int, - ), - "ConfigAssetMetadataHash", - ], - stack_inputs=[], - stack_outputs=[ - wtypes.bytes_wtype, - ], - ), - ], - "algopy.op.GTxn.config_asset_manager": [ - FunctionOpMapping( - op_code="gtxns", - is_property=False, - immediates=[ - "ConfigAssetManager", - ], - stack_inputs=[ - StackArgMapping( - arg_name="a", - allowed_types=[ - wtypes.uint64_wtype, - ], - ), - ], - stack_outputs=[ - wtypes.account_wtype, - ], - ), - FunctionOpMapping( - op_code="gtxn", - is_property=False, - immediates=[ - ImmediateArgMapping( - arg_name="a", - literal_type=int, - ), - "ConfigAssetManager", - ], - stack_inputs=[], - stack_outputs=[ - wtypes.account_wtype, - ], - ), - ], - "algopy.op.GTxn.config_asset_reserve": [ - FunctionOpMapping( - op_code="gtxns", - is_property=False, - immediates=[ - "ConfigAssetReserve", - ], - stack_inputs=[ - StackArgMapping( - arg_name="a", - allowed_types=[ - wtypes.uint64_wtype, - ], - ), - ], - stack_outputs=[ - wtypes.account_wtype, - ], - ), - FunctionOpMapping( - op_code="gtxn", - is_property=False, - immediates=[ - ImmediateArgMapping( - arg_name="a", - literal_type=int, - ), - "ConfigAssetReserve", - ], - stack_inputs=[], - stack_outputs=[ - wtypes.account_wtype, - ], - ), - ], - "algopy.op.GTxn.config_asset_freeze": [ - FunctionOpMapping( - op_code="gtxns", - is_property=False, - immediates=[ - "ConfigAssetFreeze", - ], - stack_inputs=[ - StackArgMapping( - arg_name="a", - allowed_types=[ - wtypes.uint64_wtype, - ], - ), - ], - stack_outputs=[ - wtypes.account_wtype, - ], - ), - FunctionOpMapping( - op_code="gtxn", - is_property=False, - immediates=[ - ImmediateArgMapping( - arg_name="a", - literal_type=int, - ), - "ConfigAssetFreeze", - ], - stack_inputs=[], - stack_outputs=[ - wtypes.account_wtype, - ], - ), - ], - "algopy.op.GTxn.config_asset_clawback": [ - FunctionOpMapping( - op_code="gtxns", - is_property=False, - immediates=[ - "ConfigAssetClawback", - ], - stack_inputs=[ - StackArgMapping( - arg_name="a", - allowed_types=[ - wtypes.uint64_wtype, - ], - ), - ], - stack_outputs=[ - wtypes.account_wtype, - ], - ), - FunctionOpMapping( - op_code="gtxn", - is_property=False, - immediates=[ - ImmediateArgMapping( - arg_name="a", - literal_type=int, - ), - "ConfigAssetClawback", - ], - stack_inputs=[], - stack_outputs=[ - wtypes.account_wtype, - ], - ), - ], - "algopy.op.GTxn.freeze_asset": [ - FunctionOpMapping( - op_code="gtxns", - is_property=False, - immediates=[ - "FreezeAsset", - ], - stack_inputs=[ - StackArgMapping( - arg_name="a", - allowed_types=[ - wtypes.uint64_wtype, - ], - ), - ], - stack_outputs=[ - wtypes.asset_wtype, - ], - ), - FunctionOpMapping( - op_code="gtxn", - is_property=False, - immediates=[ - ImmediateArgMapping( - arg_name="a", - literal_type=int, - ), - "FreezeAsset", - ], - stack_inputs=[], - stack_outputs=[ - wtypes.asset_wtype, - ], - ), - ], - "algopy.op.GTxn.freeze_asset_account": [ - FunctionOpMapping( - op_code="gtxns", - is_property=False, - immediates=[ - "FreezeAssetAccount", - ], - stack_inputs=[ - StackArgMapping( - arg_name="a", - allowed_types=[ - wtypes.uint64_wtype, - ], - ), - ], - stack_outputs=[ - wtypes.account_wtype, - ], - ), - FunctionOpMapping( - op_code="gtxn", - is_property=False, - immediates=[ - ImmediateArgMapping( - arg_name="a", - literal_type=int, - ), - "FreezeAssetAccount", - ], - stack_inputs=[], - stack_outputs=[ - wtypes.account_wtype, - ], - ), - ], - "algopy.op.GTxn.freeze_asset_frozen": [ - FunctionOpMapping( - op_code="gtxns", - is_property=False, - immediates=[ - "FreezeAssetFrozen", - ], - stack_inputs=[ - StackArgMapping( - arg_name="a", - allowed_types=[ - wtypes.uint64_wtype, - ], - ), - ], - stack_outputs=[ - wtypes.bool_wtype, - ], - ), - FunctionOpMapping( - op_code="gtxn", - is_property=False, - immediates=[ - ImmediateArgMapping( - arg_name="a", - literal_type=int, - ), - "FreezeAssetFrozen", - ], - stack_inputs=[], - stack_outputs=[ - wtypes.bool_wtype, - ], - ), - ], - "algopy.op.GTxn.assets": [ - FunctionOpMapping( - op_code="gtxnsas", - is_property=False, - immediates=[ - "Assets", - ], - stack_inputs=[ - StackArgMapping( - arg_name="a", - allowed_types=[ - wtypes.uint64_wtype, - ], - ), - StackArgMapping( - arg_name="b", - allowed_types=[ - wtypes.uint64_wtype, - ], - ), - ], - stack_outputs=[ - wtypes.asset_wtype, - ], - ), - FunctionOpMapping( - op_code="gtxnsa", - is_property=False, - immediates=[ - "Assets", - ImmediateArgMapping( - arg_name="b", - literal_type=int, - ), - ], - stack_inputs=[ - StackArgMapping( - arg_name="a", - allowed_types=[ - wtypes.uint64_wtype, - ], - ), - ], - stack_outputs=[ - wtypes.asset_wtype, - ], - ), - FunctionOpMapping( - op_code="gtxna", - is_property=False, - immediates=[ - ImmediateArgMapping( - arg_name="a", - literal_type=int, - ), - "Assets", - ImmediateArgMapping( - arg_name="b", - literal_type=int, - ), - ], - stack_inputs=[], - stack_outputs=[ - wtypes.asset_wtype, - ], - ), - FunctionOpMapping( - op_code="gtxnas", - is_property=False, - immediates=[ - ImmediateArgMapping( - arg_name="a", - literal_type=int, - ), - "Assets", - ], - stack_inputs=[ - StackArgMapping( - arg_name="b", - allowed_types=[ - wtypes.uint64_wtype, - ], - ), - ], - stack_outputs=[ - wtypes.asset_wtype, - ], - ), - ], - "algopy.op.GTxn.num_assets": [ - FunctionOpMapping( - op_code="gtxns", - is_property=False, - immediates=[ - "NumAssets", - ], - stack_inputs=[ - StackArgMapping( - arg_name="a", - allowed_types=[ - wtypes.uint64_wtype, - ], - ), - ], - stack_outputs=[ - wtypes.uint64_wtype, - ], - ), - FunctionOpMapping( - op_code="gtxn", - is_property=False, - immediates=[ - ImmediateArgMapping( - arg_name="a", - literal_type=int, - ), - "NumAssets", - ], - stack_inputs=[], - stack_outputs=[ - wtypes.uint64_wtype, - ], - ), - ], - "algopy.op.GTxn.applications": [ - FunctionOpMapping( - op_code="gtxnsas", - is_property=False, - immediates=[ - "Applications", - ], - stack_inputs=[ - StackArgMapping( - arg_name="a", - allowed_types=[ - wtypes.uint64_wtype, - ], - ), - StackArgMapping( - arg_name="b", - allowed_types=[ - wtypes.uint64_wtype, - ], - ), - ], - stack_outputs=[ - wtypes.application_wtype, - ], - ), - FunctionOpMapping( - op_code="gtxnsa", - is_property=False, - immediates=[ - "Applications", - ImmediateArgMapping( - arg_name="b", - literal_type=int, - ), - ], - stack_inputs=[ - StackArgMapping( - arg_name="a", - allowed_types=[ - wtypes.uint64_wtype, - ], - ), - ], - stack_outputs=[ - wtypes.application_wtype, - ], - ), - FunctionOpMapping( - op_code="gtxna", - is_property=False, - immediates=[ - ImmediateArgMapping( - arg_name="a", - literal_type=int, - ), - "Applications", - ImmediateArgMapping( - arg_name="b", - literal_type=int, - ), - ], - stack_inputs=[], - stack_outputs=[ - wtypes.application_wtype, - ], - ), - FunctionOpMapping( - op_code="gtxnas", - is_property=False, - immediates=[ - ImmediateArgMapping( - arg_name="a", - literal_type=int, - ), - "Applications", - ], - stack_inputs=[ - StackArgMapping( - arg_name="b", - allowed_types=[ - wtypes.uint64_wtype, - ], - ), - ], - stack_outputs=[ - wtypes.application_wtype, - ], - ), - ], - "algopy.op.GTxn.num_applications": [ - FunctionOpMapping( - op_code="gtxns", - is_property=False, - immediates=[ - "NumApplications", - ], - stack_inputs=[ - StackArgMapping( - arg_name="a", - allowed_types=[ - wtypes.uint64_wtype, - ], - ), - ], - stack_outputs=[ - wtypes.uint64_wtype, - ], - ), - FunctionOpMapping( - op_code="gtxn", - is_property=False, - immediates=[ - ImmediateArgMapping( - arg_name="a", - literal_type=int, - ), - "NumApplications", - ], - stack_inputs=[], - stack_outputs=[ - wtypes.uint64_wtype, - ], - ), - ], - "algopy.op.GTxn.global_num_uint": [ - FunctionOpMapping( - op_code="gtxns", - is_property=False, - immediates=[ - "GlobalNumUint", - ], - stack_inputs=[ - StackArgMapping( - arg_name="a", - allowed_types=[ - wtypes.uint64_wtype, - ], - ), - ], - stack_outputs=[ - wtypes.uint64_wtype, - ], - ), - FunctionOpMapping( - op_code="gtxn", - is_property=False, - immediates=[ - ImmediateArgMapping( - arg_name="a", - literal_type=int, - ), - "GlobalNumUint", - ], - stack_inputs=[], - stack_outputs=[ - wtypes.uint64_wtype, - ], - ), - ], - "algopy.op.GTxn.global_num_byte_slice": [ - FunctionOpMapping( - op_code="gtxns", - is_property=False, - immediates=[ - "GlobalNumByteSlice", - ], - stack_inputs=[ - StackArgMapping( - arg_name="a", - allowed_types=[ - wtypes.uint64_wtype, - ], - ), - ], - stack_outputs=[ - wtypes.uint64_wtype, - ], - ), - FunctionOpMapping( - op_code="gtxn", - is_property=False, - immediates=[ - ImmediateArgMapping( - arg_name="a", - literal_type=int, - ), - "GlobalNumByteSlice", - ], - stack_inputs=[], - stack_outputs=[ - wtypes.uint64_wtype, - ], - ), - ], - "algopy.op.GTxn.local_num_uint": [ - FunctionOpMapping( - op_code="gtxns", - is_property=False, - immediates=[ - "LocalNumUint", - ], - stack_inputs=[ - StackArgMapping( - arg_name="a", - allowed_types=[ - wtypes.uint64_wtype, - ], - ), - ], - stack_outputs=[ - wtypes.uint64_wtype, - ], - ), - FunctionOpMapping( - op_code="gtxn", - is_property=False, - immediates=[ - ImmediateArgMapping( - arg_name="a", - literal_type=int, - ), - "LocalNumUint", - ], - stack_inputs=[], - stack_outputs=[ - wtypes.uint64_wtype, - ], - ), - ], - "algopy.op.GTxn.local_num_byte_slice": [ - FunctionOpMapping( - op_code="gtxns", - is_property=False, - immediates=[ - "LocalNumByteSlice", - ], - stack_inputs=[ - StackArgMapping( - arg_name="a", - allowed_types=[ - wtypes.uint64_wtype, - ], - ), - ], - stack_outputs=[ - wtypes.uint64_wtype, - ], - ), - FunctionOpMapping( - op_code="gtxn", - is_property=False, - immediates=[ - ImmediateArgMapping( - arg_name="a", - literal_type=int, - ), - "LocalNumByteSlice", - ], - stack_inputs=[], - stack_outputs=[ - wtypes.uint64_wtype, - ], - ), - ], - "algopy.op.GTxn.extra_program_pages": [ - FunctionOpMapping( - op_code="gtxns", - is_property=False, - immediates=[ - "ExtraProgramPages", - ], - stack_inputs=[ - StackArgMapping( - arg_name="a", - allowed_types=[ - wtypes.uint64_wtype, - ], - ), - ], - stack_outputs=[ - wtypes.uint64_wtype, - ], - ), - FunctionOpMapping( - op_code="gtxn", - is_property=False, - immediates=[ - ImmediateArgMapping( - arg_name="a", - literal_type=int, - ), - "ExtraProgramPages", - ], - stack_inputs=[], - stack_outputs=[ - wtypes.uint64_wtype, - ], - ), - ], - "algopy.op.GTxn.nonparticipation": [ - FunctionOpMapping( - op_code="gtxns", - is_property=False, - immediates=[ - "Nonparticipation", - ], - stack_inputs=[ - StackArgMapping( - arg_name="a", - allowed_types=[ - wtypes.uint64_wtype, - ], - ), - ], - stack_outputs=[ - wtypes.bool_wtype, - ], - ), - FunctionOpMapping( - op_code="gtxn", - is_property=False, - immediates=[ - ImmediateArgMapping( - arg_name="a", - literal_type=int, - ), - "Nonparticipation", - ], - stack_inputs=[], - stack_outputs=[ - wtypes.bool_wtype, - ], - ), - ], - "algopy.op.GTxn.logs": [ - FunctionOpMapping( - op_code="gtxnsas", - is_property=False, - immediates=[ - "Logs", - ], - stack_inputs=[ - StackArgMapping( - arg_name="a", - allowed_types=[ - wtypes.uint64_wtype, - ], - ), - StackArgMapping( - arg_name="b", - allowed_types=[ - wtypes.uint64_wtype, - ], - ), - ], - stack_outputs=[ - wtypes.bytes_wtype, - ], - ), - FunctionOpMapping( - op_code="gtxnsa", - is_property=False, - immediates=[ - "Logs", - ImmediateArgMapping( - arg_name="b", - literal_type=int, - ), - ], - stack_inputs=[ - StackArgMapping( - arg_name="a", - allowed_types=[ - wtypes.uint64_wtype, - ], - ), - ], - stack_outputs=[ - wtypes.bytes_wtype, - ], - ), - FunctionOpMapping( - op_code="gtxna", - is_property=False, - immediates=[ - ImmediateArgMapping( - arg_name="a", - literal_type=int, - ), - "Logs", - ImmediateArgMapping( - arg_name="b", - literal_type=int, - ), - ], - stack_inputs=[], - stack_outputs=[ - wtypes.bytes_wtype, - ], - ), - FunctionOpMapping( - op_code="gtxnas", - is_property=False, - immediates=[ - ImmediateArgMapping( - arg_name="a", - literal_type=int, - ), - "Logs", - ], - stack_inputs=[ - StackArgMapping( - arg_name="b", - allowed_types=[ - wtypes.uint64_wtype, - ], - ), - ], - stack_outputs=[ - wtypes.bytes_wtype, - ], - ), - ], - "algopy.op.GTxn.num_logs": [ - FunctionOpMapping( - op_code="gtxns", - is_property=False, - immediates=[ - "NumLogs", - ], - stack_inputs=[ - StackArgMapping( - arg_name="a", - allowed_types=[ - wtypes.uint64_wtype, - ], - ), - ], - stack_outputs=[ - wtypes.uint64_wtype, - ], - ), - FunctionOpMapping( - op_code="gtxn", - is_property=False, - immediates=[ - ImmediateArgMapping( - arg_name="a", - literal_type=int, - ), - "NumLogs", - ], - stack_inputs=[], - stack_outputs=[ - wtypes.uint64_wtype, - ], - ), - ], - "algopy.op.GTxn.created_asset_id": [ - FunctionOpMapping( - op_code="gtxns", - is_property=False, - immediates=[ - "CreatedAssetID", - ], - stack_inputs=[ - StackArgMapping( - arg_name="a", - allowed_types=[ - wtypes.uint64_wtype, - ], - ), - ], - stack_outputs=[ - wtypes.asset_wtype, - ], - ), - FunctionOpMapping( - op_code="gtxn", - is_property=False, - immediates=[ - ImmediateArgMapping( - arg_name="a", - literal_type=int, - ), - "CreatedAssetID", - ], - stack_inputs=[], - stack_outputs=[ - wtypes.asset_wtype, - ], - ), - ], - "algopy.op.GTxn.created_application_id": [ - FunctionOpMapping( - op_code="gtxns", - is_property=False, - immediates=[ - "CreatedApplicationID", - ], - stack_inputs=[ - StackArgMapping( - arg_name="a", - allowed_types=[ - wtypes.uint64_wtype, - ], - ), - ], - stack_outputs=[ - wtypes.application_wtype, - ], - ), - FunctionOpMapping( - op_code="gtxn", - is_property=False, - immediates=[ - ImmediateArgMapping( - arg_name="a", - literal_type=int, - ), - "CreatedApplicationID", - ], - stack_inputs=[], - stack_outputs=[ - wtypes.application_wtype, - ], - ), - ], - "algopy.op.GTxn.last_log": [ - FunctionOpMapping( - op_code="gtxns", - is_property=False, - immediates=[ - "LastLog", - ], - stack_inputs=[ - StackArgMapping( - arg_name="a", - allowed_types=[ - wtypes.uint64_wtype, - ], - ), - ], - stack_outputs=[ - wtypes.bytes_wtype, - ], - ), - FunctionOpMapping( - op_code="gtxn", - is_property=False, - immediates=[ - ImmediateArgMapping( - arg_name="a", - literal_type=int, - ), - "LastLog", - ], - stack_inputs=[], - stack_outputs=[ - wtypes.bytes_wtype, - ], - ), - ], - "algopy.op.GTxn.state_proof_pk": [ - FunctionOpMapping( - op_code="gtxns", - is_property=False, - immediates=[ - "StateProofPK", - ], - stack_inputs=[ - StackArgMapping( - arg_name="a", - allowed_types=[ - wtypes.uint64_wtype, - ], - ), - ], - stack_outputs=[ - wtypes.bytes_wtype, - ], - ), - FunctionOpMapping( - op_code="gtxn", - is_property=False, - immediates=[ - ImmediateArgMapping( - arg_name="a", - literal_type=int, - ), - "StateProofPK", - ], - stack_inputs=[], - stack_outputs=[ - wtypes.bytes_wtype, - ], - ), - ], - "algopy.op.GTxn.approval_program_pages": [ - FunctionOpMapping( - op_code="gtxnsas", - is_property=False, - immediates=[ - "ApprovalProgramPages", - ], - stack_inputs=[ - StackArgMapping( - arg_name="a", - allowed_types=[ - wtypes.uint64_wtype, - ], - ), - StackArgMapping( - arg_name="b", - allowed_types=[ - wtypes.uint64_wtype, - ], - ), - ], - stack_outputs=[ - wtypes.bytes_wtype, - ], - ), - FunctionOpMapping( - op_code="gtxnsa", - is_property=False, - immediates=[ - "ApprovalProgramPages", - ImmediateArgMapping( - arg_name="b", - literal_type=int, - ), - ], - stack_inputs=[ - StackArgMapping( - arg_name="a", - allowed_types=[ - wtypes.uint64_wtype, - ], - ), - ], - stack_outputs=[ - wtypes.bytes_wtype, - ], - ), - FunctionOpMapping( - op_code="gtxna", - is_property=False, - immediates=[ - ImmediateArgMapping( - arg_name="a", - literal_type=int, - ), - "ApprovalProgramPages", - ImmediateArgMapping( - arg_name="b", - literal_type=int, - ), - ], - stack_inputs=[], - stack_outputs=[ - wtypes.bytes_wtype, - ], - ), - FunctionOpMapping( - op_code="gtxnas", - is_property=False, - immediates=[ - ImmediateArgMapping( - arg_name="a", - literal_type=int, - ), - "ApprovalProgramPages", - ], - stack_inputs=[ - StackArgMapping( - arg_name="b", - allowed_types=[ - wtypes.uint64_wtype, - ], - ), - ], - stack_outputs=[ - wtypes.bytes_wtype, - ], - ), - ], - "algopy.op.GTxn.num_approval_program_pages": [ - FunctionOpMapping( - op_code="gtxns", - is_property=False, - immediates=[ - "NumApprovalProgramPages", - ], - stack_inputs=[ - StackArgMapping( - arg_name="a", - allowed_types=[ - wtypes.uint64_wtype, - ], - ), - ], - stack_outputs=[ - wtypes.uint64_wtype, - ], - ), - FunctionOpMapping( - op_code="gtxn", - is_property=False, - immediates=[ - ImmediateArgMapping( - arg_name="a", - literal_type=int, - ), - "NumApprovalProgramPages", - ], - stack_inputs=[], - stack_outputs=[ - wtypes.uint64_wtype, - ], - ), - ], - "algopy.op.GTxn.clear_state_program_pages": [ - FunctionOpMapping( - op_code="gtxnsas", - is_property=False, - immediates=[ - "ClearStateProgramPages", - ], - stack_inputs=[ - StackArgMapping( - arg_name="a", - allowed_types=[ - wtypes.uint64_wtype, - ], - ), - StackArgMapping( - arg_name="b", - allowed_types=[ - wtypes.uint64_wtype, - ], - ), - ], - stack_outputs=[ - wtypes.bytes_wtype, - ], - ), - FunctionOpMapping( - op_code="gtxnsa", - is_property=False, - immediates=[ - "ClearStateProgramPages", - ImmediateArgMapping( - arg_name="b", - literal_type=int, - ), - ], - stack_inputs=[ - StackArgMapping( - arg_name="a", - allowed_types=[ - wtypes.uint64_wtype, - ], - ), - ], - stack_outputs=[ - wtypes.bytes_wtype, - ], - ), - FunctionOpMapping( - op_code="gtxna", - is_property=False, - immediates=[ - ImmediateArgMapping( - arg_name="a", - literal_type=int, - ), - "ClearStateProgramPages", - ImmediateArgMapping( - arg_name="b", - literal_type=int, - ), - ], - stack_inputs=[], - stack_outputs=[ - wtypes.bytes_wtype, - ], - ), - FunctionOpMapping( - op_code="gtxnas", - is_property=False, - immediates=[ - ImmediateArgMapping( - arg_name="a", - literal_type=int, - ), - "ClearStateProgramPages", - ], - stack_inputs=[ - StackArgMapping( - arg_name="b", - allowed_types=[ - wtypes.uint64_wtype, - ], - ), - ], - stack_outputs=[ - wtypes.bytes_wtype, - ], - ), - ], - "algopy.op.GTxn.num_clear_state_program_pages": [ - FunctionOpMapping( - op_code="gtxns", - is_property=False, - immediates=[ - "NumClearStateProgramPages", - ], - stack_inputs=[ - StackArgMapping( - arg_name="a", - allowed_types=[ - wtypes.uint64_wtype, - ], - ), - ], - stack_outputs=[ - wtypes.uint64_wtype, - ], - ), - FunctionOpMapping( - op_code="gtxn", - is_property=False, - immediates=[ - ImmediateArgMapping( - arg_name="a", - literal_type=int, - ), - "NumClearStateProgramPages", - ], - stack_inputs=[], - stack_outputs=[ - wtypes.uint64_wtype, - ], - ), - ], - "algopy.op.Global.min_txn_fee": [ - FunctionOpMapping( - op_code="global", - is_property=False, - immediates=[ - "MinTxnFee", - ], - stack_inputs=[], - stack_outputs=[ - wtypes.uint64_wtype, - ], - ), - ], - "algopy.op.Global.min_balance": [ - FunctionOpMapping( - op_code="global", - is_property=False, - immediates=[ - "MinBalance", - ], - stack_inputs=[], - stack_outputs=[ - wtypes.uint64_wtype, - ], - ), - ], - "algopy.op.Global.max_txn_life": [ - FunctionOpMapping( - op_code="global", - is_property=False, - immediates=[ - "MaxTxnLife", - ], - stack_inputs=[], - stack_outputs=[ - wtypes.uint64_wtype, - ], - ), - ], - "algopy.op.Global.zero_address": [ - FunctionOpMapping( - op_code="global", - is_property=False, - immediates=[ - "ZeroAddress", - ], - stack_inputs=[], - stack_outputs=[ - wtypes.account_wtype, - ], - ), - ], - "algopy.op.Global.group_size": [ - FunctionOpMapping( - op_code="global", - is_property=False, - immediates=[ - "GroupSize", - ], - stack_inputs=[], - stack_outputs=[ - wtypes.uint64_wtype, - ], - ), - ], - "algopy.op.Global.logic_sig_version": [ - FunctionOpMapping( - op_code="global", - is_property=False, - immediates=[ - "LogicSigVersion", - ], - stack_inputs=[], - stack_outputs=[ - wtypes.uint64_wtype, - ], - ), - ], - "algopy.op.Global.round": [ - FunctionOpMapping( - op_code="global", - is_property=False, - immediates=[ - "Round", - ], - stack_inputs=[], - stack_outputs=[ - wtypes.uint64_wtype, - ], - ), - ], - "algopy.op.Global.latest_timestamp": [ - FunctionOpMapping( - op_code="global", - is_property=False, - immediates=[ - "LatestTimestamp", - ], - stack_inputs=[], - stack_outputs=[ - wtypes.uint64_wtype, - ], - ), - ], - "algopy.op.Global.current_application_id": [ - FunctionOpMapping( - op_code="global", - is_property=False, - immediates=[ - "CurrentApplicationID", - ], - stack_inputs=[], - stack_outputs=[ - wtypes.application_wtype, - ], - ), - ], - "algopy.op.Global.creator_address": [ - FunctionOpMapping( - op_code="global", - is_property=False, - immediates=[ - "CreatorAddress", - ], - stack_inputs=[], - stack_outputs=[ - wtypes.account_wtype, - ], - ), - ], - "algopy.op.Global.current_application_address": [ - FunctionOpMapping( - op_code="global", - is_property=False, - immediates=[ - "CurrentApplicationAddress", - ], - stack_inputs=[], - stack_outputs=[ - wtypes.account_wtype, - ], - ), - ], - "algopy.op.Global.group_id": [ - FunctionOpMapping( - op_code="global", - is_property=False, - immediates=[ - "GroupID", - ], - stack_inputs=[], - stack_outputs=[ - wtypes.bytes_wtype, - ], - ), - ], - "algopy.op.Global.opcode_budget": [ - FunctionOpMapping( - op_code="global", - is_property=False, - immediates=[ - "OpcodeBudget", - ], - stack_inputs=[], - stack_outputs=[ - wtypes.uint64_wtype, - ], - ), - ], - "algopy.op.Global.caller_application_id": [ - FunctionOpMapping( - op_code="global", - is_property=False, - immediates=[ - "CallerApplicationID", - ], - stack_inputs=[], - stack_outputs=[ - wtypes.uint64_wtype, - ], - ), - ], - "algopy.op.Global.caller_application_address": [ - FunctionOpMapping( - op_code="global", - is_property=False, - immediates=[ - "CallerApplicationAddress", - ], - stack_inputs=[], - stack_outputs=[ - wtypes.account_wtype, - ], - ), - ], - "algopy.op.Global.asset_create_min_balance": [ - FunctionOpMapping( - op_code="global", - is_property=False, - immediates=[ - "AssetCreateMinBalance", - ], - stack_inputs=[], - stack_outputs=[ - wtypes.uint64_wtype, - ], - ), - ], - "algopy.op.Global.asset_opt_in_min_balance": [ - FunctionOpMapping( - op_code="global", - is_property=False, - immediates=[ - "AssetOptInMinBalance", - ], - stack_inputs=[], - stack_outputs=[ - wtypes.uint64_wtype, - ], - ), - ], - "algopy.op.Global.genesis_hash": [ - FunctionOpMapping( - op_code="global", - is_property=False, - immediates=[ - "GenesisHash", - ], - stack_inputs=[], - stack_outputs=[ - wtypes.bytes_wtype, - ], - ), - ], - "algopy.op.ITxn.sender": [ - FunctionOpMapping( - op_code="itxn", - is_property=False, - immediates=[ - "Sender", - ], - stack_inputs=[], - stack_outputs=[ - wtypes.account_wtype, - ], - ), - ], - "algopy.op.ITxn.fee": [ - FunctionOpMapping( - op_code="itxn", - is_property=False, - immediates=[ - "Fee", - ], - stack_inputs=[], - stack_outputs=[ - wtypes.uint64_wtype, - ], - ), - ], - "algopy.op.ITxn.first_valid": [ - FunctionOpMapping( - op_code="itxn", - is_property=False, - immediates=[ - "FirstValid", - ], - stack_inputs=[], - stack_outputs=[ - wtypes.uint64_wtype, - ], - ), - ], - "algopy.op.ITxn.first_valid_time": [ - FunctionOpMapping( - op_code="itxn", - is_property=False, - immediates=[ - "FirstValidTime", - ], - stack_inputs=[], - stack_outputs=[ - wtypes.uint64_wtype, - ], - ), - ], - "algopy.op.ITxn.last_valid": [ - FunctionOpMapping( - op_code="itxn", - is_property=False, - immediates=[ - "LastValid", - ], - stack_inputs=[], - stack_outputs=[ - wtypes.uint64_wtype, - ], - ), - ], - "algopy.op.ITxn.note": [ - FunctionOpMapping( - op_code="itxn", - is_property=False, - immediates=[ - "Note", - ], - stack_inputs=[], - stack_outputs=[ - wtypes.bytes_wtype, - ], - ), - ], - "algopy.op.ITxn.lease": [ - FunctionOpMapping( - op_code="itxn", - is_property=False, - immediates=[ - "Lease", - ], - stack_inputs=[], - stack_outputs=[ - wtypes.bytes_wtype, - ], - ), - ], - "algopy.op.ITxn.receiver": [ - FunctionOpMapping( - op_code="itxn", - is_property=False, - immediates=[ - "Receiver", - ], - stack_inputs=[], - stack_outputs=[ - wtypes.account_wtype, - ], - ), - ], - "algopy.op.ITxn.amount": [ - FunctionOpMapping( - op_code="itxn", - is_property=False, - immediates=[ - "Amount", - ], - stack_inputs=[], - stack_outputs=[ - wtypes.uint64_wtype, - ], - ), - ], - "algopy.op.ITxn.close_remainder_to": [ - FunctionOpMapping( - op_code="itxn", - is_property=False, - immediates=[ - "CloseRemainderTo", - ], - stack_inputs=[], - stack_outputs=[ - wtypes.account_wtype, - ], - ), - ], - "algopy.op.ITxn.vote_pk": [ - FunctionOpMapping( - op_code="itxn", - is_property=False, - immediates=[ - "VotePK", - ], - stack_inputs=[], - stack_outputs=[ - wtypes.bytes_wtype, - ], - ), - ], - "algopy.op.ITxn.selection_pk": [ - FunctionOpMapping( - op_code="itxn", - is_property=False, - immediates=[ - "SelectionPK", - ], - stack_inputs=[], - stack_outputs=[ - wtypes.bytes_wtype, - ], - ), - ], - "algopy.op.ITxn.vote_first": [ - FunctionOpMapping( - op_code="itxn", - is_property=False, - immediates=[ - "VoteFirst", - ], - stack_inputs=[], - stack_outputs=[ - wtypes.uint64_wtype, - ], - ), - ], - "algopy.op.ITxn.vote_last": [ - FunctionOpMapping( - op_code="itxn", - is_property=False, - immediates=[ - "VoteLast", - ], - stack_inputs=[], - stack_outputs=[ - wtypes.uint64_wtype, - ], - ), - ], - "algopy.op.ITxn.vote_key_dilution": [ - FunctionOpMapping( - op_code="itxn", - is_property=False, - immediates=[ - "VoteKeyDilution", - ], - stack_inputs=[], - stack_outputs=[ - wtypes.uint64_wtype, - ], - ), - ], - "algopy.op.ITxn.type": [ - FunctionOpMapping( - op_code="itxn", - is_property=False, - immediates=[ - "Type", - ], - stack_inputs=[], - stack_outputs=[ - wtypes.bytes_wtype, - ], - ), - ], - "algopy.op.ITxn.type_enum": [ - FunctionOpMapping( - op_code="itxn", - is_property=False, - immediates=[ - "TypeEnum", - ], - stack_inputs=[], - stack_outputs=[ - wtypes.uint64_wtype, - ], - ), - ], - "algopy.op.ITxn.xfer_asset": [ - FunctionOpMapping( - op_code="itxn", - is_property=False, - immediates=[ - "XferAsset", - ], - stack_inputs=[], - stack_outputs=[ - wtypes.asset_wtype, - ], - ), - ], - "algopy.op.ITxn.asset_amount": [ - FunctionOpMapping( - op_code="itxn", - is_property=False, - immediates=[ - "AssetAmount", - ], - stack_inputs=[], - stack_outputs=[ - wtypes.uint64_wtype, - ], - ), - ], - "algopy.op.ITxn.asset_sender": [ - FunctionOpMapping( - op_code="itxn", - is_property=False, - immediates=[ - "AssetSender", - ], - stack_inputs=[], - stack_outputs=[ - wtypes.account_wtype, - ], - ), - ], - "algopy.op.ITxn.asset_receiver": [ - FunctionOpMapping( - op_code="itxn", - is_property=False, - immediates=[ - "AssetReceiver", - ], - stack_inputs=[], - stack_outputs=[ - wtypes.account_wtype, - ], - ), - ], - "algopy.op.ITxn.asset_close_to": [ - FunctionOpMapping( - op_code="itxn", - is_property=False, - immediates=[ - "AssetCloseTo", - ], - stack_inputs=[], - stack_outputs=[ - wtypes.account_wtype, - ], - ), - ], - "algopy.op.ITxn.group_index": [ - FunctionOpMapping( - op_code="itxn", - is_property=False, - immediates=[ - "GroupIndex", - ], - stack_inputs=[], - stack_outputs=[ - wtypes.uint64_wtype, - ], - ), - ], - "algopy.op.ITxn.tx_id": [ - FunctionOpMapping( - op_code="itxn", - is_property=False, - immediates=[ - "TxID", - ], - stack_inputs=[], - stack_outputs=[ - wtypes.bytes_wtype, - ], - ), - ], - "algopy.op.ITxn.application_id": [ - FunctionOpMapping( - op_code="itxn", - is_property=False, - immediates=[ - "ApplicationID", - ], - stack_inputs=[], - stack_outputs=[ - wtypes.application_wtype, - ], - ), - ], - "algopy.op.ITxn.on_completion": [ - FunctionOpMapping( - op_code="itxn", - is_property=False, - immediates=[ - "OnCompletion", - ], - stack_inputs=[], - stack_outputs=[ - wtypes.uint64_wtype, - ], - ), - ], - "algopy.op.ITxn.application_args": [ - FunctionOpMapping( - op_code="itxnas", - is_property=False, - immediates=[ - "ApplicationArgs", - ], - stack_inputs=[ - StackArgMapping( - arg_name="a", - allowed_types=[ - wtypes.uint64_wtype, - ], - ), - ], - stack_outputs=[ - wtypes.bytes_wtype, - ], - ), - FunctionOpMapping( - op_code="itxna", - is_property=False, - immediates=[ - "ApplicationArgs", - ImmediateArgMapping( - arg_name="a", - literal_type=int, - ), - ], - stack_inputs=[], - stack_outputs=[ - wtypes.bytes_wtype, - ], - ), - ], - "algopy.op.ITxn.num_app_args": [ - FunctionOpMapping( - op_code="itxn", - is_property=False, - immediates=[ - "NumAppArgs", - ], - stack_inputs=[], - stack_outputs=[ - wtypes.uint64_wtype, - ], - ), - ], - "algopy.op.ITxn.accounts": [ - FunctionOpMapping( - op_code="itxnas", - is_property=False, - immediates=[ - "Accounts", - ], - stack_inputs=[ - StackArgMapping( - arg_name="a", - allowed_types=[ - wtypes.uint64_wtype, - ], - ), - ], - stack_outputs=[ - wtypes.account_wtype, - ], - ), - FunctionOpMapping( - op_code="itxna", - is_property=False, - immediates=[ - "Accounts", - ImmediateArgMapping( - arg_name="a", - literal_type=int, - ), - ], - stack_inputs=[], - stack_outputs=[ - wtypes.account_wtype, - ], - ), - ], - "algopy.op.ITxn.num_accounts": [ - FunctionOpMapping( - op_code="itxn", - is_property=False, - immediates=[ - "NumAccounts", - ], - stack_inputs=[], - stack_outputs=[ - wtypes.uint64_wtype, - ], - ), - ], - "algopy.op.ITxn.approval_program": [ - FunctionOpMapping( - op_code="itxn", - is_property=False, - immediates=[ - "ApprovalProgram", - ], - stack_inputs=[], - stack_outputs=[ - wtypes.bytes_wtype, - ], - ), - ], - "algopy.op.ITxn.clear_state_program": [ - FunctionOpMapping( - op_code="itxn", - is_property=False, - immediates=[ - "ClearStateProgram", - ], - stack_inputs=[], - stack_outputs=[ - wtypes.bytes_wtype, - ], - ), - ], - "algopy.op.ITxn.rekey_to": [ - FunctionOpMapping( - op_code="itxn", - is_property=False, - immediates=[ - "RekeyTo", - ], - stack_inputs=[], - stack_outputs=[ - wtypes.account_wtype, - ], - ), - ], - "algopy.op.ITxn.config_asset": [ - FunctionOpMapping( - op_code="itxn", - is_property=False, - immediates=[ - "ConfigAsset", - ], - stack_inputs=[], - stack_outputs=[ - wtypes.asset_wtype, - ], - ), - ], - "algopy.op.ITxn.config_asset_total": [ - FunctionOpMapping( - op_code="itxn", - is_property=False, - immediates=[ - "ConfigAssetTotal", - ], - stack_inputs=[], - stack_outputs=[ - wtypes.uint64_wtype, - ], - ), - ], - "algopy.op.ITxn.config_asset_decimals": [ - FunctionOpMapping( - op_code="itxn", - is_property=False, - immediates=[ - "ConfigAssetDecimals", - ], - stack_inputs=[], - stack_outputs=[ - wtypes.uint64_wtype, - ], - ), - ], - "algopy.op.ITxn.config_asset_default_frozen": [ - FunctionOpMapping( - op_code="itxn", - is_property=False, - immediates=[ - "ConfigAssetDefaultFrozen", - ], - stack_inputs=[], - stack_outputs=[ - wtypes.bool_wtype, - ], - ), - ], - "algopy.op.ITxn.config_asset_unit_name": [ - FunctionOpMapping( - op_code="itxn", - is_property=False, - immediates=[ - "ConfigAssetUnitName", - ], - stack_inputs=[], - stack_outputs=[ - wtypes.bytes_wtype, - ], - ), - ], - "algopy.op.ITxn.config_asset_name": [ - FunctionOpMapping( - op_code="itxn", - is_property=False, - immediates=[ - "ConfigAssetName", - ], - stack_inputs=[], - stack_outputs=[ - wtypes.bytes_wtype, - ], - ), - ], - "algopy.op.ITxn.config_asset_url": [ - FunctionOpMapping( - op_code="itxn", - is_property=False, - immediates=[ - "ConfigAssetURL", - ], - stack_inputs=[], - stack_outputs=[ - wtypes.bytes_wtype, - ], - ), - ], - "algopy.op.ITxn.config_asset_metadata_hash": [ - FunctionOpMapping( - op_code="itxn", - is_property=False, - immediates=[ - "ConfigAssetMetadataHash", - ], - stack_inputs=[], - stack_outputs=[ - wtypes.bytes_wtype, - ], - ), - ], - "algopy.op.ITxn.config_asset_manager": [ - FunctionOpMapping( - op_code="itxn", - is_property=False, - immediates=[ - "ConfigAssetManager", - ], - stack_inputs=[], - stack_outputs=[ - wtypes.account_wtype, - ], - ), - ], - "algopy.op.ITxn.config_asset_reserve": [ - FunctionOpMapping( - op_code="itxn", - is_property=False, - immediates=[ - "ConfigAssetReserve", - ], - stack_inputs=[], - stack_outputs=[ - wtypes.account_wtype, - ], - ), - ], - "algopy.op.ITxn.config_asset_freeze": [ - FunctionOpMapping( - op_code="itxn", - is_property=False, - immediates=[ - "ConfigAssetFreeze", - ], - stack_inputs=[], - stack_outputs=[ - wtypes.account_wtype, - ], - ), - ], - "algopy.op.ITxn.config_asset_clawback": [ - FunctionOpMapping( - op_code="itxn", - is_property=False, - immediates=[ - "ConfigAssetClawback", - ], - stack_inputs=[], - stack_outputs=[ - wtypes.account_wtype, - ], - ), - ], - "algopy.op.ITxn.freeze_asset": [ - FunctionOpMapping( - op_code="itxn", - is_property=False, - immediates=[ - "FreezeAsset", - ], - stack_inputs=[], - stack_outputs=[ - wtypes.asset_wtype, - ], - ), - ], - "algopy.op.ITxn.freeze_asset_account": [ - FunctionOpMapping( - op_code="itxn", - is_property=False, - immediates=[ - "FreezeAssetAccount", - ], - stack_inputs=[], - stack_outputs=[ - wtypes.account_wtype, - ], - ), - ], - "algopy.op.ITxn.freeze_asset_frozen": [ - FunctionOpMapping( - op_code="itxn", - is_property=False, - immediates=[ - "FreezeAssetFrozen", - ], - stack_inputs=[], - stack_outputs=[ - wtypes.bool_wtype, - ], - ), - ], - "algopy.op.ITxn.assets": [ - FunctionOpMapping( - op_code="itxnas", - is_property=False, - immediates=[ - "Assets", - ], - stack_inputs=[ - StackArgMapping( - arg_name="a", - allowed_types=[ - wtypes.uint64_wtype, - ], - ), - ], - stack_outputs=[ - wtypes.asset_wtype, - ], - ), - FunctionOpMapping( - op_code="itxna", - is_property=False, - immediates=[ - "Assets", - ImmediateArgMapping( - arg_name="a", - literal_type=int, - ), - ], - stack_inputs=[], - stack_outputs=[ - wtypes.asset_wtype, - ], - ), - ], - "algopy.op.ITxn.num_assets": [ - FunctionOpMapping( - op_code="itxn", - is_property=False, - immediates=[ - "NumAssets", - ], - stack_inputs=[], - stack_outputs=[ - wtypes.uint64_wtype, - ], - ), - ], - "algopy.op.ITxn.applications": [ - FunctionOpMapping( - op_code="itxnas", - is_property=False, - immediates=[ - "Applications", - ], - stack_inputs=[ - StackArgMapping( - arg_name="a", - allowed_types=[ - wtypes.uint64_wtype, - ], - ), - ], - stack_outputs=[ - wtypes.application_wtype, - ], - ), - FunctionOpMapping( - op_code="itxna", - is_property=False, - immediates=[ - "Applications", - ImmediateArgMapping( - arg_name="a", - literal_type=int, - ), - ], - stack_inputs=[], - stack_outputs=[ - wtypes.application_wtype, - ], - ), - ], - "algopy.op.ITxn.num_applications": [ - FunctionOpMapping( - op_code="itxn", - is_property=False, - immediates=[ - "NumApplications", - ], - stack_inputs=[], - stack_outputs=[ - wtypes.uint64_wtype, - ], - ), - ], - "algopy.op.ITxn.global_num_uint": [ - FunctionOpMapping( - op_code="itxn", - is_property=False, - immediates=[ - "GlobalNumUint", - ], - stack_inputs=[], - stack_outputs=[ - wtypes.uint64_wtype, - ], - ), - ], - "algopy.op.ITxn.global_num_byte_slice": [ - FunctionOpMapping( - op_code="itxn", - is_property=False, - immediates=[ - "GlobalNumByteSlice", - ], - stack_inputs=[], - stack_outputs=[ - wtypes.uint64_wtype, - ], - ), - ], - "algopy.op.ITxn.local_num_uint": [ - FunctionOpMapping( - op_code="itxn", - is_property=False, - immediates=[ - "LocalNumUint", - ], - stack_inputs=[], - stack_outputs=[ - wtypes.uint64_wtype, - ], - ), - ], - "algopy.op.ITxn.local_num_byte_slice": [ - FunctionOpMapping( - op_code="itxn", - is_property=False, - immediates=[ - "LocalNumByteSlice", - ], - stack_inputs=[], - stack_outputs=[ - wtypes.uint64_wtype, - ], - ), - ], - "algopy.op.ITxn.extra_program_pages": [ - FunctionOpMapping( - op_code="itxn", - is_property=False, - immediates=[ - "ExtraProgramPages", - ], - stack_inputs=[], - stack_outputs=[ - wtypes.uint64_wtype, - ], - ), - ], - "algopy.op.ITxn.nonparticipation": [ - FunctionOpMapping( - op_code="itxn", - is_property=False, - immediates=[ - "Nonparticipation", - ], - stack_inputs=[], - stack_outputs=[ - wtypes.bool_wtype, - ], - ), - ], - "algopy.op.ITxn.logs": [ - FunctionOpMapping( - op_code="itxnas", - is_property=False, - immediates=[ - "Logs", - ], - stack_inputs=[ - StackArgMapping( - arg_name="a", - allowed_types=[ - wtypes.uint64_wtype, - ], - ), - ], - stack_outputs=[ - wtypes.bytes_wtype, - ], - ), - FunctionOpMapping( - op_code="itxna", - is_property=False, - immediates=[ - "Logs", - ImmediateArgMapping( - arg_name="a", - literal_type=int, - ), - ], - stack_inputs=[], - stack_outputs=[ - wtypes.bytes_wtype, - ], - ), - ], - "algopy.op.ITxn.num_logs": [ - FunctionOpMapping( - op_code="itxn", - is_property=False, - immediates=[ - "NumLogs", - ], - stack_inputs=[], - stack_outputs=[ - wtypes.uint64_wtype, - ], - ), - ], - "algopy.op.ITxn.created_asset_id": [ - FunctionOpMapping( - op_code="itxn", - is_property=False, - immediates=[ - "CreatedAssetID", - ], - stack_inputs=[], - stack_outputs=[ - wtypes.asset_wtype, - ], - ), - ], - "algopy.op.ITxn.created_application_id": [ - FunctionOpMapping( - op_code="itxn", - is_property=False, - immediates=[ - "CreatedApplicationID", - ], - stack_inputs=[], - stack_outputs=[ - wtypes.application_wtype, - ], - ), - ], - "algopy.op.ITxn.last_log": [ - FunctionOpMapping( - op_code="itxn", - is_property=False, - immediates=[ - "LastLog", - ], - stack_inputs=[], - stack_outputs=[ - wtypes.bytes_wtype, - ], - ), - ], - "algopy.op.ITxn.state_proof_pk": [ - FunctionOpMapping( - op_code="itxn", - is_property=False, - immediates=[ - "StateProofPK", - ], - stack_inputs=[], - stack_outputs=[ - wtypes.bytes_wtype, - ], - ), - ], - "algopy.op.ITxn.approval_program_pages": [ - FunctionOpMapping( - op_code="itxnas", - is_property=False, - immediates=[ - "ApprovalProgramPages", - ], - stack_inputs=[ - StackArgMapping( - arg_name="a", - allowed_types=[ - wtypes.uint64_wtype, - ], - ), - ], - stack_outputs=[ - wtypes.bytes_wtype, - ], - ), - FunctionOpMapping( - op_code="itxna", - is_property=False, - immediates=[ - "ApprovalProgramPages", - ImmediateArgMapping( - arg_name="a", - literal_type=int, - ), - ], - stack_inputs=[], - stack_outputs=[ - wtypes.bytes_wtype, - ], - ), - ], - "algopy.op.ITxn.num_approval_program_pages": [ - FunctionOpMapping( - op_code="itxn", - is_property=False, - immediates=[ - "NumApprovalProgramPages", - ], - stack_inputs=[], - stack_outputs=[ - wtypes.uint64_wtype, - ], - ), - ], - "algopy.op.ITxn.clear_state_program_pages": [ - FunctionOpMapping( - op_code="itxnas", - is_property=False, - immediates=[ - "ClearStateProgramPages", - ], - stack_inputs=[ - StackArgMapping( - arg_name="a", - allowed_types=[ - wtypes.uint64_wtype, - ], - ), - ], - stack_outputs=[ - wtypes.bytes_wtype, - ], - ), - FunctionOpMapping( - op_code="itxna", - is_property=False, - immediates=[ - "ClearStateProgramPages", - ImmediateArgMapping( - arg_name="a", - literal_type=int, - ), - ], - stack_inputs=[], - stack_outputs=[ - wtypes.bytes_wtype, - ], - ), - ], - "algopy.op.ITxn.num_clear_state_program_pages": [ - FunctionOpMapping( - op_code="itxn", - is_property=False, - immediates=[ - "NumClearStateProgramPages", - ], - stack_inputs=[], - stack_outputs=[ - wtypes.uint64_wtype, - ], - ), - ], - "algopy.op.ITxnCreate.begin": [ - FunctionOpMapping( - op_code="itxn_begin", - is_property=False, - immediates=[], - stack_inputs=[], - stack_outputs=[], - ), - ], - "algopy.op.ITxnCreate.next": [ - FunctionOpMapping( - op_code="itxn_next", - is_property=False, - immediates=[], - stack_inputs=[], - stack_outputs=[], - ), - ], - "algopy.op.ITxnCreate.submit": [ - FunctionOpMapping( - op_code="itxn_submit", - is_property=False, - immediates=[], - stack_inputs=[], - stack_outputs=[], - ), - ], - "algopy.op.ITxnCreate.set_sender": [ - FunctionOpMapping( - op_code="itxn_field", - is_property=False, - immediates=[ - "Sender", - ], - stack_inputs=[ - StackArgMapping( - arg_name="a", - allowed_types=[ - wtypes.account_wtype, - ], - ), - ], - stack_outputs=[], - ), - ], - "algopy.op.ITxnCreate.set_fee": [ - FunctionOpMapping( - op_code="itxn_field", - is_property=False, - immediates=[ - "Fee", - ], - stack_inputs=[ - StackArgMapping( - arg_name="a", - allowed_types=[ - wtypes.uint64_wtype, - ], - ), - ], - stack_outputs=[], - ), - ], - "algopy.op.ITxnCreate.set_note": [ - FunctionOpMapping( - op_code="itxn_field", - is_property=False, - immediates=[ - "Note", - ], - stack_inputs=[ - StackArgMapping( - arg_name="a", - allowed_types=[ - wtypes.bytes_wtype, - ], - ), - ], - stack_outputs=[], - ), - ], - "algopy.op.ITxnCreate.set_receiver": [ - FunctionOpMapping( - op_code="itxn_field", - is_property=False, - immediates=[ - "Receiver", - ], - stack_inputs=[ - StackArgMapping( - arg_name="a", - allowed_types=[ - wtypes.account_wtype, - ], - ), - ], - stack_outputs=[], - ), - ], - "algopy.op.ITxnCreate.set_amount": [ - FunctionOpMapping( - op_code="itxn_field", - is_property=False, - immediates=[ - "Amount", - ], - stack_inputs=[ - StackArgMapping( - arg_name="a", - allowed_types=[ - wtypes.uint64_wtype, - ], - ), - ], - stack_outputs=[], - ), - ], - "algopy.op.ITxnCreate.set_close_remainder_to": [ - FunctionOpMapping( - op_code="itxn_field", - is_property=False, - immediates=[ - "CloseRemainderTo", - ], - stack_inputs=[ - StackArgMapping( - arg_name="a", - allowed_types=[ - wtypes.account_wtype, - ], - ), - ], - stack_outputs=[], - ), - ], - "algopy.op.ITxnCreate.set_vote_pk": [ - FunctionOpMapping( - op_code="itxn_field", - is_property=False, - immediates=[ - "VotePK", - ], - stack_inputs=[ - StackArgMapping( - arg_name="a", - allowed_types=[ - wtypes.bytes_wtype, - ], - ), - ], - stack_outputs=[], - ), - ], - "algopy.op.ITxnCreate.set_selection_pk": [ - FunctionOpMapping( - op_code="itxn_field", - is_property=False, - immediates=[ - "SelectionPK", - ], - stack_inputs=[ - StackArgMapping( - arg_name="a", - allowed_types=[ - wtypes.bytes_wtype, - ], - ), - ], - stack_outputs=[], - ), - ], - "algopy.op.ITxnCreate.set_vote_first": [ - FunctionOpMapping( - op_code="itxn_field", - is_property=False, - immediates=[ - "VoteFirst", - ], - stack_inputs=[ - StackArgMapping( - arg_name="a", - allowed_types=[ - wtypes.uint64_wtype, - ], - ), - ], - stack_outputs=[], - ), - ], - "algopy.op.ITxnCreate.set_vote_last": [ - FunctionOpMapping( - op_code="itxn_field", - is_property=False, - immediates=[ - "VoteLast", - ], - stack_inputs=[ - StackArgMapping( - arg_name="a", - allowed_types=[ - wtypes.uint64_wtype, - ], - ), - ], - stack_outputs=[], - ), - ], - "algopy.op.ITxnCreate.set_vote_key_dilution": [ - FunctionOpMapping( - op_code="itxn_field", - is_property=False, - immediates=[ - "VoteKeyDilution", - ], - stack_inputs=[ - StackArgMapping( - arg_name="a", - allowed_types=[ - wtypes.uint64_wtype, - ], - ), - ], - stack_outputs=[], - ), - ], - "algopy.op.ITxnCreate.set_type": [ - FunctionOpMapping( - op_code="itxn_field", - is_property=False, - immediates=[ - "Type", - ], - stack_inputs=[ - StackArgMapping( - arg_name="a", - allowed_types=[ - wtypes.bytes_wtype, - ], - ), - ], - stack_outputs=[], - ), - ], - "algopy.op.ITxnCreate.set_type_enum": [ - FunctionOpMapping( - op_code="itxn_field", - is_property=False, - immediates=[ - "TypeEnum", - ], - stack_inputs=[ - StackArgMapping( - arg_name="a", - allowed_types=[ - wtypes.uint64_wtype, - ], - ), - ], - stack_outputs=[], - ), - ], - "algopy.op.ITxnCreate.set_xfer_asset": [ - FunctionOpMapping( - op_code="itxn_field", - is_property=False, - immediates=[ - "XferAsset", - ], - stack_inputs=[ - StackArgMapping( - arg_name="a", - allowed_types=[ - wtypes.asset_wtype, - wtypes.uint64_wtype, - ], - ), - ], - stack_outputs=[], - ), - ], - "algopy.op.ITxnCreate.set_asset_amount": [ - FunctionOpMapping( - op_code="itxn_field", - is_property=False, - immediates=[ - "AssetAmount", - ], - stack_inputs=[ - StackArgMapping( - arg_name="a", - allowed_types=[ - wtypes.uint64_wtype, - ], - ), - ], - stack_outputs=[], - ), - ], - "algopy.op.ITxnCreate.set_asset_sender": [ - FunctionOpMapping( - op_code="itxn_field", - is_property=False, - immediates=[ - "AssetSender", - ], - stack_inputs=[ - StackArgMapping( - arg_name="a", - allowed_types=[ - wtypes.account_wtype, - ], - ), - ], - stack_outputs=[], - ), - ], - "algopy.op.ITxnCreate.set_asset_receiver": [ - FunctionOpMapping( - op_code="itxn_field", - is_property=False, - immediates=[ - "AssetReceiver", - ], - stack_inputs=[ - StackArgMapping( - arg_name="a", - allowed_types=[ - wtypes.account_wtype, - ], - ), - ], - stack_outputs=[], - ), - ], - "algopy.op.ITxnCreate.set_asset_close_to": [ - FunctionOpMapping( - op_code="itxn_field", - is_property=False, - immediates=[ - "AssetCloseTo", - ], - stack_inputs=[ - StackArgMapping( - arg_name="a", - allowed_types=[ - wtypes.account_wtype, - ], - ), - ], - stack_outputs=[], - ), - ], - "algopy.op.ITxnCreate.set_application_id": [ - FunctionOpMapping( - op_code="itxn_field", - is_property=False, - immediates=[ - "ApplicationID", - ], - stack_inputs=[ - StackArgMapping( - arg_name="a", - allowed_types=[ - wtypes.application_wtype, - wtypes.uint64_wtype, - ], - ), - ], - stack_outputs=[], - ), - ], - "algopy.op.ITxnCreate.set_on_completion": [ - FunctionOpMapping( - op_code="itxn_field", - is_property=False, - immediates=[ - "OnCompletion", - ], - stack_inputs=[ - StackArgMapping( - arg_name="a", - allowed_types=[ - wtypes.uint64_wtype, - ], - ), - ], - stack_outputs=[], - ), - ], - "algopy.op.ITxnCreate.set_application_args": [ - FunctionOpMapping( - op_code="itxn_field", - is_property=False, - immediates=[ - "ApplicationArgs", - ], - stack_inputs=[ - StackArgMapping( - arg_name="a", - allowed_types=[ - wtypes.bytes_wtype, - ], - ), - ], - stack_outputs=[], - ), - ], - "algopy.op.ITxnCreate.set_accounts": [ - FunctionOpMapping( - op_code="itxn_field", - is_property=False, - immediates=[ - "Accounts", - ], - stack_inputs=[ - StackArgMapping( - arg_name="a", - allowed_types=[ - wtypes.account_wtype, - ], - ), - ], - stack_outputs=[], - ), - ], - "algopy.op.ITxnCreate.set_approval_program": [ - FunctionOpMapping( - op_code="itxn_field", - is_property=False, - immediates=[ - "ApprovalProgram", - ], - stack_inputs=[ - StackArgMapping( - arg_name="a", - allowed_types=[ - wtypes.bytes_wtype, - ], - ), - ], - stack_outputs=[], - ), - ], - "algopy.op.ITxnCreate.set_clear_state_program": [ - FunctionOpMapping( - op_code="itxn_field", - is_property=False, - immediates=[ - "ClearStateProgram", - ], - stack_inputs=[ - StackArgMapping( - arg_name="a", - allowed_types=[ - wtypes.bytes_wtype, - ], - ), - ], - stack_outputs=[], - ), - ], - "algopy.op.ITxnCreate.set_rekey_to": [ - FunctionOpMapping( - op_code="itxn_field", - is_property=False, - immediates=[ - "RekeyTo", - ], - stack_inputs=[ - StackArgMapping( - arg_name="a", - allowed_types=[ - wtypes.account_wtype, - ], - ), - ], - stack_outputs=[], - ), - ], - "algopy.op.ITxnCreate.set_config_asset": [ - FunctionOpMapping( - op_code="itxn_field", - is_property=False, - immediates=[ - "ConfigAsset", - ], - stack_inputs=[ - StackArgMapping( - arg_name="a", - allowed_types=[ - wtypes.asset_wtype, - wtypes.uint64_wtype, - ], - ), - ], - stack_outputs=[], - ), - ], - "algopy.op.ITxnCreate.set_config_asset_total": [ - FunctionOpMapping( - op_code="itxn_field", - is_property=False, - immediates=[ - "ConfigAssetTotal", - ], - stack_inputs=[ - StackArgMapping( - arg_name="a", - allowed_types=[ - wtypes.uint64_wtype, - ], - ), - ], - stack_outputs=[], - ), - ], - "algopy.op.ITxnCreate.set_config_asset_decimals": [ - FunctionOpMapping( - op_code="itxn_field", - is_property=False, - immediates=[ - "ConfigAssetDecimals", - ], - stack_inputs=[ - StackArgMapping( - arg_name="a", - allowed_types=[ - wtypes.uint64_wtype, - ], - ), - ], - stack_outputs=[], - ), - ], - "algopy.op.ITxnCreate.set_config_asset_default_frozen": [ - FunctionOpMapping( - op_code="itxn_field", - is_property=False, - immediates=[ - "ConfigAssetDefaultFrozen", - ], - stack_inputs=[ - StackArgMapping( - arg_name="a", - allowed_types=[ - wtypes.bool_wtype, - wtypes.uint64_wtype, - ], - ), - ], - stack_outputs=[], - ), - ], - "algopy.op.ITxnCreate.set_config_asset_unit_name": [ - FunctionOpMapping( - op_code="itxn_field", - is_property=False, - immediates=[ - "ConfigAssetUnitName", - ], - stack_inputs=[ - StackArgMapping( - arg_name="a", - allowed_types=[ - wtypes.bytes_wtype, - ], - ), - ], - stack_outputs=[], - ), - ], - "algopy.op.ITxnCreate.set_config_asset_name": [ - FunctionOpMapping( - op_code="itxn_field", - is_property=False, - immediates=[ - "ConfigAssetName", - ], - stack_inputs=[ - StackArgMapping( - arg_name="a", - allowed_types=[ - wtypes.bytes_wtype, - ], - ), - ], - stack_outputs=[], - ), - ], - "algopy.op.ITxnCreate.set_config_asset_url": [ - FunctionOpMapping( - op_code="itxn_field", - is_property=False, - immediates=[ - "ConfigAssetURL", - ], - stack_inputs=[ - StackArgMapping( - arg_name="a", - allowed_types=[ - wtypes.bytes_wtype, - ], - ), - ], - stack_outputs=[], - ), - ], - "algopy.op.ITxnCreate.set_config_asset_metadata_hash": [ - FunctionOpMapping( - op_code="itxn_field", - is_property=False, - immediates=[ - "ConfigAssetMetadataHash", - ], - stack_inputs=[ - StackArgMapping( - arg_name="a", - allowed_types=[ - wtypes.bytes_wtype, - ], - ), - ], - stack_outputs=[], - ), - ], - "algopy.op.ITxnCreate.set_config_asset_manager": [ - FunctionOpMapping( - op_code="itxn_field", - is_property=False, - immediates=[ - "ConfigAssetManager", - ], - stack_inputs=[ - StackArgMapping( - arg_name="a", - allowed_types=[ - wtypes.account_wtype, - ], - ), - ], - stack_outputs=[], - ), - ], - "algopy.op.ITxnCreate.set_config_asset_reserve": [ - FunctionOpMapping( - op_code="itxn_field", - is_property=False, - immediates=[ - "ConfigAssetReserve", - ], - stack_inputs=[ - StackArgMapping( - arg_name="a", - allowed_types=[ - wtypes.account_wtype, - ], - ), - ], - stack_outputs=[], - ), - ], - "algopy.op.ITxnCreate.set_config_asset_freeze": [ - FunctionOpMapping( - op_code="itxn_field", - is_property=False, - immediates=[ - "ConfigAssetFreeze", - ], - stack_inputs=[ - StackArgMapping( - arg_name="a", - allowed_types=[ - wtypes.account_wtype, - ], - ), - ], - stack_outputs=[], - ), - ], - "algopy.op.ITxnCreate.set_config_asset_clawback": [ - FunctionOpMapping( - op_code="itxn_field", - is_property=False, - immediates=[ - "ConfigAssetClawback", - ], - stack_inputs=[ - StackArgMapping( - arg_name="a", - allowed_types=[ - wtypes.account_wtype, - ], - ), - ], - stack_outputs=[], - ), - ], - "algopy.op.ITxnCreate.set_freeze_asset": [ - FunctionOpMapping( - op_code="itxn_field", - is_property=False, - immediates=[ - "FreezeAsset", - ], - stack_inputs=[ - StackArgMapping( - arg_name="a", - allowed_types=[ - wtypes.asset_wtype, - wtypes.uint64_wtype, - ], - ), - ], - stack_outputs=[], - ), - ], - "algopy.op.ITxnCreate.set_freeze_asset_account": [ - FunctionOpMapping( - op_code="itxn_field", - is_property=False, - immediates=[ - "FreezeAssetAccount", - ], - stack_inputs=[ - StackArgMapping( - arg_name="a", - allowed_types=[ - wtypes.account_wtype, - ], - ), - ], - stack_outputs=[], - ), - ], - "algopy.op.ITxnCreate.set_freeze_asset_frozen": [ - FunctionOpMapping( - op_code="itxn_field", - is_property=False, - immediates=[ - "FreezeAssetFrozen", - ], - stack_inputs=[ - StackArgMapping( - arg_name="a", - allowed_types=[ - wtypes.bool_wtype, - wtypes.uint64_wtype, - ], - ), - ], - stack_outputs=[], - ), - ], - "algopy.op.ITxnCreate.set_assets": [ - FunctionOpMapping( - op_code="itxn_field", - is_property=False, - immediates=[ - "Assets", - ], - stack_inputs=[ - StackArgMapping( - arg_name="a", - allowed_types=[ - wtypes.uint64_wtype, - ], - ), - ], - stack_outputs=[], - ), - ], - "algopy.op.ITxnCreate.set_applications": [ - FunctionOpMapping( - op_code="itxn_field", - is_property=False, - immediates=[ - "Applications", - ], - stack_inputs=[ - StackArgMapping( - arg_name="a", - allowed_types=[ - wtypes.uint64_wtype, - ], - ), - ], - stack_outputs=[], - ), - ], - "algopy.op.ITxnCreate.set_global_num_uint": [ - FunctionOpMapping( - op_code="itxn_field", - is_property=False, - immediates=[ - "GlobalNumUint", - ], - stack_inputs=[ - StackArgMapping( - arg_name="a", - allowed_types=[ - wtypes.uint64_wtype, - ], - ), - ], - stack_outputs=[], - ), - ], - "algopy.op.ITxnCreate.set_global_num_byte_slice": [ - FunctionOpMapping( - op_code="itxn_field", - is_property=False, - immediates=[ - "GlobalNumByteSlice", - ], - stack_inputs=[ - StackArgMapping( - arg_name="a", - allowed_types=[ - wtypes.uint64_wtype, - ], - ), - ], - stack_outputs=[], - ), - ], - "algopy.op.ITxnCreate.set_local_num_uint": [ - FunctionOpMapping( - op_code="itxn_field", - is_property=False, - immediates=[ - "LocalNumUint", - ], - stack_inputs=[ - StackArgMapping( - arg_name="a", - allowed_types=[ - wtypes.uint64_wtype, - ], - ), - ], - stack_outputs=[], - ), - ], - "algopy.op.ITxnCreate.set_local_num_byte_slice": [ - FunctionOpMapping( - op_code="itxn_field", - is_property=False, - immediates=[ - "LocalNumByteSlice", - ], - stack_inputs=[ - StackArgMapping( - arg_name="a", - allowed_types=[ - wtypes.uint64_wtype, - ], - ), - ], - stack_outputs=[], - ), - ], - "algopy.op.ITxnCreate.set_extra_program_pages": [ - FunctionOpMapping( - op_code="itxn_field", - is_property=False, - immediates=[ - "ExtraProgramPages", - ], - stack_inputs=[ - StackArgMapping( - arg_name="a", - allowed_types=[ - wtypes.uint64_wtype, - ], - ), - ], - stack_outputs=[], - ), - ], - "algopy.op.ITxnCreate.set_nonparticipation": [ - FunctionOpMapping( - op_code="itxn_field", - is_property=False, - immediates=[ - "Nonparticipation", - ], - stack_inputs=[ - StackArgMapping( - arg_name="a", - allowed_types=[ - wtypes.bool_wtype, - wtypes.uint64_wtype, - ], - ), - ], - stack_outputs=[], - ), - ], - "algopy.op.ITxnCreate.set_state_proof_pk": [ - FunctionOpMapping( - op_code="itxn_field", - is_property=False, - immediates=[ - "StateProofPK", - ], - stack_inputs=[ - StackArgMapping( - arg_name="a", - allowed_types=[ - wtypes.bytes_wtype, - ], - ), - ], - stack_outputs=[], - ), - ], - "algopy.op.ITxnCreate.set_approval_program_pages": [ - FunctionOpMapping( - op_code="itxn_field", - is_property=False, - immediates=[ - "ApprovalProgramPages", - ], - stack_inputs=[ - StackArgMapping( - arg_name="a", - allowed_types=[ - wtypes.bytes_wtype, - ], - ), - ], - stack_outputs=[], - ), - ], - "algopy.op.ITxnCreate.set_clear_state_program_pages": [ - FunctionOpMapping( - op_code="itxn_field", - is_property=False, - immediates=[ - "ClearStateProgramPages", - ], - stack_inputs=[ - StackArgMapping( - arg_name="a", - allowed_types=[ - wtypes.bytes_wtype, - ], - ), - ], - stack_outputs=[], - ), - ], - "algopy.op.JsonRef.json_string": [ - FunctionOpMapping( - op_code="json_ref", - is_property=False, - immediates=[ - "JSONString", - ], - stack_inputs=[ - StackArgMapping( - arg_name="a", - allowed_types=[ - wtypes.bytes_wtype, - ], - ), - StackArgMapping( - arg_name="b", - allowed_types=[ - wtypes.bytes_wtype, - ], - ), - ], - stack_outputs=[ - wtypes.bytes_wtype, - ], - ), - ], - "algopy.op.JsonRef.json_uint64": [ - FunctionOpMapping( - op_code="json_ref", - is_property=False, - immediates=[ - "JSONUint64", - ], - stack_inputs=[ - StackArgMapping( - arg_name="a", - allowed_types=[ - wtypes.bytes_wtype, - ], - ), - StackArgMapping( - arg_name="b", - allowed_types=[ - wtypes.bytes_wtype, - ], - ), - ], - stack_outputs=[ - wtypes.uint64_wtype, - ], - ), - ], - "algopy.op.JsonRef.json_object": [ - FunctionOpMapping( - op_code="json_ref", - is_property=False, - immediates=[ - "JSONObject", - ], - stack_inputs=[ - StackArgMapping( - arg_name="a", - allowed_types=[ - wtypes.bytes_wtype, - ], - ), - StackArgMapping( - arg_name="b", - allowed_types=[ - wtypes.bytes_wtype, - ], - ), - ], - stack_outputs=[ - wtypes.bytes_wtype, - ], - ), - ], - "algopy.op.Scratch.load_bytes": [ - FunctionOpMapping( - op_code="loads", - is_property=False, - immediates=[], - stack_inputs=[ - StackArgMapping( - arg_name="a", - allowed_types=[ - wtypes.uint64_wtype, - ], - ), - ], - stack_outputs=[ - wtypes.bytes_wtype, - ], - ), - ], - "algopy.op.Scratch.load_uint64": [ - FunctionOpMapping( - op_code="loads", - is_property=False, - immediates=[], - stack_inputs=[ - StackArgMapping( - arg_name="a", - allowed_types=[ - wtypes.uint64_wtype, - ], - ), - ], - stack_outputs=[ - wtypes.uint64_wtype, - ], - ), - ], - "algopy.op.Scratch.store": [ - FunctionOpMapping( - op_code="stores", - is_property=False, - immediates=[], - stack_inputs=[ - StackArgMapping( - arg_name="a", - allowed_types=[ - wtypes.uint64_wtype, - ], - ), - StackArgMapping( - arg_name="b", - allowed_types=[ - wtypes.bytes_wtype, - wtypes.uint64_wtype, - ], - ), - ], - stack_outputs=[], - ), - ], - "algopy.op.Txn.sender": [ - FunctionOpMapping( - op_code="txn", - is_property=False, - immediates=[ - "Sender", - ], - stack_inputs=[], - stack_outputs=[ - wtypes.account_wtype, - ], - ), - ], - "algopy.op.Txn.fee": [ - FunctionOpMapping( - op_code="txn", - is_property=False, - immediates=[ - "Fee", - ], - stack_inputs=[], - stack_outputs=[ - wtypes.uint64_wtype, - ], - ), - ], - "algopy.op.Txn.first_valid": [ - FunctionOpMapping( - op_code="txn", - is_property=False, - immediates=[ - "FirstValid", - ], - stack_inputs=[], - stack_outputs=[ - wtypes.uint64_wtype, - ], - ), - ], - "algopy.op.Txn.first_valid_time": [ - FunctionOpMapping( - op_code="txn", - is_property=False, - immediates=[ - "FirstValidTime", - ], - stack_inputs=[], - stack_outputs=[ - wtypes.uint64_wtype, - ], - ), - ], - "algopy.op.Txn.last_valid": [ - FunctionOpMapping( - op_code="txn", - is_property=False, - immediates=[ - "LastValid", - ], - stack_inputs=[], - stack_outputs=[ - wtypes.uint64_wtype, - ], - ), - ], - "algopy.op.Txn.note": [ - FunctionOpMapping( - op_code="txn", - is_property=False, - immediates=[ - "Note", - ], - stack_inputs=[], - stack_outputs=[ - wtypes.bytes_wtype, - ], - ), - ], - "algopy.op.Txn.lease": [ - FunctionOpMapping( - op_code="txn", - is_property=False, - immediates=[ - "Lease", - ], - stack_inputs=[], - stack_outputs=[ - wtypes.bytes_wtype, - ], - ), - ], - "algopy.op.Txn.receiver": [ - FunctionOpMapping( - op_code="txn", - is_property=False, - immediates=[ - "Receiver", - ], - stack_inputs=[], - stack_outputs=[ - wtypes.account_wtype, - ], - ), - ], - "algopy.op.Txn.amount": [ - FunctionOpMapping( - op_code="txn", - is_property=False, - immediates=[ - "Amount", - ], - stack_inputs=[], - stack_outputs=[ - wtypes.uint64_wtype, - ], - ), - ], - "algopy.op.Txn.close_remainder_to": [ - FunctionOpMapping( - op_code="txn", - is_property=False, - immediates=[ - "CloseRemainderTo", - ], - stack_inputs=[], - stack_outputs=[ - wtypes.account_wtype, - ], - ), - ], - "algopy.op.Txn.vote_pk": [ - FunctionOpMapping( - op_code="txn", - is_property=False, - immediates=[ - "VotePK", - ], - stack_inputs=[], - stack_outputs=[ - wtypes.bytes_wtype, - ], - ), - ], - "algopy.op.Txn.selection_pk": [ - FunctionOpMapping( - op_code="txn", - is_property=False, - immediates=[ - "SelectionPK", - ], - stack_inputs=[], - stack_outputs=[ - wtypes.bytes_wtype, - ], - ), - ], - "algopy.op.Txn.vote_first": [ - FunctionOpMapping( - op_code="txn", - is_property=False, - immediates=[ - "VoteFirst", - ], - stack_inputs=[], - stack_outputs=[ - wtypes.uint64_wtype, - ], - ), - ], - "algopy.op.Txn.vote_last": [ - FunctionOpMapping( - op_code="txn", - is_property=False, - immediates=[ - "VoteLast", - ], - stack_inputs=[], - stack_outputs=[ - wtypes.uint64_wtype, - ], - ), - ], - "algopy.op.Txn.vote_key_dilution": [ - FunctionOpMapping( - op_code="txn", - is_property=False, - immediates=[ - "VoteKeyDilution", - ], - stack_inputs=[], - stack_outputs=[ - wtypes.uint64_wtype, - ], - ), - ], - "algopy.op.Txn.type": [ - FunctionOpMapping( - op_code="txn", - is_property=False, - immediates=[ - "Type", - ], - stack_inputs=[], - stack_outputs=[ - wtypes.bytes_wtype, - ], - ), - ], - "algopy.op.Txn.type_enum": [ - FunctionOpMapping( - op_code="txn", - is_property=False, - immediates=[ - "TypeEnum", - ], - stack_inputs=[], - stack_outputs=[ - wtypes.uint64_wtype, - ], - ), - ], - "algopy.op.Txn.xfer_asset": [ - FunctionOpMapping( - op_code="txn", - is_property=False, - immediates=[ - "XferAsset", - ], - stack_inputs=[], - stack_outputs=[ - wtypes.asset_wtype, - ], - ), - ], - "algopy.op.Txn.asset_amount": [ - FunctionOpMapping( - op_code="txn", - is_property=False, - immediates=[ - "AssetAmount", - ], - stack_inputs=[], - stack_outputs=[ - wtypes.uint64_wtype, - ], - ), - ], - "algopy.op.Txn.asset_sender": [ - FunctionOpMapping( - op_code="txn", - is_property=False, - immediates=[ - "AssetSender", - ], - stack_inputs=[], - stack_outputs=[ - wtypes.account_wtype, - ], - ), - ], - "algopy.op.Txn.asset_receiver": [ - FunctionOpMapping( - op_code="txn", - is_property=False, - immediates=[ - "AssetReceiver", - ], - stack_inputs=[], - stack_outputs=[ - wtypes.account_wtype, - ], - ), - ], - "algopy.op.Txn.asset_close_to": [ - FunctionOpMapping( - op_code="txn", - is_property=False, - immediates=[ - "AssetCloseTo", - ], - stack_inputs=[], - stack_outputs=[ - wtypes.account_wtype, - ], - ), - ], - "algopy.op.Txn.group_index": [ - FunctionOpMapping( - op_code="txn", - is_property=False, - immediates=[ - "GroupIndex", - ], - stack_inputs=[], - stack_outputs=[ - wtypes.uint64_wtype, - ], - ), - ], - "algopy.op.Txn.tx_id": [ - FunctionOpMapping( - op_code="txn", - is_property=False, - immediates=[ - "TxID", - ], - stack_inputs=[], - stack_outputs=[ - wtypes.bytes_wtype, - ], - ), - ], - "algopy.op.Txn.application_id": [ - FunctionOpMapping( - op_code="txn", - is_property=False, - immediates=[ - "ApplicationID", - ], - stack_inputs=[], - stack_outputs=[ - wtypes.application_wtype, - ], - ), - ], - "algopy.op.Txn.on_completion": [ - FunctionOpMapping( - op_code="txn", - is_property=False, - immediates=[ - "OnCompletion", - ], - stack_inputs=[], - stack_outputs=[ - wtypes.uint64_wtype, - ], - ), - ], - "algopy.op.Txn.application_args": [ - FunctionOpMapping( - op_code="txnas", - is_property=False, - immediates=[ - "ApplicationArgs", - ], - stack_inputs=[ - StackArgMapping( - arg_name="a", - allowed_types=[ - wtypes.uint64_wtype, - ], - ), - ], - stack_outputs=[ - wtypes.bytes_wtype, - ], - ), - FunctionOpMapping( - op_code="txna", - is_property=False, - immediates=[ - "ApplicationArgs", - ImmediateArgMapping( - arg_name="a", - literal_type=int, - ), - ], - stack_inputs=[], - stack_outputs=[ - wtypes.bytes_wtype, - ], - ), - ], - "algopy.op.Txn.num_app_args": [ - FunctionOpMapping( - op_code="txn", - is_property=False, - immediates=[ - "NumAppArgs", - ], - stack_inputs=[], - stack_outputs=[ - wtypes.uint64_wtype, - ], - ), - ], - "algopy.op.Txn.accounts": [ - FunctionOpMapping( - op_code="txnas", - is_property=False, - immediates=[ - "Accounts", - ], - stack_inputs=[ - StackArgMapping( - arg_name="a", - allowed_types=[ - wtypes.uint64_wtype, - ], - ), - ], - stack_outputs=[ - wtypes.account_wtype, - ], - ), - FunctionOpMapping( - op_code="txna", - is_property=False, - immediates=[ - "Accounts", - ImmediateArgMapping( - arg_name="a", - literal_type=int, - ), - ], - stack_inputs=[], - stack_outputs=[ - wtypes.account_wtype, - ], - ), - ], - "algopy.op.Txn.num_accounts": [ - FunctionOpMapping( - op_code="txn", - is_property=False, - immediates=[ - "NumAccounts", - ], - stack_inputs=[], - stack_outputs=[ - wtypes.uint64_wtype, - ], - ), - ], - "algopy.op.Txn.approval_program": [ - FunctionOpMapping( - op_code="txn", - is_property=False, - immediates=[ - "ApprovalProgram", - ], - stack_inputs=[], - stack_outputs=[ - wtypes.bytes_wtype, - ], - ), - ], - "algopy.op.Txn.clear_state_program": [ - FunctionOpMapping( - op_code="txn", - is_property=False, - immediates=[ - "ClearStateProgram", - ], - stack_inputs=[], - stack_outputs=[ - wtypes.bytes_wtype, - ], - ), - ], - "algopy.op.Txn.rekey_to": [ - FunctionOpMapping( - op_code="txn", - is_property=False, - immediates=[ - "RekeyTo", - ], - stack_inputs=[], - stack_outputs=[ - wtypes.account_wtype, - ], - ), - ], - "algopy.op.Txn.config_asset": [ - FunctionOpMapping( - op_code="txn", - is_property=False, - immediates=[ - "ConfigAsset", - ], - stack_inputs=[], - stack_outputs=[ - wtypes.asset_wtype, - ], - ), - ], - "algopy.op.Txn.config_asset_total": [ - FunctionOpMapping( - op_code="txn", - is_property=False, - immediates=[ - "ConfigAssetTotal", - ], - stack_inputs=[], - stack_outputs=[ - wtypes.uint64_wtype, - ], - ), - ], - "algopy.op.Txn.config_asset_decimals": [ - FunctionOpMapping( - op_code="txn", - is_property=False, - immediates=[ - "ConfigAssetDecimals", - ], - stack_inputs=[], - stack_outputs=[ - wtypes.uint64_wtype, - ], - ), - ], - "algopy.op.Txn.config_asset_default_frozen": [ - FunctionOpMapping( - op_code="txn", - is_property=False, - immediates=[ - "ConfigAssetDefaultFrozen", - ], - stack_inputs=[], - stack_outputs=[ - wtypes.bool_wtype, - ], - ), - ], - "algopy.op.Txn.config_asset_unit_name": [ - FunctionOpMapping( - op_code="txn", - is_property=False, - immediates=[ - "ConfigAssetUnitName", - ], - stack_inputs=[], - stack_outputs=[ - wtypes.bytes_wtype, - ], - ), - ], - "algopy.op.Txn.config_asset_name": [ - FunctionOpMapping( - op_code="txn", - is_property=False, - immediates=[ - "ConfigAssetName", - ], - stack_inputs=[], - stack_outputs=[ - wtypes.bytes_wtype, - ], - ), - ], - "algopy.op.Txn.config_asset_url": [ - FunctionOpMapping( - op_code="txn", - is_property=False, - immediates=[ - "ConfigAssetURL", - ], - stack_inputs=[], - stack_outputs=[ - wtypes.bytes_wtype, - ], - ), - ], - "algopy.op.Txn.config_asset_metadata_hash": [ - FunctionOpMapping( - op_code="txn", - is_property=False, - immediates=[ - "ConfigAssetMetadataHash", - ], - stack_inputs=[], - stack_outputs=[ - wtypes.bytes_wtype, - ], - ), - ], - "algopy.op.Txn.config_asset_manager": [ - FunctionOpMapping( - op_code="txn", - is_property=False, - immediates=[ - "ConfigAssetManager", - ], - stack_inputs=[], - stack_outputs=[ - wtypes.account_wtype, - ], - ), - ], - "algopy.op.Txn.config_asset_reserve": [ - FunctionOpMapping( - op_code="txn", - is_property=False, - immediates=[ - "ConfigAssetReserve", - ], - stack_inputs=[], - stack_outputs=[ - wtypes.account_wtype, - ], - ), - ], - "algopy.op.Txn.config_asset_freeze": [ - FunctionOpMapping( - op_code="txn", - is_property=False, - immediates=[ - "ConfigAssetFreeze", - ], - stack_inputs=[], - stack_outputs=[ - wtypes.account_wtype, - ], - ), - ], - "algopy.op.Txn.config_asset_clawback": [ - FunctionOpMapping( - op_code="txn", - is_property=False, - immediates=[ - "ConfigAssetClawback", - ], - stack_inputs=[], - stack_outputs=[ - wtypes.account_wtype, - ], - ), - ], - "algopy.op.Txn.freeze_asset": [ - FunctionOpMapping( - op_code="txn", - is_property=False, - immediates=[ - "FreezeAsset", - ], - stack_inputs=[], - stack_outputs=[ - wtypes.asset_wtype, - ], - ), - ], - "algopy.op.Txn.freeze_asset_account": [ - FunctionOpMapping( - op_code="txn", - is_property=False, - immediates=[ - "FreezeAssetAccount", - ], - stack_inputs=[], - stack_outputs=[ - wtypes.account_wtype, - ], - ), - ], - "algopy.op.Txn.freeze_asset_frozen": [ - FunctionOpMapping( - op_code="txn", - is_property=False, - immediates=[ - "FreezeAssetFrozen", - ], - stack_inputs=[], - stack_outputs=[ - wtypes.bool_wtype, - ], - ), - ], - "algopy.op.Txn.assets": [ - FunctionOpMapping( - op_code="txnas", - is_property=False, - immediates=[ - "Assets", - ], - stack_inputs=[ - StackArgMapping( - arg_name="a", - allowed_types=[ - wtypes.uint64_wtype, - ], - ), - ], - stack_outputs=[ - wtypes.asset_wtype, - ], - ), - FunctionOpMapping( - op_code="txna", - is_property=False, - immediates=[ - "Assets", - ImmediateArgMapping( - arg_name="a", - literal_type=int, - ), - ], - stack_inputs=[], - stack_outputs=[ - wtypes.asset_wtype, - ], - ), - ], - "algopy.op.Txn.num_assets": [ - FunctionOpMapping( - op_code="txn", - is_property=False, - immediates=[ - "NumAssets", - ], - stack_inputs=[], - stack_outputs=[ - wtypes.uint64_wtype, - ], - ), - ], - "algopy.op.Txn.applications": [ - FunctionOpMapping( - op_code="txnas", - is_property=False, - immediates=[ - "Applications", - ], - stack_inputs=[ - StackArgMapping( - arg_name="a", - allowed_types=[ - wtypes.uint64_wtype, - ], - ), - ], - stack_outputs=[ - wtypes.application_wtype, - ], - ), - FunctionOpMapping( - op_code="txna", - is_property=False, - immediates=[ - "Applications", - ImmediateArgMapping( - arg_name="a", - literal_type=int, - ), - ], - stack_inputs=[], - stack_outputs=[ - wtypes.application_wtype, - ], - ), - ], - "algopy.op.Txn.num_applications": [ - FunctionOpMapping( - op_code="txn", - is_property=False, - immediates=[ - "NumApplications", - ], - stack_inputs=[], - stack_outputs=[ - wtypes.uint64_wtype, - ], - ), - ], - "algopy.op.Txn.global_num_uint": [ - FunctionOpMapping( - op_code="txn", - is_property=False, - immediates=[ - "GlobalNumUint", - ], - stack_inputs=[], - stack_outputs=[ - wtypes.uint64_wtype, - ], - ), - ], - "algopy.op.Txn.global_num_byte_slice": [ - FunctionOpMapping( - op_code="txn", - is_property=False, - immediates=[ - "GlobalNumByteSlice", - ], - stack_inputs=[], - stack_outputs=[ - wtypes.uint64_wtype, - ], - ), - ], - "algopy.op.Txn.local_num_uint": [ - FunctionOpMapping( - op_code="txn", - is_property=False, - immediates=[ - "LocalNumUint", - ], - stack_inputs=[], - stack_outputs=[ - wtypes.uint64_wtype, - ], - ), - ], - "algopy.op.Txn.local_num_byte_slice": [ - FunctionOpMapping( - op_code="txn", - is_property=False, - immediates=[ - "LocalNumByteSlice", - ], - stack_inputs=[], - stack_outputs=[ - wtypes.uint64_wtype, - ], - ), - ], - "algopy.op.Txn.extra_program_pages": [ - FunctionOpMapping( - op_code="txn", - is_property=False, - immediates=[ - "ExtraProgramPages", - ], - stack_inputs=[], - stack_outputs=[ - wtypes.uint64_wtype, - ], - ), - ], - "algopy.op.Txn.nonparticipation": [ - FunctionOpMapping( - op_code="txn", - is_property=False, - immediates=[ - "Nonparticipation", - ], - stack_inputs=[], - stack_outputs=[ - wtypes.bool_wtype, - ], - ), - ], - "algopy.op.Txn.logs": [ - FunctionOpMapping( - op_code="txnas", - is_property=False, - immediates=[ - "Logs", - ], - stack_inputs=[ - StackArgMapping( - arg_name="a", - allowed_types=[ - wtypes.uint64_wtype, - ], - ), - ], - stack_outputs=[ - wtypes.bytes_wtype, - ], - ), - FunctionOpMapping( - op_code="txna", - is_property=False, - immediates=[ - "Logs", - ImmediateArgMapping( - arg_name="a", - literal_type=int, - ), - ], - stack_inputs=[], - stack_outputs=[ - wtypes.bytes_wtype, - ], - ), - ], - "algopy.op.Txn.num_logs": [ - FunctionOpMapping( - op_code="txn", - is_property=False, - immediates=[ - "NumLogs", - ], - stack_inputs=[], - stack_outputs=[ - wtypes.uint64_wtype, - ], - ), - ], - "algopy.op.Txn.created_asset_id": [ - FunctionOpMapping( - op_code="txn", - is_property=False, - immediates=[ - "CreatedAssetID", - ], - stack_inputs=[], - stack_outputs=[ - wtypes.asset_wtype, - ], - ), - ], - "algopy.op.Txn.created_application_id": [ - FunctionOpMapping( - op_code="txn", - is_property=False, - immediates=[ - "CreatedApplicationID", - ], - stack_inputs=[], - stack_outputs=[ - wtypes.application_wtype, - ], - ), - ], - "algopy.op.Txn.last_log": [ - FunctionOpMapping( - op_code="txn", - is_property=False, - immediates=[ - "LastLog", - ], - stack_inputs=[], - stack_outputs=[ - wtypes.bytes_wtype, - ], - ), - ], - "algopy.op.Txn.state_proof_pk": [ - FunctionOpMapping( - op_code="txn", - is_property=False, - immediates=[ - "StateProofPK", - ], - stack_inputs=[], - stack_outputs=[ - wtypes.bytes_wtype, - ], - ), - ], - "algopy.op.Txn.approval_program_pages": [ - FunctionOpMapping( - op_code="txnas", - is_property=False, - immediates=[ - "ApprovalProgramPages", - ], - stack_inputs=[ - StackArgMapping( - arg_name="a", - allowed_types=[ - wtypes.uint64_wtype, - ], - ), - ], - stack_outputs=[ - wtypes.bytes_wtype, - ], - ), - FunctionOpMapping( - op_code="txna", - is_property=False, - immediates=[ - "ApprovalProgramPages", - ImmediateArgMapping( - arg_name="a", - literal_type=int, - ), - ], - stack_inputs=[], - stack_outputs=[ - wtypes.bytes_wtype, - ], - ), - ], - "algopy.op.Txn.num_approval_program_pages": [ - FunctionOpMapping( - op_code="txn", - is_property=False, - immediates=[ - "NumApprovalProgramPages", - ], - stack_inputs=[], - stack_outputs=[ - wtypes.uint64_wtype, - ], - ), - ], - "algopy.op.Txn.clear_state_program_pages": [ - FunctionOpMapping( - op_code="txnas", - is_property=False, - immediates=[ - "ClearStateProgramPages", - ], - stack_inputs=[ - StackArgMapping( - arg_name="a", - allowed_types=[ - wtypes.uint64_wtype, - ], - ), - ], - stack_outputs=[ - wtypes.bytes_wtype, - ], - ), - FunctionOpMapping( - op_code="txna", - is_property=False, - immediates=[ - "ClearStateProgramPages", - ImmediateArgMapping( - arg_name="a", - literal_type=int, - ), - ], - stack_inputs=[], - stack_outputs=[ - wtypes.bytes_wtype, - ], - ), - ], - "algopy.op.Txn.num_clear_state_program_pages": [ - FunctionOpMapping( - op_code="txn", - is_property=False, - immediates=[ - "NumClearStateProgramPages", - ], - stack_inputs=[], - stack_outputs=[ - wtypes.uint64_wtype, - ], - ), - ], -} + ), +) +NAMESPACE_CLASSES: typing.Final[ + Mapping[str, Mapping[str, PropertyOpMapping | Sequence[FunctionOpMapping]]] +] = dict( + AcctParamsGet=dict( + acct_balance=( + FunctionOpMapping( + "acct_params_get", + immediates=dict(AcctBalance=None), + stack_inputs=dict(a=(pytypes.AccountType, pytypes.UInt64Type)), + result=pytypes.GenericTupleType.parameterise( + (pytypes.UInt64Type, pytypes.BoolType), source_location=None + ), + ), + ), + acct_min_balance=( + FunctionOpMapping( + "acct_params_get", + immediates=dict(AcctMinBalance=None), + stack_inputs=dict(a=(pytypes.AccountType, pytypes.UInt64Type)), + result=pytypes.GenericTupleType.parameterise( + (pytypes.UInt64Type, pytypes.BoolType), source_location=None + ), + ), + ), + acct_auth_addr=( + FunctionOpMapping( + "acct_params_get", + immediates=dict(AcctAuthAddr=None), + stack_inputs=dict(a=(pytypes.AccountType, pytypes.UInt64Type)), + result=pytypes.GenericTupleType.parameterise( + (pytypes.AccountType, pytypes.BoolType), source_location=None + ), + ), + ), + acct_total_num_uint=( + FunctionOpMapping( + "acct_params_get", + immediates=dict(AcctTotalNumUint=None), + stack_inputs=dict(a=(pytypes.AccountType, pytypes.UInt64Type)), + result=pytypes.GenericTupleType.parameterise( + (pytypes.UInt64Type, pytypes.BoolType), source_location=None + ), + ), + ), + acct_total_num_byte_slice=( + FunctionOpMapping( + "acct_params_get", + immediates=dict(AcctTotalNumByteSlice=None), + stack_inputs=dict(a=(pytypes.AccountType, pytypes.UInt64Type)), + result=pytypes.GenericTupleType.parameterise( + (pytypes.UInt64Type, pytypes.BoolType), source_location=None + ), + ), + ), + acct_total_extra_app_pages=( + FunctionOpMapping( + "acct_params_get", + immediates=dict(AcctTotalExtraAppPages=None), + stack_inputs=dict(a=(pytypes.AccountType, pytypes.UInt64Type)), + result=pytypes.GenericTupleType.parameterise( + (pytypes.UInt64Type, pytypes.BoolType), source_location=None + ), + ), + ), + acct_total_apps_created=( + FunctionOpMapping( + "acct_params_get", + immediates=dict(AcctTotalAppsCreated=None), + stack_inputs=dict(a=(pytypes.AccountType, pytypes.UInt64Type)), + result=pytypes.GenericTupleType.parameterise( + (pytypes.UInt64Type, pytypes.BoolType), source_location=None + ), + ), + ), + acct_total_apps_opted_in=( + FunctionOpMapping( + "acct_params_get", + immediates=dict(AcctTotalAppsOptedIn=None), + stack_inputs=dict(a=(pytypes.AccountType, pytypes.UInt64Type)), + result=pytypes.GenericTupleType.parameterise( + (pytypes.UInt64Type, pytypes.BoolType), source_location=None + ), + ), + ), + acct_total_assets_created=( + FunctionOpMapping( + "acct_params_get", + immediates=dict(AcctTotalAssetsCreated=None), + stack_inputs=dict(a=(pytypes.AccountType, pytypes.UInt64Type)), + result=pytypes.GenericTupleType.parameterise( + (pytypes.UInt64Type, pytypes.BoolType), source_location=None + ), + ), + ), + acct_total_assets=( + FunctionOpMapping( + "acct_params_get", + immediates=dict(AcctTotalAssets=None), + stack_inputs=dict(a=(pytypes.AccountType, pytypes.UInt64Type)), + result=pytypes.GenericTupleType.parameterise( + (pytypes.UInt64Type, pytypes.BoolType), source_location=None + ), + ), + ), + acct_total_boxes=( + FunctionOpMapping( + "acct_params_get", + immediates=dict(AcctTotalBoxes=None), + stack_inputs=dict(a=(pytypes.AccountType, pytypes.UInt64Type)), + result=pytypes.GenericTupleType.parameterise( + (pytypes.UInt64Type, pytypes.BoolType), source_location=None + ), + ), + ), + acct_total_box_bytes=( + FunctionOpMapping( + "acct_params_get", + immediates=dict(AcctTotalBoxBytes=None), + stack_inputs=dict(a=(pytypes.AccountType, pytypes.UInt64Type)), + result=pytypes.GenericTupleType.parameterise( + (pytypes.UInt64Type, pytypes.BoolType), source_location=None + ), + ), + ), + ), + AppGlobal=dict( + get_bytes=( + FunctionOpMapping( + "app_global_get", + stack_inputs=dict(a=(pytypes.BytesType,)), + result=pytypes.BytesType, + ), + ), + get_uint64=( + FunctionOpMapping( + "app_global_get", + stack_inputs=dict(a=(pytypes.BytesType,)), + result=pytypes.UInt64Type, + ), + ), + get_ex_bytes=( + FunctionOpMapping( + "app_global_get_ex", + stack_inputs=dict( + a=(pytypes.ApplicationType, pytypes.UInt64Type), b=(pytypes.BytesType,) + ), + result=pytypes.GenericTupleType.parameterise( + (pytypes.BytesType, pytypes.BoolType), source_location=None + ), + ), + ), + get_ex_uint64=( + FunctionOpMapping( + "app_global_get_ex", + stack_inputs=dict( + a=(pytypes.ApplicationType, pytypes.UInt64Type), b=(pytypes.BytesType,) + ), + result=pytypes.GenericTupleType.parameterise( + (pytypes.UInt64Type, pytypes.BoolType), source_location=None + ), + ), + ), + delete=( + FunctionOpMapping( + "app_global_del", + stack_inputs=dict(a=(pytypes.BytesType,)), + ), + ), + put=( + FunctionOpMapping( + "app_global_put", + stack_inputs=dict( + a=(pytypes.BytesType,), b=(pytypes.BytesType, pytypes.UInt64Type) + ), + ), + ), + ), + AppLocal=dict( + get_bytes=( + FunctionOpMapping( + "app_local_get", + stack_inputs=dict( + a=(pytypes.AccountType, pytypes.UInt64Type), b=(pytypes.BytesType,) + ), + result=pytypes.BytesType, + ), + ), + get_uint64=( + FunctionOpMapping( + "app_local_get", + stack_inputs=dict( + a=(pytypes.AccountType, pytypes.UInt64Type), b=(pytypes.BytesType,) + ), + result=pytypes.UInt64Type, + ), + ), + get_ex_bytes=( + FunctionOpMapping( + "app_local_get_ex", + stack_inputs=dict( + a=(pytypes.AccountType, pytypes.UInt64Type), + b=(pytypes.ApplicationType, pytypes.UInt64Type), + c=(pytypes.BytesType,), + ), + result=pytypes.GenericTupleType.parameterise( + (pytypes.BytesType, pytypes.BoolType), source_location=None + ), + ), + ), + get_ex_uint64=( + FunctionOpMapping( + "app_local_get_ex", + stack_inputs=dict( + a=(pytypes.AccountType, pytypes.UInt64Type), + b=(pytypes.ApplicationType, pytypes.UInt64Type), + c=(pytypes.BytesType,), + ), + result=pytypes.GenericTupleType.parameterise( + (pytypes.UInt64Type, pytypes.BoolType), source_location=None + ), + ), + ), + delete=( + FunctionOpMapping( + "app_local_del", + stack_inputs=dict( + a=(pytypes.AccountType, pytypes.UInt64Type), b=(pytypes.BytesType,) + ), + ), + ), + put=( + FunctionOpMapping( + "app_local_put", + stack_inputs=dict( + a=(pytypes.AccountType, pytypes.UInt64Type), + b=(pytypes.BytesType,), + c=(pytypes.BytesType, pytypes.UInt64Type), + ), + ), + ), + ), + AppParamsGet=dict( + app_approval_program=( + FunctionOpMapping( + "app_params_get", + immediates=dict(AppApprovalProgram=None), + stack_inputs=dict(a=(pytypes.ApplicationType, pytypes.UInt64Type)), + result=pytypes.GenericTupleType.parameterise( + (pytypes.BytesType, pytypes.BoolType), source_location=None + ), + ), + ), + app_clear_state_program=( + FunctionOpMapping( + "app_params_get", + immediates=dict(AppClearStateProgram=None), + stack_inputs=dict(a=(pytypes.ApplicationType, pytypes.UInt64Type)), + result=pytypes.GenericTupleType.parameterise( + (pytypes.BytesType, pytypes.BoolType), source_location=None + ), + ), + ), + app_global_num_uint=( + FunctionOpMapping( + "app_params_get", + immediates=dict(AppGlobalNumUint=None), + stack_inputs=dict(a=(pytypes.ApplicationType, pytypes.UInt64Type)), + result=pytypes.GenericTupleType.parameterise( + (pytypes.UInt64Type, pytypes.BoolType), source_location=None + ), + ), + ), + app_global_num_byte_slice=( + FunctionOpMapping( + "app_params_get", + immediates=dict(AppGlobalNumByteSlice=None), + stack_inputs=dict(a=(pytypes.ApplicationType, pytypes.UInt64Type)), + result=pytypes.GenericTupleType.parameterise( + (pytypes.UInt64Type, pytypes.BoolType), source_location=None + ), + ), + ), + app_local_num_uint=( + FunctionOpMapping( + "app_params_get", + immediates=dict(AppLocalNumUint=None), + stack_inputs=dict(a=(pytypes.ApplicationType, pytypes.UInt64Type)), + result=pytypes.GenericTupleType.parameterise( + (pytypes.UInt64Type, pytypes.BoolType), source_location=None + ), + ), + ), + app_local_num_byte_slice=( + FunctionOpMapping( + "app_params_get", + immediates=dict(AppLocalNumByteSlice=None), + stack_inputs=dict(a=(pytypes.ApplicationType, pytypes.UInt64Type)), + result=pytypes.GenericTupleType.parameterise( + (pytypes.UInt64Type, pytypes.BoolType), source_location=None + ), + ), + ), + app_extra_program_pages=( + FunctionOpMapping( + "app_params_get", + immediates=dict(AppExtraProgramPages=None), + stack_inputs=dict(a=(pytypes.ApplicationType, pytypes.UInt64Type)), + result=pytypes.GenericTupleType.parameterise( + (pytypes.UInt64Type, pytypes.BoolType), source_location=None + ), + ), + ), + app_creator=( + FunctionOpMapping( + "app_params_get", + immediates=dict(AppCreator=None), + stack_inputs=dict(a=(pytypes.ApplicationType, pytypes.UInt64Type)), + result=pytypes.GenericTupleType.parameterise( + (pytypes.AccountType, pytypes.BoolType), source_location=None + ), + ), + ), + app_address=( + FunctionOpMapping( + "app_params_get", + immediates=dict(AppAddress=None), + stack_inputs=dict(a=(pytypes.ApplicationType, pytypes.UInt64Type)), + result=pytypes.GenericTupleType.parameterise( + (pytypes.AccountType, pytypes.BoolType), source_location=None + ), + ), + ), + ), + AssetHoldingGet=dict( + asset_balance=( + FunctionOpMapping( + "asset_holding_get", + immediates=dict(AssetBalance=None), + stack_inputs=dict( + a=(pytypes.AccountType, pytypes.UInt64Type), + b=(pytypes.AssetType, pytypes.UInt64Type), + ), + result=pytypes.GenericTupleType.parameterise( + (pytypes.UInt64Type, pytypes.BoolType), source_location=None + ), + ), + ), + asset_frozen=( + FunctionOpMapping( + "asset_holding_get", + immediates=dict(AssetFrozen=None), + stack_inputs=dict( + a=(pytypes.AccountType, pytypes.UInt64Type), + b=(pytypes.AssetType, pytypes.UInt64Type), + ), + result=pytypes.GenericTupleType.parameterise( + (pytypes.BoolType, pytypes.BoolType), source_location=None + ), + ), + ), + ), + AssetParamsGet=dict( + asset_total=( + FunctionOpMapping( + "asset_params_get", + immediates=dict(AssetTotal=None), + stack_inputs=dict(a=(pytypes.AssetType, pytypes.UInt64Type)), + result=pytypes.GenericTupleType.parameterise( + (pytypes.UInt64Type, pytypes.BoolType), source_location=None + ), + ), + ), + asset_decimals=( + FunctionOpMapping( + "asset_params_get", + immediates=dict(AssetDecimals=None), + stack_inputs=dict(a=(pytypes.AssetType, pytypes.UInt64Type)), + result=pytypes.GenericTupleType.parameterise( + (pytypes.UInt64Type, pytypes.BoolType), source_location=None + ), + ), + ), + asset_default_frozen=( + FunctionOpMapping( + "asset_params_get", + immediates=dict(AssetDefaultFrozen=None), + stack_inputs=dict(a=(pytypes.AssetType, pytypes.UInt64Type)), + result=pytypes.GenericTupleType.parameterise( + (pytypes.BoolType, pytypes.BoolType), source_location=None + ), + ), + ), + asset_unit_name=( + FunctionOpMapping( + "asset_params_get", + immediates=dict(AssetUnitName=None), + stack_inputs=dict(a=(pytypes.AssetType, pytypes.UInt64Type)), + result=pytypes.GenericTupleType.parameterise( + (pytypes.BytesType, pytypes.BoolType), source_location=None + ), + ), + ), + asset_name=( + FunctionOpMapping( + "asset_params_get", + immediates=dict(AssetName=None), + stack_inputs=dict(a=(pytypes.AssetType, pytypes.UInt64Type)), + result=pytypes.GenericTupleType.parameterise( + (pytypes.BytesType, pytypes.BoolType), source_location=None + ), + ), + ), + asset_url=( + FunctionOpMapping( + "asset_params_get", + immediates=dict(AssetURL=None), + stack_inputs=dict(a=(pytypes.AssetType, pytypes.UInt64Type)), + result=pytypes.GenericTupleType.parameterise( + (pytypes.BytesType, pytypes.BoolType), source_location=None + ), + ), + ), + asset_metadata_hash=( + FunctionOpMapping( + "asset_params_get", + immediates=dict(AssetMetadataHash=None), + stack_inputs=dict(a=(pytypes.AssetType, pytypes.UInt64Type)), + result=pytypes.GenericTupleType.parameterise( + (pytypes.BytesType, pytypes.BoolType), source_location=None + ), + ), + ), + asset_manager=( + FunctionOpMapping( + "asset_params_get", + immediates=dict(AssetManager=None), + stack_inputs=dict(a=(pytypes.AssetType, pytypes.UInt64Type)), + result=pytypes.GenericTupleType.parameterise( + (pytypes.AccountType, pytypes.BoolType), source_location=None + ), + ), + ), + asset_reserve=( + FunctionOpMapping( + "asset_params_get", + immediates=dict(AssetReserve=None), + stack_inputs=dict(a=(pytypes.AssetType, pytypes.UInt64Type)), + result=pytypes.GenericTupleType.parameterise( + (pytypes.AccountType, pytypes.BoolType), source_location=None + ), + ), + ), + asset_freeze=( + FunctionOpMapping( + "asset_params_get", + immediates=dict(AssetFreeze=None), + stack_inputs=dict(a=(pytypes.AssetType, pytypes.UInt64Type)), + result=pytypes.GenericTupleType.parameterise( + (pytypes.AccountType, pytypes.BoolType), source_location=None + ), + ), + ), + asset_clawback=( + FunctionOpMapping( + "asset_params_get", + immediates=dict(AssetClawback=None), + stack_inputs=dict(a=(pytypes.AssetType, pytypes.UInt64Type)), + result=pytypes.GenericTupleType.parameterise( + (pytypes.AccountType, pytypes.BoolType), source_location=None + ), + ), + ), + asset_creator=( + FunctionOpMapping( + "asset_params_get", + immediates=dict(AssetCreator=None), + stack_inputs=dict(a=(pytypes.AssetType, pytypes.UInt64Type)), + result=pytypes.GenericTupleType.parameterise( + (pytypes.AccountType, pytypes.BoolType), source_location=None + ), + ), + ), + ), + Block=dict( + blk_seed=( + FunctionOpMapping( + "block", + immediates=dict(BlkSeed=None), + stack_inputs=dict(a=(pytypes.UInt64Type,)), + result=pytypes.BytesType, + ), + ), + blk_timestamp=( + FunctionOpMapping( + "block", + immediates=dict(BlkTimestamp=None), + stack_inputs=dict(a=(pytypes.UInt64Type,)), + result=pytypes.UInt64Type, + ), + ), + ), + Box=dict( + create=( + FunctionOpMapping( + "box_create", + stack_inputs=dict(a=(pytypes.BytesType,), b=(pytypes.UInt64Type,)), + result=pytypes.BoolType, + ), + ), + delete=( + FunctionOpMapping( + "box_del", + stack_inputs=dict(a=(pytypes.BytesType,)), + result=pytypes.BoolType, + ), + ), + extract=( + FunctionOpMapping( + "box_extract", + stack_inputs=dict( + a=(pytypes.BytesType,), b=(pytypes.UInt64Type,), c=(pytypes.UInt64Type,) + ), + result=pytypes.BytesType, + ), + ), + get=( + FunctionOpMapping( + "box_get", + stack_inputs=dict(a=(pytypes.BytesType,)), + result=pytypes.GenericTupleType.parameterise( + (pytypes.BytesType, pytypes.BoolType), source_location=None + ), + ), + ), + length=( + FunctionOpMapping( + "box_len", + stack_inputs=dict(a=(pytypes.BytesType,)), + result=pytypes.GenericTupleType.parameterise( + (pytypes.UInt64Type, pytypes.BoolType), source_location=None + ), + ), + ), + put=( + FunctionOpMapping( + "box_put", + stack_inputs=dict(a=(pytypes.BytesType,), b=(pytypes.BytesType,)), + ), + ), + replace=( + FunctionOpMapping( + "box_replace", + stack_inputs=dict( + a=(pytypes.BytesType,), b=(pytypes.UInt64Type,), c=(pytypes.BytesType,) + ), + ), + ), + resize=( + FunctionOpMapping( + "box_resize", + stack_inputs=dict(a=(pytypes.BytesType,), b=(pytypes.UInt64Type,)), + ), + ), + splice=( + FunctionOpMapping( + "box_splice", + stack_inputs=dict( + a=(pytypes.BytesType,), + b=(pytypes.UInt64Type,), + c=(pytypes.UInt64Type,), + d=(pytypes.BytesType,), + ), + ), + ), + ), + EllipticCurve=dict( + add=( + FunctionOpMapping( + "ec_add", + immediates=dict(g=str), + stack_inputs=dict(a=(pytypes.BytesType,), b=(pytypes.BytesType,)), + result=pytypes.BytesType, + ), + ), + map_to=( + FunctionOpMapping( + "ec_map_to", + immediates=dict(g=str), + stack_inputs=dict(a=(pytypes.BytesType,)), + result=pytypes.BytesType, + ), + ), + scalar_mul_multi=( + FunctionOpMapping( + "ec_multi_scalar_mul", + immediates=dict(g=str), + stack_inputs=dict(a=(pytypes.BytesType,), b=(pytypes.BytesType,)), + result=pytypes.BytesType, + ), + ), + pairing_check=( + FunctionOpMapping( + "ec_pairing_check", + immediates=dict(g=str), + stack_inputs=dict(a=(pytypes.BytesType,), b=(pytypes.BytesType,)), + result=pytypes.BoolType, + ), + ), + scalar_mul=( + FunctionOpMapping( + "ec_scalar_mul", + immediates=dict(g=str), + stack_inputs=dict(a=(pytypes.BytesType,), b=(pytypes.BytesType,)), + result=pytypes.BytesType, + ), + ), + subgroup_check=( + FunctionOpMapping( + "ec_subgroup_check", + immediates=dict(g=str), + stack_inputs=dict(a=(pytypes.BytesType,)), + result=pytypes.BoolType, + ), + ), + ), + GITxn=dict( + sender=( + FunctionOpMapping( + "gitxn", + immediates=dict(t=int, Sender=None), + result=pytypes.AccountType, + ), + ), + fee=( + FunctionOpMapping( + "gitxn", + immediates=dict(t=int, Fee=None), + result=pytypes.UInt64Type, + ), + ), + first_valid=( + FunctionOpMapping( + "gitxn", + immediates=dict(t=int, FirstValid=None), + result=pytypes.UInt64Type, + ), + ), + first_valid_time=( + FunctionOpMapping( + "gitxn", + immediates=dict(t=int, FirstValidTime=None), + result=pytypes.UInt64Type, + ), + ), + last_valid=( + FunctionOpMapping( + "gitxn", + immediates=dict(t=int, LastValid=None), + result=pytypes.UInt64Type, + ), + ), + note=( + FunctionOpMapping( + "gitxn", + immediates=dict(t=int, Note=None), + result=pytypes.BytesType, + ), + ), + lease=( + FunctionOpMapping( + "gitxn", + immediates=dict(t=int, Lease=None), + result=pytypes.BytesType, + ), + ), + receiver=( + FunctionOpMapping( + "gitxn", + immediates=dict(t=int, Receiver=None), + result=pytypes.AccountType, + ), + ), + amount=( + FunctionOpMapping( + "gitxn", + immediates=dict(t=int, Amount=None), + result=pytypes.UInt64Type, + ), + ), + close_remainder_to=( + FunctionOpMapping( + "gitxn", + immediates=dict(t=int, CloseRemainderTo=None), + result=pytypes.AccountType, + ), + ), + vote_pk=( + FunctionOpMapping( + "gitxn", + immediates=dict(t=int, VotePK=None), + result=pytypes.BytesType, + ), + ), + selection_pk=( + FunctionOpMapping( + "gitxn", + immediates=dict(t=int, SelectionPK=None), + result=pytypes.BytesType, + ), + ), + vote_first=( + FunctionOpMapping( + "gitxn", + immediates=dict(t=int, VoteFirst=None), + result=pytypes.UInt64Type, + ), + ), + vote_last=( + FunctionOpMapping( + "gitxn", + immediates=dict(t=int, VoteLast=None), + result=pytypes.UInt64Type, + ), + ), + vote_key_dilution=( + FunctionOpMapping( + "gitxn", + immediates=dict(t=int, VoteKeyDilution=None), + result=pytypes.UInt64Type, + ), + ), + type=( + FunctionOpMapping( + "gitxn", + immediates=dict(t=int, Type=None), + result=pytypes.BytesType, + ), + ), + type_enum=( + FunctionOpMapping( + "gitxn", + immediates=dict(t=int, TypeEnum=None), + result=pytypes.UInt64Type, + ), + ), + xfer_asset=( + FunctionOpMapping( + "gitxn", + immediates=dict(t=int, XferAsset=None), + result=pytypes.AssetType, + ), + ), + asset_amount=( + FunctionOpMapping( + "gitxn", + immediates=dict(t=int, AssetAmount=None), + result=pytypes.UInt64Type, + ), + ), + asset_sender=( + FunctionOpMapping( + "gitxn", + immediates=dict(t=int, AssetSender=None), + result=pytypes.AccountType, + ), + ), + asset_receiver=( + FunctionOpMapping( + "gitxn", + immediates=dict(t=int, AssetReceiver=None), + result=pytypes.AccountType, + ), + ), + asset_close_to=( + FunctionOpMapping( + "gitxn", + immediates=dict(t=int, AssetCloseTo=None), + result=pytypes.AccountType, + ), + ), + group_index=( + FunctionOpMapping( + "gitxn", + immediates=dict(t=int, GroupIndex=None), + result=pytypes.UInt64Type, + ), + ), + tx_id=( + FunctionOpMapping( + "gitxn", + immediates=dict(t=int, TxID=None), + result=pytypes.BytesType, + ), + ), + application_id=( + FunctionOpMapping( + "gitxn", + immediates=dict(t=int, ApplicationID=None), + result=pytypes.ApplicationType, + ), + ), + on_completion=( + FunctionOpMapping( + "gitxn", + immediates=dict(t=int, OnCompletion=None), + result=pytypes.UInt64Type, + ), + ), + application_args=( + FunctionOpMapping( + "gitxnas", + immediates=dict(t=int, ApplicationArgs=None), + stack_inputs=dict(a=(pytypes.UInt64Type,)), + result=pytypes.BytesType, + ), + FunctionOpMapping( + "gitxna", + immediates=dict(t=int, ApplicationArgs=None, a=int), + result=pytypes.BytesType, + ), + ), + num_app_args=( + FunctionOpMapping( + "gitxn", + immediates=dict(t=int, NumAppArgs=None), + result=pytypes.UInt64Type, + ), + ), + accounts=( + FunctionOpMapping( + "gitxnas", + immediates=dict(t=int, Accounts=None), + stack_inputs=dict(a=(pytypes.UInt64Type,)), + result=pytypes.AccountType, + ), + FunctionOpMapping( + "gitxna", + immediates=dict(t=int, Accounts=None, a=int), + result=pytypes.AccountType, + ), + ), + num_accounts=( + FunctionOpMapping( + "gitxn", + immediates=dict(t=int, NumAccounts=None), + result=pytypes.UInt64Type, + ), + ), + approval_program=( + FunctionOpMapping( + "gitxn", + immediates=dict(t=int, ApprovalProgram=None), + result=pytypes.BytesType, + ), + ), + clear_state_program=( + FunctionOpMapping( + "gitxn", + immediates=dict(t=int, ClearStateProgram=None), + result=pytypes.BytesType, + ), + ), + rekey_to=( + FunctionOpMapping( + "gitxn", + immediates=dict(t=int, RekeyTo=None), + result=pytypes.AccountType, + ), + ), + config_asset=( + FunctionOpMapping( + "gitxn", + immediates=dict(t=int, ConfigAsset=None), + result=pytypes.AssetType, + ), + ), + config_asset_total=( + FunctionOpMapping( + "gitxn", + immediates=dict(t=int, ConfigAssetTotal=None), + result=pytypes.UInt64Type, + ), + ), + config_asset_decimals=( + FunctionOpMapping( + "gitxn", + immediates=dict(t=int, ConfigAssetDecimals=None), + result=pytypes.UInt64Type, + ), + ), + config_asset_default_frozen=( + FunctionOpMapping( + "gitxn", + immediates=dict(t=int, ConfigAssetDefaultFrozen=None), + result=pytypes.BoolType, + ), + ), + config_asset_unit_name=( + FunctionOpMapping( + "gitxn", + immediates=dict(t=int, ConfigAssetUnitName=None), + result=pytypes.BytesType, + ), + ), + config_asset_name=( + FunctionOpMapping( + "gitxn", + immediates=dict(t=int, ConfigAssetName=None), + result=pytypes.BytesType, + ), + ), + config_asset_url=( + FunctionOpMapping( + "gitxn", + immediates=dict(t=int, ConfigAssetURL=None), + result=pytypes.BytesType, + ), + ), + config_asset_metadata_hash=( + FunctionOpMapping( + "gitxn", + immediates=dict(t=int, ConfigAssetMetadataHash=None), + result=pytypes.BytesType, + ), + ), + config_asset_manager=( + FunctionOpMapping( + "gitxn", + immediates=dict(t=int, ConfigAssetManager=None), + result=pytypes.AccountType, + ), + ), + config_asset_reserve=( + FunctionOpMapping( + "gitxn", + immediates=dict(t=int, ConfigAssetReserve=None), + result=pytypes.AccountType, + ), + ), + config_asset_freeze=( + FunctionOpMapping( + "gitxn", + immediates=dict(t=int, ConfigAssetFreeze=None), + result=pytypes.AccountType, + ), + ), + config_asset_clawback=( + FunctionOpMapping( + "gitxn", + immediates=dict(t=int, ConfigAssetClawback=None), + result=pytypes.AccountType, + ), + ), + freeze_asset=( + FunctionOpMapping( + "gitxn", + immediates=dict(t=int, FreezeAsset=None), + result=pytypes.AssetType, + ), + ), + freeze_asset_account=( + FunctionOpMapping( + "gitxn", + immediates=dict(t=int, FreezeAssetAccount=None), + result=pytypes.AccountType, + ), + ), + freeze_asset_frozen=( + FunctionOpMapping( + "gitxn", + immediates=dict(t=int, FreezeAssetFrozen=None), + result=pytypes.BoolType, + ), + ), + assets=( + FunctionOpMapping( + "gitxnas", + immediates=dict(t=int, Assets=None), + stack_inputs=dict(a=(pytypes.UInt64Type,)), + result=pytypes.AssetType, + ), + FunctionOpMapping( + "gitxna", + immediates=dict(t=int, Assets=None, a=int), + result=pytypes.AssetType, + ), + ), + num_assets=( + FunctionOpMapping( + "gitxn", + immediates=dict(t=int, NumAssets=None), + result=pytypes.UInt64Type, + ), + ), + applications=( + FunctionOpMapping( + "gitxnas", + immediates=dict(t=int, Applications=None), + stack_inputs=dict(a=(pytypes.UInt64Type,)), + result=pytypes.ApplicationType, + ), + FunctionOpMapping( + "gitxna", + immediates=dict(t=int, Applications=None, a=int), + result=pytypes.ApplicationType, + ), + ), + num_applications=( + FunctionOpMapping( + "gitxn", + immediates=dict(t=int, NumApplications=None), + result=pytypes.UInt64Type, + ), + ), + global_num_uint=( + FunctionOpMapping( + "gitxn", + immediates=dict(t=int, GlobalNumUint=None), + result=pytypes.UInt64Type, + ), + ), + global_num_byte_slice=( + FunctionOpMapping( + "gitxn", + immediates=dict(t=int, GlobalNumByteSlice=None), + result=pytypes.UInt64Type, + ), + ), + local_num_uint=( + FunctionOpMapping( + "gitxn", + immediates=dict(t=int, LocalNumUint=None), + result=pytypes.UInt64Type, + ), + ), + local_num_byte_slice=( + FunctionOpMapping( + "gitxn", + immediates=dict(t=int, LocalNumByteSlice=None), + result=pytypes.UInt64Type, + ), + ), + extra_program_pages=( + FunctionOpMapping( + "gitxn", + immediates=dict(t=int, ExtraProgramPages=None), + result=pytypes.UInt64Type, + ), + ), + nonparticipation=( + FunctionOpMapping( + "gitxn", + immediates=dict(t=int, Nonparticipation=None), + result=pytypes.BoolType, + ), + ), + logs=( + FunctionOpMapping( + "gitxnas", + immediates=dict(t=int, Logs=None), + stack_inputs=dict(a=(pytypes.UInt64Type,)), + result=pytypes.BytesType, + ), + FunctionOpMapping( + "gitxna", + immediates=dict(t=int, Logs=None, a=int), + result=pytypes.BytesType, + ), + ), + num_logs=( + FunctionOpMapping( + "gitxn", + immediates=dict(t=int, NumLogs=None), + result=pytypes.UInt64Type, + ), + ), + created_asset_id=( + FunctionOpMapping( + "gitxn", + immediates=dict(t=int, CreatedAssetID=None), + result=pytypes.AssetType, + ), + ), + created_application_id=( + FunctionOpMapping( + "gitxn", + immediates=dict(t=int, CreatedApplicationID=None), + result=pytypes.ApplicationType, + ), + ), + last_log=( + FunctionOpMapping( + "gitxn", + immediates=dict(t=int, LastLog=None), + result=pytypes.BytesType, + ), + ), + state_proof_pk=( + FunctionOpMapping( + "gitxn", + immediates=dict(t=int, StateProofPK=None), + result=pytypes.BytesType, + ), + ), + approval_program_pages=( + FunctionOpMapping( + "gitxnas", + immediates=dict(t=int, ApprovalProgramPages=None), + stack_inputs=dict(a=(pytypes.UInt64Type,)), + result=pytypes.BytesType, + ), + FunctionOpMapping( + "gitxna", + immediates=dict(t=int, ApprovalProgramPages=None, a=int), + result=pytypes.BytesType, + ), + ), + num_approval_program_pages=( + FunctionOpMapping( + "gitxn", + immediates=dict(t=int, NumApprovalProgramPages=None), + result=pytypes.UInt64Type, + ), + ), + clear_state_program_pages=( + FunctionOpMapping( + "gitxnas", + immediates=dict(t=int, ClearStateProgramPages=None), + stack_inputs=dict(a=(pytypes.UInt64Type,)), + result=pytypes.BytesType, + ), + FunctionOpMapping( + "gitxna", + immediates=dict(t=int, ClearStateProgramPages=None, a=int), + result=pytypes.BytesType, + ), + ), + num_clear_state_program_pages=( + FunctionOpMapping( + "gitxn", + immediates=dict(t=int, NumClearStateProgramPages=None), + result=pytypes.UInt64Type, + ), + ), + ), + GTxn=dict( + sender=( + FunctionOpMapping( + "gtxns", + immediates=dict(Sender=None), + stack_inputs=dict(a=(pytypes.UInt64Type,)), + result=pytypes.AccountType, + ), + FunctionOpMapping( + "gtxn", + immediates=dict(a=int, Sender=None), + result=pytypes.AccountType, + ), + ), + fee=( + FunctionOpMapping( + "gtxns", + immediates=dict(Fee=None), + stack_inputs=dict(a=(pytypes.UInt64Type,)), + result=pytypes.UInt64Type, + ), + FunctionOpMapping( + "gtxn", + immediates=dict(a=int, Fee=None), + result=pytypes.UInt64Type, + ), + ), + first_valid=( + FunctionOpMapping( + "gtxns", + immediates=dict(FirstValid=None), + stack_inputs=dict(a=(pytypes.UInt64Type,)), + result=pytypes.UInt64Type, + ), + FunctionOpMapping( + "gtxn", + immediates=dict(a=int, FirstValid=None), + result=pytypes.UInt64Type, + ), + ), + first_valid_time=( + FunctionOpMapping( + "gtxns", + immediates=dict(FirstValidTime=None), + stack_inputs=dict(a=(pytypes.UInt64Type,)), + result=pytypes.UInt64Type, + ), + FunctionOpMapping( + "gtxn", + immediates=dict(a=int, FirstValidTime=None), + result=pytypes.UInt64Type, + ), + ), + last_valid=( + FunctionOpMapping( + "gtxns", + immediates=dict(LastValid=None), + stack_inputs=dict(a=(pytypes.UInt64Type,)), + result=pytypes.UInt64Type, + ), + FunctionOpMapping( + "gtxn", + immediates=dict(a=int, LastValid=None), + result=pytypes.UInt64Type, + ), + ), + note=( + FunctionOpMapping( + "gtxns", + immediates=dict(Note=None), + stack_inputs=dict(a=(pytypes.UInt64Type,)), + result=pytypes.BytesType, + ), + FunctionOpMapping( + "gtxn", + immediates=dict(a=int, Note=None), + result=pytypes.BytesType, + ), + ), + lease=( + FunctionOpMapping( + "gtxns", + immediates=dict(Lease=None), + stack_inputs=dict(a=(pytypes.UInt64Type,)), + result=pytypes.BytesType, + ), + FunctionOpMapping( + "gtxn", + immediates=dict(a=int, Lease=None), + result=pytypes.BytesType, + ), + ), + receiver=( + FunctionOpMapping( + "gtxns", + immediates=dict(Receiver=None), + stack_inputs=dict(a=(pytypes.UInt64Type,)), + result=pytypes.AccountType, + ), + FunctionOpMapping( + "gtxn", + immediates=dict(a=int, Receiver=None), + result=pytypes.AccountType, + ), + ), + amount=( + FunctionOpMapping( + "gtxns", + immediates=dict(Amount=None), + stack_inputs=dict(a=(pytypes.UInt64Type,)), + result=pytypes.UInt64Type, + ), + FunctionOpMapping( + "gtxn", + immediates=dict(a=int, Amount=None), + result=pytypes.UInt64Type, + ), + ), + close_remainder_to=( + FunctionOpMapping( + "gtxns", + immediates=dict(CloseRemainderTo=None), + stack_inputs=dict(a=(pytypes.UInt64Type,)), + result=pytypes.AccountType, + ), + FunctionOpMapping( + "gtxn", + immediates=dict(a=int, CloseRemainderTo=None), + result=pytypes.AccountType, + ), + ), + vote_pk=( + FunctionOpMapping( + "gtxns", + immediates=dict(VotePK=None), + stack_inputs=dict(a=(pytypes.UInt64Type,)), + result=pytypes.BytesType, + ), + FunctionOpMapping( + "gtxn", + immediates=dict(a=int, VotePK=None), + result=pytypes.BytesType, + ), + ), + selection_pk=( + FunctionOpMapping( + "gtxns", + immediates=dict(SelectionPK=None), + stack_inputs=dict(a=(pytypes.UInt64Type,)), + result=pytypes.BytesType, + ), + FunctionOpMapping( + "gtxn", + immediates=dict(a=int, SelectionPK=None), + result=pytypes.BytesType, + ), + ), + vote_first=( + FunctionOpMapping( + "gtxns", + immediates=dict(VoteFirst=None), + stack_inputs=dict(a=(pytypes.UInt64Type,)), + result=pytypes.UInt64Type, + ), + FunctionOpMapping( + "gtxn", + immediates=dict(a=int, VoteFirst=None), + result=pytypes.UInt64Type, + ), + ), + vote_last=( + FunctionOpMapping( + "gtxns", + immediates=dict(VoteLast=None), + stack_inputs=dict(a=(pytypes.UInt64Type,)), + result=pytypes.UInt64Type, + ), + FunctionOpMapping( + "gtxn", + immediates=dict(a=int, VoteLast=None), + result=pytypes.UInt64Type, + ), + ), + vote_key_dilution=( + FunctionOpMapping( + "gtxns", + immediates=dict(VoteKeyDilution=None), + stack_inputs=dict(a=(pytypes.UInt64Type,)), + result=pytypes.UInt64Type, + ), + FunctionOpMapping( + "gtxn", + immediates=dict(a=int, VoteKeyDilution=None), + result=pytypes.UInt64Type, + ), + ), + type=( + FunctionOpMapping( + "gtxns", + immediates=dict(Type=None), + stack_inputs=dict(a=(pytypes.UInt64Type,)), + result=pytypes.BytesType, + ), + FunctionOpMapping( + "gtxn", + immediates=dict(a=int, Type=None), + result=pytypes.BytesType, + ), + ), + type_enum=( + FunctionOpMapping( + "gtxns", + immediates=dict(TypeEnum=None), + stack_inputs=dict(a=(pytypes.UInt64Type,)), + result=pytypes.UInt64Type, + ), + FunctionOpMapping( + "gtxn", + immediates=dict(a=int, TypeEnum=None), + result=pytypes.UInt64Type, + ), + ), + xfer_asset=( + FunctionOpMapping( + "gtxns", + immediates=dict(XferAsset=None), + stack_inputs=dict(a=(pytypes.UInt64Type,)), + result=pytypes.AssetType, + ), + FunctionOpMapping( + "gtxn", + immediates=dict(a=int, XferAsset=None), + result=pytypes.AssetType, + ), + ), + asset_amount=( + FunctionOpMapping( + "gtxns", + immediates=dict(AssetAmount=None), + stack_inputs=dict(a=(pytypes.UInt64Type,)), + result=pytypes.UInt64Type, + ), + FunctionOpMapping( + "gtxn", + immediates=dict(a=int, AssetAmount=None), + result=pytypes.UInt64Type, + ), + ), + asset_sender=( + FunctionOpMapping( + "gtxns", + immediates=dict(AssetSender=None), + stack_inputs=dict(a=(pytypes.UInt64Type,)), + result=pytypes.AccountType, + ), + FunctionOpMapping( + "gtxn", + immediates=dict(a=int, AssetSender=None), + result=pytypes.AccountType, + ), + ), + asset_receiver=( + FunctionOpMapping( + "gtxns", + immediates=dict(AssetReceiver=None), + stack_inputs=dict(a=(pytypes.UInt64Type,)), + result=pytypes.AccountType, + ), + FunctionOpMapping( + "gtxn", + immediates=dict(a=int, AssetReceiver=None), + result=pytypes.AccountType, + ), + ), + asset_close_to=( + FunctionOpMapping( + "gtxns", + immediates=dict(AssetCloseTo=None), + stack_inputs=dict(a=(pytypes.UInt64Type,)), + result=pytypes.AccountType, + ), + FunctionOpMapping( + "gtxn", + immediates=dict(a=int, AssetCloseTo=None), + result=pytypes.AccountType, + ), + ), + group_index=( + FunctionOpMapping( + "gtxns", + immediates=dict(GroupIndex=None), + stack_inputs=dict(a=(pytypes.UInt64Type,)), + result=pytypes.UInt64Type, + ), + FunctionOpMapping( + "gtxn", + immediates=dict(a=int, GroupIndex=None), + result=pytypes.UInt64Type, + ), + ), + tx_id=( + FunctionOpMapping( + "gtxns", + immediates=dict(TxID=None), + stack_inputs=dict(a=(pytypes.UInt64Type,)), + result=pytypes.BytesType, + ), + FunctionOpMapping( + "gtxn", + immediates=dict(a=int, TxID=None), + result=pytypes.BytesType, + ), + ), + application_id=( + FunctionOpMapping( + "gtxns", + immediates=dict(ApplicationID=None), + stack_inputs=dict(a=(pytypes.UInt64Type,)), + result=pytypes.ApplicationType, + ), + FunctionOpMapping( + "gtxn", + immediates=dict(a=int, ApplicationID=None), + result=pytypes.ApplicationType, + ), + ), + on_completion=( + FunctionOpMapping( + "gtxns", + immediates=dict(OnCompletion=None), + stack_inputs=dict(a=(pytypes.UInt64Type,)), + result=pytypes.UInt64Type, + ), + FunctionOpMapping( + "gtxn", + immediates=dict(a=int, OnCompletion=None), + result=pytypes.UInt64Type, + ), + ), + application_args=( + FunctionOpMapping( + "gtxnsas", + immediates=dict(ApplicationArgs=None), + stack_inputs=dict(a=(pytypes.UInt64Type,), b=(pytypes.UInt64Type,)), + result=pytypes.BytesType, + ), + FunctionOpMapping( + "gtxnsa", + immediates=dict(ApplicationArgs=None, b=int), + stack_inputs=dict(a=(pytypes.UInt64Type,)), + result=pytypes.BytesType, + ), + FunctionOpMapping( + "gtxna", + immediates=dict(a=int, ApplicationArgs=None, b=int), + result=pytypes.BytesType, + ), + FunctionOpMapping( + "gtxnas", + immediates=dict(a=int, ApplicationArgs=None), + stack_inputs=dict(b=(pytypes.UInt64Type,)), + result=pytypes.BytesType, + ), + ), + num_app_args=( + FunctionOpMapping( + "gtxns", + immediates=dict(NumAppArgs=None), + stack_inputs=dict(a=(pytypes.UInt64Type,)), + result=pytypes.UInt64Type, + ), + FunctionOpMapping( + "gtxn", + immediates=dict(a=int, NumAppArgs=None), + result=pytypes.UInt64Type, + ), + ), + accounts=( + FunctionOpMapping( + "gtxnsas", + immediates=dict(Accounts=None), + stack_inputs=dict(a=(pytypes.UInt64Type,), b=(pytypes.UInt64Type,)), + result=pytypes.AccountType, + ), + FunctionOpMapping( + "gtxnsa", + immediates=dict(Accounts=None, b=int), + stack_inputs=dict(a=(pytypes.UInt64Type,)), + result=pytypes.AccountType, + ), + FunctionOpMapping( + "gtxna", + immediates=dict(a=int, Accounts=None, b=int), + result=pytypes.AccountType, + ), + FunctionOpMapping( + "gtxnas", + immediates=dict(a=int, Accounts=None), + stack_inputs=dict(b=(pytypes.UInt64Type,)), + result=pytypes.AccountType, + ), + ), + num_accounts=( + FunctionOpMapping( + "gtxns", + immediates=dict(NumAccounts=None), + stack_inputs=dict(a=(pytypes.UInt64Type,)), + result=pytypes.UInt64Type, + ), + FunctionOpMapping( + "gtxn", + immediates=dict(a=int, NumAccounts=None), + result=pytypes.UInt64Type, + ), + ), + approval_program=( + FunctionOpMapping( + "gtxns", + immediates=dict(ApprovalProgram=None), + stack_inputs=dict(a=(pytypes.UInt64Type,)), + result=pytypes.BytesType, + ), + FunctionOpMapping( + "gtxn", + immediates=dict(a=int, ApprovalProgram=None), + result=pytypes.BytesType, + ), + ), + clear_state_program=( + FunctionOpMapping( + "gtxns", + immediates=dict(ClearStateProgram=None), + stack_inputs=dict(a=(pytypes.UInt64Type,)), + result=pytypes.BytesType, + ), + FunctionOpMapping( + "gtxn", + immediates=dict(a=int, ClearStateProgram=None), + result=pytypes.BytesType, + ), + ), + rekey_to=( + FunctionOpMapping( + "gtxns", + immediates=dict(RekeyTo=None), + stack_inputs=dict(a=(pytypes.UInt64Type,)), + result=pytypes.AccountType, + ), + FunctionOpMapping( + "gtxn", + immediates=dict(a=int, RekeyTo=None), + result=pytypes.AccountType, + ), + ), + config_asset=( + FunctionOpMapping( + "gtxns", + immediates=dict(ConfigAsset=None), + stack_inputs=dict(a=(pytypes.UInt64Type,)), + result=pytypes.AssetType, + ), + FunctionOpMapping( + "gtxn", + immediates=dict(a=int, ConfigAsset=None), + result=pytypes.AssetType, + ), + ), + config_asset_total=( + FunctionOpMapping( + "gtxns", + immediates=dict(ConfigAssetTotal=None), + stack_inputs=dict(a=(pytypes.UInt64Type,)), + result=pytypes.UInt64Type, + ), + FunctionOpMapping( + "gtxn", + immediates=dict(a=int, ConfigAssetTotal=None), + result=pytypes.UInt64Type, + ), + ), + config_asset_decimals=( + FunctionOpMapping( + "gtxns", + immediates=dict(ConfigAssetDecimals=None), + stack_inputs=dict(a=(pytypes.UInt64Type,)), + result=pytypes.UInt64Type, + ), + FunctionOpMapping( + "gtxn", + immediates=dict(a=int, ConfigAssetDecimals=None), + result=pytypes.UInt64Type, + ), + ), + config_asset_default_frozen=( + FunctionOpMapping( + "gtxns", + immediates=dict(ConfigAssetDefaultFrozen=None), + stack_inputs=dict(a=(pytypes.UInt64Type,)), + result=pytypes.BoolType, + ), + FunctionOpMapping( + "gtxn", + immediates=dict(a=int, ConfigAssetDefaultFrozen=None), + result=pytypes.BoolType, + ), + ), + config_asset_unit_name=( + FunctionOpMapping( + "gtxns", + immediates=dict(ConfigAssetUnitName=None), + stack_inputs=dict(a=(pytypes.UInt64Type,)), + result=pytypes.BytesType, + ), + FunctionOpMapping( + "gtxn", + immediates=dict(a=int, ConfigAssetUnitName=None), + result=pytypes.BytesType, + ), + ), + config_asset_name=( + FunctionOpMapping( + "gtxns", + immediates=dict(ConfigAssetName=None), + stack_inputs=dict(a=(pytypes.UInt64Type,)), + result=pytypes.BytesType, + ), + FunctionOpMapping( + "gtxn", + immediates=dict(a=int, ConfigAssetName=None), + result=pytypes.BytesType, + ), + ), + config_asset_url=( + FunctionOpMapping( + "gtxns", + immediates=dict(ConfigAssetURL=None), + stack_inputs=dict(a=(pytypes.UInt64Type,)), + result=pytypes.BytesType, + ), + FunctionOpMapping( + "gtxn", + immediates=dict(a=int, ConfigAssetURL=None), + result=pytypes.BytesType, + ), + ), + config_asset_metadata_hash=( + FunctionOpMapping( + "gtxns", + immediates=dict(ConfigAssetMetadataHash=None), + stack_inputs=dict(a=(pytypes.UInt64Type,)), + result=pytypes.BytesType, + ), + FunctionOpMapping( + "gtxn", + immediates=dict(a=int, ConfigAssetMetadataHash=None), + result=pytypes.BytesType, + ), + ), + config_asset_manager=( + FunctionOpMapping( + "gtxns", + immediates=dict(ConfigAssetManager=None), + stack_inputs=dict(a=(pytypes.UInt64Type,)), + result=pytypes.AccountType, + ), + FunctionOpMapping( + "gtxn", + immediates=dict(a=int, ConfigAssetManager=None), + result=pytypes.AccountType, + ), + ), + config_asset_reserve=( + FunctionOpMapping( + "gtxns", + immediates=dict(ConfigAssetReserve=None), + stack_inputs=dict(a=(pytypes.UInt64Type,)), + result=pytypes.AccountType, + ), + FunctionOpMapping( + "gtxn", + immediates=dict(a=int, ConfigAssetReserve=None), + result=pytypes.AccountType, + ), + ), + config_asset_freeze=( + FunctionOpMapping( + "gtxns", + immediates=dict(ConfigAssetFreeze=None), + stack_inputs=dict(a=(pytypes.UInt64Type,)), + result=pytypes.AccountType, + ), + FunctionOpMapping( + "gtxn", + immediates=dict(a=int, ConfigAssetFreeze=None), + result=pytypes.AccountType, + ), + ), + config_asset_clawback=( + FunctionOpMapping( + "gtxns", + immediates=dict(ConfigAssetClawback=None), + stack_inputs=dict(a=(pytypes.UInt64Type,)), + result=pytypes.AccountType, + ), + FunctionOpMapping( + "gtxn", + immediates=dict(a=int, ConfigAssetClawback=None), + result=pytypes.AccountType, + ), + ), + freeze_asset=( + FunctionOpMapping( + "gtxns", + immediates=dict(FreezeAsset=None), + stack_inputs=dict(a=(pytypes.UInt64Type,)), + result=pytypes.AssetType, + ), + FunctionOpMapping( + "gtxn", + immediates=dict(a=int, FreezeAsset=None), + result=pytypes.AssetType, + ), + ), + freeze_asset_account=( + FunctionOpMapping( + "gtxns", + immediates=dict(FreezeAssetAccount=None), + stack_inputs=dict(a=(pytypes.UInt64Type,)), + result=pytypes.AccountType, + ), + FunctionOpMapping( + "gtxn", + immediates=dict(a=int, FreezeAssetAccount=None), + result=pytypes.AccountType, + ), + ), + freeze_asset_frozen=( + FunctionOpMapping( + "gtxns", + immediates=dict(FreezeAssetFrozen=None), + stack_inputs=dict(a=(pytypes.UInt64Type,)), + result=pytypes.BoolType, + ), + FunctionOpMapping( + "gtxn", + immediates=dict(a=int, FreezeAssetFrozen=None), + result=pytypes.BoolType, + ), + ), + assets=( + FunctionOpMapping( + "gtxnsas", + immediates=dict(Assets=None), + stack_inputs=dict(a=(pytypes.UInt64Type,), b=(pytypes.UInt64Type,)), + result=pytypes.AssetType, + ), + FunctionOpMapping( + "gtxnsa", + immediates=dict(Assets=None, b=int), + stack_inputs=dict(a=(pytypes.UInt64Type,)), + result=pytypes.AssetType, + ), + FunctionOpMapping( + "gtxna", + immediates=dict(a=int, Assets=None, b=int), + result=pytypes.AssetType, + ), + FunctionOpMapping( + "gtxnas", + immediates=dict(a=int, Assets=None), + stack_inputs=dict(b=(pytypes.UInt64Type,)), + result=pytypes.AssetType, + ), + ), + num_assets=( + FunctionOpMapping( + "gtxns", + immediates=dict(NumAssets=None), + stack_inputs=dict(a=(pytypes.UInt64Type,)), + result=pytypes.UInt64Type, + ), + FunctionOpMapping( + "gtxn", + immediates=dict(a=int, NumAssets=None), + result=pytypes.UInt64Type, + ), + ), + applications=( + FunctionOpMapping( + "gtxnsas", + immediates=dict(Applications=None), + stack_inputs=dict(a=(pytypes.UInt64Type,), b=(pytypes.UInt64Type,)), + result=pytypes.ApplicationType, + ), + FunctionOpMapping( + "gtxnsa", + immediates=dict(Applications=None, b=int), + stack_inputs=dict(a=(pytypes.UInt64Type,)), + result=pytypes.ApplicationType, + ), + FunctionOpMapping( + "gtxna", + immediates=dict(a=int, Applications=None, b=int), + result=pytypes.ApplicationType, + ), + FunctionOpMapping( + "gtxnas", + immediates=dict(a=int, Applications=None), + stack_inputs=dict(b=(pytypes.UInt64Type,)), + result=pytypes.ApplicationType, + ), + ), + num_applications=( + FunctionOpMapping( + "gtxns", + immediates=dict(NumApplications=None), + stack_inputs=dict(a=(pytypes.UInt64Type,)), + result=pytypes.UInt64Type, + ), + FunctionOpMapping( + "gtxn", + immediates=dict(a=int, NumApplications=None), + result=pytypes.UInt64Type, + ), + ), + global_num_uint=( + FunctionOpMapping( + "gtxns", + immediates=dict(GlobalNumUint=None), + stack_inputs=dict(a=(pytypes.UInt64Type,)), + result=pytypes.UInt64Type, + ), + FunctionOpMapping( + "gtxn", + immediates=dict(a=int, GlobalNumUint=None), + result=pytypes.UInt64Type, + ), + ), + global_num_byte_slice=( + FunctionOpMapping( + "gtxns", + immediates=dict(GlobalNumByteSlice=None), + stack_inputs=dict(a=(pytypes.UInt64Type,)), + result=pytypes.UInt64Type, + ), + FunctionOpMapping( + "gtxn", + immediates=dict(a=int, GlobalNumByteSlice=None), + result=pytypes.UInt64Type, + ), + ), + local_num_uint=( + FunctionOpMapping( + "gtxns", + immediates=dict(LocalNumUint=None), + stack_inputs=dict(a=(pytypes.UInt64Type,)), + result=pytypes.UInt64Type, + ), + FunctionOpMapping( + "gtxn", + immediates=dict(a=int, LocalNumUint=None), + result=pytypes.UInt64Type, + ), + ), + local_num_byte_slice=( + FunctionOpMapping( + "gtxns", + immediates=dict(LocalNumByteSlice=None), + stack_inputs=dict(a=(pytypes.UInt64Type,)), + result=pytypes.UInt64Type, + ), + FunctionOpMapping( + "gtxn", + immediates=dict(a=int, LocalNumByteSlice=None), + result=pytypes.UInt64Type, + ), + ), + extra_program_pages=( + FunctionOpMapping( + "gtxns", + immediates=dict(ExtraProgramPages=None), + stack_inputs=dict(a=(pytypes.UInt64Type,)), + result=pytypes.UInt64Type, + ), + FunctionOpMapping( + "gtxn", + immediates=dict(a=int, ExtraProgramPages=None), + result=pytypes.UInt64Type, + ), + ), + nonparticipation=( + FunctionOpMapping( + "gtxns", + immediates=dict(Nonparticipation=None), + stack_inputs=dict(a=(pytypes.UInt64Type,)), + result=pytypes.BoolType, + ), + FunctionOpMapping( + "gtxn", + immediates=dict(a=int, Nonparticipation=None), + result=pytypes.BoolType, + ), + ), + logs=( + FunctionOpMapping( + "gtxnsas", + immediates=dict(Logs=None), + stack_inputs=dict(a=(pytypes.UInt64Type,), b=(pytypes.UInt64Type,)), + result=pytypes.BytesType, + ), + FunctionOpMapping( + "gtxnsa", + immediates=dict(Logs=None, b=int), + stack_inputs=dict(a=(pytypes.UInt64Type,)), + result=pytypes.BytesType, + ), + FunctionOpMapping( + "gtxna", + immediates=dict(a=int, Logs=None, b=int), + result=pytypes.BytesType, + ), + FunctionOpMapping( + "gtxnas", + immediates=dict(a=int, Logs=None), + stack_inputs=dict(b=(pytypes.UInt64Type,)), + result=pytypes.BytesType, + ), + ), + num_logs=( + FunctionOpMapping( + "gtxns", + immediates=dict(NumLogs=None), + stack_inputs=dict(a=(pytypes.UInt64Type,)), + result=pytypes.UInt64Type, + ), + FunctionOpMapping( + "gtxn", + immediates=dict(a=int, NumLogs=None), + result=pytypes.UInt64Type, + ), + ), + created_asset_id=( + FunctionOpMapping( + "gtxns", + immediates=dict(CreatedAssetID=None), + stack_inputs=dict(a=(pytypes.UInt64Type,)), + result=pytypes.AssetType, + ), + FunctionOpMapping( + "gtxn", + immediates=dict(a=int, CreatedAssetID=None), + result=pytypes.AssetType, + ), + ), + created_application_id=( + FunctionOpMapping( + "gtxns", + immediates=dict(CreatedApplicationID=None), + stack_inputs=dict(a=(pytypes.UInt64Type,)), + result=pytypes.ApplicationType, + ), + FunctionOpMapping( + "gtxn", + immediates=dict(a=int, CreatedApplicationID=None), + result=pytypes.ApplicationType, + ), + ), + last_log=( + FunctionOpMapping( + "gtxns", + immediates=dict(LastLog=None), + stack_inputs=dict(a=(pytypes.UInt64Type,)), + result=pytypes.BytesType, + ), + FunctionOpMapping( + "gtxn", + immediates=dict(a=int, LastLog=None), + result=pytypes.BytesType, + ), + ), + state_proof_pk=( + FunctionOpMapping( + "gtxns", + immediates=dict(StateProofPK=None), + stack_inputs=dict(a=(pytypes.UInt64Type,)), + result=pytypes.BytesType, + ), + FunctionOpMapping( + "gtxn", + immediates=dict(a=int, StateProofPK=None), + result=pytypes.BytesType, + ), + ), + approval_program_pages=( + FunctionOpMapping( + "gtxnsas", + immediates=dict(ApprovalProgramPages=None), + stack_inputs=dict(a=(pytypes.UInt64Type,), b=(pytypes.UInt64Type,)), + result=pytypes.BytesType, + ), + FunctionOpMapping( + "gtxnsa", + immediates=dict(ApprovalProgramPages=None, b=int), + stack_inputs=dict(a=(pytypes.UInt64Type,)), + result=pytypes.BytesType, + ), + FunctionOpMapping( + "gtxna", + immediates=dict(a=int, ApprovalProgramPages=None, b=int), + result=pytypes.BytesType, + ), + FunctionOpMapping( + "gtxnas", + immediates=dict(a=int, ApprovalProgramPages=None), + stack_inputs=dict(b=(pytypes.UInt64Type,)), + result=pytypes.BytesType, + ), + ), + num_approval_program_pages=( + FunctionOpMapping( + "gtxns", + immediates=dict(NumApprovalProgramPages=None), + stack_inputs=dict(a=(pytypes.UInt64Type,)), + result=pytypes.UInt64Type, + ), + FunctionOpMapping( + "gtxn", + immediates=dict(a=int, NumApprovalProgramPages=None), + result=pytypes.UInt64Type, + ), + ), + clear_state_program_pages=( + FunctionOpMapping( + "gtxnsas", + immediates=dict(ClearStateProgramPages=None), + stack_inputs=dict(a=(pytypes.UInt64Type,), b=(pytypes.UInt64Type,)), + result=pytypes.BytesType, + ), + FunctionOpMapping( + "gtxnsa", + immediates=dict(ClearStateProgramPages=None, b=int), + stack_inputs=dict(a=(pytypes.UInt64Type,)), + result=pytypes.BytesType, + ), + FunctionOpMapping( + "gtxna", + immediates=dict(a=int, ClearStateProgramPages=None, b=int), + result=pytypes.BytesType, + ), + FunctionOpMapping( + "gtxnas", + immediates=dict(a=int, ClearStateProgramPages=None), + stack_inputs=dict(b=(pytypes.UInt64Type,)), + result=pytypes.BytesType, + ), + ), + num_clear_state_program_pages=( + FunctionOpMapping( + "gtxns", + immediates=dict(NumClearStateProgramPages=None), + stack_inputs=dict(a=(pytypes.UInt64Type,)), + result=pytypes.UInt64Type, + ), + FunctionOpMapping( + "gtxn", + immediates=dict(a=int, NumClearStateProgramPages=None), + result=pytypes.UInt64Type, + ), + ), + ), + Global=dict( + min_txn_fee=PropertyOpMapping( + "global", + "MinTxnFee", + pytypes.UInt64Type, + ), + min_balance=PropertyOpMapping( + "global", + "MinBalance", + pytypes.UInt64Type, + ), + max_txn_life=PropertyOpMapping( + "global", + "MaxTxnLife", + pytypes.UInt64Type, + ), + zero_address=PropertyOpMapping( + "global", + "ZeroAddress", + pytypes.AccountType, + ), + group_size=PropertyOpMapping( + "global", + "GroupSize", + pytypes.UInt64Type, + ), + logic_sig_version=PropertyOpMapping( + "global", + "LogicSigVersion", + pytypes.UInt64Type, + ), + round=PropertyOpMapping( + "global", + "Round", + pytypes.UInt64Type, + ), + latest_timestamp=PropertyOpMapping( + "global", + "LatestTimestamp", + pytypes.UInt64Type, + ), + current_application_id=PropertyOpMapping( + "global", + "CurrentApplicationID", + pytypes.ApplicationType, + ), + creator_address=PropertyOpMapping( + "global", + "CreatorAddress", + pytypes.AccountType, + ), + current_application_address=PropertyOpMapping( + "global", + "CurrentApplicationAddress", + pytypes.AccountType, + ), + group_id=PropertyOpMapping( + "global", + "GroupID", + pytypes.BytesType, + ), + opcode_budget=( + FunctionOpMapping( + "global", + immediates=dict(OpcodeBudget=None), + result=pytypes.UInt64Type, + ), + ), + caller_application_id=PropertyOpMapping( + "global", + "CallerApplicationID", + pytypes.UInt64Type, + ), + caller_application_address=PropertyOpMapping( + "global", + "CallerApplicationAddress", + pytypes.AccountType, + ), + asset_create_min_balance=PropertyOpMapping( + "global", + "AssetCreateMinBalance", + pytypes.UInt64Type, + ), + asset_opt_in_min_balance=PropertyOpMapping( + "global", + "AssetOptInMinBalance", + pytypes.UInt64Type, + ), + genesis_hash=PropertyOpMapping( + "global", + "GenesisHash", + pytypes.BytesType, + ), + ), + ITxn=dict( + sender=( + FunctionOpMapping( + "itxn", + immediates=dict(Sender=None), + result=pytypes.AccountType, + ), + ), + fee=( + FunctionOpMapping( + "itxn", + immediates=dict(Fee=None), + result=pytypes.UInt64Type, + ), + ), + first_valid=( + FunctionOpMapping( + "itxn", + immediates=dict(FirstValid=None), + result=pytypes.UInt64Type, + ), + ), + first_valid_time=( + FunctionOpMapping( + "itxn", + immediates=dict(FirstValidTime=None), + result=pytypes.UInt64Type, + ), + ), + last_valid=( + FunctionOpMapping( + "itxn", + immediates=dict(LastValid=None), + result=pytypes.UInt64Type, + ), + ), + note=( + FunctionOpMapping( + "itxn", + immediates=dict(Note=None), + result=pytypes.BytesType, + ), + ), + lease=( + FunctionOpMapping( + "itxn", + immediates=dict(Lease=None), + result=pytypes.BytesType, + ), + ), + receiver=( + FunctionOpMapping( + "itxn", + immediates=dict(Receiver=None), + result=pytypes.AccountType, + ), + ), + amount=( + FunctionOpMapping( + "itxn", + immediates=dict(Amount=None), + result=pytypes.UInt64Type, + ), + ), + close_remainder_to=( + FunctionOpMapping( + "itxn", + immediates=dict(CloseRemainderTo=None), + result=pytypes.AccountType, + ), + ), + vote_pk=( + FunctionOpMapping( + "itxn", + immediates=dict(VotePK=None), + result=pytypes.BytesType, + ), + ), + selection_pk=( + FunctionOpMapping( + "itxn", + immediates=dict(SelectionPK=None), + result=pytypes.BytesType, + ), + ), + vote_first=( + FunctionOpMapping( + "itxn", + immediates=dict(VoteFirst=None), + result=pytypes.UInt64Type, + ), + ), + vote_last=( + FunctionOpMapping( + "itxn", + immediates=dict(VoteLast=None), + result=pytypes.UInt64Type, + ), + ), + vote_key_dilution=( + FunctionOpMapping( + "itxn", + immediates=dict(VoteKeyDilution=None), + result=pytypes.UInt64Type, + ), + ), + type=( + FunctionOpMapping( + "itxn", + immediates=dict(Type=None), + result=pytypes.BytesType, + ), + ), + type_enum=( + FunctionOpMapping( + "itxn", + immediates=dict(TypeEnum=None), + result=pytypes.UInt64Type, + ), + ), + xfer_asset=( + FunctionOpMapping( + "itxn", + immediates=dict(XferAsset=None), + result=pytypes.AssetType, + ), + ), + asset_amount=( + FunctionOpMapping( + "itxn", + immediates=dict(AssetAmount=None), + result=pytypes.UInt64Type, + ), + ), + asset_sender=( + FunctionOpMapping( + "itxn", + immediates=dict(AssetSender=None), + result=pytypes.AccountType, + ), + ), + asset_receiver=( + FunctionOpMapping( + "itxn", + immediates=dict(AssetReceiver=None), + result=pytypes.AccountType, + ), + ), + asset_close_to=( + FunctionOpMapping( + "itxn", + immediates=dict(AssetCloseTo=None), + result=pytypes.AccountType, + ), + ), + group_index=( + FunctionOpMapping( + "itxn", + immediates=dict(GroupIndex=None), + result=pytypes.UInt64Type, + ), + ), + tx_id=( + FunctionOpMapping( + "itxn", + immediates=dict(TxID=None), + result=pytypes.BytesType, + ), + ), + application_id=( + FunctionOpMapping( + "itxn", + immediates=dict(ApplicationID=None), + result=pytypes.ApplicationType, + ), + ), + on_completion=( + FunctionOpMapping( + "itxn", + immediates=dict(OnCompletion=None), + result=pytypes.UInt64Type, + ), + ), + application_args=( + FunctionOpMapping( + "itxnas", + immediates=dict(ApplicationArgs=None), + stack_inputs=dict(a=(pytypes.UInt64Type,)), + result=pytypes.BytesType, + ), + FunctionOpMapping( + "itxna", + immediates=dict(ApplicationArgs=None, a=int), + result=pytypes.BytesType, + ), + ), + num_app_args=( + FunctionOpMapping( + "itxn", + immediates=dict(NumAppArgs=None), + result=pytypes.UInt64Type, + ), + ), + accounts=( + FunctionOpMapping( + "itxnas", + immediates=dict(Accounts=None), + stack_inputs=dict(a=(pytypes.UInt64Type,)), + result=pytypes.AccountType, + ), + FunctionOpMapping( + "itxna", + immediates=dict(Accounts=None, a=int), + result=pytypes.AccountType, + ), + ), + num_accounts=( + FunctionOpMapping( + "itxn", + immediates=dict(NumAccounts=None), + result=pytypes.UInt64Type, + ), + ), + approval_program=( + FunctionOpMapping( + "itxn", + immediates=dict(ApprovalProgram=None), + result=pytypes.BytesType, + ), + ), + clear_state_program=( + FunctionOpMapping( + "itxn", + immediates=dict(ClearStateProgram=None), + result=pytypes.BytesType, + ), + ), + rekey_to=( + FunctionOpMapping( + "itxn", + immediates=dict(RekeyTo=None), + result=pytypes.AccountType, + ), + ), + config_asset=( + FunctionOpMapping( + "itxn", + immediates=dict(ConfigAsset=None), + result=pytypes.AssetType, + ), + ), + config_asset_total=( + FunctionOpMapping( + "itxn", + immediates=dict(ConfigAssetTotal=None), + result=pytypes.UInt64Type, + ), + ), + config_asset_decimals=( + FunctionOpMapping( + "itxn", + immediates=dict(ConfigAssetDecimals=None), + result=pytypes.UInt64Type, + ), + ), + config_asset_default_frozen=( + FunctionOpMapping( + "itxn", + immediates=dict(ConfigAssetDefaultFrozen=None), + result=pytypes.BoolType, + ), + ), + config_asset_unit_name=( + FunctionOpMapping( + "itxn", + immediates=dict(ConfigAssetUnitName=None), + result=pytypes.BytesType, + ), + ), + config_asset_name=( + FunctionOpMapping( + "itxn", + immediates=dict(ConfigAssetName=None), + result=pytypes.BytesType, + ), + ), + config_asset_url=( + FunctionOpMapping( + "itxn", + immediates=dict(ConfigAssetURL=None), + result=pytypes.BytesType, + ), + ), + config_asset_metadata_hash=( + FunctionOpMapping( + "itxn", + immediates=dict(ConfigAssetMetadataHash=None), + result=pytypes.BytesType, + ), + ), + config_asset_manager=( + FunctionOpMapping( + "itxn", + immediates=dict(ConfigAssetManager=None), + result=pytypes.AccountType, + ), + ), + config_asset_reserve=( + FunctionOpMapping( + "itxn", + immediates=dict(ConfigAssetReserve=None), + result=pytypes.AccountType, + ), + ), + config_asset_freeze=( + FunctionOpMapping( + "itxn", + immediates=dict(ConfigAssetFreeze=None), + result=pytypes.AccountType, + ), + ), + config_asset_clawback=( + FunctionOpMapping( + "itxn", + immediates=dict(ConfigAssetClawback=None), + result=pytypes.AccountType, + ), + ), + freeze_asset=( + FunctionOpMapping( + "itxn", + immediates=dict(FreezeAsset=None), + result=pytypes.AssetType, + ), + ), + freeze_asset_account=( + FunctionOpMapping( + "itxn", + immediates=dict(FreezeAssetAccount=None), + result=pytypes.AccountType, + ), + ), + freeze_asset_frozen=( + FunctionOpMapping( + "itxn", + immediates=dict(FreezeAssetFrozen=None), + result=pytypes.BoolType, + ), + ), + assets=( + FunctionOpMapping( + "itxnas", + immediates=dict(Assets=None), + stack_inputs=dict(a=(pytypes.UInt64Type,)), + result=pytypes.AssetType, + ), + FunctionOpMapping( + "itxna", + immediates=dict(Assets=None, a=int), + result=pytypes.AssetType, + ), + ), + num_assets=( + FunctionOpMapping( + "itxn", + immediates=dict(NumAssets=None), + result=pytypes.UInt64Type, + ), + ), + applications=( + FunctionOpMapping( + "itxnas", + immediates=dict(Applications=None), + stack_inputs=dict(a=(pytypes.UInt64Type,)), + result=pytypes.ApplicationType, + ), + FunctionOpMapping( + "itxna", + immediates=dict(Applications=None, a=int), + result=pytypes.ApplicationType, + ), + ), + num_applications=( + FunctionOpMapping( + "itxn", + immediates=dict(NumApplications=None), + result=pytypes.UInt64Type, + ), + ), + global_num_uint=( + FunctionOpMapping( + "itxn", + immediates=dict(GlobalNumUint=None), + result=pytypes.UInt64Type, + ), + ), + global_num_byte_slice=( + FunctionOpMapping( + "itxn", + immediates=dict(GlobalNumByteSlice=None), + result=pytypes.UInt64Type, + ), + ), + local_num_uint=( + FunctionOpMapping( + "itxn", + immediates=dict(LocalNumUint=None), + result=pytypes.UInt64Type, + ), + ), + local_num_byte_slice=( + FunctionOpMapping( + "itxn", + immediates=dict(LocalNumByteSlice=None), + result=pytypes.UInt64Type, + ), + ), + extra_program_pages=( + FunctionOpMapping( + "itxn", + immediates=dict(ExtraProgramPages=None), + result=pytypes.UInt64Type, + ), + ), + nonparticipation=( + FunctionOpMapping( + "itxn", + immediates=dict(Nonparticipation=None), + result=pytypes.BoolType, + ), + ), + logs=( + FunctionOpMapping( + "itxnas", + immediates=dict(Logs=None), + stack_inputs=dict(a=(pytypes.UInt64Type,)), + result=pytypes.BytesType, + ), + FunctionOpMapping( + "itxna", + immediates=dict(Logs=None, a=int), + result=pytypes.BytesType, + ), + ), + num_logs=( + FunctionOpMapping( + "itxn", + immediates=dict(NumLogs=None), + result=pytypes.UInt64Type, + ), + ), + created_asset_id=( + FunctionOpMapping( + "itxn", + immediates=dict(CreatedAssetID=None), + result=pytypes.AssetType, + ), + ), + created_application_id=( + FunctionOpMapping( + "itxn", + immediates=dict(CreatedApplicationID=None), + result=pytypes.ApplicationType, + ), + ), + last_log=( + FunctionOpMapping( + "itxn", + immediates=dict(LastLog=None), + result=pytypes.BytesType, + ), + ), + state_proof_pk=( + FunctionOpMapping( + "itxn", + immediates=dict(StateProofPK=None), + result=pytypes.BytesType, + ), + ), + approval_program_pages=( + FunctionOpMapping( + "itxnas", + immediates=dict(ApprovalProgramPages=None), + stack_inputs=dict(a=(pytypes.UInt64Type,)), + result=pytypes.BytesType, + ), + FunctionOpMapping( + "itxna", + immediates=dict(ApprovalProgramPages=None, a=int), + result=pytypes.BytesType, + ), + ), + num_approval_program_pages=( + FunctionOpMapping( + "itxn", + immediates=dict(NumApprovalProgramPages=None), + result=pytypes.UInt64Type, + ), + ), + clear_state_program_pages=( + FunctionOpMapping( + "itxnas", + immediates=dict(ClearStateProgramPages=None), + stack_inputs=dict(a=(pytypes.UInt64Type,)), + result=pytypes.BytesType, + ), + FunctionOpMapping( + "itxna", + immediates=dict(ClearStateProgramPages=None, a=int), + result=pytypes.BytesType, + ), + ), + num_clear_state_program_pages=( + FunctionOpMapping( + "itxn", + immediates=dict(NumClearStateProgramPages=None), + result=pytypes.UInt64Type, + ), + ), + ), + ITxnCreate=dict( + begin=( + FunctionOpMapping( + "itxn_begin", + ), + ), + next=( + FunctionOpMapping( + "itxn_next", + ), + ), + submit=( + FunctionOpMapping( + "itxn_submit", + ), + ), + set_sender=( + FunctionOpMapping( + "itxn_field", + immediates=dict(Sender=None), + stack_inputs=dict(a=(pytypes.AccountType,)), + ), + ), + set_fee=( + FunctionOpMapping( + "itxn_field", + immediates=dict(Fee=None), + stack_inputs=dict(a=(pytypes.UInt64Type,)), + ), + ), + set_note=( + FunctionOpMapping( + "itxn_field", + immediates=dict(Note=None), + stack_inputs=dict(a=(pytypes.BytesType,)), + ), + ), + set_receiver=( + FunctionOpMapping( + "itxn_field", + immediates=dict(Receiver=None), + stack_inputs=dict(a=(pytypes.AccountType,)), + ), + ), + set_amount=( + FunctionOpMapping( + "itxn_field", + immediates=dict(Amount=None), + stack_inputs=dict(a=(pytypes.UInt64Type,)), + ), + ), + set_close_remainder_to=( + FunctionOpMapping( + "itxn_field", + immediates=dict(CloseRemainderTo=None), + stack_inputs=dict(a=(pytypes.AccountType,)), + ), + ), + set_vote_pk=( + FunctionOpMapping( + "itxn_field", + immediates=dict(VotePK=None), + stack_inputs=dict(a=(pytypes.BytesType,)), + ), + ), + set_selection_pk=( + FunctionOpMapping( + "itxn_field", + immediates=dict(SelectionPK=None), + stack_inputs=dict(a=(pytypes.BytesType,)), + ), + ), + set_vote_first=( + FunctionOpMapping( + "itxn_field", + immediates=dict(VoteFirst=None), + stack_inputs=dict(a=(pytypes.UInt64Type,)), + ), + ), + set_vote_last=( + FunctionOpMapping( + "itxn_field", + immediates=dict(VoteLast=None), + stack_inputs=dict(a=(pytypes.UInt64Type,)), + ), + ), + set_vote_key_dilution=( + FunctionOpMapping( + "itxn_field", + immediates=dict(VoteKeyDilution=None), + stack_inputs=dict(a=(pytypes.UInt64Type,)), + ), + ), + set_type=( + FunctionOpMapping( + "itxn_field", + immediates=dict(Type=None), + stack_inputs=dict(a=(pytypes.BytesType,)), + ), + ), + set_type_enum=( + FunctionOpMapping( + "itxn_field", + immediates=dict(TypeEnum=None), + stack_inputs=dict(a=(pytypes.UInt64Type,)), + ), + ), + set_xfer_asset=( + FunctionOpMapping( + "itxn_field", + immediates=dict(XferAsset=None), + stack_inputs=dict(a=(pytypes.AssetType, pytypes.UInt64Type)), + ), + ), + set_asset_amount=( + FunctionOpMapping( + "itxn_field", + immediates=dict(AssetAmount=None), + stack_inputs=dict(a=(pytypes.UInt64Type,)), + ), + ), + set_asset_sender=( + FunctionOpMapping( + "itxn_field", + immediates=dict(AssetSender=None), + stack_inputs=dict(a=(pytypes.AccountType,)), + ), + ), + set_asset_receiver=( + FunctionOpMapping( + "itxn_field", + immediates=dict(AssetReceiver=None), + stack_inputs=dict(a=(pytypes.AccountType,)), + ), + ), + set_asset_close_to=( + FunctionOpMapping( + "itxn_field", + immediates=dict(AssetCloseTo=None), + stack_inputs=dict(a=(pytypes.AccountType,)), + ), + ), + set_application_id=( + FunctionOpMapping( + "itxn_field", + immediates=dict(ApplicationID=None), + stack_inputs=dict(a=(pytypes.ApplicationType, pytypes.UInt64Type)), + ), + ), + set_on_completion=( + FunctionOpMapping( + "itxn_field", + immediates=dict(OnCompletion=None), + stack_inputs=dict(a=(pytypes.UInt64Type,)), + ), + ), + set_application_args=( + FunctionOpMapping( + "itxn_field", + immediates=dict(ApplicationArgs=None), + stack_inputs=dict(a=(pytypes.BytesType,)), + ), + ), + set_accounts=( + FunctionOpMapping( + "itxn_field", + immediates=dict(Accounts=None), + stack_inputs=dict(a=(pytypes.AccountType,)), + ), + ), + set_approval_program=( + FunctionOpMapping( + "itxn_field", + immediates=dict(ApprovalProgram=None), + stack_inputs=dict(a=(pytypes.BytesType,)), + ), + ), + set_clear_state_program=( + FunctionOpMapping( + "itxn_field", + immediates=dict(ClearStateProgram=None), + stack_inputs=dict(a=(pytypes.BytesType,)), + ), + ), + set_rekey_to=( + FunctionOpMapping( + "itxn_field", + immediates=dict(RekeyTo=None), + stack_inputs=dict(a=(pytypes.AccountType,)), + ), + ), + set_config_asset=( + FunctionOpMapping( + "itxn_field", + immediates=dict(ConfigAsset=None), + stack_inputs=dict(a=(pytypes.AssetType, pytypes.UInt64Type)), + ), + ), + set_config_asset_total=( + FunctionOpMapping( + "itxn_field", + immediates=dict(ConfigAssetTotal=None), + stack_inputs=dict(a=(pytypes.UInt64Type,)), + ), + ), + set_config_asset_decimals=( + FunctionOpMapping( + "itxn_field", + immediates=dict(ConfigAssetDecimals=None), + stack_inputs=dict(a=(pytypes.UInt64Type,)), + ), + ), + set_config_asset_default_frozen=( + FunctionOpMapping( + "itxn_field", + immediates=dict(ConfigAssetDefaultFrozen=None), + stack_inputs=dict(a=(pytypes.BoolType, pytypes.UInt64Type)), + ), + ), + set_config_asset_unit_name=( + FunctionOpMapping( + "itxn_field", + immediates=dict(ConfigAssetUnitName=None), + stack_inputs=dict(a=(pytypes.BytesType,)), + ), + ), + set_config_asset_name=( + FunctionOpMapping( + "itxn_field", + immediates=dict(ConfigAssetName=None), + stack_inputs=dict(a=(pytypes.BytesType,)), + ), + ), + set_config_asset_url=( + FunctionOpMapping( + "itxn_field", + immediates=dict(ConfigAssetURL=None), + stack_inputs=dict(a=(pytypes.BytesType,)), + ), + ), + set_config_asset_metadata_hash=( + FunctionOpMapping( + "itxn_field", + immediates=dict(ConfigAssetMetadataHash=None), + stack_inputs=dict(a=(pytypes.BytesType,)), + ), + ), + set_config_asset_manager=( + FunctionOpMapping( + "itxn_field", + immediates=dict(ConfigAssetManager=None), + stack_inputs=dict(a=(pytypes.AccountType,)), + ), + ), + set_config_asset_reserve=( + FunctionOpMapping( + "itxn_field", + immediates=dict(ConfigAssetReserve=None), + stack_inputs=dict(a=(pytypes.AccountType,)), + ), + ), + set_config_asset_freeze=( + FunctionOpMapping( + "itxn_field", + immediates=dict(ConfigAssetFreeze=None), + stack_inputs=dict(a=(pytypes.AccountType,)), + ), + ), + set_config_asset_clawback=( + FunctionOpMapping( + "itxn_field", + immediates=dict(ConfigAssetClawback=None), + stack_inputs=dict(a=(pytypes.AccountType,)), + ), + ), + set_freeze_asset=( + FunctionOpMapping( + "itxn_field", + immediates=dict(FreezeAsset=None), + stack_inputs=dict(a=(pytypes.AssetType, pytypes.UInt64Type)), + ), + ), + set_freeze_asset_account=( + FunctionOpMapping( + "itxn_field", + immediates=dict(FreezeAssetAccount=None), + stack_inputs=dict(a=(pytypes.AccountType,)), + ), + ), + set_freeze_asset_frozen=( + FunctionOpMapping( + "itxn_field", + immediates=dict(FreezeAssetFrozen=None), + stack_inputs=dict(a=(pytypes.BoolType, pytypes.UInt64Type)), + ), + ), + set_assets=( + FunctionOpMapping( + "itxn_field", + immediates=dict(Assets=None), + stack_inputs=dict(a=(pytypes.UInt64Type,)), + ), + ), + set_applications=( + FunctionOpMapping( + "itxn_field", + immediates=dict(Applications=None), + stack_inputs=dict(a=(pytypes.UInt64Type,)), + ), + ), + set_global_num_uint=( + FunctionOpMapping( + "itxn_field", + immediates=dict(GlobalNumUint=None), + stack_inputs=dict(a=(pytypes.UInt64Type,)), + ), + ), + set_global_num_byte_slice=( + FunctionOpMapping( + "itxn_field", + immediates=dict(GlobalNumByteSlice=None), + stack_inputs=dict(a=(pytypes.UInt64Type,)), + ), + ), + set_local_num_uint=( + FunctionOpMapping( + "itxn_field", + immediates=dict(LocalNumUint=None), + stack_inputs=dict(a=(pytypes.UInt64Type,)), + ), + ), + set_local_num_byte_slice=( + FunctionOpMapping( + "itxn_field", + immediates=dict(LocalNumByteSlice=None), + stack_inputs=dict(a=(pytypes.UInt64Type,)), + ), + ), + set_extra_program_pages=( + FunctionOpMapping( + "itxn_field", + immediates=dict(ExtraProgramPages=None), + stack_inputs=dict(a=(pytypes.UInt64Type,)), + ), + ), + set_nonparticipation=( + FunctionOpMapping( + "itxn_field", + immediates=dict(Nonparticipation=None), + stack_inputs=dict(a=(pytypes.BoolType, pytypes.UInt64Type)), + ), + ), + set_state_proof_pk=( + FunctionOpMapping( + "itxn_field", + immediates=dict(StateProofPK=None), + stack_inputs=dict(a=(pytypes.BytesType,)), + ), + ), + set_approval_program_pages=( + FunctionOpMapping( + "itxn_field", + immediates=dict(ApprovalProgramPages=None), + stack_inputs=dict(a=(pytypes.BytesType,)), + ), + ), + set_clear_state_program_pages=( + FunctionOpMapping( + "itxn_field", + immediates=dict(ClearStateProgramPages=None), + stack_inputs=dict(a=(pytypes.BytesType,)), + ), + ), + ), + JsonRef=dict( + json_string=( + FunctionOpMapping( + "json_ref", + immediates=dict(JSONString=None), + stack_inputs=dict(a=(pytypes.BytesType,), b=(pytypes.BytesType,)), + result=pytypes.BytesType, + ), + ), + json_uint64=( + FunctionOpMapping( + "json_ref", + immediates=dict(JSONUint64=None), + stack_inputs=dict(a=(pytypes.BytesType,), b=(pytypes.BytesType,)), + result=pytypes.UInt64Type, + ), + ), + json_object=( + FunctionOpMapping( + "json_ref", + immediates=dict(JSONObject=None), + stack_inputs=dict(a=(pytypes.BytesType,), b=(pytypes.BytesType,)), + result=pytypes.BytesType, + ), + ), + ), + Scratch=dict( + load_bytes=( + FunctionOpMapping( + "loads", + stack_inputs=dict(a=(pytypes.UInt64Type,)), + result=pytypes.BytesType, + ), + ), + load_uint64=( + FunctionOpMapping( + "loads", + stack_inputs=dict(a=(pytypes.UInt64Type,)), + result=pytypes.UInt64Type, + ), + ), + store=( + FunctionOpMapping( + "stores", + stack_inputs=dict( + a=(pytypes.UInt64Type,), b=(pytypes.BytesType, pytypes.UInt64Type) + ), + ), + ), + ), + Txn=dict( + sender=PropertyOpMapping( + "txn", + "Sender", + pytypes.AccountType, + ), + fee=PropertyOpMapping( + "txn", + "Fee", + pytypes.UInt64Type, + ), + first_valid=PropertyOpMapping( + "txn", + "FirstValid", + pytypes.UInt64Type, + ), + first_valid_time=PropertyOpMapping( + "txn", + "FirstValidTime", + pytypes.UInt64Type, + ), + last_valid=PropertyOpMapping( + "txn", + "LastValid", + pytypes.UInt64Type, + ), + note=PropertyOpMapping( + "txn", + "Note", + pytypes.BytesType, + ), + lease=PropertyOpMapping( + "txn", + "Lease", + pytypes.BytesType, + ), + receiver=PropertyOpMapping( + "txn", + "Receiver", + pytypes.AccountType, + ), + amount=PropertyOpMapping( + "txn", + "Amount", + pytypes.UInt64Type, + ), + close_remainder_to=PropertyOpMapping( + "txn", + "CloseRemainderTo", + pytypes.AccountType, + ), + vote_pk=PropertyOpMapping( + "txn", + "VotePK", + pytypes.BytesType, + ), + selection_pk=PropertyOpMapping( + "txn", + "SelectionPK", + pytypes.BytesType, + ), + vote_first=PropertyOpMapping( + "txn", + "VoteFirst", + pytypes.UInt64Type, + ), + vote_last=PropertyOpMapping( + "txn", + "VoteLast", + pytypes.UInt64Type, + ), + vote_key_dilution=PropertyOpMapping( + "txn", + "VoteKeyDilution", + pytypes.UInt64Type, + ), + type=PropertyOpMapping( + "txn", + "Type", + pytypes.BytesType, + ), + type_enum=PropertyOpMapping( + "txn", + "TypeEnum", + pytypes.UInt64Type, + ), + xfer_asset=PropertyOpMapping( + "txn", + "XferAsset", + pytypes.AssetType, + ), + asset_amount=PropertyOpMapping( + "txn", + "AssetAmount", + pytypes.UInt64Type, + ), + asset_sender=PropertyOpMapping( + "txn", + "AssetSender", + pytypes.AccountType, + ), + asset_receiver=PropertyOpMapping( + "txn", + "AssetReceiver", + pytypes.AccountType, + ), + asset_close_to=PropertyOpMapping( + "txn", + "AssetCloseTo", + pytypes.AccountType, + ), + group_index=PropertyOpMapping( + "txn", + "GroupIndex", + pytypes.UInt64Type, + ), + tx_id=PropertyOpMapping( + "txn", + "TxID", + pytypes.BytesType, + ), + application_id=PropertyOpMapping( + "txn", + "ApplicationID", + pytypes.ApplicationType, + ), + on_completion=PropertyOpMapping( + "txn", + "OnCompletion", + pytypes.UInt64Type, + ), + application_args=( + FunctionOpMapping( + "txnas", + immediates=dict(ApplicationArgs=None), + stack_inputs=dict(a=(pytypes.UInt64Type,)), + result=pytypes.BytesType, + ), + FunctionOpMapping( + "txna", + immediates=dict(ApplicationArgs=None, a=int), + result=pytypes.BytesType, + ), + ), + num_app_args=PropertyOpMapping( + "txn", + "NumAppArgs", + pytypes.UInt64Type, + ), + accounts=( + FunctionOpMapping( + "txnas", + immediates=dict(Accounts=None), + stack_inputs=dict(a=(pytypes.UInt64Type,)), + result=pytypes.AccountType, + ), + FunctionOpMapping( + "txna", + immediates=dict(Accounts=None, a=int), + result=pytypes.AccountType, + ), + ), + num_accounts=PropertyOpMapping( + "txn", + "NumAccounts", + pytypes.UInt64Type, + ), + approval_program=PropertyOpMapping( + "txn", + "ApprovalProgram", + pytypes.BytesType, + ), + clear_state_program=PropertyOpMapping( + "txn", + "ClearStateProgram", + pytypes.BytesType, + ), + rekey_to=PropertyOpMapping( + "txn", + "RekeyTo", + pytypes.AccountType, + ), + config_asset=PropertyOpMapping( + "txn", + "ConfigAsset", + pytypes.AssetType, + ), + config_asset_total=PropertyOpMapping( + "txn", + "ConfigAssetTotal", + pytypes.UInt64Type, + ), + config_asset_decimals=PropertyOpMapping( + "txn", + "ConfigAssetDecimals", + pytypes.UInt64Type, + ), + config_asset_default_frozen=PropertyOpMapping( + "txn", + "ConfigAssetDefaultFrozen", + pytypes.BoolType, + ), + config_asset_unit_name=PropertyOpMapping( + "txn", + "ConfigAssetUnitName", + pytypes.BytesType, + ), + config_asset_name=PropertyOpMapping( + "txn", + "ConfigAssetName", + pytypes.BytesType, + ), + config_asset_url=PropertyOpMapping( + "txn", + "ConfigAssetURL", + pytypes.BytesType, + ), + config_asset_metadata_hash=PropertyOpMapping( + "txn", + "ConfigAssetMetadataHash", + pytypes.BytesType, + ), + config_asset_manager=PropertyOpMapping( + "txn", + "ConfigAssetManager", + pytypes.AccountType, + ), + config_asset_reserve=PropertyOpMapping( + "txn", + "ConfigAssetReserve", + pytypes.AccountType, + ), + config_asset_freeze=PropertyOpMapping( + "txn", + "ConfigAssetFreeze", + pytypes.AccountType, + ), + config_asset_clawback=PropertyOpMapping( + "txn", + "ConfigAssetClawback", + pytypes.AccountType, + ), + freeze_asset=PropertyOpMapping( + "txn", + "FreezeAsset", + pytypes.AssetType, + ), + freeze_asset_account=PropertyOpMapping( + "txn", + "FreezeAssetAccount", + pytypes.AccountType, + ), + freeze_asset_frozen=PropertyOpMapping( + "txn", + "FreezeAssetFrozen", + pytypes.BoolType, + ), + assets=( + FunctionOpMapping( + "txnas", + immediates=dict(Assets=None), + stack_inputs=dict(a=(pytypes.UInt64Type,)), + result=pytypes.AssetType, + ), + FunctionOpMapping( + "txna", + immediates=dict(Assets=None, a=int), + result=pytypes.AssetType, + ), + ), + num_assets=PropertyOpMapping( + "txn", + "NumAssets", + pytypes.UInt64Type, + ), + applications=( + FunctionOpMapping( + "txnas", + immediates=dict(Applications=None), + stack_inputs=dict(a=(pytypes.UInt64Type,)), + result=pytypes.ApplicationType, + ), + FunctionOpMapping( + "txna", + immediates=dict(Applications=None, a=int), + result=pytypes.ApplicationType, + ), + ), + num_applications=PropertyOpMapping( + "txn", + "NumApplications", + pytypes.UInt64Type, + ), + global_num_uint=PropertyOpMapping( + "txn", + "GlobalNumUint", + pytypes.UInt64Type, + ), + global_num_byte_slice=PropertyOpMapping( + "txn", + "GlobalNumByteSlice", + pytypes.UInt64Type, + ), + local_num_uint=PropertyOpMapping( + "txn", + "LocalNumUint", + pytypes.UInt64Type, + ), + local_num_byte_slice=PropertyOpMapping( + "txn", + "LocalNumByteSlice", + pytypes.UInt64Type, + ), + extra_program_pages=PropertyOpMapping( + "txn", + "ExtraProgramPages", + pytypes.UInt64Type, + ), + nonparticipation=PropertyOpMapping( + "txn", + "Nonparticipation", + pytypes.BoolType, + ), + logs=( + FunctionOpMapping( + "txnas", + immediates=dict(Logs=None), + stack_inputs=dict(a=(pytypes.UInt64Type,)), + result=pytypes.BytesType, + ), + FunctionOpMapping( + "txna", + immediates=dict(Logs=None, a=int), + result=pytypes.BytesType, + ), + ), + num_logs=PropertyOpMapping( + "txn", + "NumLogs", + pytypes.UInt64Type, + ), + created_asset_id=PropertyOpMapping( + "txn", + "CreatedAssetID", + pytypes.AssetType, + ), + created_application_id=PropertyOpMapping( + "txn", + "CreatedApplicationID", + pytypes.ApplicationType, + ), + last_log=PropertyOpMapping( + "txn", + "LastLog", + pytypes.BytesType, + ), + state_proof_pk=PropertyOpMapping( + "txn", + "StateProofPK", + pytypes.BytesType, + ), + approval_program_pages=( + FunctionOpMapping( + "txnas", + immediates=dict(ApprovalProgramPages=None), + stack_inputs=dict(a=(pytypes.UInt64Type,)), + result=pytypes.BytesType, + ), + FunctionOpMapping( + "txna", + immediates=dict(ApprovalProgramPages=None, a=int), + result=pytypes.BytesType, + ), + ), + num_approval_program_pages=PropertyOpMapping( + "txn", + "NumApprovalProgramPages", + pytypes.UInt64Type, + ), + clear_state_program_pages=( + FunctionOpMapping( + "txnas", + immediates=dict(ClearStateProgramPages=None), + stack_inputs=dict(a=(pytypes.UInt64Type,)), + result=pytypes.BytesType, + ), + FunctionOpMapping( + "txna", + immediates=dict(ClearStateProgramPages=None, a=int), + result=pytypes.BytesType, + ), + ), + num_clear_state_program_pages=PropertyOpMapping( + "txn", + "NumClearStateProgramPages", + pytypes.UInt64Type, + ), + ), +) diff --git a/src/puya/awst_build/intrinsic_models.py b/src/puya/awst_build/intrinsic_models.py index c0aa68eb1c..4c8d4577a9 100644 --- a/src/puya/awst_build/intrinsic_models.py +++ b/src/puya/awst_build/intrinsic_models.py @@ -1,25 +1,15 @@ -from collections.abc import Sequence +""" +Used to map algopy/_gen.pyi stubs to AWST. +Referenced by both scripts/generate_stubs.py and src/puya/awst_build/eb/intrinsics.py +""" + +from collections.abc import Mapping, Sequence, Set from functools import cached_property import attrs -from puya.awst import wtypes - -# used to map algopy/_gen.pyi stubs to awst -# referenced by both scripts/generate_stubs.py and src/puya/awst_build/eb/intrinsics.py - - -@attrs.frozen -class StackArgMapping: - arg_name: str - """Name of algopy argument to obtain value from""" - allowed_types: Sequence[wtypes.WType] = attrs.field() - """Valid types for this argument, in descending priority for literal conversions""" - - @allowed_types.validator - def check(self, _attribute: object, value: Sequence[wtypes.WType]) -> None: - if wtypes.biguint_wtype in value and wtypes.uint64_wtype in value: - raise ValueError("overlap in integral types") +from puya.awst_build import pytypes +from puya.errors import InternalError @attrs.frozen @@ -30,19 +20,57 @@ class ImmediateArgMapping: """Literal type for the argument""" +@attrs.frozen +class PropertyOpMapping: + op_code: str + immediate: str + typ: pytypes.PyType = attrs.field( + validator=attrs.validators.not_(attrs.validators.in_([pytypes.NoneType])) + ) + + @attrs.frozen class FunctionOpMapping: op_code: str """TEAL op code for this mapping""" - immediates: Sequence[str | ImmediateArgMapping] = attrs.field(factory=tuple) - """A list of constant values or references to an algopy argument to include in immediate""" - stack_inputs: Sequence[StackArgMapping] = attrs.field(factory=tuple) - """References to an algopy argument""" - stack_outputs: Sequence[wtypes.WType] = attrs.field(factory=tuple) + immediates: Mapping[str, type[str | int] | None] = attrs.field(default={}) + """A sequence of constant values or references to an algopy argument to include in immediate""" + stack_inputs: Mapping[str, Sequence[pytypes.PyType]] = attrs.field(default={}) + """Mapping of stack argument names to valid types for the argument, + in descending priority for literal conversions""" + result: pytypes.PyType = pytypes.NoneType """Types output by TEAL op""" - is_property: bool = False - """Is this function represented as a property""" @cached_property - def literal_arg_names(self) -> set[str]: - return {im.arg_name for im in self.immediates if not isinstance(im, str)} + def literal_arg_names(self) -> Set[str]: + result = set[str]() + for name, maybe_lit_type in self.immediates.items(): + if maybe_lit_type is not None: + if name in result: + raise InternalError( + f"Duplicated immediate input name: {name!r} for {self.op_code!r}" + ) + result.add(name) + return result + + @stack_inputs.validator + def _validate_stack_inputs( + self, _attribute: object, value: Mapping[str, Sequence[pytypes.PyType]] + ) -> None: + for name, types in value.items(): + if not types: + raise InternalError( + f"No stack input types provided for argument {name!r} of {self.op_code!r}" + ) + if pytypes.BigUIntType in types and pytypes.UInt64Type in types: + raise InternalError( + f"Overlap in integral types for argument {name!r} or {self.op_code!r}" + ) + + def __attrs_post_init__(self) -> None: + duplicates = self.literal_arg_names & self.stack_inputs.keys() + if duplicates: + raise InternalError( + f"Duplicate arg names between stack inputs and immediates for {self.op_code!r}:" + + ", ".join(duplicates) + ) diff --git a/src/puya/awst_build/module.py b/src/puya/awst_build/module.py index ed7477fd60..56f1c61b8e 100644 --- a/src/puya/awst_build/module.py +++ b/src/puya/awst_build/module.py @@ -8,7 +8,6 @@ from puya import log from puya.algo_constants import MAX_SCRATCH_SLOT_NUMBER -from puya.awst import wtypes from puya.awst.nodes import ( ConstantDeclaration, ConstantValue, @@ -51,6 +50,18 @@ class _LogicSigDecoratorInfo: name_override: str | None +def value_or_error(callback: Callable[[], object]) -> object: + try: + return callback() + except Exception as ex: + return ex + + +_BUILTIN_INHERITABLE: t.Final = frozenset( + ("builtins.object", "abc.ABC", *mypy.types.PROTOCOL_NAMES) +) + + class ModuleASTConverter(BaseMyPyVisitor[StatementResult, ConstantValue]): """This does basic validation, and traversal of valid module scope elements, collecting and folding constants.""" @@ -163,6 +174,7 @@ def _process_logic_sig_decorator( def visit_class_def(self, cdef: mypy.nodes.ClassDef) -> StatementResult: self.check_fatal_decorators(cdef.decorators) + cdef_loc = self._location(cdef) match cdef.analyzed: case None: pass @@ -175,7 +187,7 @@ def visit_class_def(self, cdef: mypy.nodes.ClassDef) -> StatementResult: "Analyzed class expression of type" f" {type(unrecognised_analysis_expression).__name__}," " please report this issue and check the compilation results carefully", - cdef, + cdef_loc, ) for decorator in cdef.decorators: self._error( @@ -185,64 +197,73 @@ def visit_class_def(self, cdef: mypy.nodes.ClassDef) -> StatementResult: ), location=decorator, ) - if cdef.info.bad_mro: - self._error("Bad MRO", location=cdef) - elif cdef.info.has_base(constants.CLS_ARC4_STRUCT): - if [ti.fullname for ti in cdef.info.direct_base_classes()] != [ - constants.CLS_ARC4_STRUCT - ]: - # TODO: allow inheritance of arc4.Struct? + info: mypy.nodes.TypeInfo = cdef.info + if info.bad_mro: + self._error("Bad MRO", location=cdef_loc) + return [] + if info.metaclass_type and info.metaclass_type.type.fullname not in ( + "abc.ABCMeta", + "typing._ProtocolMeta", + "typing_extensions._ProtocolMeta", + constants.CLS_ARC4_STRUCT_META, + constants.STRUCT_META, + ): + self._error( + f"Unsupported metaclass: {info.metaclass_type.type.fullname}", + location=cdef_loc, + ) + return [] + + direct_base_types = [ + self.context.require_ptype(ti.fullname, cdef_loc) + for ti in info.direct_base_classes() + if ti.fullname not in _BUILTIN_INHERITABLE + ] + mro_types = [ + self.context.require_ptype(ti.fullname, cdef_loc) + for ti in info.mro[1:] + if ti.fullname not in _BUILTIN_INHERITABLE + ] + for struct_base in (pytypes.StructBaseType, pytypes.ARC4StructBaseType): + # note that since these struct bases aren't protocols, any subclasses + # cannot be protocols + if direct_base_types == [struct_base]: + return _process_struct(self.context, struct_base, cdef) + if struct_base in mro_types: self._error( - "arc4.Struct classes must only inherit directly from arc4.Struct", cdef + f"{struct_base} classes must only inherit directly from {struct_base}", + cdef_loc, ) - else: - return _process_arc4_struct(self.context, cdef) - elif cdef.info.has_base(constants.STRUCT_BASE): - if [ti.fullname for ti in cdef.info.direct_base_classes()] != [constants.STRUCT_BASE]: - # TODO: allow inheritance of Structs? - self._error("Struct classes must only inherit directly from Struct", cdef) - else: - return _process_struct(self.context, cdef) - elif cdef.info.has_base(constants.CLS_ARC4_CLIENT): - if [ti.fullname for ti in cdef.info.direct_base_classes()] != [ - constants.CLS_ARC4_CLIENT - ]: - self._error("ARC4Client classes must only inherit directly from ARC4Client", cdef) - else: - # nothing to do, ARC4Client classes are used for type info only - pass - elif cdef.info.has_base(constants.CONTRACT_BASE): - # TODO: mypyc also checks for typing.TypingMeta and typing.GenericMeta equivalently - # in a similar check - I can't find many references to these, should we include - # them? - if ( - cdef.info.metaclass_type - and cdef.info.metaclass_type.type.fullname != "abc.ABCMeta" - ): - self._error( - f"Unsupported metaclass: {cdef.info.metaclass_type.type.fullname}", - location=cdef, + return [] + + self.context.register_pytype( + pytypes.StaticType(name=cdef.fullname, bases=direct_base_types, mro=mro_types) + ) + if info.is_protocol: + if pytypes.ARC4ClientBaseType not in direct_base_types: + logger.debug( + f"Skipping further processing of protocol class {cdef.fullname}", + location=cdef_loc, ) - # TODO: other checks above? - else: - class_options = _process_contract_class_options(self.context, self, cdef) - return [lambda ctx: ContractASTConverter.convert(ctx, cdef, class_options)] - else: + return [] + + if pytypes.ContractBaseType not in mro_types: self._error( f"Unsupported class declaration." f" Contract classes must inherit either directly" f" or indirectly from {constants.CONTRACT_BASE_ALIAS}.", - location=cdef, + location=cdef_loc, ) - return [] + return [] + + class_options = _process_contract_class_options(self.context, self, cdef) + return [lambda ctx: ContractASTConverter.convert(ctx, cdef, class_options)] def visit_operator_assignment_stmt( self, stmt: mypy.nodes.OperatorAssignmentStmt ) -> StatementResult: match stmt.lvalue: case mypy.nodes.NameExpr(name="__all__"): - # TODO: this value is technically usable at runtime in Python, - # any references to it in the method bodies should fail return self.empty_statement(stmt) case _: self._unsupported(stmt) @@ -259,66 +280,101 @@ def visit_if_stmt(self, stmt: mypy.nodes.IfStmt) -> StatementResult: return [] def visit_assignment_stmt(self, stmt: mypy.nodes.AssignmentStmt) -> StatementResult: + stmt_loc = self._location(stmt) self._precondition( - bool(stmt.lvalues), "assignment statements should have at least one lvalue", stmt + bool(stmt.lvalues), "assignment statements should have at least one lvalue", stmt_loc ) self._precondition( not stmt.invalid_recursive_alias, "assignment statement with invalid_recursive_alias", - stmt, + stmt_loc, ) - if stmt.is_alias_def: # ie is this a typing.TypeAlias - return [] # skip it - match stmt.lvalues: - case [mypy.nodes.NameExpr(name="__all__")]: - # TODO: this value is technically usable at runtime in Python, - # any references to it in the method bodies should fail - return [] # skip it - # mypy comments here indicate if this is a special form, - # it will be a single lvalue of type NameExpr - # https://github.com/python/mypy/blob/d2022a0007c0eb176ccaf37a9aa54c958be7fb10/mypy/semanal.py#L3508 - case [mypy.nodes.NameExpr(is_special_form=True)]: - match stmt.rvalue: - # is_special_form also includes functional form or Enum or TypedDict - # declarations, we don't support those yet so need to exclude them from - # being skipped over here, otherwise the reported error later on in compilation - # could get real weird - case mypy.nodes.CallExpr( - analyzed=(mypy.nodes.EnumCallExpr() | mypy.nodes.TypedDictExpr()) - ): - self._unsupported(stmt.rvalue, "unsupported type") - case _: - return [] # skip it - const_delcs = StatementResult() - - for lvalue in stmt.lvalues: - match lvalue, stmt.rvalue: - case mypy.nodes.NameExpr() as name_expr, rvalue: - fullname = ".".join((self.context.module_name, name_expr.name)) - # fullname might be unset if this is in - # a conditional branch that's !TYPE_CHECKING - if name_expr.fullname: - self._precondition( - name_expr.fullname == fullname, - f"assignment to module const - expected fullname of {fullname}," - f" but mypy had {name_expr.fullname}", - lvalue, - ) - constant_value = rvalue.accept(self) - self.context.constants[fullname] = constant_value - const_delcs.append( - ConstantDeclaration( - name=name_expr.name, - value=constant_value, - source_location=self._location(lvalue), + lvalues = stmt.lvalues + if not self._check_assignment_lvalues(lvalues): + return [] + if stmt.is_alias_def: + match stmt.rvalue: + case mypy.nodes.RefExpr( + is_alias_rvalue=True, node=mypy.nodes.TypeInfo(fullname=alias_fullname) + ): + maybe_aliased_pytype = self.context.lookup_pytype(alias_fullname) + if maybe_aliased_pytype is None: + self.context.error( + f"Unknown type for type alias: {alias_fullname}", stmt_loc ) + return [] + aliased_pytype = maybe_aliased_pytype + case mypy.nodes.IndexExpr( + analyzed=mypy.nodes.TypeAliasExpr( + node=mypy.nodes.TypeAlias(alias_tvars=[], target=alias_type) + ) + ): + aliased_pytype = self.context.type_to_pytype( + alias_type, source_location=stmt_loc ) case _: - self._unsupported( + self._error("Unsupported type-alias format", stmt_loc) + return [] + for lvalue in lvalues: + self.context.register_pytype(aliased_pytype, alias=lvalue.fullname) + # We don't include type aliases in AWST since they're Python specific + return [] + if any(lvalue.is_special_form for lvalue in lvalues): + self._error("Unsupported type-form", stmt_loc) + + const_delcs = StatementResult() + constant_value = stmt.rvalue.accept(self) + for lvalue in lvalues: + self.context.constants[lvalue.fullname] = constant_value + const_delcs.append( + ConstantDeclaration( + name=lvalue.name, value=constant_value, source_location=stmt_loc + ) + ) + + return const_delcs + + def _check_assignment_lvalues( + self, lvalues: list[mypy.nodes.Lvalue] + ) -> t.TypeGuard[list[mypy.nodes.NameExpr]]: + """Does some pre-condition checks, including that all lvalues are simple (ie name-exprs), + hence the TypeGuard return type. If it returns True, then we should try and handle the + assignment.""" + result = True + for lvalue in lvalues: + if not isinstance(lvalue, mypy.nodes.NameExpr): + self._error( + "Only straight-forward assignment targets supported at module level", lvalue + ) + result = False + else: + if len(lvalues) > 1: + self._precondition( + not lvalue.is_special_form, "special form with multiple lvalues", lvalue + ) + if lvalue.name == "__all__": + # Special notation to denote the public members of a file, we don't need to + # store this as we don't validate star-imports, mypy does, hence the False. + # We check inside functions if this is attempted to be referenced and produce + # a specific error message. + result = False + if len(lvalues) > 1: + self._error("Multi-assignment with __all__ not supported", lvalue) + break + fullname = ".".join((self.context.module_name, lvalue.name)) + # fullname might be unset if this is in + # a conditional branch that's !TYPE_CHECKING + if lvalue.fullname: + self._precondition( + lvalue.fullname == fullname, + f"assignment to module const - expected fullname of {fullname}," + f" but mypy had {lvalue.fullname}", lvalue, - "only straight-forward assignment targets supported at module level", ) - return const_delcs + else: + # fix it up + lvalue._fullname = fullname # noqa: SLF001 + return result def visit_block(self, block: mypy.nodes.Block) -> StatementResult: result = StatementResult() @@ -609,7 +665,7 @@ def _process_contract_class_options( def _process_struct( - context: ASTConversionModuleContext, cdef: mypy.nodes.ClassDef + context: ASTConversionModuleContext, base: pytypes.PyType, cdef: mypy.nodes.ClassDef ) -> StatementResult: fields = dict[str, pytypes.PyType]() field_decls = list[StructureField]() @@ -640,85 +696,24 @@ def _process_struct( cdef.info.names[symbol_name].plugin_generated ): pass - case _: - context.error("Unsupported Struct declaration", stmt) - has_error = True - if has_error: - return [] - cls_loc = context.node_location(cdef) - frozen = cdef.info.metadata["dataclass"]["frozen"] - assert isinstance(frozen, bool) - struct_typ = pytypes.StructType.native( - name=cdef.fullname, - fields=fields, - frozen=frozen, - source_location=cls_loc, - ) - return [ - StructureDefinition( - name=cdef.name, - source_location=cls_loc, - fields=field_decls, - wtype=struct_typ.wtype, - docstring=docstring, - ) - ] - - -def _process_arc4_struct( - context: ASTConversionModuleContext, cdef: mypy.nodes.ClassDef -) -> StatementResult: - fields = dict[str, pytypes.PyType]() - field_decls = list[StructureField]() - docstring = cdef.docstring - - has_error = False - for stmt in cdef.defs.body: - match stmt: - case mypy.nodes.ExpressionStmt(expr=mypy.nodes.StrExpr()): - # ignore class docstring, already extracted - # TODO: should we capture field "docstrings"? - pass - case mypy.nodes.AssignmentStmt( - lvalues=[mypy.nodes.NameExpr(name=field_name)], - rvalue=mypy.nodes.TempNode(), - type=mypy.types.Type() as mypy_type, - ): - stmt_loc = context.node_location(stmt) - pytype = context.type_to_pytype(mypy_type, source_location=stmt_loc) - if not wtypes.is_arc4_encoded_type(pytype.wtype): - context.error(f"Invalid field type for arc4.Struct: {pytype}", stmt_loc) - has_error = True - else: - fields[field_name] = pytype - field_decls.append( - StructureField( - source_location=stmt_loc, - name=field_name, - wtype=pytype.wtype, - ) - ) - case mypy.nodes.SymbolNode(name=symbol_name) if ( - cdef.info.names[symbol_name].plugin_generated - ): + case mypy.nodes.PassStmt(): pass case _: - context.error("Unsupported arc4.Struct declaration", stmt) + context.error(f"Unsupported syntax for {base} member declaration", stmt) has_error = True if has_error: return [] - if not fields: - context.error("arc4.Struct requires at least one field", cdef) - return [] cls_loc = context.node_location(cdef) frozen = cdef.info.metadata["dataclass"]["frozen"] assert isinstance(frozen, bool) - struct_typ = pytypes.StructType.arc4( + struct_typ = pytypes.StructType( + base=base, name=cdef.fullname, fields=fields, frozen=frozen, source_location=cls_loc, ) + context.register_pytype(struct_typ) return [ StructureDefinition( name=cdef.name, diff --git a/src/puya/awst_build/pytypes.py b/src/puya/awst_build/pytypes.py index 7da86b51bf..a4ff064544 100644 --- a/src/puya/awst_build/pytypes.py +++ b/src/puya/awst_build/pytypes.py @@ -22,10 +22,26 @@ class PyType(abc.ABC): name: str """The canonical fully qualified type name""" - generic: GenericType | None = None + generic: _GenericType | None = None """The generic type that this type was parameterised from, if any.""" - metaclass: MetaclassType | None = None - """The metaclass for this type, if different from builtins.type""" + bases: Sequence[PyType] = attrs.field(default=(), converter=tuple["PyType", ...]) + """Direct base classes. probably excluding the implicit builtins.object?""" + mro: Sequence[PyType] = attrs.field(default=(), converter=tuple["PyType", ...]) + """All base cases, in Method Resolution Order""" + + @bases.validator + def _bases_validate(self, _attribute: object, bases: Sequence[PyType]) -> None: + if len(set(bases)) != len(bases): + raise InternalError(f"Duplicate bases in {self}: [{', '.join(map(str, bases))}]") + + @mro.validator + def _mro_validate(self, _attribute: object, mro: Sequence[PyType]) -> None: + bases_missing_from_mro = set(self.bases).difference(mro) + if bases_missing_from_mro: + raise InternalError( + f"Bases missing from MRO in {self}:" + f" [{', '.join(map(str, bases_missing_from_mro))}]" + ) @cached_property def _friendly_name(self) -> str: @@ -59,33 +75,28 @@ def parameterise( raise CodeError(f"Type already has parameters: {self}", source_location) raise CodeError(f"Not a generic type: {self}", source_location) - def register(self) -> typing.Self: - _register(self) - return self - def register_alias(self, name: str) -> typing.Self: - _register(self, alias=name) - return self +_builtins_registry: typing.Final = dict[str, PyType]() -# Registry used for lookups from mypy types. -_type_registry: typing.Final = dict[str, PyType]() +_TPyType = typing.TypeVar("_TPyType", bound=PyType) -def _register(typ: PyType, *, alias: str | None = None) -> None: +def _register_builtin(typ: _TPyType, *, alias: str | None = None) -> _TPyType: name = alias or typ.name - existing_entry = _type_registry.get(name) + existing_entry = _builtins_registry.get(name) if existing_entry is None: - _type_registry[name] = typ + _builtins_registry[name] = typ elif existing_entry is typ: logger.debug(f"Duplicate registration of {typ}") else: raise InternalError(f"Duplicate mapping of {name}") + return typ -def lookup(name: str) -> PyType | None: - """Lookup type by the canonical fully qualified name""" - return _type_registry.get(name) +def builtins_registry() -> dict[str, PyType]: + """Get a copy of the builtins registry""" + return _builtins_registry.copy() # https://typing.readthedocs.io/en/latest/spec/literal.html#legal-and-illegal-parameterizations @@ -97,19 +108,21 @@ def lookup(name: str) -> PyType | None: TypingLiteralValue: typing.TypeAlias = int | bytes | str | bool | None TypeArg: typing.TypeAlias = PyType | TypingLiteralValue TypeArgs: typing.TypeAlias = tuple[TypeArg, ...] -Parameterise: typing.TypeAlias = Callable[["GenericType", TypeArgs, SourceLocation | None], PyType] +Parameterise: typing.TypeAlias = Callable[ + ["_GenericType", TypeArgs, SourceLocation | None], PyType +] @typing.final @attrs.frozen -class GenericType(PyType, abc.ABC): +class _GenericType(PyType, abc.ABC): """Represents a typing.Generic type with unknown parameters""" _parameterise: Parameterise _instance_cache: dict[TypeArgs, PyType] = attrs.field(factory=dict, eq=False) def __attrs_post_init__(self) -> None: - self.register() + _register_builtin(self) @typing.override @property @@ -127,41 +140,16 @@ def parameterise( ) -@typing.final -@attrs.frozen -class MetaclassType(PyType): - generic: None = None - - @typing.override - @property - def wtype(self) -> typing.Never: - raise CodeError("Metaclass types are not valid as values") - - def __attrs_post_init__(self) -> None: - self.register() - - @typing.override - def parameterise( - self, args: Sequence[PyType | TypingLiteralValue], source_location: SourceLocation | None - ) -> typing.Never: - raise CodeError("Generic metaclass types are not supported", source_location) - - -ABCMeta: typing.Final = MetaclassType(name="abc.ABCMeta") -StructMeta: typing.Final = MetaclassType(name=constants.STRUCT_META) -ARC4StructMeta: typing.Final = MetaclassType(name=constants.CLS_ARC4_STRUCT_META) - - @attrs.frozen class TupleType(PyType): - generic: GenericType + generic: _GenericType items: tuple[PyType, ...] = attrs.field(validator=attrs.validators.min_len(1)) wtype: wtypes.WType @attrs.frozen class ArrayType(PyType): - generic: GenericType + generic: _GenericType items: PyType size: int | None wtype: wtypes.WType @@ -175,12 +163,21 @@ class StorageProxyType(PyType): @attrs.frozen class StorageMapProxyType(PyType): - generic: GenericType + generic: _GenericType key: PyType content: PyType wtype: wtypes.WType +@typing.final +@attrs.frozen +class StaticType(PyType): + @typing.override + @property + def wtype(self) -> typing.Never: + raise CodeError(f"{self} is only usable as a type and cannot be instantiated") + + @typing.final @attrs.frozen(init=False) class StructType(PyType): @@ -190,6 +187,7 @@ class StructType(PyType): frozen: bool wtype: wtypes.WType source_location: SourceLocation | None + generic: None = None @cached_property def names(self) -> Sequence[str]: @@ -201,63 +199,34 @@ def types(self) -> Sequence[PyType]: def __init__( self, - metaclass: MetaclassType, - typ: Callable[ - [str, Mapping[str, wtypes.WType], bool, SourceLocation | None], wtypes.WType - ], *, + base: PyType, name: str, fields: Mapping[str, PyType], frozen: bool, source_location: SourceLocation | None, ): field_wtypes = {name: field_typ.wtype for name, field_typ in fields.items()} - wtype = typ(name, field_wtypes, frozen, source_location) + # TODO: this is a bit of a kludge + wtype_cls: Callable[ + [str, Mapping[str, wtypes.WType], bool, SourceLocation | None], wtypes.WType + ] + if base is ARC4StructBaseType: + wtype_cls = wtypes.ARC4Struct + elif base is StructBaseType: + wtype_cls = wtypes.WStructType + else: + raise InternalError(f"Unknown struct base type: {base}", source_location) + wtype = wtype_cls(name, field_wtypes, frozen, source_location) self.__attrs_init__( - metaclass=metaclass, + bases=[base], + mro=[base], name=name, wtype=wtype, fields=fields, frozen=frozen, source_location=source_location, ) - self.register() - - @classmethod - def native( - cls, - *, - name: str, - fields: Mapping[str, PyType], - frozen: bool, - source_location: SourceLocation | None, - ) -> typing.Self: - return cls( - metaclass=StructMeta, - typ=wtypes.WStructType, - name=name, - fields=fields, - frozen=frozen, - source_location=source_location, - ) - - @classmethod - def arc4( - cls, - *, - name: str, - fields: Mapping[str, PyType], - frozen: bool, - source_location: SourceLocation | None, - ) -> typing.Self: - return cls( - metaclass=ARC4StructMeta, - typ=wtypes.ARC4Struct, - name=name, - fields=fields, - frozen=frozen, - source_location=source_location, - ) @typing.final @@ -266,7 +235,7 @@ class _SimpleType(PyType): wtype: wtypes.WType def __attrs_post_init__(self) -> None: - self.register() + _register_builtin(self) NoneType: typing.Final[PyType] = _SimpleType( @@ -305,6 +274,10 @@ def __attrs_post_init__(self) -> None: name=constants.CLS_APPLICATION, wtype=wtypes.application_wtype, ) +BytesBackedType: typing.Final[PyType] = _SimpleType( + name=f"{constants.ALGOPY_PREFIX}_primitives.BytesBacked", + wtype=wtypes.bytes_wtype, +) OnCompleteActionType: typing.Final[PyType] = _SimpleType( name=constants.ENUM_CLS_ON_COMPLETE_ACTION, @@ -314,6 +287,10 @@ def __attrs_post_init__(self) -> None: name=constants.ENUM_CLS_TRANSACTION_TYPE, wtype=wtypes.uint64_wtype, ) +OpUpFeeSourceType: typing.Final[PyType] = _SimpleType( + name=constants.OP_UP_FEE_SOURCE, + wtype=wtypes.uint64_wtype, +) ARC4StringType: typing.Final[PyType] = _SimpleType( name=constants.CLS_ARC4_STRING, @@ -335,14 +312,14 @@ def __attrs_post_init__(self) -> None: @attrs.frozen class ARC4UIntNType(PyType): - generic: GenericType + generic: _GenericType bits: int wtype: wtypes.WType def _make_arc4_unsigned_int_parameterise(*, max_bits: int | None = None) -> Parameterise: def parameterise( - self: GenericType, args: TypeArgs, source_location: SourceLocation | None + self: _GenericType, args: TypeArgs, source_location: SourceLocation | None ) -> ARC4UIntNType: try: (bits,) = args @@ -366,28 +343,33 @@ def parameterise( return parameterise -GenericARC4UIntNType: typing.Final = GenericType( +GenericARC4UIntNType: typing.Final = _GenericType( name=constants.CLS_ARC4_UINTN, parameterise=_make_arc4_unsigned_int_parameterise(max_bits=64), ) -GenericARC4BigUIntNType: typing.Final = GenericType( +GenericARC4BigUIntNType: typing.Final = _GenericType( name=constants.CLS_ARC4_BIG_UINTN, parameterise=_make_arc4_unsigned_int_parameterise(), ) -ARC4ByteType: typing.Final[PyType] = ARC4UIntNType( - generic=GenericARC4UIntNType, - name=constants.CLS_ARC4_BYTE, - wtype=wtypes.arc4_byte_type, - bits=8, -).register() +ARC4ByteType: typing.Final[PyType] = _register_builtin( + ARC4UIntNType( + generic=GenericARC4UIntNType, + name=constants.CLS_ARC4_BYTE, + wtype=wtypes.arc4_byte_type, + bits=8, + ) +) ARC4UIntN_Aliases: typing.Final = immutabledict[int, ARC4UIntNType]( { - (_bits := 2**_exp): (GenericARC4UIntNType if _bits <= 64 else GenericARC4BigUIntNType) - .parameterise([_bits], source_location=None) - .register_alias(f"{constants.ARC4_PREFIX}UInt{_bits}") + (_bits := 2**_exp): _register_builtin( + (GenericARC4UIntNType if _bits <= 64 else GenericARC4BigUIntNType).parameterise( + [_bits], source_location=None + ), + alias=f"{constants.ARC4_PREFIX}UInt{_bits}", + ) for _exp in range(3, 10) } ) @@ -395,7 +377,7 @@ def parameterise( @attrs.frozen class ARC4UFixedNxMType(PyType): - generic: GenericType + generic: _GenericType bits: int precision: int wtype: wtypes.WType @@ -403,7 +385,7 @@ class ARC4UFixedNxMType(PyType): def _make_arc4_unsigned_fixed_parameterise(*, max_bits: int | None = None) -> Parameterise: def parameterise( - self: GenericType, args: TypeArgs, source_location: SourceLocation | None + self: _GenericType, args: TypeArgs, source_location: SourceLocation | None ) -> ARC4UFixedNxMType: try: bits, precision = args @@ -428,11 +410,11 @@ def parameterise( return parameterise -GenericARC4UFixedNxMType: typing.Final = GenericType( +GenericARC4UFixedNxMType: typing.Final = _GenericType( name=constants.CLS_ARC4_UFIXEDNXM, parameterise=_make_arc4_unsigned_fixed_parameterise(max_bits=64), ) -GenericARC4BigUFixedNxMType: typing.Final = GenericType( +GenericARC4BigUFixedNxMType: typing.Final = _GenericType( name=constants.CLS_ARC4_BIG_UFIXEDNXM, parameterise=_make_arc4_unsigned_fixed_parameterise(), ) @@ -442,7 +424,7 @@ def _make_tuple_parameterise( typ: Callable[[Iterable[wtypes.WType], SourceLocation | None], wtypes.WType] ) -> Parameterise: def parameterise( - self: GenericType, args: TypeArgs, source_location: SourceLocation | None + self: _GenericType, args: TypeArgs, source_location: SourceLocation | None ) -> TupleType: py_types = [] item_wtypes = [] @@ -468,12 +450,12 @@ def parameterise( return parameterise -GenericTupleType: typing.Final = GenericType( +GenericTupleType: typing.Final = _GenericType( name="builtins.tuple", parameterise=_make_tuple_parameterise(wtypes.WTuple), ) -GenericARC4TupleType: typing.Final = GenericType( +GenericARC4TupleType: typing.Final = _GenericType( name=constants.CLS_ARC4_TUPLE, parameterise=_make_tuple_parameterise(wtypes.ARC4Tuple), ) @@ -483,7 +465,7 @@ def _make_array_parameterise( typ: Callable[[wtypes.WType, SourceLocation | None], wtypes.WType] ) -> Parameterise: def parameterise( - self: GenericType, args: TypeArgs, source_location: SourceLocation | None + self: _GenericType, args: TypeArgs, source_location: SourceLocation | None ) -> ArrayType: try: (arg,) = args @@ -508,12 +490,12 @@ def parameterise( return parameterise -GenericArrayType: typing.Final = GenericType( +GenericArrayType: typing.Final = _GenericType( name=constants.CLS_ARRAY, parameterise=_make_array_parameterise(wtypes.WArray), ) -GenericARC4DynamicArrayType: typing.Final = GenericType( +GenericARC4DynamicArrayType: typing.Final = _GenericType( name=constants.CLS_ARC4_DYNAMIC_ARRAY, parameterise=_make_array_parameterise(wtypes.ARC4DynamicArray), ) @@ -523,7 +505,7 @@ def _make_fixed_array_parameterise( typ: Callable[[wtypes.WType, int, SourceLocation | None], wtypes.WType] ) -> Parameterise: def parameterise( - self: GenericType, args: TypeArgs, source_location: SourceLocation | None + self: _GenericType, args: TypeArgs, source_location: SourceLocation | None ) -> ArrayType: try: items, size = args @@ -553,7 +535,7 @@ def parameterise( return parameterise -GenericARC4StaticArrayType: typing.Final = GenericType( +GenericARC4StaticArrayType: typing.Final = _GenericType( name=constants.CLS_ARC4_STATIC_ARRAY, parameterise=_make_fixed_array_parameterise(wtypes.ARC4StaticArray), ) @@ -561,7 +543,7 @@ def parameterise( def _make_storage_parameterise(key_type: wtypes.WType) -> Parameterise: def parameterise( - self: GenericType, args: TypeArgs, source_location: SourceLocation | None + self: _GenericType, args: TypeArgs, source_location: SourceLocation | None ) -> StorageProxyType: try: (arg,) = args @@ -589,7 +571,7 @@ def _make_storage_parameterise_todo_remove_me( key_type: Callable[[wtypes.WType], wtypes.WType] ) -> Parameterise: def parameterise( - self: GenericType, args: TypeArgs, source_location: SourceLocation | None + self: _GenericType, args: TypeArgs, source_location: SourceLocation | None ) -> StorageProxyType: try: (arg,) = args @@ -614,7 +596,7 @@ def parameterise( def _parameterise_storage_map( - self: GenericType, args: TypeArgs, source_location: SourceLocation | None + self: _GenericType, args: TypeArgs, source_location: SourceLocation | None ) -> StorageMapProxyType: try: key, content = args @@ -637,33 +619,35 @@ def _parameterise_storage_map( # would have to change strategy in _gather_global_direct_storages if so # wtype=wtypes.box_key, # TODO: FIXME - wtype=wtypes.WBoxMapProxy.from_key_and_content_type(content.wtype), + wtype=wtypes.WBoxMapProxy.from_key_and_content_type(key.wtype, content.wtype), ) -GenericGlobalStateType: typing.Final = GenericType( +GenericGlobalStateType: typing.Final = _GenericType( name=constants.CLS_GLOBAL_STATE, parameterise=_make_storage_parameterise(wtypes.state_key), ) -GenericLocalStateType: typing.Final = GenericType( +GenericLocalStateType: typing.Final = _GenericType( name=constants.CLS_LOCAL_STATE, parameterise=_make_storage_parameterise(wtypes.state_key), ) -GenericBoxType: typing.Final = GenericType( +GenericBoxType: typing.Final = _GenericType( name=constants.CLS_BOX_PROXY, # TODO: FIXME # parameterise=_make_storage_parameterise(wtypes.box_key), parameterise=_make_storage_parameterise_todo_remove_me(wtypes.WBoxProxy.from_content_type), ) -BoxRefType: typing.Final = StorageProxyType( - name=constants.CLS_BOX_REF_PROXY, - content=BytesType, - # wtype=wtypes.box_key, - wtype=wtypes.box_ref_proxy_type, # TODO: fixme - generic=None, -).register() +BoxRefType: typing.Final = _register_builtin( + StorageProxyType( + name=constants.CLS_BOX_REF_PROXY, + content=BytesType, + # wtype=wtypes.box_key, + wtype=wtypes.box_ref_proxy_type, # TODO: fixme + generic=None, + ) +) -GenericBoxMapType: typing.Final = GenericType( +GenericBoxMapType: typing.Final = _GenericType( name=constants.CLS_BOX_MAP_PROXY, parameterise=_parameterise_storage_map, ) @@ -679,58 +663,153 @@ def _parameterise_storage_map( ) -def _make_txn_types( - kind: constants.TransactionType | None, - name: str, - itxn_fields: str | None = None, - itxn_result: str | None = None, -) -> tuple[PyType, PyType, PyType]: - gtxn_name = f"{constants.ALGOPY_PREFIX}gtxn.{name}Transaction" - itxn_fieldset_name = itxn_fields or f"{constants.ALGOPY_PREFIX}itxn.{name}" - itxn_result_name = itxn_result or f"{constants.ALGOPY_PREFIX}itxn.{name}InnerTransaction" +def _make_txn_types(kind: constants.TransactionType | None) -> tuple[PyType, PyType, PyType]: + gtxn_type = _make_gtxn_type(kind) + itxn_fieldset_type = _make_itxn_fieldset_type(kind) + itxn_result_type = _make_itxn_result_type(kind) + return gtxn_type, itxn_fieldset_type, itxn_result_type + - gtxn_type = _SimpleType( - name=gtxn_name, +def _make_gtxn_type(kind: constants.TransactionType | None) -> PyType: + if kind is None: + wtype_name = "group_transaction" + cls_name = "Transaction" + else: + wtype_name = f"group_transaction_{kind.name}" + cls_name = f"{_TXN_TYPE_NAMES[kind]}Transaction" + stub_name = f"{constants.ALGOPY_PREFIX}gtxn.{cls_name}" + return _SimpleType( + name=stub_name, wtype=wtypes.WGroupTransaction( - stub_name=gtxn_name, - name="group_transaction" if not kind else f"group_transaction_{kind.name}", + name=wtype_name, transaction_type=kind, + stub_name=stub_name, ), ) - itxn_fieldset_type = _SimpleType( - name=itxn_fieldset_name, + +def _make_itxn_fieldset_type(kind: constants.TransactionType | None) -> PyType: + if kind is None: + wtype_name = "inner_transaction_fields" + cls_name = "InnerTransaction" + else: + wtype_name = f"inner_transaction_fields_{kind.name}" + cls_name = _TXN_TYPE_NAMES[kind] + stub_name = f"{constants.ALGOPY_PREFIX}itxn.{cls_name}" + return _SimpleType( + name=stub_name, wtype=wtypes.WInnerTransactionFields( - stub_name=itxn_fieldset_name, - name=( - "inner_transaction_fields" if not kind else f"inner_transaction_fields_{kind.name}" - ), - transaction_type=kind, + name=wtype_name, transaction_type=kind, stub_name=stub_name ), ) - itxn_result_type = _SimpleType( - name=itxn_result_name, + +def _make_itxn_result_type(kind: constants.TransactionType | None) -> PyType: + if kind is None: + wtype_name = "inner_transaction" + cls_name = "InnerTransactionResult" + else: + wtype_name = f"inner_transaction_{kind.name}" + cls_name = f"{_TXN_TYPE_NAMES[kind]}InnerTransaction" + stub_name = f"{constants.ALGOPY_PREFIX}itxn.{cls_name}" + return _SimpleType( + name=stub_name, wtype=wtypes.WInnerTransaction( - stub_name=itxn_result_name, - name="inner_transaction" if not kind else f"inner_transaction_{kind.name}", - transaction_type=kind, + name=wtype_name, transaction_type=kind, stub_name=stub_name ), ) - return gtxn_type, itxn_fieldset_type, itxn_result_type +_TXN_TYPE_NAMES: typing.Final[Mapping[constants.TransactionType, str]] = { + constants.TransactionType.pay: "Payment", + constants.TransactionType.keyreg: "KeyRegistration", + constants.TransactionType.acfg: "AssetConfig", + constants.TransactionType.axfer: "AssetTransfer", + constants.TransactionType.afrz: "AssetFreeze", + constants.TransactionType.appl: "ApplicationCall", +} -# TODO: assign these -_make_txn_types(constants.TransactionType.pay, "Payment") -_make_txn_types(constants.TransactionType.keyreg, "KeyRegistration") -_make_txn_types(constants.TransactionType.acfg, "AssetConfig") -_make_txn_types(constants.TransactionType.axfer, "AssetTransfer") -_make_txn_types(constants.TransactionType.afrz, "AssetFreeze") -_make_txn_types(constants.TransactionType.appl, "ApplicationCall") -_make_txn_types( +_all_txn_kinds: typing.Final[Sequence[constants.TransactionType | None]] = [ None, - "", - f"{constants.ALGOPY_PREFIX}itxn.InnerTransaction", - f"{constants.ALGOPY_PREFIX}itxn.InnerTransactionResult", + *constants.TransactionType, +] +GroupTransactionTypes: typing.Final[Mapping[constants.TransactionType | None, PyType]] = { + kind: _make_gtxn_type(kind) for kind in _all_txn_kinds +} +InnerTransactionFieldsetTypes: typing.Final[Mapping[constants.TransactionType | None, PyType]] = { + kind: _make_itxn_fieldset_type(kind) for kind in _all_txn_kinds +} +InnerTransactionResultTypes: typing.Final[Mapping[constants.TransactionType | None, PyType]] = { + kind: _make_itxn_result_type(kind) for kind in _all_txn_kinds +} + + +@attrs.frozen(kw_only=True) +class _CompileTimeType(PyType): + generic: None = None + _wtype_error: str + + @typing.override + @property + def wtype(self) -> typing.Never: + msg = self._wtype_error.format(self=self) + raise CodeError(msg) + + def __attrs_post_init__(self) -> None: + _register_builtin(self) + + +def _make_op_namespace_types() -> Sequence[PyType]: + from itertools import chain + + from puya.awst_build.intrinsic_data import ENUM_CLASSES, NAMESPACE_CLASSES + + return [ + _CompileTimeType( + name="".join((constants.ALGOPY_OP_PREFIX, cls_name)), + wtype_error="{self} is a namespace type only and not usable at runtime", + ) + for cls_name in chain(ENUM_CLASSES, NAMESPACE_CLASSES) + ] + + +OpNamespaceTypes: typing.Final = _make_op_namespace_types() + +StateTotalsType: typing.Final[PyType] = _CompileTimeType( + name=f"{constants.ALGOPY_PREFIX}_contract.StateTotals", + wtype_error="{self} is only usable in a class options context", +) + +urangeType: typing.Final[PyType] = _CompileTimeType( # noqa: N816 + name=constants.URANGE, + wtype_error="{self} is not usable at runtime", +) + +LogicSigType: typing.Final[PyType] = _CompileTimeType( + name=f"{constants.ALGOPY_PREFIX}_logic_sig.LogicSig", + wtype_error="{self} is only usable in a static context", +) + + +@attrs.frozen +class _BaseType(PyType): + """Type that is only usable as a base type""" + + @typing.override + @property + def wtype(self) -> typing.Never: + raise CodeError(f"{self} is only usable as a base type") + + def __attrs_post_init__(self) -> None: + _register_builtin(self) + + +ContractBaseType: typing.Final[PyType] = _BaseType(name=constants.CONTRACT_BASE) +ARC4ContractBaseType: typing.Final[PyType] = _BaseType( + name=constants.ARC4_CONTRACT_BASE, + bases=[ContractBaseType], + mro=[ContractBaseType], ) +ARC4ClientBaseType: typing.Final[PyType] = _BaseType(name=constants.CLS_ARC4_CLIENT) +ARC4StructBaseType: typing.Final[PyType] = _BaseType(name=constants.CLS_ARC4_STRUCT) +StructBaseType: typing.Final[PyType] = _BaseType(name=constants.STRUCT_BASE) diff --git a/src/puya/awst_build/subroutine.py b/src/puya/awst_build/subroutine.py index c43a35ccff..33520ea8d4 100644 --- a/src/puya/awst_build/subroutine.py +++ b/src/puya/awst_build/subroutine.py @@ -12,7 +12,6 @@ from puya.awst import wtypes from puya.awst.nodes import ( AppStateExpression, - AppStateKind, AssertStatement, AssignmentExpression, AssignmentStatement, @@ -50,7 +49,7 @@ from puya.awst_build import constants, pytypes from puya.awst_build.base_mypy_visitor import BaseMyPyVisitor from puya.awst_build.context import ASTConversionModuleContext -from puya.awst_build.contract_data import AppStateDeclType, AppStorageDeclaration +from puya.awst_build.contract_data import AppStorageDeclaration from puya.awst_build.eb.arc4 import ( ARC4BoolClassExpressionBuilder, ARC4ClientClassExpressionBuilder, @@ -63,11 +62,6 @@ StateProxyDefinitionBuilder, ) from puya.awst_build.eb.bool import BoolClassExpressionBuilder -from puya.awst_build.eb.box import ( - BoxMapProxyExpressionBuilder, - BoxProxyExpressionBuilder, - BoxRefProxyExpressionBuilder, -) from puya.awst_build.eb.contracts import ( ContractSelfExpressionBuilder, ContractTypeExpressionBuilder, @@ -321,21 +315,24 @@ def visit_assignment_stmt(self, stmt: mypy.nodes.AssignmentStmt) -> Sequence[Sta return [] match stmt.rvalue: case mypy.nodes.TempNode(no_rhs=True): - # forward type-declaration only - self._precondition( - len(stmt.lvalues) == 1 and isinstance(stmt.lvalues[0], mypy.nodes.RefExpr), - "forward type declarations should only have one target," - " and it should be a RefExpr", - stmt_loc, - ) - return [] + match stmt.lvalues: + case [mypy.nodes.NameExpr(name=var_name)]: + if stmt.type is not None: # should always be the case, but ... + self._symtable[var_name] = self.context.type_to_pytype( + stmt.type, source_location=stmt_loc + ) + # forward type-declaration only, no-op + return [] + case _: + raise InternalError( + "Forward type declarations should only have one target," + " and it should be a NameExpr", + stmt_loc, + ) rvalue = require_expression_builder(stmt.rvalue.accept(self)) - if isinstance( - rvalue, - StateProxyDefinitionBuilder - | BoxProxyExpressionBuilder - | BoxRefProxyExpressionBuilder - | BoxMapProxyExpressionBuilder, + rvalue_pytyp = self.context.mypy_expr_node_type(stmt.rvalue) + if rvalue_pytyp is pytypes.BoxRefType or isinstance( + rvalue_pytyp, pytypes.StorageProxyType | pytypes.StorageMapProxyType ): try: (lvalue,) = stmt.lvalues @@ -343,10 +340,10 @@ def visit_assignment_stmt(self, stmt: mypy.nodes.AssignmentStmt) -> Sequence[Sta # this is true regardless of whether it's a self assignment or not, # these are objects so aliasing is an issue in terms of semantic compatibility raise CodeError( - f"{rvalue.python_name} can only be assigned to a single variable", stmt_loc + f"{rvalue_pytyp} can only be assigned to a single variable", stmt_loc ) from None if is_self_member(lvalue): - return self._handle_proxy_assignment(lvalue, rvalue, stmt_loc) + return self._handle_proxy_assignment(lvalue, rvalue, rvalue_pytyp, stmt_loc) elif len(stmt.lvalues) > 1: # TODO: PyType from rvalue, since it's guaranteed to be EB rvalue = temporary_assignment_if_required(rvalue) @@ -363,51 +360,49 @@ def visit_assignment_stmt(self, stmt: mypy.nodes.AssignmentStmt) -> Sequence[Sta def _handle_proxy_assignment( self, lvalue: mypy.nodes.MemberExpr, - rvalue: ( - StateProxyDefinitionBuilder - | BoxProxyExpressionBuilder - | BoxRefProxyExpressionBuilder - | BoxMapProxyExpressionBuilder - ), + rvalue: ExpressionBuilder, + rvalue_pytyp: pytypes.PyType, stmt_loc: SourceLocation, ) -> Sequence[Statement]: if self.contract_method_info is None: raise InternalError("Assignment to self outside of a contract class", stmt_loc) if self.func_def.name != "__init__": raise CodeError( - f"{rvalue.python_name} can only be assigned to a member variable" + f"{rvalue_pytyp} can only be assigned to a member variable" " in the __init__ method", stmt_loc, ) cref = self.contract_method_info.cref if isinstance(rvalue, StateProxyDefinitionBuilder): - return self._handle_state_proxy_assignment(cref, lvalue, rvalue, stmt_loc) + return self._handle_state_proxy_assignment( + cref, lvalue, rvalue, rvalue_pytyp, stmt_loc + ) else: - return self._handle_box_proxy_assignment(cref, lvalue, rvalue, stmt_loc) + return self._handle_box_proxy_assignment(cref, lvalue, rvalue, rvalue_pytyp, stmt_loc) def _handle_state_proxy_assignment( self, cref: ContractReference, lvalue: mypy.nodes.MemberExpr, rvalue: StateProxyDefinitionBuilder, + rvalue_pytyp: pytypes.PyType, stmt_loc: SourceLocation, ) -> Sequence[Statement]: member_name = lvalue.name member_loc = self._location(lvalue) - defn = rvalue.build_definition(member_name, cref, member_loc) + defn = rvalue.build_definition(member_name, cref, rvalue_pytyp, member_loc) self.context.state_defs[cref][member_name] = defn if rvalue.initial_value is None: return [] - elif defn.kind != AppStateKind.app_global: + elif rvalue_pytyp.generic is not pytypes.GenericGlobalStateType: raise InternalError( - f"Don't know how to do initialise-on-declaration" - f" for storage of kind {defn.kind}", - stmt_loc, + f"Don't know how to do initialise-on-declaration for {rvalue_pytyp}", stmt_loc ) else: global_state_target = AppStateExpression( + key=defn.key, field_name=defn.member_name, - wtype=defn.storage_wtype, + wtype=defn.definition.storage_wtype, source_location=defn.source_location, ) return [ @@ -422,42 +417,25 @@ def _handle_box_proxy_assignment( self, cref: ContractReference, lvalue: mypy.nodes.MemberExpr, - rvalue: ( - BoxRefProxyExpressionBuilder | BoxProxyExpressionBuilder | BoxMapProxyExpressionBuilder - ), + rvalue: ExpressionBuilder, + rvalue_pytyp: pytypes.PyType, stmt_loc: SourceLocation, ) -> Sequence[Statement]: member_name = lvalue.name key = rvalue.rvalue() match key: - case BoxProxyExpression(key=BytesConstant() as key_override, wtype=expr_wtype): - if expr_wtype is wtypes.box_ref_proxy_type: - kind = AppStateKind.box_ref - decl_type = AppStateDeclType.box_ref - storage_wtype = wtypes.bytes_wtype - elif isinstance(expr_wtype, wtypes.WBoxProxy): - kind = AppStateKind.box - decl_type = AppStateDeclType.box - storage_wtype = expr_wtype.content_wtype - elif isinstance(expr_wtype, wtypes.WBoxMapProxy): - kind = AppStateKind.box_map - decl_type = AppStateDeclType.box_map - storage_wtype = expr_wtype.content_wtype - else: - raise InternalError("Unexpected") + case BoxProxyExpression(key=BytesConstant() as key_override): self.context.state_defs[cref][member_name] = AppStorageDeclaration( member_name=member_name, key_override=key_override, source_location=key.source_location, - storage_wtype=storage_wtype, + typ=rvalue_pytyp, description=None, - decl_type=decl_type, - kind=kind, defined_in=cref, ) return [] raise CodeError( - f"{rvalue.python_name} must be declared with compile time static keys" + f"{rvalue_pytyp} must be declared with compile time static keys" f" when assigned to 'self'", stmt_loc, ) @@ -695,7 +673,7 @@ def _visit_ref_expr_maybe_aliased( if typ.has_base(constants.CLS_ARC4_CLIENT): # provides type info only return ARC4ClientClassExpressionBuilder(self.context, expr_loc, typ.defn.info) if typ.has_base(constants.STRUCT_BASE) or typ.has_base(constants.CLS_ARC4_STRUCT): - pytyp = pytypes.lookup(fullname) + pytyp = self.context.lookup_pytype(fullname) if pytyp is None: raise CodeError(f"Unknown struct subclass {fullname}", expr_loc) # TODO: use PyType directly @@ -841,20 +819,34 @@ def _visit_ref_expr_of_builtins( def _visit_ref_expr_of_algopy( self, fullname: str, location: SourceLocation, node: mypy.nodes.SymbolNode | None ) -> ExpressionBuilder: + from puya.awst_build.intrinsic_data import ( + ENUM_CLASSES, + FUNC_TO_AST_MAPPER, + NAMESPACE_CLASSES, + ) + if fullname.startswith(constants.ALGOPY_OP_PREFIX): if isinstance(node, mypy.nodes.TypeAlias): t = mypy.types.get_proper_type(node.target) if isinstance(t, mypy.types.Instance): node = t.type match node: - case mypy.nodes.TypeInfo() as type_info: - if type_info.has_base("builtins.str"): - return IntrinsicEnumClassExpressionBuilder(type_info, location=location) - return IntrinsicNamespaceClassExpressionBuilder(type_info, location=location) - case mypy.nodes.FuncDef() as func_def: - return IntrinsicFunctionExpressionBuilder(func_def, location=location) - case _: - raise InternalError(f"Unhandled algopy name: {fullname}", location) + case mypy.nodes.TypeInfo(defn=mypy.nodes.ClassDef(name=class_name)) as type_info: + if (enum_data := ENUM_CLASSES.get(class_name)) is not None: + return IntrinsicEnumClassExpressionBuilder( + enum_data, type_info, location=location + ) + elif (cls_data := NAMESPACE_CLASSES.get(class_name)) is not None: + return IntrinsicNamespaceClassExpressionBuilder( + cls_data, type_info, location=location + ) + case mypy.nodes.FuncDef(name=func_name) as func_def: + mappings = FUNC_TO_AST_MAPPER.get(func_name) + if mappings is not None: + return IntrinsicFunctionExpressionBuilder( + func_def, mappings, location=location + ) + raise InternalError(f"Unhandled algopy name: {fullname}", location) if ( fullname in (constants.CLS_LOCAL_STATE, constants.CLS_GLOBAL_STATE) and self.contract_method_info is None diff --git a/src/puya/awst_build/validation/awst_traverser.py b/src/puya/awst_build/validation/awst_traverser.py index 23284c4504..bdc432d40a 100644 --- a/src/puya/awst_build/validation/awst_traverser.py +++ b/src/puya/awst_build/validation/awst_traverser.py @@ -34,7 +34,7 @@ def visit_contract_fragment(self, statement: awst_nodes.ContractFragment) -> Non else: self.visit_app_state_definition(node) - def visit_app_state_definition(self, state_defn: awst_nodes.AppStateDefinition) -> None: + def visit_app_state_definition(self, state_defn: awst_nodes.AppStorageDefinition) -> None: pass def visit_structure_definition(self, statement: awst_nodes.StructureDefinition) -> None: diff --git a/src/puya/ir/builder/assignment.py b/src/puya/ir/builder/assignment.py index b172fd2f3e..62ad3e5eed 100644 --- a/src/puya/ir/builder/assignment.py +++ b/src/puya/ir/builder/assignment.py @@ -74,44 +74,33 @@ def handle_assignment( context, target=dst, value=src, assignment_location=assignment_location ) ] - case awst_nodes.AppStateExpression(field_name=field_name, source_location=key_loc): + case awst_nodes.AppStateExpression(key=awst_key): source = context.visitor.materialise_value_provider( value, description="new_state_value" ) if len(source) != 1: raise CodeError("Tuple state is not supported", assignment_location) - state_def = context.resolve_state(field_name, key_loc) + key_value = context.visitor.visit_and_materialise_single(awst_key) context.block_builder.add( Intrinsic( op=AVMOp.app_global_put, - args=[ - context.visitor.visit_bytes_constant(state_def.key), - source[0], - ], + args=[key_value, source[0]], source_location=assignment_location, ) ) return source - case awst_nodes.AppAccountStateExpression( - field_name=field_name, - account=account_expr, - source_location=key_loc, - ): + case awst_nodes.AppAccountStateExpression(key=awst_key, account=account_expr): source = context.visitor.materialise_value_provider( value, description="new_state_value" ) account = context.visitor.visit_and_materialise_single(account_expr) if len(source) != 1: raise CodeError("Tuple state is not supported", assignment_location) - state_def = context.resolve_state(field_name, key_loc) + key_value = context.visitor.visit_and_materialise_single(awst_key) context.block_builder.add( Intrinsic( op=AVMOp.app_local_put, - args=[ - account, - context.visitor.visit_bytes_constant(state_def.key), - source[0], - ], + args=[account, key_value, source[0]], source_location=assignment_location, ) ) diff --git a/src/puya/ir/builder/state.py b/src/puya/ir/builder/state.py index 79ff6ae6ed..cae9c6200e 100644 --- a/src/puya/ir/builder/state.py +++ b/src/puya/ir/builder/state.py @@ -1,3 +1,5 @@ +import typing + from puya.awst import nodes as awst_nodes from puya.ir import intrinsic_factory from puya.ir.avm_ops import AVMOp @@ -38,23 +40,23 @@ def visit_state_delete(context: IRFunctionBuildContext, statement: awst_nodes.St match statement.field: case awst_nodes.BoxKeyExpression(): return box.visit_box_state_delete(context, statement) + case awst_nodes.AppStateExpression(key=awst_key): + op = AVMOp.app_global_del + awst_account = None + case awst_nodes.AppAccountStateExpression(key=awst_key, account=awst_account): + op = AVMOp.app_local_del + case _: + typing.assert_never(statement.field) + + args = [] + if awst_account is not None: + account_value = context.visitor.visit_and_materialise_single(awst_account) + args.append(account_value) + key_value = context.visitor.visit_and_materialise_single(awst_key) + args.append(key_value) - subject = statement.field - state_def = context.resolve_state(subject.field_name, subject.source_location) - key = context.visitor.visit_bytes_constant(state_def.key) - args: list[Value] = [key] - if isinstance(subject, awst_nodes.AppStateExpression): - op = AVMOp.app_global_del - else: - op = AVMOp.app_local_del - account = context.visitor.visit_and_materialise_single(subject.account) - args.insert(0, account) context.block_builder.add( - Intrinsic( - op=op, - args=args, - source_location=statement.source_location, - ) + Intrinsic(op=op, args=args, source_location=statement.source_location) ) @@ -130,9 +132,8 @@ def _build_state_get_ex( expr: awst_nodes.AppAccountStateExpression | awst_nodes.AppStateExpression, source_location: SourceLocation, ) -> Intrinsic: - state_def = context.resolve_state(expr.field_name, expr.source_location) current_app_offset = UInt64Constant(value=0, source_location=expr.source_location) - key = context.visitor.visit_bytes_constant(state_def.key) + key = context.visitor.visit_and_materialise_single(expr.key) args: list[Value] = [current_app_offset, key] if isinstance(expr, awst_nodes.AppStateExpression): op = AVMOp.app_global_get_ex @@ -144,8 +145,5 @@ def _build_state_get_ex( op=op, args=args, source_location=source_location, - types=[ - wtype_to_ir_type(state_def.storage_wtype), - IRType.bool, - ], + types=[wtype_to_ir_type(expr.wtype), IRType.bool], ) diff --git a/src/puya/ir/context.py b/src/puya/ir/context.py index 54dd36300a..4d428f2706 100644 --- a/src/puya/ir/context.py +++ b/src/puya/ir/context.py @@ -107,17 +107,17 @@ def resolve_function_reference( ) return func - def resolve_state( + def resolve_state( # TODO: yeet me self, field_name: str, source_location: SourceLocation - ) -> awst_nodes.AppStateDefinition: + ) -> awst_nodes.AppStorageDefinition: node = self._resolve_contract_attribute(field_name, source_location) - if not isinstance(node, awst_nodes.AppStateDefinition): + if not isinstance(node, awst_nodes.AppStorageDefinition): raise CodeError(f"State reference {field_name} resolved to {node}", source_location) return node def _resolve_contract_attribute( self, name: str, source_location: SourceLocation - ) -> awst_nodes.ContractMethod | awst_nodes.AppStateDefinition: + ) -> awst_nodes.ContractMethod | awst_nodes.AppStorageDefinition: if self.contract is None: raise InternalError( f"Cannot resolve contract member {name} as there is no current contract", diff --git a/src/puya/ir/main.py b/src/puya/ir/main.py index 1f3f385cb6..73b207ada6 100644 --- a/src/puya/ir/main.py +++ b/src/puya/ir/main.py @@ -400,32 +400,37 @@ def fold_state_and_special_methods( if result.clear_program is None: result.clear_program = c.clear_program for state in c.app_state.values(): - if state.kind == awst_nodes.AppStateKind.app_global: - translated = ContractState( - name=state.member_name, - source_location=state.source_location, - key=state.key.value, # TODO: pass encoding? - storage_type=wtype_to_avm_type(state.storage_wtype), - description=state.description, - ) - result.global_state[translated.name] = translated - elif state.kind == awst_nodes.AppStateKind.account_local: - translated = ContractState( - name=state.member_name, - source_location=state.source_location, - key=state.key.value, # TODO: pass encoding? - storage_type=wtype_to_avm_type(state.storage_wtype), - description=state.description, - ) - result.local_state[translated.name] = translated - elif state.kind in ( - awst_nodes.AppStateKind.box, - awst_nodes.AppStateKind.box_ref, - awst_nodes.AppStateKind.box_map, - ): - pass - else: - raise InternalError(f"Unhandled state kind: {state.kind}", state.source_location) + match state.kind: + case awst_nodes.AppStorageKind.app_global: + if state.key_wtype is not None: + raise InternalError( + f"maps of {state.kind} are not supported yet", state.source_location + ) + translated = ContractState( + name=state.member_name, + source_location=state.source_location, + key=state.key.value, # TODO: pass encoding? + storage_type=wtype_to_avm_type(state.storage_wtype), + description=state.description, + ) + result.global_state[translated.name] = translated + case awst_nodes.AppStorageKind.account_local: + if state.key_wtype is not None: + raise InternalError( + f"maps of {state.kind} are not supported yet", state.source_location + ) + translated = ContractState( + name=state.member_name, + source_location=state.source_location, + key=state.key.value, # TODO: pass encoding? + storage_type=wtype_to_avm_type(state.storage_wtype), + description=state.description, + ) + result.local_state[translated.name] = translated + case awst_nodes.AppStorageKind.box: + pass # TODO: forward these on + case _: + typing.assert_never(state.kind) for cm in c.subroutines: if cm.abimethod_config: maybe_arc4_method_refs.setdefault(cm.name, (cm, cm.abimethod_config)) diff --git a/stubs/algopy-stubs/_box.pyi b/stubs/algopy-stubs/_box.pyi index 1740d5ee37..d83c772aab 100644 --- a/stubs/algopy-stubs/_box.pyi +++ b/stubs/algopy-stubs/_box.pyi @@ -1,12 +1,11 @@ import typing -from typing import Generic, TypeVar from algopy import Bytes, UInt64 -_TContent = TypeVar("_TContent") -_TKey = TypeVar("_TKey") +_TContent = typing.TypeVar("_TContent") +_TKey = typing.TypeVar("_TKey") -class Box(Generic[_TContent]): +class Box(typing.Generic[_TContent]): """ Box abstracts the reading and writing of a single value to a single box. The box size will be reconfigured dynamically to fit the size of the value being assigned to @@ -145,7 +144,7 @@ class BoxRef: Get the length of this Box. Fails if the box does not exist """ -class BoxMap(Generic[_TKey, _TContent]): +class BoxMap(typing.Generic[_TKey, _TContent]): """ BoxMap abstracts the reading and writing of a set of boxes using a common key and content type. Each composite key (prefix + key) still needs to be made available to the application via the diff --git a/test_cases/module_consts/contract.py b/test_cases/module_consts/contract.py index 85c3361f37..6763d6355f 100644 --- a/test_cases/module_consts/contract.py +++ b/test_cases/module_consts/contract.py @@ -12,10 +12,10 @@ T = True and (1 == 1) -_T = typing.TypeVar("_T") -TruthyType = bool | typing.Literal[0, 1] if typing.TYPE_CHECKING: + TruthyType = bool | typing.Literal[0, 1] + _T = typing.TypeVar("_T") def identity(x: _T) -> _T: return x diff --git a/tests/test_expected_output/arc4.test b/tests/test_expected_output/arc4.test index 728ff883cf..8d6e5728fd 100644 --- a/tests/test_expected_output/arc4.test +++ b/tests/test_expected_output/arc4.test @@ -2,8 +2,27 @@ # fmt: off # type: ignore -## case: test_emit_errors +## case: test_invalid_arc4_struct_member_type +from algopy import * + +class BadStruct(arc4.Struct): ## E: Invalid ARC4 Struct declaration, the following fields are not ARC4 encoded types: a, c + a: UInt64 + b: arc4.UInt64 + c: bool + +## case: test_invalid_arc4_struct_empty +from algopy import * + +class BadStruct2(arc4.Struct): ## E: arc4.Struct needs at least one element + pass + +## case: test_invalid_arc4_member_syntax +from algopy import * +class BadStruct3(arc4.Struct): + x: arc4.UInt64 = arc4.UInt64(1) ## E: Unsupported syntax for algopy.arc4.Struct member declaration + +## case: test_emit_errors from algopy import arc4, subroutine class Event(arc4.Struct): @@ -82,16 +101,16 @@ import typing from algopy import arc4, subroutine -A: typing.TypeAlias = arc4.UIntN[typing.Literal[72]] -B: typing.TypeAlias = arc4.BigUIntN[typing.Literal[520]] +A: typing.TypeAlias = arc4.UIntN[typing.Literal[72]] ## E: Max bit size of algopy.arc4.UIntN is 64, got 72 +B: typing.TypeAlias = arc4.BigUIntN[typing.Literal[520]] ## E: Bit size must be between 8 and 512 inclusive # TODO: add test for non-8-multiple -C: typing.TypeAlias = arc4.UFixedNxM[typing.Literal[72], typing.Literal[10]] -D: typing.TypeAlias = arc4.BigUFixedNxM[typing.Literal[520], typing.Literal[10]] +C: typing.TypeAlias = arc4.UFixedNxM[typing.Literal[72], typing.Literal[10]] ## E: Max bit size of algopy.arc4.UFixedNxM is 64, got 72 +D: typing.TypeAlias = arc4.BigUFixedNxM[typing.Literal[520], typing.Literal[10]] ## E: Bit size must be between 8 and 512 inclusive # TODO: add test for non-8-multiple -E: typing.TypeAlias = arc4.UFixedNxM[typing.Literal[64], typing.Literal[0]] -F: typing.TypeAlias = arc4.BigUFixedNxM[typing.Literal[512], typing.Literal[0]] +E: typing.TypeAlias = arc4.UFixedNxM[typing.Literal[64], typing.Literal[0]] ## E: Precision must be between 1 and 160 inclusive +F: typing.TypeAlias = arc4.BigUFixedNxM[typing.Literal[512], typing.Literal[0]] ## E: Precision must be between 1 and 160 inclusive @subroutine def testA(x: A) -> None: ## E: Max bit size of algopy.arc4.UIntN is 64, got 72 @@ -380,4 +399,4 @@ from algopy import arc4, Contract class MyContract(Contract): ## W: Class abi_decorator_not_arc4_contract.MyContract is implicitly abstract @arc4.abimethod ## E: algopy.arc4.abimethod decorator is only for subclasses of algopy.ARC4Contract def test(self) -> None: - pass \ No newline at end of file + pass diff --git a/tests/test_expected_output/expected_errors.test b/tests/test_expected_output/expected_errors.test index d0ced728c5..f03062f7cd 100644 --- a/tests/test_expected_output/expected_errors.test +++ b/tests/test_expected_output/expected_errors.test @@ -300,3 +300,18 @@ class Derived4(Base): def __init__(self) -> None: super().__init__() self.bar_p = GlobalState(Bytes(b"bbb")) # type: ignore[arg-type] ## E: some error message here about redefining proxies + + +## case: void_state +from algopy import * + +class Con(Contract): + x: None ## E: None is not supported as a value, only a return type + + def approval_program(self) -> bool: + self.x = log(b"") # type: ignore[func-returns-value] ## E: None indicates an empty return and cannot be assigned + return True + + def clear_state_program(self) -> bool: + assert self.x ## E: None does not support boolean evaluation + return True diff --git a/tests/test_expected_output/subroutine.test b/tests/test_expected_output/subroutine.test index 84060d7ea6..55bd5882a7 100644 --- a/tests/test_expected_output/subroutine.test +++ b/tests/test_expected_output/subroutine.test @@ -333,12 +333,18 @@ def test() -> None: true = False ## case: no_none_name -from algopy import subroutine +from algopy import * @subroutine def test() -> None: none = None ## E: None is not supported as a value, only a return type +@subroutine +def test2(x: UInt64) -> None: + y = test() ## E: None indicates an empty return and cannot be assigned + if x > 0: + y = x + ## case: can_reference_global_defined_after from algopy import UInt64, subroutine @@ -484,4 +490,12 @@ def no_op() -> None: @subroutine def test() -> None: if no_op(): ## E: None does not support boolean evaluation - pass \ No newline at end of file + pass + + +## case: subroutine_taking_none +from algopy import * + +@subroutine +def naughty(foo: None) -> None: ## E: void type arguments are not supported + return foo diff --git a/tests/test_pytypes.py b/tests/test_pytypes.py new file mode 100644 index 0000000000..ba91ae0b2a --- /dev/null +++ b/tests/test_pytypes.py @@ -0,0 +1,58 @@ +from collections.abc import Mapping + +import pytest +from puya.awst_build import pytypes + +from tests import VCS_ROOT + +_STUB_SUFFIX = ".pyi" + + +def stub_class_names_and_predefined_aliases() -> list[str]: + from mypy import build, find_sources, fscache, nodes + from puya.compile import get_mypy_options + + stubs_dir = (VCS_ROOT / "stubs" / "algopy-stubs").resolve() + mypy_options = get_mypy_options() + fs_cache = fscache.FileSystemCache() + mypy_build_sources = find_sources.create_source_list( + paths=[str(stubs_dir)], options=mypy_options, fscache=fs_cache + ) + build_result = build.build(sources=mypy_build_sources, options=mypy_options, fscache=fs_cache) + result = set() + + algopy_module = build_result.files["algopy"] + modules_to_visit = [algopy_module] + seen_modules = set() + while modules_to_visit: + module = modules_to_visit.pop() + if module in seen_modules: + continue + seen_modules.add(module) + for name, symbol in module.names.items(): + if name.startswith("_") or symbol.module_hidden or symbol.kind != nodes.GDEF: + continue + match symbol.node: + case nodes.MypyFile() as new_module: + modules_to_visit.append(new_module) + case nodes.TypeAlias(fullname=alias_name): + result.add(alias_name) + case nodes.TypeInfo(fullname=class_name): + result.add(class_name) + return sorted(result) + + +@pytest.fixture(scope="session") +def builtins_registry() -> Mapping[str, pytypes.PyType]: + return pytypes.builtins_registry() + + +@pytest.mark.parametrize( + "fullname", + stub_class_names_and_predefined_aliases(), + ids=str, +) +def test_stub_class_names_lookup( + builtins_registry: Mapping[str, pytypes.PyType], fullname: str +) -> None: + assert fullname in builtins_registry, f"{fullname} is missing from pytypes"