This repository has been archived by the owner on Oct 19, 2024. It is now read-only.
feat(abigen): include ethevent proc macro in abigen code gen workflow #232
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This integrates the
EthEvent
trait in theabigen
code generation process.Motivation
The
EthEvent
makes the output of theabigen
macro more consistent for events, and allows for generating further helper methods, as mentioned in #228.Solution
Instead of generating the methods
name
,signature
andabi_signature
for each event provided in the ABI, theEthEvent
trait is simply implemented via a#[derive(EthEvent)]
during theabigen
workflow. In addition all structs that are declared in the human readable abi are generated aswell. If a solidity event contains variables with solidity structs as tyoe , the generated rust struct variables have the corresponding rust. This has currently a limitation where the build fails if a solidity event has an array of a struct as input, however gakonst/ethabi#1 should remove this limitation.Open Discussion
Filter
name suffix, I think this is not necessary and could be removed.EthEvent
methods as before, an import of theEthEvent
is required, right now the generated contract module does notpub EthEvent
, which would be breaking as well as the minor change from&'static str
toCow<'static, str>
inEthEvent::name
andEthEvent::abi_signature
, I'd think that is negligible.