-
Notifications
You must be signed in to change notification settings - Fork 501
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
services/horizon: Ingest Liquidity Pool Trades #3857
Conversation
49a4d03
to
970c2e7
Compare
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.
LGTM! When reading the code I started wondering if it's possible that the trade against LP is successful but the LP doesn't change (ex. <1 stroop trade) so the meta changes are not generated for it. If it's true then there are several places where we rely on this. It's not clear from CAP so we should check with Stellar-Core team.
services/horizon/internal/ingest/processors/trades_processor.go
Outdated
Show resolved
Hide resolved
} | ||
|
||
for _, trade := range p.trades { | ||
row := trade.row |
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.
Isn't row
a copy? So all updates below will update a copy?
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.
that's ok because in the end we are calling on batch.Add()
on row
. trade.row
is never used anywhere
services/horizon/internal/ingest/processors/trades_processor.go
Outdated
Show resolved
Hide resolved
if fee, err = p.findPoolFee(transaction, opidx, id); err != nil { | ||
return nil, err | ||
} | ||
row.LiquidityPoolFee = null.IntFrom(int64(fee)) |
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.
I can't find setting row.*LiquidityPoolID
fields. Should we do it here?
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.
@bartekn that is done in Commit()
. In this function we gather all the liqudity pool id strings. Then in commit we map the liquidity pool id strings to their int ids from the history_liquidity_pools
table. Once we have the mapping we set the row.*LiquidityPoolID
fields with the int id values
Co-authored-by: Bartek Nowotarski <[email protected]>
I asked this to the Stellar-Core team and they said:
|
Fixes #3810
This PR implements ingestion the db functionality required for ingestion. I still need to implement functions and tests to query liquidity pool trades. The remaining functionality will be implemented in #3835