-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Preview user actions: open/close longs, shorts, and lp #464
Comments
One note about function openShort(
uint256 _bondAmount,
uint256 _maxDeposit,
address _destination,
bool _asUnderlying
)
external
payable
nonReentrant
isNotPaused
returns (uint256 maturityTime, uint256 traderDeposit) In the UI however, we will want the inverse of this. Users will want a quote based on the amount of base they choose to deposit. |
add the function that calculate openLong etc. to DataProvider.sol and queries that return the results. Front end should be able to specify trade size. Should call hyperdrive and add getter function |
@DannyDelott That's just the way we've added it to the UI now, but that could change. Depending on how we end up talking about shorts and longs, users could end up preferring to choose an amount of bonds to short. @gtowle03 @jalextowle Do these changes affect audits? How easy would it be to change this later? |
Discussing with @jalextowle that we'll be punting on this for now in favor of higher priority work that's emerged from audit feedback. This will be revisited later, likely prior to a public testnet release (ie: goerli). In the meantime, we'll communicate the limitations of the UI during the trading competition. |
Feature Request
The frontend needs a way to get quotes for common actions (openLong, closeShort) without submitting the transaction. These are the desired methods:
openLongPreview
closeLongPreview
openShortPreview
closeShortPreview
addLiquidityPreview
removeLiquidityPreview
What this solves
Lots of UX shortfalls. Today the UI is calling the existing Hyperdrive functions in view mode, however this requires allowances first. This means users are essentially having to pay before they can even see the price tag on a trade. And secondly, a view mode call will fail if you don't have enough base, bonds, or shares to get a real quote, so you can't preview large hypothetical trades.
Additional context
It's pretty much table stakes for an AMM to provide these methods on-chain. Here's how two of the largest AMMs have implemented this:
The text was updated successfully, but these errors were encountered: