Skip to content
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

feature: Solidity struct type support in sol_interface! macro #74

Open
akirillo opened this issue Oct 7, 2023 · 0 comments · Fixed by #139
Open

feature: Solidity struct type support in sol_interface! macro #74

akirillo opened this issue Oct 7, 2023 · 0 comments · Fixed by #139

Comments

@akirillo
Copy link

akirillo commented Oct 7, 2023

Hi there,
I'm trying to define an interface using the sol_interface! macro, in which a function returns a custom type (struct).
Ideally, I would like to be able to use the sol! macro from alloy-sol-types to define my struct.
When I try this, for example:

use stylus_sdk::prelude::*;
use alloy_sol_types::sol;

sol! {
  struct MyStruct {
    uint256 myNum;
  }
}

sol_interface! {
  interface IMyInterface {
    function doThing() returns (MyStruct);
  }
}

I get the error:

proc macro panicked
message: not yet implemented: Solidity type SolChallenges is not yet implemented in sol_interface!

I dug around in the code a bit, and it seems that sol_interface! can't interpret any struct types.

The ability to do so (particularly in tandem with the sol! macro) would be amazing, as currently, I believe my only option is to return a tuple type and manually deserialize it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant