[ISSUE-121] docs: research gas and cost efficiency for event emission #146
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.
docs: research gas and cost efficiency for event emission
closes #121
How I calculated the gas usage?
Prepare a spreadsheet with the gas usage based on the current and proposed events emitted and set for a comparison.
Estimate the gas when calling createSwap and record their gas usage.
Take measures of the gas usage.
Add the allowed field in the events. Take Measure.
Add the bidding and asking field in the events. Take Measure.
Add the price of ETH at $2.200 and calculate the gas cost in dollars.
Conclusion
After the study about gas usage in the swaplace, I came to the conclusion that we can add the "allowed" field in the "SwapCreated" event, but if we add the "biding" and "asking" fields, we will increase a lot the gas usage in the emit of events, so I this PR I added the "allowed" field in the swap created event and refactored all events to use assembly to reduce the gas usage.
And about the "biding" and "asking" fields, I think that is have a lot of gas usage and I'm studying about how we can emit the event with assembly there paramters, I tried but I couldn't, I'm trying yet :)
If possible, I need your review about this PR :), I'm ready to fix/improve something and work togheter!!!