Content pfp
Content
@
0 reply
0 recast
2 reactions

Cristian Strat pfp
Cristian Strat
@c
Does anyone have an implementation of “getAmountIn” for Velo v2 / Solidly “stable” pools? i.e., the inverse of this function https://github.com/velodrome-finance/contracts/blob/main/contracts/Pool.sol#L449 The curve is the curve is yx^3 + xy^3 = k.
1 reply
5 recasts
9 reactions

Stas pfp
Stas
@stas
Don't recall, but this might be helpful to draft one https://github.com/velodrome-finance/contracts/blob/main/contracts/Router.sol#L600 Anything specific you're trying to achieve?
1 reply
0 recast
0 reaction

Cristian Strat pfp
Cristian Strat
@c
Thanks! I looked around a bit, and it doesn't seem like the router/zap logic has exact-output quoting. The use case is to calculate the input amount required to swap into an exact output amount. e.g., how much USDC do I need to get exactly 1 ETH
1 reply
0 recast
1 reaction

Cristian Strat pfp
Cristian Strat
@c
The universal router doesn't have it either: https://github.com/velodrome-finance/universal-router/blob/4dbb527ff0970f6c848458cf5d60bc486bdeff0b/contracts/modules/uniswap/v2/UniswapV2Library.sol#L143
1 reply
0 recast
0 reaction

Stas pfp
Stas
@stas
Yup, it would have to be implemented based on the above, sadly nothing out of the box If you're in our discord happy to review closer or get some more feedback from our devs
1 reply
0 recast
1 reaction

Cristian Strat pfp
Cristian Strat
@c
Would it make sense to add this to the router? It seems like it was intentionally left out of scope.
2 replies
0 recast
0 reaction

Stas pfp
Stas
@stas
This router is no longer in use with the release of the Slipstream. It is still used to add and remove liquidity because of the slippage checks, but quoting and routing are now handled outside of this. Overall, "reverse quoting" is requested for the first time by you 😊
1 reply
0 recast
1 reaction

Cristian Strat pfp
Cristian Strat
@c
Ha! I may be the first to ask about the contract function, but I’m probably not the first to ask for the feature enabled by this function. Go to the Velodrome/Aerodrome frontend and try to _buy_ exactly 1 ETH. You can’t, right? Most other DEXs have this feature.
1 reply
0 recast
0 reaction