Skip to content

Commit

Permalink
Merge branch 'main' into test-liquidity-bot
Browse files Browse the repository at this point in the history
  • Loading branch information
haythem96 authored May 31, 2022
2 parents 0bf24cb + 8b24f82 commit 69cc751
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 19 deletions.
1 change: 0 additions & 1 deletion packages/frontend/src/state/positions/atoms.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,6 @@ export const managerAtom = atom((get) => {
})
export const activePositionsAtom = atom<any[]>([])
export const closedPositionsAtom = atom<any[]>([])
export const lpPositionsLoadingAtom = atom(false)
export const squeethLiquidityAtom = atom(BIG_ZERO)
export const wethLiquidityAtom = atom(BIG_ZERO)
export const depositedSqueethAtom = atom(BIG_ZERO)
Expand Down
19 changes: 1 addition & 18 deletions packages/frontend/src/state/positions/hooks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ import {
managerAtom,
activePositionsAtom,
closedPositionsAtom,
lpPositionsLoadingAtom,
squeethLiquidityAtom,
wethLiquidityAtom,
depositedSqueethAtom,
Expand Down Expand Up @@ -207,7 +206,6 @@ export const useLpDebt = () => {
export const useLPPositionsQuery = () => {
const { squeethPool } = useAtomValue(addressesAtom)
const address = useAtomValue(addressAtom)
const lpPositionsLoading = useAtomValue(lpPositionsLoadingAtom)
const { data, refetch, loading, subscribeToMore } = useQuery<positions, positionsVariables>(POSITIONS_QUERY, {
variables: {
poolAddress: squeethPool?.toLowerCase(),
Expand All @@ -233,7 +231,7 @@ export const useLPPositionsQuery = () => {
})
}, [address, squeethPool, subscribeToMore])

return { data, refetch, loading: loading || lpPositionsLoading }
return { data, refetch, loading }
}

const MAX_UNIT = '0xffffffffffffffffffffffffffffffff'
Expand Down Expand Up @@ -320,7 +318,6 @@ export const usePositionsAndFeesComputation = () => {
const isWethToken0 = useAtomValue(isWethToken0Atom)
const [activePositions, setActivePositions] = useAtom(activePositionsAtom)
const setClosedPositions = useUpdateAtom(closedPositionsAtom)
const setLoading = useUpdateAtom(lpPositionsLoadingAtom)
const setDepositedSqueeth = useUpdateAtom(depositedSqueethAtom)
const setDepositedWeth = useUpdateAtom(depositedWethAtom)
const setWithdrawnSqueeth = useUpdateAtom(withdrawnSqueethAtom)
Expand All @@ -333,7 +330,6 @@ export const usePositionsAndFeesComputation = () => {

useAppEffect(() => {
if (positionAndFees && !gphLoading) {
setLoading(true)
// Promise.all(positionAndFees).then((values: any[]) => {
setActivePositions(positionAndFees.filter((p) => p.amount0.gt(0) || p.amount1.gt(0)))
setClosedPositions(positionAndFees.filter((p) => p.amount0.isZero() && p.amount1.isZero()))
Expand Down Expand Up @@ -367,18 +363,6 @@ export const usePositionsAndFeesComputation = () => {
setWithdrawnWeth(withWeth)
setSqueethLiquidity(sqthLiq)
setWethLiquidity(wethLiq)
if (
!(
depSqth.isEqualTo(0) &&
depWeth.isEqualTo(0) &&
withSqth.isEqualTo(0) &&
sqthLiq.isEqualTo(0) &&
wethLiq.isEqualTo(0)
) ||
activePositions.length === 0
)
setLoading(false)
// })
}
}, [
gphLoading,
Expand All @@ -389,7 +373,6 @@ export const usePositionsAndFeesComputation = () => {
setClosedPositions,
setDepositedSqueeth,
setDepositedWeth,
setLoading,
setSqueethLiquidity,
setWethLiquidity,
setWithdrawnSqueeth,
Expand Down

0 comments on commit 69cc751

Please sign in to comment.