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

[WEB-1247-199] Refactor price magic and set TVL of ib to 0 after 2022-01-22 #199

Merged
merged 22 commits into from
Jan 27, 2022

Conversation

mariuspod
Copy link
Contributor

@mariuspod mariuspod commented Jan 24, 2022

Compared TVLs for ETH and FTM at e1c2867, they matched exactly to the numbers before the refactoring at a specific block:

FTM:
INFO yearn.yearn:98 exported block=28902947 tvl=1293641401 took=2.437s

ETH:
INFO yearn.yearn:98 exported block=14067796 tvl=4527109756 took=21.640s

With the ironbank tvl change 7c4a75b this might be harder to verify, I can also move the ib fix into a separate PR if that's preferred.

@yearn-linear-gh-sync yearn-linear-gh-sync bot changed the title Refactor price magic and set TVL of ib to 0 after 2022-01-22 [WEB-1247-199] Refactor price magic and set TVL of ib to 0 after 2022-01-22 Jan 24, 2022
@linear
Copy link

linear bot commented Jan 24, 2022

WEB-1247 [WEB-1247-199] Refactor price magic and set TVL of ib to 0 after 2022-01-22

Compared TVLs for ETH and FTM at e1c2867, they matched exactly to the numbers before the refactoring at a specific block:

FTM:
INFO yearn.yearn:98 exported block=28902947 tvl=1293641401 took=2.437s

ETH:
INFO yearn.yearn:98 exported block=14067796 tvl=4527109756 took=21.640s

With the ironbank tvl change 7c4a75b this might be harder to verify, I can also move the ib fix into a separate PR if that's preferred.

@mariuspod mariuspod linked an issue Jan 24, 2022 that may be closed by this pull request
@mariuspod mariuspod requested a review from banteg January 24, 2022 13:37
yearn/ironbank.py Outdated Show resolved Hide resolved
yearn/ironbank.py Outdated Show resolved Hide resolved
if block_ts > snapshot_ts:
tvl = 0
else:
tvl = (res["getCash"] + res["totalBorrows"] - res["totalReserves"]) * price
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

need to clarify the formula, see #201

yearn/prices/band.py Show resolved Hide resolved
yearn/prices/chainlink.py Outdated Show resolved Hide resolved
yearn/prices/magic.py Outdated Show resolved Hide resolved
yearn/prices/magic.py Show resolved Hide resolved
yearn/prices/magic.py Outdated Show resolved Hide resolved
synthetix,
band,
uniswap_v2,
uniswap_v3,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe it's time we switch to trying uni v3 before v2? need to check it doesn't break historical exporter.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

didn't check that one yet

yearn/prices/magic.py Outdated Show resolved Hide resolved
yearn/prices/magic.py Outdated Show resolved Hide resolved
@banteg banteg self-requested a review January 26, 2022 09:03
@mariuspod mariuspod force-pushed the feat/price_magic_ib_tvl branch from 914a627 to 092ce07 Compare January 26, 2022 10:29
mariuspod and others added 3 commits January 26, 2022 11:42
* fix: ironbank dash

* fix: overview dash

* update overview changes

* update TVL in Yearn Ecosystem dash

* update vault overview dash

* run prettier
@banteg banteg merged commit d1aaa9e into master Jan 27, 2022
mariuspod added a commit to BobTheBuidler/yearn-exporter that referenced this pull request Jan 27, 2022
…-01-22 (yearn#199)

* fix: added ust stablecoin.

* feat: refactor multiple chain-based #get_price methods into a single one.

* feat: set ironbank tvl to 0 after 2022-01-22T00:00:00Z because they launched as a separate product.

* fix: define a constant for the ironbank snapshot block per network and use that for comparing with the current block.

* fix: allow to override the default behaviour where the ib TVL is excluded after the snapshot block.

* fix: remove __repr__ method.

* fix: remove chain.id check.

* fix: make token unwrapping chain-aware.

* feat: refactor balance as a class. Move memory-cached code into a pure function so it can be cached.

* feat: refactor pool-like markets and add #is_in_pool and #get_pool_price for them

* fix: make the usage of the constant more explicit.

* fix: remove special handling here to not obscure any underlying problems.

* fix: order for if-check

* fix: change market order.

* fix: create two metrics to track ib tvl before and after the snapshot.

* fix: revert changes and make querying of uniswap_v2, balancer and yearn-lens more explicit again.

* fix: oracles could be empty for the given network.

* feat: remove ib tvl from the total sums if the conditions are met.

* fix: constant import

* fix: remove unused __repr__ methods.

* fix: resolve circular import for balancer.

* Update dashboards (yearn#209)

* fix: ironbank dash

* fix: overview dash

* update overview changes

* update TVL in Yearn Ecosystem dash

* update vault overview dash

* run prettier

Co-authored-by: Dark Ghosty <[email protected]>
@BobTheBuidler BobTheBuidler deleted the feat/price_magic_ib_tvl branch February 1, 2022 01:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[WEB-1239-198] exclude ironbank tvl after ib token launch
3 participants