Skip to content

Commit

Permalink
Merge pull request #93 from HaloDAO/develop
Browse files Browse the repository at this point in the history
Merge develop to master
  • Loading branch information
tracyarciaga authored Sep 17, 2021
2 parents e4d730c + 4051f9f commit 1d96b71
Show file tree
Hide file tree
Showing 5 changed files with 39 additions and 12 deletions.
22 changes: 22 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
version: 2.1

orbs:
node: circleci/[email protected]

jobs:
test:
executor:
name: node/default
tag: '12.22.3'
steps:
- checkout
- node/install-packages:
pkg-manager: yarn
- run:
command: yarn run test
name: Run tests

workflows:
test_my_app:
jobs:
- test
10 changes: 4 additions & 6 deletions src/components/Farm/FarmPoolCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -456,11 +456,13 @@ export default function FarmPoolCard({
const stakedBPTs = useStakedBPTPerPool([poolInfo.pid], rewardsVersion)
const bptStaked = stakedBPTs[poolInfo.pid] ?? 0

// Pool liquidity
const poolLiquidity = getPoolLiquidity(poolInfo, tokenPrice)

// Staked BPT value calculation
const totalSupplyAmount = useTotalSupply(poolInfo.asToken)
const totalSupply = totalSupplyAmount ? parseFloat(formatEther(`${totalSupplyAmount.raw}`)) : 0
const liquidity = getPoolLiquidity(poolInfo, tokenPrice)
const lpTokenPrice = totalSupply > 0 && liquidity > 0 ? liquidity / totalSupply : 0
const lpTokenPrice = totalSupply > 0 && poolLiquidity > 0 ? poolLiquidity / totalSupply : 0
const bptStakedValue = bptStaked * lpTokenPrice

// Get user earned HALO
Expand All @@ -482,10 +484,6 @@ export default function FarmPoolCard({
// Make use of `useDepositWithdrawPoolTokensCallback` for deposit & withdraw poolTokens methods
const { deposit, withdraw, harvest } = useDepositWithdrawHarvestCallback(rewardsVersion)

// Pool Liquidity
const poolLiquidity =
poolInfo.provider === PoolProvider.Halo ? poolInfo.liquidity : getPoolLiquidity(poolInfo, tokenPrice)

/**
* APY computation
*/
Expand Down
8 changes: 4 additions & 4 deletions src/components/Header/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -210,14 +210,14 @@ const Title = styled.a`
}
.site-logo {
width: 40px;
width: 20px;
}
${({ theme }) => theme.mediaWidth.upToMedium`
justify-self: center;
.site-logo {
width: 26px;
width: 16px;
}
`};
`
Expand All @@ -239,7 +239,7 @@ const StyledNavLink = styled(NavLink).attrs({
cursor: pointer;
text-decoration: none;
color: ${({ theme }) => theme.text2};
font-size: 1.5rem;
font-size: 1rem;
width: fit-content;
margin: 4px 15px 0;
padding: 1.25rem 0;
Expand Down Expand Up @@ -271,7 +271,7 @@ const StyledExternalLink = styled(ExternalLink).attrs({
cursor: pointer;
text-decoration: none;
color: ${({ theme }) => theme.text2};
font-size: 1.5rem;
font-size: 1rem;
width: fit-content;
margin: 4px 15px 0;
font-weight: 400;
Expand Down
4 changes: 3 additions & 1 deletion src/components/Tailwind/InputFields/CurrencyInput.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,16 @@ const TokenInput = ({
showMax,
onSelectToken,
tokenList,

balance
}: TokenInputProps) => {
const [showModal, setShowModal] = useState(false)
const { account } = useActiveWeb3React()
const currencyBalance = useCurrencyBalance(account ?? undefined, currency)

const onMax = () => {
if (balance) {
balance = balance ? balance : currencyBalance?.toSignificant(6)
if (balance && Number(balance) > 0) {
didChangeValue(balance)
}
}
Expand Down
7 changes: 6 additions & 1 deletion src/utils/poolInfo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import {
SUSHI_POOLS_ADDRESSES,
UNI_POOLS_ADDRESSES
} from 'constants/pools'
import { PoolInfo } from 'halo-hooks/usePoolInfo'
import { PoolInfo, PoolProvider } from 'halo-hooks/usePoolInfo'
import { TokenPrice } from 'halo-hooks/useTokenPrice'
import { getAddress } from 'ethers/lib/utils'
import { ChainId } from '@sushiswap/sdk'
Expand Down Expand Up @@ -81,6 +81,11 @@ export const tokenSymbolForPool = (address: string) => {
}

export const getPoolLiquidity = (poolInfo: PoolInfo, tokenPrice: TokenPrice) => {
// No need to compute for $ liquidity if a HALO pool
if (poolInfo.provider === PoolProvider.Halo) {
return poolInfo.liquidity
}

let sumWeight = 0
let sumValue = 0
// console.log(`Calculating liquidity for: ${poolInfo.pair}...`)
Expand Down

0 comments on commit 1d96b71

Please sign in to comment.