-
Notifications
You must be signed in to change notification settings - Fork 123
Asset Autoloop [1/x] loopdb: modify liquidity to use asset ids #877
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
Conversation
| // Unmarshal the params. | ||
| req := &clientrpc.LiquidityParameters{} | ||
| err = proto.Unmarshal(paramsBytes, req) | ||
| if len(params) != 1 { |
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: can move this above to the other param check.
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 think emptiness check should still come first (just as it is now).
de33223 to
5747a8e
Compare
hieblmi
left a comment
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 for the nicely sized PR, I've done a first pass.
loopdb/migrate.go
Outdated
|
|
||
| // Put the liquidity parameters in the toStore. | ||
| err = m.toStore.PutLiquidityParams(ctx, params) | ||
| err = m.toStore.PutLiquidityParams(ctx, "btc", params[0].Params) |
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: use constant defaultBtcAssetId.
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.
could this override future assedIDs other than defaultBtcAssetId?
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.
no, but this shouldn't be a problem I'd assum. New users will not run into this functions, and I'd assume most old users will have migrated already.
| INSERT INTO liquidity_params (id, params) | ||
| SELECT 1, params | ||
| FROM liquidity_params_assets_backup | ||
| WHERE asset_id = 'BTC'; |
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 this "btc"?
|
|
||
| -- Copy data from the old table to the new table | ||
| INSERT INTO new_liquidity_params (asset_id, params) | ||
| SELECT 'BTC', params FROM liquidity_params; |
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 this 'btc'?
5747a8e to
a180f2a
Compare
bhandras
left a comment
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! 💯
| // Unmarshal the params. | ||
| req := &clientrpc.LiquidityParameters{} | ||
| err = proto.Unmarshal(paramsBytes, req) | ||
| if len(params) != 1 { |
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 think emptiness check should still come first (just as it is now).
| @@ -1,5 +1,5 @@ | |||
| //go:build test_db_postgres | |||
| // +build test_db_postgres | |||
| //go:build !test_db_postgres | |||
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 think these tag guards were correct?
|
@sputn1ck, remember to re-request review from reviewers when ready |
This PR modifies how we store liquidity params by adding an asset id key