Skip to content
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

Frontend for Opening a New Position with 1-Click-LP #710

Open
wants to merge 60 commits into
base: main
Choose a base branch
from

Conversation

nikkaroraa
Copy link
Member

@nikkaroraa nikkaroraa commented Nov 5, 2022

Task:

Frontend for Opening a New Position for Mint + LP. New LP page is at /new-lp slug

Description

This is the 1st part of 1-Click-LP project, which basically builds on top of ControllerHelper smart contract.

Loom video

The frontend lets the user input ETH amount. This amount then gets split out into ethInVault and ethInLP.

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Document update

How Has This Been Tested

Couldn't test it on any network, neitherlocal nor Goerli, since ControllerHelper contract isn't ready to be deployed there. @DemolaJames is currently working on deploying it on Goerli.

So no other way but to compare it with the reference implementation in this PR. Compared the ETH deposit values and everything seems fine.

FE Checklist

  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • My changes generate no new warnings
  • Added video recordings if it is a UI change

User Facing Checklist

  • I fully understand the user problem this PR is solving
  • I know who the target user is for this PR and have a deep understanding of that user
  • I have tried this flow thinking from the pov of the target user for this PR
  • I (or working w someone on team) have scheduled a user test for this PR (if it is a large change)

@vercel
Copy link

vercel bot commented Nov 5, 2022

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated
continuouscall ✅ Ready (Inspect) Visit Preview Nov 21, 2022 at 7:53PM (UTC)

@@ -252,6 +285,40 @@ export const useGetTickPrices = () => {
return getTickPrices
}

export const useGetTicksFromPriceRange = () => {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm still not sure about this calculation. Whosoever is reviewing it, please take a look!

@@ -141,4 +168,36 @@ const darkPalete: ThemeOptions = {
},
}

const newDarkPalette: ThemeOptions = {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

colors and fonts being used in this new lp page are different from the existing ones. hence made this a separate one.

@@ -25,7 +25,8 @@
"@styles/*": ["src/styles/*"],
"@types/*": ["src/types/*"],
"@utils/*": ["src/utils/*"],
"@queries/*": ["src/queries/*"]
"@queries/*": ["src/queries/*"],
"@state/*": ["src/state/*"]
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not sure why we weren't doing this already?

Copy link
Contributor

@alexisgauba alexisgauba left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here liquidation price doesn't update as I adjust collat ratio - is that out of scope for this PR and being added in a diff PR?

Also the default checkbox should uncheck itself if I adjust my collateralization ratio, and then if I re-check the box it should go back to the default ratio

Screen Shot 2022-11-10 at 11 14 40 PM

We should also have the default price ranges filled out to be full range

Screen Shot 2022-11-10 at 11 13 54 PM

)

function getSteps() {
return ['Depositing ETH', 'Earning interest']
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lets actually just make this one step of 'Depositing ETH' since the user isn't earning fees + funding at their deposit, they earn fees + funding over time

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Got it. If not "Earning interest", there should be something else I think. Otherwise the stepper design looks incomplete.

Screenshot 2022-11-21 at 7 16 45 PM


For now I'm removing the stepper component and just keeping "view dashboard" there.

Screenshot 2022-11-21 at 7 15 33 PM

Deposit ERC-20s, earn ETH.
</Typography>
<Typography variant="subtitle1" className={classes.subtitle}>
Provide liquidity to earn interest through fees and funding.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Provide liquidity to earn interest through fees and funding.
Provide liquidity to earn through fees.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done!

<div className={classes.root}>
<div className={classes.container}>
<Typography variant="h1" className={classes.title}>
Deposit ERC-20s, earn ETH.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Deposit ERC-20s, earn ETH.
Deposit ETH, earn fees

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done!

@nikkaroraa
Copy link
Member Author

nikkaroraa commented Nov 21, 2022

Here liquidation price doesn't update as I adjust collat ratio - is that out of scope for this PR and being added in a diff PR?

Also the default checkbox should uncheck itself if I adjust my collateralization ratio, and then if I re-check the box it should go back to the default ratio

Screen Shot 2022-11-10 at 11 14 40 PM

We should also have the default price ranges filled out to be full range

Screen Shot 2022-11-10 at 11 13 54 PM

Re: Liquidation price and Default checkbox should uncheck

It works as expected now.

Re: Default price ranges filled out to be full range

The max price for full range would be a really big number, wouldn't look good in the input IMO. Can we change "Default" label to "Use full range" instead? Would that be clear enough?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants