|
|
@ -20,7 +20,7 @@ def generate_interface( |
|
|
|
skip_events: bool = False, |
|
|
|
skip_events: bool = False, |
|
|
|
skip_errors: bool = False, |
|
|
|
skip_errors: bool = False, |
|
|
|
skip_enums: bool = False, |
|
|
|
skip_enums: bool = False, |
|
|
|
skip_structs: bool = False |
|
|
|
skip_structs: bool = False, |
|
|
|
) -> str: |
|
|
|
) -> str: |
|
|
|
""" |
|
|
|
""" |
|
|
|
Generates code for a Solidity interface to the contract. |
|
|
|
Generates code for a Solidity interface to the contract. |
|
|
@ -116,6 +116,7 @@ def generate_interface_function_signature( |
|
|
|
returns = [ |
|
|
|
returns = [ |
|
|
|
convert_type_for_solidity_signature_to_string(ret.type).replace("(", "").replace(")", "") |
|
|
|
convert_type_for_solidity_signature_to_string(ret.type).replace("(", "").replace(")", "") |
|
|
|
if unroll_structs |
|
|
|
if unroll_structs |
|
|
|
|
|
|
|
or (isinstance(ret.type, ArrayType) and isinstance(ret.type.type, UserDefinedType)) |
|
|
|
else f"{str(ret.type.type)} memory" |
|
|
|
else f"{str(ret.type.type)} memory" |
|
|
|
if isinstance(ret.type, UserDefinedType) and isinstance(ret.type.type, (Structure, Enum)) |
|
|
|
if isinstance(ret.type, UserDefinedType) and isinstance(ret.type.type, (Structure, Enum)) |
|
|
|
else "address" |
|
|
|
else "address" |
|
|
@ -126,6 +127,7 @@ def generate_interface_function_signature( |
|
|
|
parameters = [ |
|
|
|
parameters = [ |
|
|
|
convert_type_for_solidity_signature_to_string(param.type).replace("(", "").replace(")", "") |
|
|
|
convert_type_for_solidity_signature_to_string(param.type).replace("(", "").replace(")", "") |
|
|
|
if unroll_structs |
|
|
|
if unroll_structs |
|
|
|
|
|
|
|
or (isinstance(param.type, ArrayType) and isinstance(param.type.type, UserDefinedType)) |
|
|
|
else f"{str(param.type.type)} memory" |
|
|
|
else f"{str(param.type.type)} memory" |
|
|
|
if isinstance(param.type, UserDefinedType) |
|
|
|
if isinstance(param.type, UserDefinedType) |
|
|
|
and isinstance(param.type.type, (Structure, Enum)) |
|
|
|
and isinstance(param.type.type, (Structure, Enum)) |
|
|
|