You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Right now, only exactIn swaps are supported, are there case where we want/need an exact out swap?
@alpinechicken can you think about this? @KMKoushik , for the front end is there one that would be better or worse?
An example of this would be:
Someone has an LP with 50 oSQTH and 50 ETH in it. The current price of oSQTH/ETH is 1:1.
One example is they want to rebalance to a new LP that has 75 oSQTH, with new ranges, and need to sell some ETH to do this. The front end has to figure out how much ETH the user can take from the existing LP and any additional ETH needed to get these extra 25 oSQTHs. For this, it seems easiest to do an exactOut swap where 25 OSQTH is the amount out and the amountIn is returned from the quoter.
If the user instead wants to reduce their oSQTH side of the LP to only have 25 oSQTH, it might be easiest/best to do an exactIn swap, where the exactIn amount is 25, and the ETH proceeds can be queried from the quoter.
It's likely possible for the front end to do both of these using only exactIn or exactOut swaps, but is it easier/better to do with both or does that add too much complexity?
@alexisgauba@zkoticha@KMKoushik this also ties in with the front end user experience. My thinking is that when a user specifies a new amount that is greater than the current asset balance for one of the LP assets the front end will look to do an exactOut swap and solve for the other asset in the LP (figure out how much it needs based on the ranges and the other asset). When a user specifies a new amount that is less than the current asset balance for one of the LP assets the f/e will look to do an exactIn swap and solve for the other asset in the LP (figure out how much it needs based on the ranges and the other asset).
The text was updated successfully, but these errors were encountered:
Possible to get approximately right with exactIn or exactOut using uniswap quoter contract, but def better with both exactIn and exactOut.
I still have to deal with some uncertainty either way. In your first example I choose 75 oSQTH and a range for the LP. I won't know exactly how much eth until I know the price tick. That's of the same kind of order of uncertainty as exactIn vs exactOut, though less uncertainty is better!
From a UI perspective:
choose: a new range for the LP and amount of one side
get: an approximation for the other side and the eth cost of the change
E.g.
I have a 0.25 -> 0.35 range with 50 oSQTH and 50 ETH
I want to go to a 0.3 -> 0.4 range with 75 oSQTH -> Fe tells me approx how much eth I'll get in the LP. Contract liquidates LP, exactOuts for 25, and uses vault eth and proceeds for the rest.
Right now, only exactIn swaps are supported, are there case where we want/need an exact out swap?
@alpinechicken can you think about this?
@KMKoushik , for the front end is there one that would be better or worse?
An example of this would be:
Someone has an LP with 50 oSQTH and 50 ETH in it. The current price of oSQTH/ETH is 1:1.
One example is they want to rebalance to a new LP that has 75 oSQTH, with new ranges, and need to sell some ETH to do this. The front end has to figure out how much ETH the user can take from the existing LP and any additional ETH needed to get these extra 25 oSQTHs. For this, it seems easiest to do an exactOut swap where 25 OSQTH is the amount out and the amountIn is returned from the quoter.
If the user instead wants to reduce their oSQTH side of the LP to only have 25 oSQTH, it might be easiest/best to do an exactIn swap, where the exactIn amount is 25, and the ETH proceeds can be queried from the quoter.
It's likely possible for the front end to do both of these using only exactIn or exactOut swaps, but is it easier/better to do with both or does that add too much complexity?
@alexisgauba @zkoticha @KMKoushik this also ties in with the front end user experience. My thinking is that when a user specifies a new amount that is greater than the current asset balance for one of the LP assets the front end will look to do an exactOut swap and solve for the other asset in the LP (figure out how much it needs based on the ranges and the other asset). When a user specifies a new amount that is less than the current asset balance for one of the LP assets the f/e will look to do an exactIn swap and solve for the other asset in the LP (figure out how much it needs based on the ranges and the other asset).
The text was updated successfully, but these errors were encountered: