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