-
Notifications
You must be signed in to change notification settings - Fork 91
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
Bugfix/fix collateral twap #844
Bugfix/fix collateral twap #844
Conversation
This pull request is still a draft I will notify when it is ready for the review. |
I am finally back to this issue, in the background I spent quite some time on reading related articles and Frax sources and their concept of twap from either an Oracle or double oracles (https://github.com/FraxFinance/frax-oracles/tree/master/src). |
it's what a good programmer does |
Thank you, it takes me longer than expected but moving forward. |
To be used by LibUbiquityPool to fetch collateral token prices
Still in progress but I will speed up now. |
The oracle and price updates implemented in LibUbiquityPool.
Note to myself: need to resolve conflicts after last merge. |
# Comment event received without a recognized user command. |
Hi @rndquu I added a new twap test skeleton today, and got interrupted in trying to solve the broken Yarn Audit check. It seems that this is broken due to yarnpkg/berry#4117 and more specifically yarnpkg/berry#4117 (comment) . After I upgraded locally to yarn 4,
I guess we'll need to open a separate issue for that. In the meantime let's continue to solve this issue first. |
@gitcoindev hey
Ok, thank you I will fix the TWAP and the |
@rndquu thank you! Indeed, let me tackle unresolved bot tasks today and move them out of my plate. |
We're planning to use the So the question is should we get the |
Curve metapool seems to make the most sense to me. Can also consider uniswap. Possibly average both |
While working on this issue I did some research and read multiple articles. This one has a good recipe of the algorithm which is relevant for us: https://news.curve.fi/chainlink-oracles-and-curve-pools/ About LUSD itself I will also paste a few interesting links I read on their blog a few days ago: https://www.liquity.org/blog/price-oracles-in-liquity https://www.liquity.org/blog/the-oracle-conundrum The Oracle conundrum is a good article on price oracles in general, btw. I had to check myself what conundrum is -) The defillama link below provides overall allocation of LUSD across different chains: |
@rndquu are you sure? i'm seeing a deployed chainlink LUSD/USD oracle, check the tag name https://etherscan.io/address/0x3D7aE7E594f2f2091Ad8798313450130d0Aba3a0 |
Hmm, I can't find this price feed at https://data.chain.link/ |
I couldn't either, probably a bug on their front end, check the search, https://github.com/search?q=0x3D7aE7E594f2f2091Ad8798313450130d0Aba3a0&type=code this one is used by some different protocols |
Yeah, I see that's a live |
it's a clear front end bug on their end and it doesnt make sense to be on rollups only, it's first mainnet then others |
refactor: refactor UbiquityPool
I missed it but this issue was solved when we were refactoring the Ubiquity pool contract. Anyway the current PR adds oracle (via chainlink) support for collateral token pricing which is the feature we'd earlier decided to implement. Simply put the oracles in the whole protocol work this way:
I'll update the deployment scripts (to deploy TWAP and set chainlink price feed) in another PR. @gitcoindev @molecula451 Pls review. P.S. Diamond storage CI run is failing but this is expected and ok since the contracts are not deployed yet. Update: @molecula451 just found out (thank you a lot) that aave uses https://etherscan.io/address/0x3D7aE7E594f2f2091Ad8798313450130d0Aba3a0 in their LUSD oracle contract so https://etherscan.io/address/0x3D7aE7E594f2f2091Ad8798313450130d0Aba3a0 seems to be legit. |
Thank you a lot @rndquu for the summary. I am going through your changes now, should finish the review in the next 30-60 minutes. |
@rndquu I also was struggling to find it but confirmed it in the official Liquity / LUSD documentation: see https://docs.liquity.org/documentation/resources , on the page find 0x3D7aE7E594f2f2091Ad8798313450130d0Aba3a0 therefore, for me also legit. Funnily enough, they made a typo on the website and instead of |
Cool, thank you, @molecula451 also found that aave uses https://etherscan.io/address/0x3D7aE7E594f2f2091Ad8798313450130d0Aba3a0 in their |
I have reviewed the latest changes from @rndquu , lgtm! I leave the final review to @molecula451 |
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 implementation looks good and the revamped tests are much better now, once again everyone good work here
Resolves #830