Commit dbc9e85b authored by Noah Zinsmeister's avatar Noah Zinsmeister

bug fixes

parent 7dafb0cf
...@@ -116,7 +116,7 @@ export function PositionPage({ ...@@ -116,7 +116,7 @@ export function PositionPage({
// construct Position from details returned // construct Position from details returned
const [poolState, pool] = usePool(currency0 ?? undefined, currency1 ?? undefined, feeAmount) const [poolState, pool] = usePool(currency0 ?? undefined, currency1 ?? undefined, feeAmount)
const position = useMemo(() => { const position = useMemo(() => {
if (pool && liquidity && tickLower && tickUpper) { if (pool && liquidity && typeof tickLower === 'number' && typeof tickUpper === 'number') {
return new Position({ pool, liquidity: liquidity.toString(), tickLower, tickUpper }) return new Position({ pool, liquidity: liquidity.toString(), tickLower, tickUpper })
} }
return undefined return undefined
...@@ -129,7 +129,9 @@ export function PositionPage({ ...@@ -129,7 +129,9 @@ export function PositionPage({
// check if price is within range // check if price is within range
const outOfRange: boolean = const outOfRange: boolean =
pool && tickLower && tickUpper ? pool.tickCurrent < tickLower || pool.tickCurrent > tickUpper : false pool && typeof tickLower === 'number' && typeof tickUpper === 'number'
? pool.tickCurrent < tickLower || pool.tickCurrent > tickUpper
: false
// fees // fees
const [feeValue0, feeValue1] = useV3PositionFees(pool ?? undefined, positionDetails) const [feeValue0, feeValue1] = useV3PositionFees(pool ?? undefined, positionDetails)
......
...@@ -251,7 +251,7 @@ function Remove({ tokenId }: { tokenId: BigNumber }) { ...@@ -251,7 +251,7 @@ function Remove({ tokenId }: { tokenId: BigNumber }) {
</RowBetween> </RowBetween>
<LightCard> <LightCard>
<AutoColumn gap="md"> <AutoColumn gap="md">
<TYPE.main fontWeight={400}>Withdrawl Amount</TYPE.main> <TYPE.main fontWeight={400}>Amount</TYPE.main>
<RowBetween> <RowBetween>
<TYPE.label fontSize="40px">{percentForSlider}%</TYPE.label> <TYPE.label fontSize="40px">{percentForSlider}%</TYPE.label>
<AutoRow gap="4px" justify="flex-end"> <AutoRow gap="4px" justify="flex-end">
...@@ -296,29 +296,33 @@ function Remove({ tokenId }: { tokenId: BigNumber }) { ...@@ -296,29 +296,33 @@ function Remove({ tokenId }: { tokenId: BigNumber }) {
<CurrencyLogo size="20px" style={{ marginLeft: '8px' }} currency={liquidityValue1?.token} /> <CurrencyLogo size="20px" style={{ marginLeft: '8px' }} currency={liquidityValue1?.token} />
</RowFixed> </RowFixed>
</RowBetween> </RowBetween>
<Break /> {feeValue0?.greaterThan(0) || feeValue1?.greaterThan(0) ? (
<RowBetween> <>
<Text fontSize={16} fontWeight={500}> <Break />
{currency0?.symbol} Fees: <RowBetween>
</Text> <Text fontSize={16} fontWeight={500}>
<RowFixed> {currency0?.symbol} Fees Earned:
<Text fontSize={16} fontWeight={500} marginLeft={'6px'}> </Text>
{feeValue0 && <FormattedCurrencyAmount currencyAmount={feeValue0} />} <RowFixed>
</Text> <Text fontSize={16} fontWeight={500} marginLeft={'6px'}>
<CurrencyLogo size="20px" style={{ marginLeft: '8px' }} currency={feeValue0?.token} /> {feeValue0 && <FormattedCurrencyAmount currencyAmount={feeValue0} />}
</RowFixed> </Text>
</RowBetween> <CurrencyLogo size="20px" style={{ marginLeft: '8px' }} currency={feeValue0?.token} />
<RowBetween> </RowFixed>
<Text fontSize={16} fontWeight={500}> </RowBetween>
{currency1?.symbol} Fees: <RowBetween>
</Text> <Text fontSize={16} fontWeight={500}>
<RowFixed> {currency1?.symbol} Fees Earned:
<Text fontSize={16} fontWeight={500} marginLeft={'6px'}> </Text>
{feeValue1 && <FormattedCurrencyAmount currencyAmount={feeValue1} />} <RowFixed>
</Text> <Text fontSize={16} fontWeight={500} marginLeft={'6px'}>
<CurrencyLogo size="20px" style={{ marginLeft: '8px' }} currency={feeValue1?.token} /> {feeValue1 && <FormattedCurrencyAmount currencyAmount={feeValue1} />}
</RowFixed> </Text>
</RowBetween> <CurrencyLogo size="20px" style={{ marginLeft: '8px' }} currency={feeValue1?.token} />
</RowFixed>
</RowBetween>
</>
) : null}
</AutoColumn> </AutoColumn>
</LightCard> </LightCard>
<div style={{ display: 'flex' }}> <div style={{ display: 'flex' }}>
......
...@@ -37,7 +37,12 @@ export function useDerivedV3BurnInfo( ...@@ -37,7 +37,12 @@ export function useDerivedV3BurnInfo(
const partialPosition = useMemo( const partialPosition = useMemo(
() => () =>
pool && position?.liquidity && position?.tickLower && position?.tickLower pool &&
position?.liquidity &&
position?.tickLower &&
position?.tickUpper &&
typeof position.tickLower === 'number' &&
typeof position.tickUpper === 'number'
? new Position({ ? new Position({
pool, pool,
liquidity: position.liquidity.mul(percent).div(100).toString(), liquidity: position.liquidity.mul(percent).div(100).toString(),
......
...@@ -205,16 +205,18 @@ export function useDerivedMintInfo( ...@@ -205,16 +205,18 @@ export function useDerivedMintInfo(
[key: string]: number | undefined [key: string]: number | undefined
} = useMemo(() => { } = useMemo(() => {
return { return {
[Bound.LOWER]: existingPosition?.tickLower [Bound.LOWER]:
? existingPosition?.tickLower existingPosition?.tickLower && typeof existingPosition.tickLower === 'number'
: invertPrice ? existingPosition.tickLower
? tryParseTick(token1, token0, feeAmount, rightRangeTypedValue) : invertPrice
: tryParseTick(token0, token1, feeAmount, leftRangeTypedValue), ? tryParseTick(token1, token0, feeAmount, rightRangeTypedValue)
[Bound.UPPER]: existingPosition?.tickUpper : tryParseTick(token0, token1, feeAmount, leftRangeTypedValue),
? existingPosition?.tickUpper [Bound.UPPER]:
: invertPrice existingPosition?.tickUpper && typeof existingPosition.tickUpper === 'number'
? tryParseTick(token1, token0, feeAmount, leftRangeTypedValue) ? existingPosition?.tickUpper
: tryParseTick(token0, token1, feeAmount, rightRangeTypedValue), : invertPrice
? tryParseTick(token1, token0, feeAmount, leftRangeTypedValue)
: tryParseTick(token0, token1, feeAmount, rightRangeTypedValue),
} }
}, [existingPosition, feeAmount, invertPrice, leftRangeTypedValue, rightRangeTypedValue, token0, token1]) }, [existingPosition, feeAmount, invertPrice, leftRangeTypedValue, rightRangeTypedValue, token0, token1])
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment