Content pfp
Content
@
https://opensea.io/collection/evm-6
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

Stas pfp
Stas
@stas
Was never a priority 🙈
1 reply
0 recast
1 reaction

Cristian Strat pfp
Cristian Strat
@c
You know better. Let me know if it makes sense to contribute a PR.
1 reply
0 recast
0 reaction

Stas pfp
Stas
@stas
Wanted to confirm this the quoter in use atm, and there's a call to get the exact input. Note, these functions aren't views and calls to these should be simulated! https://optimistic.etherscan.io/address/0x89D8218ed5fF1e46d8dcd33fb0bbeE3be1621466#writeContract Will add notes on the UX improvement though, ty ty
1 reply
0 recast
0 reaction

Cristian Strat pfp
Cristian Strat
@c
That’s the QuoterV2 contract, and it’s for concentrated (aka, Slipstream / “Uniswap v3” style) pools only. It doesn’t handle Velodrome “volatile” and “stable” pools. AFAICT no contract in Velodrome’s GH org provides exact-output quotes (i.e., getInputAmountForExactOutput) or swaps for “stable” pools, which is why I started this thread.
1 reply
0 recast
0 reaction