Skip to content
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

Backend DB incorrectly populating x/y IDs in "pools" table #39

Open
Eeysirhc opened this issue Apr 2, 2022 · 1 comment
Open

Backend DB incorrectly populating x/y IDs in "pools" table #39

Eeysirhc opened this issue Apr 2, 2022 · 1 comment

Comments

@Eeysirhc
Copy link

Eeysirhc commented Apr 2, 2022

Issue: the "pools" table is not correctly populating the associated x/y ID ticker values for the respective liquidity pool ID.

Each LP pair has their own ID. For example, ERG/ergopad would have its own unique value and ergopad/ERG would have something else despite the asset ticker ID being the same - they are just switched.

If we run the following for the above example....

select 
distinct p.pool_id, 
p.x_id, 
a_x.ticker as x_ticker, 
p.y_id, 
a_y.ticker as y_ticker, 
a_x.ticker || '/' || a_y.ticker as ticker
from pools p 
LEFT JOIN assets a_x ON a_x.id = p.x_id
LEFT JOIN assets a_y ON a_y.id = p.y_id

where (a_x.ticker = 'ergopad' or a_y.ticker = 'ergopad')
and (a_x.ticker = 'ERG' or a_y.ticker = 'ERG')
;

We get the following results:

Row 1

pool_id: 61a579c46d92f2718576fc9839a2a1983f172e889ec234af8504b5bbf10edd89	
x_id: 0000000000000000000000000000000000000000000000000000000000000000
x_ticker: ERG	
y_id: d71693c49a84fbbecd4908c94813b46514b18b67a99952dc1e6e4791556de413
y_ticker: ergopad
ticker: ERG/ergopad

Row 2

pool_id: d7868533f26db1b1728c1f85c2326a3c0327b57ddab14e41a2b77a5d4c20f4b2	
x_id: 0000000000000000000000000000000000000000000000000000000000000000
x_ticker: ERG
y_id: d71693c49a84fbbecd4908c94813b46514b18b67a99952dc1e6e4791556de413
y_ticker: ergopad
ticker: ERG/ergopad

Despite being different pool IDs, the x_id and y_id columns are populating the same values for both and creating an incorrect output for the final ticker column.

@Eeysirhc Eeysirhc changed the title Backend DB mislabeling x/y id and ticker values in "pools" table Backend DB incorrectly populating x/y IDs in "pools" table Apr 2, 2022
@oskin1
Copy link
Member

oskin1 commented Apr 10, 2022

ERG in native pools (pools involving ERG) is always X. Thus, it doesn't matter whether you created the pool as ERG/ergopad or ergopad/ERG in the UI.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants