Feat: Add swapMetadata to TickUpdates #NTRN-440#808
Merged
pr0n00gler merged 4 commits intomainfrom Feb 25, 2025
Merged
Conversation
Contributor
Author
dib542
previously approved these changes
Jan 24, 2025
Contributor
dib542
left a comment
There was a problem hiding this comment.
This looks good 👍
This is all we need to enable very easy analysis and indexing of
- pair price
- swap volume
- LP fees
for timeseries or latest value / 24hr aggregation values.
Note: I previously thought a AmountIn/AmountOut or DepositIn/DepositOut like attribute would also be needed, but such an attribute would only be helpful to compute change in Dex liqudity volume easily, the aggregate of which can be fairly easily calculated (TVL diff over time) and the specific price changes of liquidity over time is not of current interest (and can also still be derived from current data).
|
|
||
| tickUpdates := s.GetAllMatchingEvents(types.TickUpdateEventKey) | ||
|
|
||
| // LimitOrder TickUpdate has correct SwapMetadatrra |
Contributor
There was a problem hiding this comment.
Suggested change
| // LimitOrder TickUpdate has correct SwapMetadatrra | |
| // LimitOrder TickUpdate has correct SwapMetadata |
Mistype 😅, is also on other added comment
| lpSwapOut, _ := lpTickUpdate.GetAttribute(types.AttributeSwapAmountOut) | ||
| s.Equal("9000000", lpSwapIn.Value) | ||
| s.Equal("8999100", lpSwapOut.Value) | ||
| } |
Contributor
There was a problem hiding this comment.
Maybe add a negative test, that the regular deposits does not include any swap attributes
dib542
approved these changes
Jan 28, 2025
pr0n00gler
approved these changes
Feb 25, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Add SwapAmountIn and SwapAmountOut attributes to tick updates for easier indexing of swap events.