-
Notifications
You must be signed in to change notification settings - Fork 5.9k
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
abi.decode to accept types as parameter and output as struct #7134
Comments
I like the general idea, but why not simply ask to decode into a struct?
|
Answering my own question: |
My use case was for creating a registry which serves as a generic factory for arbitrary contracts. I ended up moving away from the generic factory and instead resolved to adding custom factories which can have ABI decoding template in the code. The ability to decode into a struct would be great. Perhaps providing a template at runtime may be used in other use cases. |
If I understand you correctly, this is either about templates or about dynamic types. There is another issue that proposes to implement templates ( #869 ) and dynamic types is against the core design of Solidity, so I'm closing this. Please reopen if I misunderstood you. |
Abstract
With AbiEncoderV2 around the corner, it would be great to be able to pass in a template of types as a parameter to the abi.decode() function and have it output a struct with the desired shape.
Becomes
Motivation
This allows for using abi.encode and abi.decode for encoding arbitrary data without specifying hardcoded types.
Specification
unknown
Backwards Compatibility
unknown
The text was updated successfully, but these errors were encountered: