-
Notifications
You must be signed in to change notification settings - Fork 5
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
Add missing transfers for sDAI deposits and withdraws #327
Conversation
looks at event logs of the savings dai contract and adds a - AMM_IN transfers for Withdraw events - AMM_OUT transfers for Deposit events
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.
Nice job here!
I fixed some typos and added the pull request number. For completeness, here is a forked query on dune for the two affected auctions:
If this PR is merged, I will update
|
Looks good! Doing some sanity checks with settlements with sDAI for which we didn't have any accounting issues, and if things look good, will approve |
Here is an example where we seem to have a problem. |
Good catch. The problem was that the tranfer ledger should only contain transfers to and from the settlement contract. Thus it also only should add additional transfers for sDAI if the settlement contract is doing the trading. I added a check in the query. |
All tests that I ran checked out, and the code makes sense, so I am approving! |
Conversions DAI<>sDAI are not correctly accounted for in the current slippage query. This has led to two settlements with computes slippage even though the slippage was actually small.
The reason is that
Withdraw
andDeposit
events are only accompanied by one transfer. But in terms buffer changes they correspond to two transfers.Tenderly and eigenphi get this wrong as well in their asset change calculations. To see what happens to buffers one can use phalcon or look at state changes.
With the proposed change, additional transfers are created by looking at event logs of the SavingsDAI contract.
Withdraw
event.Deposit
event.This is not a general solution and only works for sDAI. Since we want to support that token now, I added this fix to the query.
Long term it would be nice to have a more general solution.