From 4dea71705a183941e310bf5230dbb635fc9bb3ed Mon Sep 17 00:00:00 2001 From: schystz Date: Thu, 16 Sep 2021 14:50:11 +0800 Subject: [PATCH 1/8] Add .circleci/config.yml --- .circleci/config.yml | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 .circleci/config.yml diff --git a/.circleci/config.yml b/.circleci/config.yml new file mode 100644 index 00000000..ec359ff7 --- /dev/null +++ b/.circleci/config.yml @@ -0,0 +1,14 @@ +# This config is equivalent to both the '.circleci/extended/orb-free.yml' and the base '.circleci/config.yml' +version: 2.1 + +orbs: + node: circleci/node@4.1 + +workflows: + sample: + jobs: + - node/test: + version: '15.1' + # This is the node version to use for the `cimg/node` tag + # Relevant tags can be found on the CircleCI Developer Hub + # https://circleci.com/developer/images/image/cimg/node From 03dd5090603debb832862e5e06a032205588627e Mon Sep 17 00:00:00 2001 From: schystz Date: Thu, 16 Sep 2021 15:00:28 +0800 Subject: [PATCH 2/8] Add .circleci/config.yml --- .circleci/config.yml | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index ec359ff7..63a7c1db 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -1,14 +1,16 @@ -# This config is equivalent to both the '.circleci/extended/orb-free.yml' and the base '.circleci/config.yml' version: 2.1 orbs: - node: circleci/node@4.1 + node: circleci/node@4.7.0 +jobs: + example-job: + docker: + # replace with your preferred image + - image: cimg/base:stable + steps: + - node/install-yarn workflows: - sample: + example-workflow: jobs: - - node/test: - version: '15.1' - # This is the node version to use for the `cimg/node` tag - # Relevant tags can be found on the CircleCI Developer Hub - # https://circleci.com/developer/images/image/cimg/node + - example-job \ No newline at end of file From 147e6b724d57f1a60ffc098559ca2777caa6cd57 Mon Sep 17 00:00:00 2001 From: schystz Date: Thu, 16 Sep 2021 15:08:34 +0800 Subject: [PATCH 3/8] Updated config.yml --- .circleci/config.yml | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 63a7c1db..c3d4f1ee 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -3,14 +3,8 @@ version: 2.1 orbs: node: circleci/node@4.7.0 -jobs: - example-job: - docker: - # replace with your preferred image - - image: cimg/base:stable - steps: - - node/install-yarn workflows: - example-workflow: - jobs: - - example-job \ No newline at end of file + example-workflow: + jobs: + - node/test: + pkg-manager: yarn \ No newline at end of file From 456c66eb94dfb3e5b757fc55cda73ec8f2493b27 Mon Sep 17 00:00:00 2001 From: schystz Date: Thu, 16 Sep 2021 15:11:39 +0800 Subject: [PATCH 4/8] Updated config.yml --- .circleci/config.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index c3d4f1ee..3001346c 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -7,4 +7,6 @@ workflows: example-workflow: jobs: - node/test: - pkg-manager: yarn \ No newline at end of file + pkg-manager: yarn + override-ci-command: yarn install + cache-version: v1 \ No newline at end of file From f9124da2f72e2c88e104657f30b68199e42e7b56 Mon Sep 17 00:00:00 2001 From: schystz Date: Thu, 16 Sep 2021 15:28:16 +0800 Subject: [PATCH 5/8] Updated config.yml --- .circleci/config.yml | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 3001346c..37aa3a32 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -1,12 +1,19 @@ version: 2.1 - orbs: node: circleci/node@4.7.0 - +jobs: + test: + executor: + name: node/default + tag: '13' + steps: + - checkout + - node/install-packages: + pkg-manager: yarn + - run: + command: yarn run test + name: Run YARN tests workflows: - example-workflow: - jobs: - - node/test: - pkg-manager: yarn - override-ci-command: yarn install - cache-version: v1 \ No newline at end of file + test_my_app: + jobs: + - test \ No newline at end of file From 7eaa9985b8e952bce09df4d41547fbfeb45823ba Mon Sep 17 00:00:00 2001 From: schystz Date: Thu, 16 Sep 2021 15:32:56 +0800 Subject: [PATCH 6/8] Updated config.yml --- .circleci/config.yml | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 37aa3a32..71ca909e 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -1,18 +1,21 @@ version: 2.1 + orbs: node: circleci/node@4.7.0 + jobs: test: executor: name: node/default - tag: '13' + tag: '12.22.3' steps: - checkout - node/install-packages: pkg-manager: yarn - run: command: yarn run test - name: Run YARN tests + name: Run tests + workflows: test_my_app: jobs: From 9f81ee39518a0df16ea147e93bb3138311b20f1e Mon Sep 17 00:00:00 2001 From: James Russell Orola Date: Thu, 16 Sep 2021 20:03:10 +0800 Subject: [PATCH 7/8] Adjustments on getPoolLiquidity() helper for HALO AMM pools --- src/components/Farm/FarmPoolCard.tsx | 10 ++++------ src/utils/poolInfo.ts | 7 ++++++- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/src/components/Farm/FarmPoolCard.tsx b/src/components/Farm/FarmPoolCard.tsx index 86b2aba0..cca6d828 100644 --- a/src/components/Farm/FarmPoolCard.tsx +++ b/src/components/Farm/FarmPoolCard.tsx @@ -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 @@ -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 */ diff --git a/src/utils/poolInfo.ts b/src/utils/poolInfo.ts index e374d4c7..32fc4755 100644 --- a/src/utils/poolInfo.ts +++ b/src/utils/poolInfo.ts @@ -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' @@ -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}...`) From 8cf7fc72b1486bbc609b5697ed5d7c6af3fc378d Mon Sep 17 00:00:00 2001 From: tracy Date: Fri, 17 Sep 2021 14:28:23 +0800 Subject: [PATCH 8/8] Fix max button and update navbar --- src/components/Header/index.tsx | 8 ++++---- src/components/Tailwind/InputFields/CurrencyInput.tsx | 4 +++- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/src/components/Header/index.tsx b/src/components/Header/index.tsx index 115c181b..0465dc8d 100644 --- a/src/components/Header/index.tsx +++ b/src/components/Header/index.tsx @@ -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; } `}; ` @@ -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; @@ -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; diff --git a/src/components/Tailwind/InputFields/CurrencyInput.tsx b/src/components/Tailwind/InputFields/CurrencyInput.tsx index f6afd2ba..8568f8bb 100644 --- a/src/components/Tailwind/InputFields/CurrencyInput.tsx +++ b/src/components/Tailwind/InputFields/CurrencyInput.tsx @@ -30,6 +30,7 @@ const TokenInput = ({ showMax, onSelectToken, tokenList, + balance }: TokenInputProps) => { const [showModal, setShowModal] = useState(false) @@ -37,7 +38,8 @@ const TokenInput = ({ const currencyBalance = useCurrencyBalance(account ?? undefined, currency) const onMax = () => { - if (balance) { + balance = balance ? balance : currencyBalance?.toSignificant(6) + if (balance && Number(balance) > 0) { didChangeValue(balance) } }