-
-
Notifications
You must be signed in to change notification settings - Fork 799
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
cannot import structs #2670
Comments
@mhorsley30896 struct definitions aren't exported from interface definitions. right now the thing to do is redefine import interfaces.MyInterface as MC
# ...
struct A_Struct:
a: uint256
b: uint256
# ...
my_contract: MC I'm leaving this issue open though so we can track a discussion about changing the semantics here. |
@charles-cooper you also have to define |
yep you need to define in both places -- and I agree about the overkill part |
A side note: ABI encoding defines structs as tuples of their members (although there is some undefined behavior with tight packing), so one way to handle this might to implicitly convert structs to and from tuples, so that the interfaces matched up |
meeting notes: we should allow this, |
+1 for ability to import structs -- would be very helpful! |
implemented in #3663 |
Suppose I have a simple contract that records a user input in a struct.
Now if I export the interface for this contract such that another contract can use it
If I save this output into an interface file called
MyInterface.vy
and then write a second contractThen when I try and compile this I get an error
This error can be removed if I delete
A_Struct
as the return type forstruct_map
inMyInterface.vy
. Is this expected behaviour or am I misunderstanding something around structs and interfaces?The text was updated successfully, but these errors were encountered: