-
Notifications
You must be signed in to change notification settings - Fork 89
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add support for 0.01% tier (#2769)
* chore: add support for 0.01% tier * only show 1bps on mainnet * rename VERY_LOW to LOWEST * upgrade to v3-sdk 3.7.0 * add snapshot testing for lowest tier * fix integration test * fix integration test * use ALL_SUPPORTED_CHAIN_IDS over string all * consider 0.01% tier in pool (#2770) * merge main and only consider lowest tier for mainnet
- Loading branch information
Justin Domingue
authored
Nov 12, 2021
1 parent
8a99bad
commit 408c907
Showing
14 changed files
with
215 additions
and
154 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
import { Trans } from '@lingui/macro' | ||
import { FeeAmount } from '@uniswap/v3-sdk' | ||
import { ButtonRadioChecked } from 'components/Button' | ||
import { AutoColumn } from 'components/Column' | ||
import { useFeeTierDistribution } from 'hooks/useFeeTierDistribution' | ||
import { PoolState } from 'hooks/usePools' | ||
import React from 'react' | ||
import styled from 'styled-components/macro' | ||
import { TYPE } from 'theme' | ||
|
||
import { FeeTierPercentageBadge } from './FeeTierPercentageBadge' | ||
import { FEE_AMOUNT_DETAIL } from './shared' | ||
|
||
const ResponsiveText = styled(TYPE.label)` | ||
line-height: 16px; | ||
font-size: 14px; | ||
${({ theme }) => theme.mediaWidth.upToSmall` | ||
font-size: 12px; | ||
line-height: 12px; | ||
`}; | ||
` | ||
|
||
interface FeeOptionProps { | ||
feeAmount: FeeAmount | ||
active: boolean | ||
distributions: ReturnType<typeof useFeeTierDistribution>['distributions'] | ||
poolState: PoolState | ||
onClick: () => void | ||
} | ||
|
||
export function FeeOption({ feeAmount, active, poolState, distributions, onClick }: FeeOptionProps) { | ||
return ( | ||
<ButtonRadioChecked active={active} onClick={onClick}> | ||
<AutoColumn gap="sm" justify="flex-start"> | ||
<AutoColumn justify="flex-start" gap="6px"> | ||
<ResponsiveText> | ||
<Trans>{FEE_AMOUNT_DETAIL[feeAmount].label}%</Trans> | ||
</ResponsiveText> | ||
<TYPE.main fontWeight={400} fontSize="12px" textAlign="left"> | ||
{FEE_AMOUNT_DETAIL[feeAmount].description} | ||
</TYPE.main> | ||
</AutoColumn> | ||
|
||
{distributions && ( | ||
<FeeTierPercentageBadge distributions={distributions} feeAmount={feeAmount} poolState={poolState} /> | ||
)} | ||
</AutoColumn> | ||
</ButtonRadioChecked> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import { Trans } from '@lingui/macro' | ||
import { FeeAmount } from '@uniswap/v3-sdk' | ||
import Badge from 'components/Badge' | ||
import { useFeeTierDistribution } from 'hooks/useFeeTierDistribution' | ||
import { PoolState } from 'hooks/usePools' | ||
import React from 'react' | ||
import { TYPE } from 'theme' | ||
|
||
export function FeeTierPercentageBadge({ | ||
feeAmount, | ||
distributions, | ||
poolState, | ||
}: { | ||
feeAmount: FeeAmount | ||
distributions: ReturnType<typeof useFeeTierDistribution>['distributions'] | ||
poolState: PoolState | ||
}) { | ||
return ( | ||
<Badge> | ||
<TYPE.label fontSize={11}> | ||
{!distributions || poolState === PoolState.NOT_EXISTS || poolState === PoolState.INVALID ? ( | ||
<Trans>Not created</Trans> | ||
) : distributions[feeAmount] !== undefined ? ( | ||
<Trans>{distributions[feeAmount]?.toFixed(0)}% select</Trans> | ||
) : ( | ||
<Trans>No data</Trans> | ||
)} | ||
</TYPE.label> | ||
</Badge> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.