Closed doliG closed 1 year ago
@brozorec can you guide me through what's needed on the slippage? Idea is to calculate the price impact percentage.
@ferostar
Figma screens show Price Impact on Collateral and Price Impact on Borrow. When should we show each?
When we bridge the collateral, there could be some slippage on the collateral: bridge WETH (chain A, incurs slippage) > deposit WETH (chain B) -> borrow USDC (chain B)
When we bridge the borrowed assets, there could be some slippage on it: deposit WETH (chain A) -> borrow USDC (chain A) -> bridge USDC (chain B, incurs slippage)
You can find more info on why this happens here: https://github.com/Fujicracy/fuji-v2/issues/242
The SDK returns the slippage in USD, do I have a way to convert the token amount to USD? I don't think I saw anything to be able to do that
When we call sdk.previews.depositAndBorrow
for each available vault, we receive the array of steps
. In each "step", there's a field amount
. The SDK computes the amount for that step.
For example, I have here "bridge -> deposit -> borrow":
We can see that the bridged amount "0x1ff973cafa8000" (0.009 WETH) differs from the deposited amount "0x1ffef4a5f339c6" (0.00900605 WETH). The user in that case actually will receive more than what he deposited, this is what we call a positive slippage. Usually, it's the other way around lol. So the price impact is calculated based on those numbers and it's ~6 basis points (+0.06%). That's actually the value of estimateSlippage
field.
Also... the modal has a "Best route" title. I don't see it. Should we keep it / change it / remove it?
If I understand correctly @brozorec this slippage is based on Connext's fees. So we should only show it if there's a bridge operation and it will be on the collateral or on the borrow, as Figma shows, depending on when the bridging occurs, before or after depositing. Correct?
If I understand correctly @brozorec this slippage is based on Connext's fees. So we should only show it if there's a bridge operation and it will be on the collateral or on the borrow, as Figma shows, depending on when the bridging occurs, before or after depositing. Correct?
Yep, that's correct :+1: Slippage occurs only when there's some bridging involved.
Also... the modal has a "Best route" title. I don't see it. Should we keep it / change it / remove it?
What about "Available routes"?
done with #286
Context
After integration of the route modal (in #63), we want to make it work.
Designs >
Todo
Explanations
The routing modal is another visual way of selecting a vault. Selecting a vault is already implemented in
Overview > VaultsMenu
so you can check here the logic.Related