Skip to content

Commit

Permalink
Remove COW from locked GNO from subsidy calculation and header button (
Browse files Browse the repository at this point in the history
…#512)

* Remove COW from locked GNO from subsidy calculation

* Updated to remove locked GNO cow from header button and discount
  • Loading branch information
nenadV91 authored May 4, 2022
1 parent 34842cd commit b835015
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions src/custom/state/cowToken/hooks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import { setSwapVCowStatus, SwapVCowStatus } from './actions'
import { OperationType } from 'components/TransactionConfirmationModal'
import { APPROVE_GAS_LIMIT_DEFAULT } from 'hooks/useApproveCallback/useApproveCallbackMod'
import { useTokenBalance } from 'state/wallet/hooks'
import { useCowFromLockedGnoBalances } from 'pages/Profile/LockedGnoVesting/hooks'
// import { useCowFromLockedGnoBalances } from 'pages/Profile/LockedGnoVesting/hooks'
import { SupportedChainId } from 'constants/chains'
import JSBI from 'jsbi'

Expand Down Expand Up @@ -170,32 +170,32 @@ export function useCowBalance() {
export function useCombinedBalance() {
const { chainId, account } = useActiveWeb3React()
const { total: vCowBalance } = useVCowData()
const { allocated, claimed } = useCowFromLockedGnoBalances()
// const { allocated, claimed } = useCowFromLockedGnoBalances()
const cowBalance = useCowBalance()

const lockedGnoBalance = useMemo(() => {
if (!allocated || !claimed) {
return
}
// const lockedGnoBalance = useMemo(() => {
// if (!allocated || !claimed) {
// return
// }

return JSBI.subtract(allocated.quotient, claimed.quotient)
}, [allocated, claimed])
// return JSBI.subtract(allocated.quotient, claimed.quotient)
// }, [allocated, claimed])

return useMemo(() => {
let tmpBalance = JSBI.BigInt(0)

const isLoading = account && (!vCowBalance || !lockedGnoBalance || !cowBalance) ? true : false
const isLoading = account && (!vCowBalance /* || !lockedGnoBalance */ || !cowBalance) ? true : false

const cow = COW[chainId || SupportedChainId.MAINNET]

if (account) {
if (vCowBalance) tmpBalance = JSBI.add(tmpBalance, vCowBalance.quotient)
if (lockedGnoBalance) tmpBalance = JSBI.add(tmpBalance, lockedGnoBalance)
// if (lockedGnoBalance) tmpBalance = JSBI.add(tmpBalance, lockedGnoBalance)
if (cowBalance) tmpBalance = JSBI.add(tmpBalance, cowBalance.quotient)
}

const balance = CurrencyAmount.fromRawAmount(cow, tmpBalance)

return { balance, isLoading }
}, [vCowBalance, lockedGnoBalance, cowBalance, chainId, account])
}, [vCowBalance, /* lockedGnoBalance, */ cowBalance, chainId, account])
}

0 comments on commit b835015

Please sign in to comment.