Commit dbc9e85b authored by Noah Zinsmeister's avatar Noah Zinsmeister

bug fixes

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