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

One-Click LP: Collect Fees #598

Open
wants to merge 36 commits into
base: one-click-lp-close
Choose a base branch
from

Conversation

daryakaviani
Copy link
Contributor

Task: One-Click LP Collect Fees

Description

Collect fees accumulated by an LP position via the ControllerHelper's rebalanceLpInVault function.

Learn more about the One-Click LP API here.

@vercel
Copy link

vercel bot commented Jul 13, 2022

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

Name Status Preview Updated
continuouscall ✅ Ready (Inspect) Visit Preview Aug 9, 2022 at 7:14AM (UTC)

@deepthinker250 deepthinker250 changed the base branch from main to one-click-lp-close July 13, 2022 17:51
Copy link
Contributor

@aleone aleone left a comment

Choose a reason for hiding this comment

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

Small changes, big one that will impact all PRs is that we need to be more conservative with the amount of ETH that we borrow to target a higher CR.

approving to not block, but needs to be fixed

@@ -17,6 +17,7 @@ import { useGetDebtAmount, useGetTwapSqueethPrice, useGetVault } from '../contro
const TICK_SPACE = 60
const COLLAT_RATIO = 1.5
const POOL_FEE = 3000
const MAX_INT = new BigNumber(2).pow(128).minus(1).toFixed(0)
Copy link
Contributor

Choose a reason for hiding this comment

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

maybe call this MAX_INT_128 or something, might need MAX_INT_256 later, etc


const shortAmount = fromTokenAmount(vaultBefore.shortAmount, OSQUEETH_DECIMALS)
const debtInEth = await getDebtAmount(shortAmount)
const collateralToFlashloan = debtInEth.multipliedBy(COLLAT_RATIO)
Copy link
Contributor

Choose a reason for hiding this comment

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

for all of these we need to have some buffer room.

If the transaction takes some time to be mined and spot prices change, its possible we won't be borrowing enough ETH.

Maybe 200% is fine?

@alpinechicken alpinechicken self-requested a review August 4, 2022 01:44
Copy link
Contributor

@alpinechicken alpinechicken left a comment

Choose a reason for hiding this comment

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

lgtm


export const CONTROLLER_HELPER: Address = {
1: '0xfa86d43b41Fa7a759c606130cc81970A955ff816',
3: '0x7e9C5490e91F93529c6480B46a59D738F6bcEa43',
Copy link
Contributor

Choose a reason for hiding this comment

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

ropsten ded :(

Copy link
Contributor

Choose a reason for hiding this comment

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

should add goerli deployment

Copy link
Contributor

@aleone aleone left a comment

Choose a reason for hiding this comment

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

lgtm, I think before merge we might want to remove all the other f/e code that doesnt deal with collect fees (ie useClosePosition, etc)

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.

4 participants