frontend-monorepo
frontend-monorepo copied to clipboard
Use EstimateAMMBounds API
The Chore
There is a new API for estimateAMMBounds
that Core are providing.
We should presumably be using it in some way.... exactly how I'm not sure yet.
Tasks
- [ ] When user inputs a commitment we need either a "check commitment" button or similar to what we do on the deal ticket we should ping the
estimateAMMBound
API every time someone changes an input field - [ ] If the API comes back with an
AMMError
display the appropriate text- [ ] 0 = Unknown error
- [ ] 1 = Commitment is below the global limit set by the network, increase your commitment to submit
- [ ] 2 = AMM's lower price is too far from the base price for the given commitment resulting in zero volume between price levels. Either increase your commitment size or tighten your lower price bound to submit.
- [ ] 3 = AMM's upper price is too far from the base price for the given commitment resulting in zero volume between price levels. Either increase your commitment size or tighten your upper price bound to submit.
- [ ] 4 = AMM's upper & lower price are too far from the base price for the given commitment resulting in zero volume between price levels. Either increase your commitment size or tighten both your upper and lower price bounds to submit.
- [ ] Note that we have a long standing item to create some kind of "user friendly error message store" so we can map from Core errors to nice messages to display .... maybe this is time to finally make it?
NB. Long term this API will allow us to provide graphical feedback on the shape of your curve and how your position and PNL will change as price moves, but right now this is not important.
Additional details / background info
Spec highlghts
Core issue
https://github.com/vegaprotocol/vega/issues/11028
Full spec
https://github.com/vegaprotocol/specs/pull/2019/files?short_path=3eaa598#diff-3eaa598aefb053dc1e74b7c54af6a1c95017ff21c269485a09406980e1c5ab29
Protos
https://github.com/vegaprotocol/vega/blob/develop/protos/sources/data-node/api/v2/trading_data.proto#L5084-L5111