-
Notifications
You must be signed in to change notification settings - Fork 504
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
horizon: Ingest Liquidity Pool Ledger Entries #3815
Conversation
services/horizon/internal/db2/schema/migrations/49_liquidity_pools.sql
Outdated
Show resolved
Hide resolved
services/horizon/internal/db2/schema/migrations/49_liquidity_pools.sql
Outdated
Show resolved
Hide resolved
@@ -0,0 +1,31 @@ | |||
-- +migrate Up | |||
|
|||
CREATE TABLE liquidity_pools ( |
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.
@sydneynotthecity just wanted to let you know about the new tables we're going to add in horizon to support CAP-38. Not all the schema changes will be included in this PR because we've broken down the tasks over a bunch of issues:
https://github.com/stellar/go/issues?q=is%3Aissue+is%3Aopen+label%3Aamm
I will make sure to tag you in each PR which introduces a schema change so you can be up to date
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.
thanks, @tamirms! appreciate the heads up and will review each one. Will these changes be a part of the Nov release?
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.
The schema has been updated to use a single table (and store the reserves in a json blob
just like we do for the claimants in the claimable_balances table)
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.
Will these changes be a part of the Nov release?
yeah, I think November is when the protocol is scheduled to be upgraded. At that point liquidity pools will be enabled in pubnet. But, we aim to finish horizon support for liquidity pools by the end of August so we can have sufficient time to test the functionality ahead of the protocol launch.
b6ce2c2
to
1427766
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! Had one nit and a couple questions for my own understanding. Will create the subsequent issues in stellar-etl
to account for liquidity pools.
case db2.OrderAscending: | ||
if r != nil { | ||
sql = sql. | ||
Where(sq.Expr("lp.id > ?", r)) |
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.
❓ Is this a way to limit the amount of results returned? Or is the where clause used as a way to paginate the query?
@@ -0,0 +1,31 @@ | |||
-- +migrate Up | |||
|
|||
CREATE TABLE liquidity_pools ( |
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.
thanks, @tamirms! appreciate the heads up and will review each one. Will these changes be a part of the Nov release?
services/horizon/internal/db2/schema/migrations/49_liquidity_pools.sql
Outdated
Show resolved
Hide resolved
3ed0cfb
to
aa00199
Compare
4acad65
to
5526fa6
Compare
5526fa6
to
2752759
Compare
@tamirms this is ready for review. Tests are failing at:
There seems to be a clash in the use of |
cdf9026
to
e5e7a10
Compare
6c6c2b8
to
32aadda
Compare
32aadda
to
2d00973
Compare
services/horizon/internal/ingest/processors/liquidity_pools_processor_test.go
Outdated
Show resolved
Hide resolved
@tamirms PTAL |
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.
looks great!
|
||
// GetLiquidityPoolsByID finds all liquidity pools by PoolId | ||
func (q *Q) GetLiquidityPoolsByID(ctx context.Context, poolIDs []string) ([]LiquidityPool, error) { | ||
var cBalances []LiquidityPool |
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.
cBalances
-> liquidityPools
.
return lp, err | ||
} | ||
|
||
// GetLiquidityPools finds all liquidity pools where accountID is one of the claimants |
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.
Comment needs updating.
if err != nil { | ||
return errors.Wrap(err, "Error creating ledger key") | ||
} | ||
rowsAffected, err = p.qLiquidityPools.RemoveLiquidityPool(ctx, hex.EncodeToString(lPool.LiquidityPoolId[:])) |
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.
Nit: We added PoolIDToString
in https://github.com/stellar/go/pull/3826/files#diff-aaf89e53adf03495063ecc74f1e3725e7f299fa8b5679f6592174ae6d12fa2c3R138.
Fixes #3805