diff --git a/src/pages/Pool/PositionPage.tsx b/src/pages/Pool/PositionPage.tsx index 469834a75e..4d37ef2789 100644 --- a/src/pages/Pool/PositionPage.tsx +++ b/src/pages/Pool/PositionPage.tsx @@ -31,6 +31,7 @@ import ReactGA from 'react-ga' import { TransactionResponse } from '@ethersproject/providers' import { Dots } from 'components/swap/styleds' import { getPriceOrderingFromPositionForUI } from '../../components/PositionListItem' +import { useSingleCallResult } from 'state/multicall/hooks' const PageWrapper = styled.div` min-width: 800px; @@ -233,6 +234,9 @@ export function PositionPage({ }) }, [chainId, feeValue0, feeValue1, positionManager, account, tokenId, addTransaction, library]) + const owner = useSingleCallResult(!!tokenId ? positionManager : null, 'ownerOf', [tokenId]).result?.[0] + const ownsNFT = owner === account || positionDetails?.operator === account + return loading || poolState === PoolState.LOADING || !feeAmount ? (
@@ -262,41 +266,44 @@ export function PositionPage({ {basisPointsToPercent(feeAmount / 100).toSignificant()}% - - {feeValue0?.greaterThan(0) || feeValue1?.greaterThan(0) || !!collectMigrationHash ? ( - - {!!collectMigrationHash && !isCollectPending ? ( - 'Collected' - ) : isCollectPending || collecting ? ( - Collecting - ) : ( - 'Collect fees' - )} - - ) : null} - {currency0 && currency1 && feeAmount && tokenId ? ( - - - Add liquidity - - - ) : null} - {tokenId && ( - - - Remove liquidity - - - )} - + + {ownsNFT && ( + + {feeValue0?.greaterThan(0) || feeValue1?.greaterThan(0) || !!collectMigrationHash ? ( + + {!!collectMigrationHash && !isCollectPending ? ( + 'Collected' + ) : isCollectPending || collecting ? ( + Collecting + ) : ( + 'Collect fees' + )} + + ) : null} + {currency0 && currency1 && feeAmount && tokenId ? ( + + + Add liquidity + + + ) : null} + {tokenId && ( + + + Remove liquidity + + + )} + + )}