-
Notifications
You must be signed in to change notification settings - Fork 106
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
Feat: Add swapMetadata to TickUpdates #NTRN-440 #808
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// LimitOrder TickUpdate has correct SwapMetadatrra | |
// LimitOrder TickUpdate has correct SwapMetadata |
Mistype 😅, is also on other added comment
lpSwapIn, _ := lpTickUpdate.GetAttribute(types.AttributeSwapAmountIn) | ||
lpSwapOut, _ := lpTickUpdate.GetAttribute(types.AttributeSwapAmountOut) | ||
s.Equal("9000000", lpSwapIn.Value) | ||
s.Equal("8999100", lpSwapOut.Value) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe add a negative test, that the regular deposits does not include any swap attributes
Add SwapAmountIn and SwapAmountOut attributes to tick updates for easier indexing of swap events.