Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Add function to get amount of asset locked per tick in pool#283

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Open
TheBlueMastiff wants to merge4 commits intouniswap-python:master
base:master
Choose a base branch
Loading
fromTheBlueMastiff:asset_locked_per_tick

Conversation

TheBlueMastiff
Copy link

@TheBlueMastiffTheBlueMastiff commentedOct 11, 2022
edited
Loading

This function is more or less the same as theget_tvl_in_pool() function but slightly modified to return the amount of each asset locked in a pool per tick.

I created a test to ensure that the amounts returned sum to the same result asget_tvl_in_pool(). I'm having trouble running the tests locally, so I thought I'd open a PR so the tests could run on Github.

@ErikBjare
Copy link
Member

Wow, well done!

I've allowed the test to run now. If you want to run them yourself without having to wait for me to approve the run, you can push to the master branch of your own fork, which should trigger a run (althought might be missing credentials).

@codecov
Copy link

codecovbot commentedOct 12, 2022
edited
Loading

Codecov Report

Base:84.17% // Head:57.67% // Decreases project coverage by-26.50%⚠️

Coverage data is based on head(acfa607) compared to base(dc053cd).
Patch coverage: 2.38% of modified lines in pull request are covered.

❗ Current headacfa607 differs from pull request most recent head4a4cf25. Consider uploading reports for the commit4a4cf25 to get more accurate results

Additional details and impacted files
@@             Coverage Diff             @@##           master     #283       +/-   ##===========================================- Coverage   84.17%   57.67%   -26.51%===========================================  Files          10       10                 Lines        1030     1082       +52     ===========================================- Hits          867      624      -243- Misses        163      458      +295
Impacted FilesCoverage Δ
uniswap/constants.py100.00% <ø> (ø)
uniswap/uniswap.py50.58% <2.38%> (-31.88%)⬇️
uniswap/util.py64.86% <0.00%> (-22.10%)⬇️

Help us with your feedback. Take ten seconds to tell ushow you rate us. Have a feature suggestion?Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment?Let us know in this issue.

@ErikBjare
Copy link
Member

Looks like we have a failure:

/home/runner/work/uniswap-python/uniswap-python/tests/test_uniswap.py:385: TypeError: 'function' object is not subscriptable

Was also picked up by the typechecking:

poetry run mypy --prettyuniswap/uniswap.py:1454: error: Need type annotation for"liquidity_per_tick_dict"            liquidity_per_tick_dict = {                                      ^tests/test_uniswap.py:385: error: Value of type "Callable[[Uniswap], Any]" isnot indexable            pool = client.get_pool_instance(tokens[token0], tokens[token1]...                                            ^Found 2 errors in 2 files (checked 12 source files)make: *** [Makefile:7: typecheck] Error 1

@KeremP
Copy link
Contributor

@IanMichaelHarper looks like the error is here:

@pytest.mark.parametrize("token0, token1", [("DAI","USDC")])deftest_asset_locked_per_tick_sums_to_tvl(self,client:Uniswap,token0,token1):          .....

whereas in order to use thetokens dict that is scoped with the pytest decorators you must pass it in as input:

@pytest.mark.parametrize("token0, token1", [("DAI","USDC")])deftest_asset_locked_per_tick_sums_to_tvl(self,client:Uniswap,tokens,token0,token1):          .....

@TheBlueMastiff
Copy link
Author

Whoops. Sorry about that. Updated now.

@TheBlueMastiff
Copy link
Author

this is how I had the test passing originally for what I was working on, where approximately correct was fine. Finding the discrepancy for exact values requires more digging and debugging.

@KeremP
Copy link
Contributor

I think approximately correct is fine for now, working with the tickbitmap, etc. can get a little complex.

Apparently the subgraph bug has been fixed somewhat recently:
Uniswap/v3-subgraph#74 (comment)

I'll definitely take a look this weekend and see if there are any improvements to glean and update the tvl in pool code respectively.

Good work though! 👍

TheBlueMastiff reacted with thumbs up emoji

@shakibaei65

This comment has been minimized.

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers
No reviews
Assignees
No one assigned
Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

4 participants
@TheBlueMastiff@ErikBjare@KeremP@shakibaei65

[8]ページ先頭

©2009-2025 Movatter.jp