Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add missing transfers for sDAI deposits and withdraws (#327)
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. - https://etherscan.io/tx/0xdae82500c69c66db4e4a8c64e1d6a95f3cdc5cb81a5a00228ce6f247b9b8cefd - https://etherscan.io/tx/0x8dc62a04eb6b42e571c19cccf7d6503c83f8b1add671ba5b5a9c4c8404b1042a The reason is that `Withdraw` and `Deposit` events are only accompanied by _one_ transfer. But in terms buffer changes they correspond to _two_ transfers. [Tenderly](https://www.tdly.co/tx/mainnet/0xdae82500c69c66db4e4a8c64e1d6a95f3cdc5cb81a5a00228ce6f247b9b8cefd) and [eigenphi](https://eigenphi.io/mev/eigentx/0xdae82500c69c66db4e4a8c64e1d6a95f3cdc5cb81a5a00228ce6f247b9b8cefd) get this wrong as well in their asset change calculations. To see what happens to buffers one can use [phalcon](https://explorer.phalcon.xyz/tx/eth/0xdae82500c69c66db4e4a8c64e1d6a95f3cdc5cb81a5a00228ce6f247b9b8cefd) or look at state changes. With the proposed change, additional transfers are created by looking at event logs of the SavingsDAI contract. - One AMM_IN transfer is created for each `Withdraw` event. - One AMM_OUT transfer is created for each `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.
- Loading branch information