|
|
@ -1,7 +1,6 @@ |
|
|
|
# Functions for generating Solidity code |
|
|
|
# Functions for generating Solidity code |
|
|
|
from typing import TYPE_CHECKING, Optional |
|
|
|
from typing import TYPE_CHECKING, Optional |
|
|
|
|
|
|
|
|
|
|
|
from slither.core.solidity_types.user_defined_type import UserDefinedType |
|
|
|
|
|
|
|
from slither.utils.type import convert_type_for_solidity_signature_to_string |
|
|
|
from slither.utils.type import convert_type_for_solidity_signature_to_string |
|
|
|
|
|
|
|
|
|
|
|
if TYPE_CHECKING: |
|
|
|
if TYPE_CHECKING: |
|
|
@ -23,8 +22,12 @@ def generate_interface(contract: "Contract") -> str: |
|
|
|
name, args = event.signature |
|
|
|
name, args = event.signature |
|
|
|
interface += f" event {name}({', '.join(args)});\n" |
|
|
|
interface += f" event {name}({', '.join(args)});\n" |
|
|
|
for error in contract.custom_errors: |
|
|
|
for error in contract.custom_errors: |
|
|
|
args = [convert_type_for_solidity_signature_to_string(arg.type).replace("(", "").replace(")", "") |
|
|
|
args = [ |
|
|
|
for arg in error.parameters] |
|
|
|
convert_type_for_solidity_signature_to_string(arg.type) |
|
|
|
|
|
|
|
.replace("(", "") |
|
|
|
|
|
|
|
.replace(")", "") |
|
|
|
|
|
|
|
for arg in error.parameters |
|
|
|
|
|
|
|
] |
|
|
|
interface += f" error {error.name}({', '.join(args)});\n" |
|
|
|
interface += f" error {error.name}({', '.join(args)});\n" |
|
|
|
for enum in contract.enums: |
|
|
|
for enum in contract.enums: |
|
|
|
interface += f" enum {enum.name} {{ {', '.join(enum.values)} }}\n" |
|
|
|
interface += f" enum {enum.name} {{ {', '.join(enum.values)} }}\n" |
|
|
|