Commit 2ee9b16c authored by Noah Zinsmeister's avatar Noah Zinsmeister Committed by GitHub

remove a lot of dead code (#1970)

parent c52cd2c3
[
{
"name": "Transfer",
"inputs": [
{
"type": "address",
"name": "_from",
"indexed": true
},
{
"type": "address",
"name": "_to",
"indexed": true
},
{
"type": "uint256",
"name": "_tokenId",
"indexed": true
}
],
"anonymous": false,
"type": "event"
},
{
"name": "Approval",
"inputs": [
{
"type": "address",
"name": "_owner",
"indexed": true
},
{
"type": "address",
"name": "_approved",
"indexed": true
},
{
"type": "uint256",
"name": "_tokenId",
"indexed": true
}
],
"anonymous": false,
"type": "event"
},
{
"name": "ApprovalForAll",
"inputs": [
{
"type": "address",
"name": "_owner",
"indexed": true
},
{
"type": "address",
"name": "_operator",
"indexed": true
},
{
"type": "bool",
"name": "_approved",
"indexed": false
}
],
"anonymous": false,
"type": "event"
},
{
"outputs": [],
"inputs": [],
"constant": false,
"payable": false,
"type": "constructor"
},
{
"name": "tokenURI",
"outputs": [
{
"type": "string",
"name": "out"
}
],
"inputs": [
{
"type": "uint256",
"name": "_tokenId"
}
],
"constant": true,
"payable": false,
"type": "function",
"gas": "22405"
},
{
"name": "tokenByIndex",
"outputs": [
{
"type": "uint256",
"name": "out"
}
],
"inputs": [
{
"type": "uint256",
"name": "_index"
}
],
"constant": true,
"payable": false,
"type": "function",
"gas": "631"
},
{
"name": "tokenOfOwnerByIndex",
"outputs": [
{
"type": "uint256",
"name": "out"
}
],
"inputs": [
{
"type": "address",
"name": "_owner"
},
{
"type": "uint256",
"name": "_index"
}
],
"constant": true,
"payable": false,
"type": "function",
"gas": "1248"
},
{
"name": "transferFrom",
"outputs": [],
"inputs": [
{
"type": "address",
"name": "_from"
},
{
"type": "address",
"name": "_to"
},
{
"type": "uint256",
"name": "_tokenId"
}
],
"constant": false,
"payable": false,
"type": "function",
"gas": "259486"
},
{
"name": "safeTransferFrom",
"outputs": [],
"inputs": [
{
"type": "address",
"name": "_from"
},
{
"type": "address",
"name": "_to"
},
{
"type": "uint256",
"name": "_tokenId"
}
],
"constant": false,
"payable": false,
"type": "function"
},
{
"name": "safeTransferFrom",
"outputs": [],
"inputs": [
{
"type": "address",
"name": "_from"
},
{
"type": "address",
"name": "_to"
},
{
"type": "uint256",
"name": "_tokenId"
},
{
"type": "bytes",
"name": "_data"
}
],
"constant": false,
"payable": false,
"type": "function"
},
{
"name": "approve",
"outputs": [],
"inputs": [
{
"type": "address",
"name": "_approved"
},
{
"type": "uint256",
"name": "_tokenId"
}
],
"constant": false,
"payable": false,
"type": "function",
"gas": "38422"
},
{
"name": "setApprovalForAll",
"outputs": [],
"inputs": [
{
"type": "address",
"name": "_operator"
},
{
"type": "bool",
"name": "_approved"
}
],
"constant": false,
"payable": false,
"type": "function",
"gas": "38016"
},
{
"name": "mint",
"outputs": [
{
"type": "bool",
"name": "out"
}
],
"inputs": [
{
"type": "address",
"name": "_to"
}
],
"constant": false,
"payable": false,
"type": "function",
"gas": "182636"
},
{
"name": "changeMinter",
"outputs": [],
"inputs": [
{
"type": "address",
"name": "_minter"
}
],
"constant": false,
"payable": false,
"type": "function",
"gas": "35897"
},
{
"name": "changeURI",
"outputs": [],
"inputs": [
{
"type": "address",
"name": "_newURI"
}
],
"constant": false,
"payable": false,
"type": "function",
"gas": "35927"
},
{
"name": "name",
"outputs": [
{
"type": "string",
"name": "out"
}
],
"inputs": [],
"constant": true,
"payable": false,
"type": "function",
"gas": "6612"
},
{
"name": "symbol",
"outputs": [
{
"type": "string",
"name": "out"
}
],
"inputs": [],
"constant": true,
"payable": false,
"type": "function",
"gas": "6642"
},
{
"name": "totalSupply",
"outputs": [
{
"type": "uint256",
"name": "out"
}
],
"inputs": [],
"constant": true,
"payable": false,
"type": "function",
"gas": "873"
},
{
"name": "minter",
"outputs": [
{
"type": "address",
"name": "out"
}
],
"inputs": [],
"constant": true,
"payable": false,
"type": "function",
"gas": "903"
},
{
"name": "socks",
"outputs": [
{
"type": "address",
"name": "out",
"unit": "Socks"
}
],
"inputs": [],
"constant": true,
"payable": false,
"type": "function",
"gas": "933"
},
{
"name": "newURI",
"outputs": [
{
"type": "address",
"name": "out"
}
],
"inputs": [],
"constant": true,
"payable": false,
"type": "function",
"gas": "963"
},
{
"name": "ownerOf",
"outputs": [
{
"type": "address",
"name": "out"
}
],
"inputs": [
{
"type": "uint256",
"name": "arg0"
}
],
"constant": true,
"payable": false,
"type": "function",
"gas": "1126"
},
{
"name": "balanceOf",
"outputs": [
{
"type": "uint256",
"name": "out"
}
],
"inputs": [
{
"type": "address",
"name": "arg0"
}
],
"constant": true,
"payable": false,
"type": "function",
"gas": "1195"
},
{
"name": "getApproved",
"outputs": [
{
"type": "address",
"name": "out"
}
],
"inputs": [
{
"type": "uint256",
"name": "arg0"
}
],
"constant": true,
"payable": false,
"type": "function",
"gas": "1186"
},
{
"name": "isApprovedForAll",
"outputs": [
{
"type": "bool",
"name": "out"
}
],
"inputs": [
{
"type": "address",
"name": "arg0"
},
{
"type": "address",
"name": "arg1"
}
],
"constant": true,
"payable": false,
"type": "function",
"gas": "1415"
},
{
"name": "supportsInterface",
"outputs": [
{
"type": "bool",
"name": "out"
}
],
"inputs": [
{
"type": "bytes32",
"name": "arg0"
}
],
"constant": true,
"payable": false,
"type": "function",
"gas": "1246"
}
]
...@@ -24,13 +24,6 @@ const ActiveDot = styled.span` ...@@ -24,13 +24,6 @@ const ActiveDot = styled.span`
margin-right: 4px; margin-right: 4px;
` `
export const DarkBadge = styled.div`
width: fit-content;
border-radius: 8px;
background-color: ${({ theme }) => theme.bg0};
padding: 4px 6px;
`
export default function RangeBadge({ export default function RangeBadge({
removed, removed,
inRange, inRange,
......
...@@ -13,7 +13,7 @@ export enum BadgeVariant { ...@@ -13,7 +13,7 @@ export enum BadgeVariant {
WARNING_OUTLINE = 'WARNING_OUTLINE', WARNING_OUTLINE = 'WARNING_OUTLINE',
} }
export interface BadgeProps { interface BadgeProps {
variant?: BadgeVariant variant?: BadgeVariant
} }
......
...@@ -149,48 +149,6 @@ export const ButtonSecondary = styled(Base)` ...@@ -149,48 +149,6 @@ export const ButtonSecondary = styled(Base)`
} }
` `
export const ButtonPink = styled(Base)`
background-color: ${({ theme }) => theme.primary1};
color: white;
&:focus {
box-shadow: 0 0 0 1pt ${({ theme }) => darken(0.05, theme.primary1)};
background-color: ${({ theme }) => darken(0.05, theme.primary1)};
}
&:hover {
background-color: ${({ theme }) => darken(0.05, theme.primary1)};
}
&:active {
box-shadow: 0 0 0 1pt ${({ theme }) => darken(0.1, theme.primary1)};
background-color: ${({ theme }) => darken(0.1, theme.primary1)};
}
&:disabled {
background-color: ${({ theme }) => theme.primary1};
opacity: 50%;
cursor: auto;
}
`
export const ButtonUNIGradient = styled(ButtonPrimary)`
color: white;
padding: 4px 8px;
height: 36px;
font-weight: 500;
background-color: ${({ theme }) => theme.bg3};
background: radial-gradient(174.47% 188.91% at 1.84% 0%, #ff007a 0%, #2172e5 100%), #edeef2;
width: fit-content;
position: relative;
cursor: pointer;
border: none;
white-space: no-wrap;
:hover {
opacity: 0.8;
}
:active {
opacity: 0.9;
}
`
export const ButtonOutlined = styled(Base)` export const ButtonOutlined = styled(Base)`
border: 1px solid ${({ theme }) => theme.bg2}; border: 1px solid ${({ theme }) => theme.bg2};
background-color: transparent; background-color: transparent;
...@@ -255,27 +213,6 @@ export const ButtonText = styled(Base)` ...@@ -255,27 +213,6 @@ export const ButtonText = styled(Base)`
} }
` `
export const ButtonWhite = styled(Base)`
border: 1px solid #edeef2;
background-color: ${({ theme }) => theme.bg1};
color: black;
&:focus {
// eslint-disable-next-line @typescript-eslint/no-unused-vars
box-shadow: 0 0 0 1pt ${darken(0.05, '#edeef2')};
}
&:hover {
box-shadow: 0 0 0 1pt ${darken(0.1, '#edeef2')};
}
&:active {
box-shadow: 0 0 0 1pt ${darken(0.1, '#edeef2')};
}
&:disabled {
opacity: 50%;
cursor: auto;
}
`
const ButtonConfirmedStyle = styled(Base)` const ButtonConfirmedStyle = styled(Base)`
background-color: ${({ theme }) => theme.bg3}; background-color: ${({ theme }) => theme.bg3};
color: ${({ theme }) => theme.text1}; color: ${({ theme }) => theme.text1};
......
...@@ -40,12 +40,6 @@ export const YellowCard = styled(Card)` ...@@ -40,12 +40,6 @@ export const YellowCard = styled(Card)`
font-weight: 500; font-weight: 500;
` `
export const PinkCard = styled(Card)`
background-color: rgba(255, 0, 122, 0.03);
color: ${({ theme }) => theme.primary1};
font-weight: 500;
`
export const BlueCard = styled(Card)` export const BlueCard = styled(Card)`
background-color: ${({ theme }) => theme.primary5}; background-color: ${({ theme }) => theme.primary5};
color: ${({ theme }) => theme.blue2}; color: ${({ theme }) => theme.blue2};
......
...@@ -9,7 +9,7 @@ const Wrapper = styled.div<{ margin: boolean; sizeraw: number }>` ...@@ -9,7 +9,7 @@ const Wrapper = styled.div<{ margin: boolean; sizeraw: number }>`
margin-left: ${({ sizeraw, margin }) => margin && (sizeraw / 3 + 8).toString() + 'px'}; margin-left: ${({ sizeraw, margin }) => margin && (sizeraw / 3 + 8).toString() + 'px'};
` `
export interface DoubleCurrencyLogoProps { interface DoubleCurrencyLogoProps {
margin?: boolean margin?: boolean
size?: number size?: number
currency0?: Currency currency0?: Currency
......
import styled from 'styled-components/macro'
import { AlertTriangle, X } from 'react-feather'
import { useURLWarningToggle, useURLWarningVisible } from '../../state/user/hooks'
import { isMobile } from 'react-device-detect'
import { Trans } from '@lingui/macro'
const PhishAlert = styled.div<{ isActive: any }>`
width: 100%;
padding: 6px 6px;
background-color: ${({ theme }) => theme.blue1};
color: white;
font-size: 11px;
justify-content: space-between;
align-items: center;
display: ${({ isActive }) => (isActive ? 'flex' : 'none')};
`
export const StyledClose = styled(X)`
:hover {
cursor: pointer;
}
`
export default function URLWarning() {
const toggleURLWarning = useURLWarningToggle()
const showURLWarning = useURLWarningVisible()
return isMobile ? (
<PhishAlert isActive={showURLWarning}>
<div style={{ display: 'flex' }}>
<AlertTriangle style={{ marginRight: 6 }} size={12} />
<Trans>
Make sure the URL is
<code style={{ padding: '0 4px', display: 'inline', fontWeight: 'bold' }}>app.uniswap.org</code>
</Trans>
</div>
<StyledClose size={12} onClick={toggleURLWarning} />
</PhishAlert>
) : window.location.hostname === 'app.uniswap.org' ? (
<PhishAlert isActive={showURLWarning}>
<div style={{ display: 'flex' }}>
<AlertTriangle style={{ marginRight: 6 }} size={12} />
<Trans>
Always make sure the URL is
<code style={{ padding: '0 4px', display: 'inline', fontWeight: 'bold' }}>app.uniswap.org</code> - bookmark it
to be safe.
</Trans>
</div>
<StyledClose size={12} onClick={toggleURLWarning} />
</PhishAlert>
) : null
}
...@@ -255,7 +255,7 @@ const StyledExternalLink = styled(ExternalLink).attrs({ ...@@ -255,7 +255,7 @@ const StyledExternalLink = styled(ExternalLink).attrs({
`} `}
` `
export const StyledMenuButton = styled.button` const StyledMenuButton = styled.button`
position: relative; position: relative;
width: 100%; width: 100%;
height: 100%; height: 100%;
......
export const dummyData = [
{ time: '2018-10-19', value: 35.98 },
{ time: '2018-10-22', value: 35.75 },
{ time: '2018-10-23', value: 35.65 },
{ time: '2018-10-24', value: 34.12 },
{ time: '2018-10-25', value: 35.84 },
{ time: '2018-10-26', value: 35.24 },
{ time: '2018-10-29', value: 35.99 },
{ time: '2018-10-30', value: 37.71 },
{ time: '2018-10-31', value: 38.14 },
{ time: '2018-11-01', value: 37.95 },
{ time: '2018-11-02', value: 37.66 },
{ time: '2018-11-05', value: 38.02 },
{ time: '2018-11-06', value: 37.73 },
{ time: '2018-11-07', value: 38.3 },
{ time: '2018-11-08', value: 38.3 },
{ time: '2018-11-09', value: 38.34 },
{ time: '2018-11-12', value: 38.0 },
{ time: '2018-11-13', value: 37.72 },
{ time: '2018-11-14', value: 38.29 },
{ time: '2018-11-15', value: 38.49 },
{ time: '2018-11-16', value: 38.59 },
{ time: '2018-11-19', value: 38.18 },
{ time: '2018-11-20', value: 36.76 },
{ time: '2018-11-21', value: 37.51 },
{ time: '2018-11-23', value: 37.39 },
{ time: '2018-11-26', value: 37.77 },
{ time: '2018-11-27', value: 38.36 },
{ time: '2018-11-28', value: 39.06 },
{ time: '2018-11-29', value: 39.42 },
{ time: '2018-11-30', value: 39.01 },
{ time: '2018-12-03', value: 39.15 },
{ time: '2018-12-04', value: 37.69 },
{ time: '2018-12-06', value: 37.88 },
{ time: '2018-12-07', value: 37.41 },
{ time: '2018-12-10', value: 37.35 },
{ time: '2018-12-11', value: 36.84 },
{ time: '2018-12-12', value: 36.98 },
{ time: '2018-12-13', value: 36.76 },
{ time: '2018-12-14', value: 36.34 },
{ time: '2018-12-17', value: 36.21 },
{ time: '2018-12-18', value: 35.65 },
{ time: '2018-12-19', value: 35.19 },
{ time: '2018-12-20', value: 34.62 },
{ time: '2018-12-21', value: 33.75 },
{ time: '2018-12-24', value: 33.07 },
{ time: '2018-12-26', value: 34.14 },
{ time: '2018-12-27', value: 34.47 },
{ time: '2018-12-28', value: 34.35 },
{ time: '2018-12-31', value: 34.05 },
{ time: '2019-01-02', value: 34.37 },
{ time: '2019-01-03', value: 34.64 },
{ time: '2019-01-04', value: 35.81 },
{ time: '2019-01-07', value: 35.43 },
{ time: '2019-01-08', value: 35.72 },
{ time: '2019-01-09', value: 36.06 },
{ time: '2019-01-10', value: 35.82 },
{ time: '2019-01-11', value: 35.63 },
{ time: '2019-01-14', value: 35.77 },
{ time: '2019-01-15', value: 35.83 },
{ time: '2019-01-16', value: 35.9 },
{ time: '2019-01-17', value: 35.91 },
{ time: '2019-01-18', value: 36.21 },
{ time: '2019-01-22', value: 34.97 },
{ time: '2019-01-23', value: 36.89 },
{ time: '2019-01-24', value: 36.24 },
{ time: '2019-01-25', value: 35.78 },
{ time: '2019-01-28', value: 35.37 },
{ time: '2019-01-29', value: 36.08 },
{ time: '2019-01-30', value: 35.43 },
{ time: '2019-01-31', value: 36.57 },
{ time: '2019-02-01', value: 36.79 },
{ time: '2019-02-04', value: 36.77 },
{ time: '2019-02-05', value: 37.15 },
{ time: '2019-02-06', value: 37.17 },
{ time: '2019-02-07', value: 37.68 },
{ time: '2019-02-08', value: 37.6 },
{ time: '2019-02-11', value: 37.0 },
{ time: '2019-02-12', value: 37.24 },
{ time: '2019-02-13', value: 37.03 },
{ time: '2019-02-14', value: 37.26 },
{ time: '2019-02-15', value: 37.77 },
{ time: '2019-02-19', value: 37.55 },
{ time: '2019-02-20', value: 37.79 },
{ time: '2019-02-21', value: 38.47 },
{ time: '2019-02-22', value: 38.61 },
{ time: '2019-02-25', value: 38.57 },
{ time: '2019-02-26', value: 38.8 },
{ time: '2019-02-27', value: 38.53 },
{ time: '2019-02-28', value: 38.67 },
{ time: '2019-03-01', value: 39.1 },
{ time: '2019-03-04', value: 38.73 },
{ time: '2019-03-05', value: 38.72 },
{ time: '2019-03-06', value: 38.61 },
{ time: '2019-03-07', value: 38.38 },
{ time: '2019-03-08', value: 38.19 },
{ time: '2019-03-11', value: 39.17 },
{ time: '2019-03-12', value: 39.49 },
{ time: '2019-03-13', value: 39.56 },
{ time: '2019-03-14', value: 39.87 },
{ time: '2019-03-15', value: 40.47 },
{ time: '2019-03-18', value: 39.92 },
{ time: '2019-03-19', value: 39.78 },
{ time: '2019-03-20', value: 39.47 },
{ time: '2019-03-21', value: 40.05 },
{ time: '2019-03-22', value: 39.46 },
{ time: '2019-03-25', value: 39.18 },
{ time: '2019-03-26', value: 39.63 },
{ time: '2019-03-27', value: 40.21 },
{ time: '2019-03-28', value: 40.42 },
{ time: '2019-03-29', value: 39.98 },
{ time: '2019-04-01', value: 40.31 },
{ time: '2019-04-02', value: 40.02 },
{ time: '2019-04-03', value: 40.27 },
{ time: '2019-04-04', value: 40.41 },
{ time: '2019-04-05', value: 40.42 },
{ time: '2019-04-08', value: 40.71 },
{ time: '2019-04-09', value: 41.04 },
{ time: '2019-04-10', value: 41.08 },
{ time: '2019-04-11', value: 41.04 },
{ time: '2019-04-12', value: 41.3 },
{ time: '2019-04-15', value: 41.78 },
{ time: '2019-04-16', value: 41.97 },
{ time: '2019-04-17', value: 42.57 },
{ time: '2019-04-18', value: 42.43 },
{ time: '2019-04-22', value: 42.0 },
{ time: '2019-04-23', value: 41.99 },
{ time: '2019-04-24', value: 41.85 },
{ time: '2019-04-25', value: 42.93 },
{ time: '2019-04-26', value: 43.08 },
{ time: '2019-04-29', value: 43.45 },
{ time: '2019-04-30', value: 43.53 },
{ time: '2019-05-01', value: 43.42 },
{ time: '2019-05-02', value: 42.65 },
{ time: '2019-05-03', value: 43.29 },
{ time: '2019-05-06', value: 43.3 },
{ time: '2019-05-07', value: 42.76 },
{ time: '2019-05-08', value: 42.55 },
{ time: '2019-05-09', value: 42.92 },
{ time: '2019-05-10', value: 43.15 },
{ time: '2019-05-13', value: 42.28 },
{ time: '2019-05-14', value: 42.91 },
{ time: '2019-05-15', value: 42.49 },
{ time: '2019-05-16', value: 43.19 },
{ time: '2019-05-17', value: 43.54 },
{ time: '2019-05-20', value: 42.78 },
{ time: '2019-05-21', value: 43.29 },
{ time: '2019-05-22', value: 43.3 },
{ time: '2019-05-23', value: 42.73 },
{ time: '2019-05-24', value: 42.67 },
{ time: '2019-05-28', value: 42.75 },
]
...@@ -10,7 +10,7 @@ const Wrapper = styled(Card)` ...@@ -10,7 +10,7 @@ const Wrapper = styled(Card)`
width: 100%; width: 100%;
padding: 1rem; padding: 1rem;
display: flex; display: flex;
background-color: ${({ theme }) => theme.bg0} background-color: ${({ theme }) => theme.bg0};
flex-direction: column; flex-direction: column;
> * { > * {
font-size: 1rem; font-size: 1rem;
...@@ -19,7 +19,7 @@ const Wrapper = styled(Card)` ...@@ -19,7 +19,7 @@ const Wrapper = styled(Card)`
const DEFAULT_HEIGHT = 300 const DEFAULT_HEIGHT = 300
export type LineChartProps = { type LineChartProps = {
data: any[] data: any[]
color?: string | undefined color?: string | undefined
height?: number | undefined height?: number | undefined
......
...@@ -5,7 +5,7 @@ import useTheme from '../../hooks/useTheme' ...@@ -5,7 +5,7 @@ import useTheme from '../../hooks/useTheme'
const BAD_SRCS: { [tokenAddress: string]: true } = {} const BAD_SRCS: { [tokenAddress: string]: true } = {}
export interface LogoProps extends Pick<ImageProps, 'style' | 'alt' | 'className'> { interface LogoProps extends Pick<ImageProps, 'style' | 'alt' | 'className'> {
srcs: string[] srcs: string[]
} }
......
...@@ -7,7 +7,7 @@ import { PopupContent } from '../../state/application/actions' ...@@ -7,7 +7,7 @@ import { PopupContent } from '../../state/application/actions'
import { useRemovePopup } from '../../state/application/hooks' import { useRemovePopup } from '../../state/application/hooks'
import TransactionPopup from './TransactionPopup' import TransactionPopup from './TransactionPopup'
export const StyledClose = styled(X)` const StyledClose = styled(X)`
position: absolute; position: absolute;
right: 10px; right: 10px;
top: 10px; top: 10px;
...@@ -16,7 +16,7 @@ export const StyledClose = styled(X)` ...@@ -16,7 +16,7 @@ export const StyledClose = styled(X)`
cursor: pointer; cursor: pointer;
} }
` `
export const Popup = styled.div` const Popup = styled.div`
display: inline-block; display: inline-block;
width: 100%; width: 100%;
padding: 1em; padding: 1em;
......
import JSBI from 'jsbi' import JSBI from 'jsbi'
import { Percent, CurrencyAmount, Token } from '@uniswap/sdk-core' import { Percent, CurrencyAmount, Token } from '@uniswap/sdk-core'
import { Pair } from '@uniswap/v2-sdk' import { Pair } from '@uniswap/v2-sdk'
import { darken } from 'polished'
import { useState } from 'react' import { useState } from 'react'
import { ChevronDown, ChevronUp } from 'react-feather' import { ChevronDown, ChevronUp } from 'react-feather'
import { Link } from 'react-router-dom' import { Link } from 'react-router-dom'
...@@ -21,7 +20,7 @@ import { CardNoise } from '../earn/styled' ...@@ -21,7 +20,7 @@ import { CardNoise } from '../earn/styled'
import { useColor } from '../../hooks/useColor' import { useColor } from '../../hooks/useColor'
import Card, { GreyCard, LightCard } from '../Card' import { GreyCard, LightCard } from '../Card'
import { AutoColumn } from '../Column' import { AutoColumn } from '../Column'
import CurrencyLogo from '../CurrencyLogo' import CurrencyLogo from '../CurrencyLogo'
import DoubleCurrencyLogo from '../DoubleLogo' import DoubleCurrencyLogo from '../DoubleLogo'
...@@ -33,12 +32,6 @@ export const FixedHeightRow = styled(RowBetween)` ...@@ -33,12 +32,6 @@ export const FixedHeightRow = styled(RowBetween)`
height: 24px; height: 24px;
` `
export const HoverCard = styled(Card)`
border: 1px solid transparent;
:hover {
border: 1px solid ${({ theme }) => darken(0.06, theme.bg2)};
}
`
const StyledPositionCard = styled(LightCard)<{ bgColor: any }>` const StyledPositionCard = styled(LightCard)<{ bgColor: any }>`
border: none; border: none;
background: ${({ theme, bgColor }) => background: ${({ theme, bgColor }) =>
......
...@@ -34,7 +34,7 @@ const MobileHeader = styled.div` ...@@ -34,7 +34,7 @@ const MobileHeader = styled.div`
} }
` `
export type PositionListProps = React.PropsWithChildren<{ type PositionListProps = React.PropsWithChildren<{
positions: PositionDetails[] positions: PositionDetails[]
}> }>
......
...@@ -117,7 +117,7 @@ const DataText = styled.div` ...@@ -117,7 +117,7 @@ const DataText = styled.div`
`}; `};
` `
export interface PositionListItemProps { interface PositionListItemProps {
positionDetails: PositionDetails positionDetails: PositionDetails
} }
......
import { Text } from 'rebass'
import styled from 'styled-components/macro'
import { RowFixed } from '../Row'
export const FilterWrapper = styled(RowFixed)`
padding: 8px;
background-color: ${({ theme }) => theme.bg2};
color: ${({ theme }) => theme.text1};
border-radius: 8px;
user-select: none;
& > * {
user-select: none;
}
:hover {
cursor: pointer;
}
`
export default function SortButton({
toggleSortOrder,
ascending,
}: {
toggleSortOrder: () => void
ascending: boolean
}) {
return (
<FilterWrapper onClick={toggleSortOrder}>
<Text fontSize={14} fontWeight={500}>
{ascending ? '' : ''}
</Text>
</FilterWrapper>
)
}
import styled from 'styled-components/macro' import styled from 'styled-components/macro'
import { AutoColumn } from '../Column' import { AutoColumn } from '../Column'
import { RowBetween, RowFixed } from '../Row' import { RowBetween } from '../Row'
export const ModalInfo = styled.div`
${({ theme }) => theme.flexRowNoWrap}
align-items: center;
padding: 1rem 1rem;
margin: 0.25rem 0.5rem;
justify-content: center;
flex: 1;
user-select: none;
`
export const StyledMenu = styled.div`
display: flex;
justify-content: center;
align-items: center;
position: relative;
border: none;
`
export const PopoverContainer = styled.div<{ show: boolean }>`
z-index: 100;
visibility: ${(props) => (props.show ? 'visible' : 'hidden')};
opacity: ${(props) => (props.show ? 1 : 0)};
transition: visibility 150ms linear, opacity 150ms linear;
background: ${({ theme }) => theme.bg2};
border: 1px solid ${({ theme }) => theme.bg3};
box-shadow: 0px 0px 1px rgba(0, 0, 0, 0.01), 0px 4px 8px rgba(0, 0, 0, 0.04), 0px 16px 24px rgba(0, 0, 0, 0.04),
0px 24px 32px rgba(0, 0, 0, 0.01);
color: ${({ theme }) => theme.text2};
border-radius: 0.5rem;
padding: 1rem;
display: grid;
grid-template-rows: 1fr;
grid-gap: 8px;
font-size: 1rem;
text-align: left;
top: 80px;
`
export const TextDot = styled.div` export const TextDot = styled.div`
height: 3px; height: 3px;
...@@ -46,10 +9,6 @@ export const TextDot = styled.div` ...@@ -46,10 +9,6 @@ export const TextDot = styled.div`
border-radius: 50%; border-radius: 50%;
` `
export const FadedSpan = styled(RowFixed)`
color: ${({ theme }) => theme.primary1};
font-size: 14px;
`
export const Checkbox = styled.input` export const Checkbox = styled.input`
border: 1px solid ${({ theme }) => theme.red3}; border: 1px solid ${({ theme }) => theme.red3};
height: 20px; height: 20px;
......
import { readableColor } from 'polished'
import styled from 'styled-components/macro'
import { colors } from 'theme'
const Swatch = styled.div`
align-items: center;
display: flex;
flex-direction: column;
height: 100px;
justify-content: center;
min-width: 200px;
`
const Wrapper = styled.div`
display: flex;
flex-wrap: wrap;
flex-direction: row;
`
interface ThemePaletteProps {
isDarkMode: boolean
}
export default function ThemePalette({ isDarkMode }: ThemePaletteProps) {
const data = colors(isDarkMode)
return (
<Wrapper>
{Object.entries(data).map(([key, value]) => (
<Swatch key={key} style={{ color: readableColor(value), backgroundColor: value }}>
<div>{key}</div>
<div>{value}</div>
</Swatch>
))}
</Wrapper>
)
}
...@@ -30,7 +30,7 @@ const StatusText = styled(TYPE.main)<{ isActive?: boolean }>` ...@@ -30,7 +30,7 @@ const StatusText = styled(TYPE.main)<{ isActive?: boolean }>`
color: ${({ theme, isActive }) => (isActive ? theme.text1 : theme.text3)}; color: ${({ theme, isActive }) => (isActive ? theme.text1 : theme.text3)};
` `
export interface ToggleProps { interface ToggleProps {
id?: string id?: string
isActive: boolean isActive: boolean
bgColor: string bgColor: string
......
...@@ -30,7 +30,7 @@ const StyledToggle = styled.button<{ isActive?: boolean; activeElement?: boolean ...@@ -30,7 +30,7 @@ const StyledToggle = styled.button<{ isActive?: boolean; activeElement?: boolean
padding: 2px; padding: 2px;
` `
export interface ToggleProps { interface ToggleProps {
id?: string id?: string
isActive: boolean isActive: boolean
toggle: () => void toggle: () => void
......
...@@ -21,7 +21,7 @@ export default function Tooltip({ text, ...rest }: TooltipProps) { ...@@ -21,7 +21,7 @@ export default function Tooltip({ text, ...rest }: TooltipProps) {
return <Popover content={<TooltipContainer>{text}</TooltipContainer>} {...rest} /> return <Popover content={<TooltipContainer>{text}</TooltipContainer>} {...rest} />
} }
export function TooltipContent({ content, ...rest }: TooltipContentProps) { function TooltipContent({ content, ...rest }: TooltipContentProps) {
return <Popover content={<TooltipContainer>{content}</TooltipContainer>} {...rest} /> return <Popover content={<TooltipContainer>{content}</TooltipContainer>} {...rest} />
} }
......
...@@ -39,7 +39,7 @@ const StyledLogo = styled.img` ...@@ -39,7 +39,7 @@ const StyledLogo = styled.img`
margin-left: 6px; margin-left: 6px;
` `
export function ConfirmationPendingContent({ function ConfirmationPendingContent({
onDismiss, onDismiss,
pendingText, pendingText,
inline, inline,
...@@ -78,7 +78,7 @@ export function ConfirmationPendingContent({ ...@@ -78,7 +78,7 @@ export function ConfirmationPendingContent({
) )
} }
export function TransactionSubmittedContent({ function TransactionSubmittedContent({
onDismiss, onDismiss,
chainId, chainId,
hash, hash,
......
...@@ -87,7 +87,7 @@ const SlippageEmojiContainer = styled.span` ...@@ -87,7 +87,7 @@ const SlippageEmojiContainer = styled.span`
`} `}
` `
export interface TransactionSettingsProps { interface TransactionSettingsProps {
placeholderSlippage: Percent // varies according to the context in which the settings dialog is placed placeholderSlippage: Percent // varies according to the context in which the settings dialog is placed
} }
......
...@@ -5,17 +5,6 @@ import uImage from '../../assets/images/big_unicorn.png' ...@@ -5,17 +5,6 @@ import uImage from '../../assets/images/big_unicorn.png'
import xlUnicorn from '../../assets/images/xl_uni.png' import xlUnicorn from '../../assets/images/xl_uni.png'
import noise from '../../assets/images/noise.png' import noise from '../../assets/images/noise.png'
export const TextBox = styled.div`
display: flex;
align-items: center;
justify-content: center;
padding: 4px 12px;
border: 1px solid rgba(255, 255, 255, 0.4);
border-radius: 20px;
width: fit-content;
justify-self: flex-end;
`
export const DataCard = styled(AutoColumn)<{ disabled?: boolean }>` export const DataCard = styled(AutoColumn)<{ disabled?: boolean }>`
background: radial-gradient(76.02% 75.41% at 1.84% 0%, #ff007a 0%, #2172e5 100%); background: radial-gradient(76.02% 75.41% at 1.84% 0%, #ff007a 0%, #2172e5 100%);
border-radius: 12px; border-radius: 12px;
......
...@@ -11,7 +11,7 @@ import { RowBetween, RowFixed } from '../Row' ...@@ -11,7 +11,7 @@ import { RowBetween, RowFixed } from '../Row'
import FormattedPriceImpact from './FormattedPriceImpact' import FormattedPriceImpact from './FormattedPriceImpact'
import SwapRoute from './SwapRoute' import SwapRoute from './SwapRoute'
export interface AdvancedSwapDetailsProps { interface AdvancedSwapDetailsProps {
trade?: V2Trade<Currency, Currency, TradeType> | V3Trade<Currency, Currency, TradeType> trade?: V2Trade<Currency, Currency, TradeType> | V3Trade<Currency, Currency, TradeType>
allowedSlippage: Percent allowedSlippage: Percent
} }
......
import styled from 'styled-components/macro'
import { useLastTruthy } from '../../hooks/useLast'
import { AdvancedSwapDetails, AdvancedSwapDetailsProps } from './AdvancedSwapDetails'
const AdvancedDetailsFooter = styled.div<{ show: boolean }>`
width: 100%;
border-bottom-left-radius: 20px;
border-bottom-right-radius: 20px;
color: ${({ theme }) => theme.text2};
`
export default function AdvancedSwapDetailsDropdown({ trade, ...rest }: AdvancedSwapDetailsProps) {
const lastTrade = useLastTruthy(trade)
return (
<AdvancedDetailsFooter show={Boolean(trade)}>
<AdvancedSwapDetails {...rest} trade={trade ?? lastTrade ?? undefined} />
</AdvancedDetailsFooter>
)
}
import { Percent } from '@uniswap/sdk-core' import { Percent } from '@uniswap/sdk-core'
import { warningSeverity } from '../../utils/prices' import { warningSeverity } from '../../utils/prices'
import { ErrorText, ErrorPill } from './styleds' import { ErrorText } from './styleds'
/** /**
* Formatted version of price impact text with warning colors * Formatted version of price impact text with warning colors
...@@ -12,11 +12,3 @@ export default function FormattedPriceImpact({ priceImpact }: { priceImpact?: Pe ...@@ -12,11 +12,3 @@ export default function FormattedPriceImpact({ priceImpact }: { priceImpact?: Pe
</ErrorText> </ErrorText>
) )
} }
export function SmallFormattedPriceImpact({ priceImpact }: { priceImpact?: Percent }) {
return (
<ErrorPill fontWeight={500} fontSize={12} severity={warningSeverity(priceImpact)}>
{priceImpact ? `(${priceImpact.multiply(-1).toFixed(2)}%)` : '-'}
</ErrorPill>
)
}
...@@ -22,7 +22,7 @@ import { LightCard } from '../Card' ...@@ -22,7 +22,7 @@ import { LightCard } from '../Card'
import TradePrice from '../swap/TradePrice' import TradePrice from '../swap/TradePrice'
export const ArrowWrapper = styled.div` const ArrowWrapper = styled.div`
padding: 4px; padding: 4px;
border-radius: 12px; border-radius: 12px;
height: 32px; height: 32px;
......
import { transparentize } from 'polished' import { transparentize } from 'polished'
import { ReactNode } from 'react' import { ReactNode } from 'react'
import { Link } from 'react-router-dom'
import { AlertTriangle } from 'react-feather' import { AlertTriangle } from 'react-feather'
import styled, { css } from 'styled-components' import styled, { css } from 'styled-components'
...@@ -42,11 +41,6 @@ export const SectionBreak = styled.div` ...@@ -42,11 +41,6 @@ export const SectionBreak = styled.div`
background-color: ${({ theme }) => theme.bg3}; background-color: ${({ theme }) => theme.bg3};
` `
export const BottomGrouping = styled.div`
margin-top: ;
/* background-color: ${({ theme }) => theme.bg1}; */
`
export const ErrorText = styled(Text)<{ severity?: 0 | 1 | 2 | 3 | 4 }>` export const ErrorText = styled(Text)<{ severity?: 0 | 1 | 2 | 3 | 4 }>`
color: ${({ theme, severity }) => color: ${({ theme, severity }) =>
severity === 3 || severity === 4 severity === 3 || severity === 4
...@@ -58,55 +52,6 @@ export const ErrorText = styled(Text)<{ severity?: 0 | 1 | 2 | 3 | 4 }>` ...@@ -58,55 +52,6 @@ export const ErrorText = styled(Text)<{ severity?: 0 | 1 | 2 | 3 | 4 }>`
: theme.text2}; : theme.text2};
` `
export const ErrorPill = styled(Text)<{ severity?: 0 | 1 | 2 | 3 | 4 }>`
border-radius: 8px;
color: ${({ theme, severity }) =>
severity === 3 || severity === 4
? theme.red1
: severity === 2
? theme.yellow2
: severity === 1
? theme.text1
: theme.text3};
/* background-color: ${({ theme, severity }) =>
severity === 3 || severity === 4
? transparentize(0.9, theme.red1)
: severity === 2
? transparentize(0.9, theme.yellow2)
: severity === 1
? transparentize(0.9, theme.text1)
: transparentize(0.9, theme.green1)}; */
`
export const StyledBalanceMaxMini = styled.button`
/* height: 22px; */
width: fit-content;
background-color: ${({ theme }) => theme.bg1};
border: none;
border-radius: 8px;
padding: 0;
font-size: 0.875rem;
font-weight: 400;
opacity: 0.6;
margin-right: 0.5rem;
cursor: pointer;
color: ${({ theme }) => theme.text1};
display: flex;
justify-content: center;
align-items: center;
float: right;
:hover {
background-color: ${({ theme }) => theme.bg2};
}
:focus {
background-color: ${({ theme }) => theme.bg2};
outline: none;
}
`
export const TruncatedText = styled(Text)` export const TruncatedText = styled(Text)`
text-overflow: ellipsis; text-overflow: ellipsis;
max-width: 220px; max-width: 220px;
...@@ -183,19 +128,3 @@ export const SwapShowAcceptChanges = styled(AutoColumn)` ...@@ -183,19 +128,3 @@ export const SwapShowAcceptChanges = styled(AutoColumn)`
border-radius: 12px; border-radius: 12px;
margin-top: 8px; margin-top: 8px;
` `
export const Separator = styled.div`
width: 100%;
height: 1px;
background-color: ${({ theme }) => theme.bg2};
`
export const V2TradeAlertWrapper = styled(Link)`
background-color: ${({ theme }) => theme.bg2};
display: flex;
align-items: center;
border-radius: 12px;
height: 22px;
margin-right: 0.5rem;
padding: 0 0.25rem 0 0.5rem;
text-decoration: none !important;
`
...@@ -28,7 +28,7 @@ interface BatchItem { ...@@ -28,7 +28,7 @@ interface BatchItem {
reject: (error: Error) => void reject: (error: Error) => void
} }
export class MiniRpcProvider implements AsyncSendable { class MiniRpcProvider implements AsyncSendable {
public readonly isMetaMask: false = false public readonly isMetaMask: false = false
public readonly chainId: number public readonly chainId: number
public readonly url: string public readonly url: string
......
...@@ -14,8 +14,9 @@ export const BIG_INT_SECONDS_IN_WEEK = JSBI.BigInt(60 * 60 * 24 * 7) ...@@ -14,8 +14,9 @@ export const BIG_INT_SECONDS_IN_WEEK = JSBI.BigInt(60 * 60 * 24 * 7)
export const BIG_INT_ZERO = JSBI.BigInt(0) export const BIG_INT_ZERO = JSBI.BigInt(0)
// one basis JSBI.BigInt // one basis JSBI.BigInt
export const ONE_BIPS = new Percent(JSBI.BigInt(1), JSBI.BigInt(10000)) const BIPS_BASE = JSBI.BigInt(10000)
export const BIPS_BASE = JSBI.BigInt(10000) export const ONE_BIPS = new Percent(JSBI.BigInt(1), BIPS_BASE)
// used for warning states // used for warning states
export const ALLOWED_PRICE_IMPACT_LOW: Percent = new Percent(JSBI.BigInt(100), BIPS_BASE) // 1% export const ALLOWED_PRICE_IMPACT_LOW: Percent = new Percent(JSBI.BigInt(100), BIPS_BASE) // 1%
export const ALLOWED_PRICE_IMPACT_MEDIUM: Percent = new Percent(JSBI.BigInt(300), BIPS_BASE) // 3% export const ALLOWED_PRICE_IMPACT_MEDIUM: Percent = new Percent(JSBI.BigInt(300), BIPS_BASE) // 3%
...@@ -25,8 +26,7 @@ export const PRICE_IMPACT_WITHOUT_FEE_CONFIRM_MIN: Percent = new Percent(JSBI.Bi ...@@ -25,8 +26,7 @@ export const PRICE_IMPACT_WITHOUT_FEE_CONFIRM_MIN: Percent = new Percent(JSBI.Bi
// for non expert mode disable swaps above this // for non expert mode disable swaps above this
export const BLOCKED_PRICE_IMPACT_NON_EXPERT: Percent = new Percent(JSBI.BigInt(1500), BIPS_BASE) // 15% export const BLOCKED_PRICE_IMPACT_NON_EXPERT: Percent = new Percent(JSBI.BigInt(1500), BIPS_BASE) // 15%
// used to ensure the user doesn't send so much ETH so they end up with <.01 export const BETTER_TRADE_LESS_HOPS_THRESHOLD = new Percent(JSBI.BigInt(50), BIPS_BASE)
export const BETTER_TRADE_LESS_HOPS_THRESHOLD = new Percent(JSBI.BigInt(50), JSBI.BigInt(10000))
export const ZERO_PERCENT = new Percent('0') export const ZERO_PERCENT = new Percent('0')
export const ONE_HUNDRED_PERCENT = new Percent('1') export const ONE_HUNDRED_PERCENT = new Percent('1')
...@@ -7,7 +7,7 @@ import PORTIS_ICON_URL from '../assets/images/portisIcon.png' ...@@ -7,7 +7,7 @@ import PORTIS_ICON_URL from '../assets/images/portisIcon.png'
import WALLETCONNECT_ICON_URL from '../assets/images/walletConnectIcon.svg' import WALLETCONNECT_ICON_URL from '../assets/images/walletConnectIcon.svg'
import { fortmatic, injected, portis, walletconnect, walletlink } from '../connectors' import { fortmatic, injected, portis, walletconnect, walletlink } from '../connectors'
export interface WalletInfo { interface WalletInfo {
connector?: AbstractConnector connector?: AbstractConnector
name: string name: string
iconURL: string iconURL: string
......
...@@ -4,7 +4,6 @@ import { abi as UNI_ABI } from '@uniswap/governance/build/Uni.json' ...@@ -4,7 +4,6 @@ import { abi as UNI_ABI } from '@uniswap/governance/build/Uni.json'
import { abi as STAKING_REWARDS_ABI } from '@uniswap/liquidity-staker/build/StakingRewards.json' import { abi as STAKING_REWARDS_ABI } from '@uniswap/liquidity-staker/build/StakingRewards.json'
import { abi as MERKLE_DISTRIBUTOR_ABI } from '@uniswap/merkle-distributor/build/MerkleDistributor.json' import { abi as MERKLE_DISTRIBUTOR_ABI } from '@uniswap/merkle-distributor/build/MerkleDistributor.json'
import { abi as IUniswapV2PairABI } from '@uniswap/v2-core/build/IUniswapV2Pair.json' import { abi as IUniswapV2PairABI } from '@uniswap/v2-core/build/IUniswapV2Pair.json'
import { abi as V3FactoryABI } from '@uniswap/v3-core/artifacts/contracts/UniswapV3Factory.sol/UniswapV3Factory.json'
import { abi as QuoterABI } from '@uniswap/v3-periphery/artifacts/contracts/lens/Quoter.sol/Quoter.json' import { abi as QuoterABI } from '@uniswap/v3-periphery/artifacts/contracts/lens/Quoter.sol/Quoter.json'
import { abi as V2MigratorABI } from '@uniswap/v3-periphery/artifacts/contracts/V3Migrator.sol/V3Migrator.json' import { abi as V2MigratorABI } from '@uniswap/v3-periphery/artifacts/contracts/V3Migrator.sol/V3Migrator.json'
import { abi as IUniswapV2Router02ABI } from '@uniswap/v2-periphery/build/IUniswapV2Router02.json' import { abi as IUniswapV2Router02ABI } from '@uniswap/v2-periphery/build/IUniswapV2Router02.json'
...@@ -15,28 +14,24 @@ import ENS_PUBLIC_RESOLVER_ABI from 'abis/ens-public-resolver.json' ...@@ -15,28 +14,24 @@ import ENS_PUBLIC_RESOLVER_ABI from 'abis/ens-public-resolver.json'
import ENS_ABI from 'abis/ens-registrar.json' import ENS_ABI from 'abis/ens-registrar.json'
import ERC20_ABI from 'abis/erc20.json' import ERC20_ABI from 'abis/erc20.json'
import ERC20_BYTES32_ABI from 'abis/erc20_bytes32.json' import ERC20_BYTES32_ABI from 'abis/erc20_bytes32.json'
import { Unisocks } from 'abis/types/Unisocks'
import UNISOCKS_ABI from 'abis/unisocks.json'
import WETH_ABI from 'abis/weth.json' import WETH_ABI from 'abis/weth.json'
import EIP_2612 from 'abis/eip_2612.json' import EIP_2612 from 'abis/eip_2612.json'
import { import {
NONFUNGIBLE_POSITION_MANAGER_ADDRESSES, NONFUNGIBLE_POSITION_MANAGER_ADDRESSES,
QUOTER_ADDRESSES, QUOTER_ADDRESSES,
V3_CORE_FACTORY_ADDRESSES,
V3_MIGRATOR_ADDRESSES, V3_MIGRATOR_ADDRESSES,
ARGENT_WALLET_DETECTOR_ADDRESS, ARGENT_WALLET_DETECTOR_ADDRESS,
MERKLE_DISTRIBUTOR_ADDRESS, MERKLE_DISTRIBUTOR_ADDRESS,
MULTICALL_ADDRESS, MULTICALL_ADDRESS,
V2_ROUTER_ADDRESS, V2_ROUTER_ADDRESS,
ENS_REGISTRAR_ADDRESSES, ENS_REGISTRAR_ADDRESSES,
SOCKS_CONTROLLER_ADDRESSES,
GOVERNANCE_ALPHA_V0_ADDRESSES, GOVERNANCE_ALPHA_V0_ADDRESSES,
GOVERNANCE_ALPHA_V1_ADDRESSES, GOVERNANCE_ALPHA_V1_ADDRESSES,
} from 'constants/addresses' } from 'constants/addresses'
import { abi as NFTPositionManagerABI } from '@uniswap/v3-periphery/artifacts/contracts/NonfungiblePositionManager.sol/NonfungiblePositionManager.json' import { abi as NFTPositionManagerABI } from '@uniswap/v3-periphery/artifacts/contracts/NonfungiblePositionManager.sol/NonfungiblePositionManager.json'
import { useMemo } from 'react' import { useMemo } from 'react'
import { Quoter, UniswapV3Factory, NonfungiblePositionManager, UniswapInterfaceMulticall } from 'types/v3' import { Quoter, NonfungiblePositionManager, UniswapInterfaceMulticall } from 'types/v3'
import { V3Migrator } from 'types/v3/V3Migrator' import { V3Migrator } from 'types/v3/V3Migrator'
import { getContract } from 'utils' import { getContract } from 'utils'
import { Erc20, ArgentWalletDetector, EnsPublicResolver, EnsRegistrar, Weth } from '../abis/types' import { Erc20, ArgentWalletDetector, EnsPublicResolver, EnsRegistrar, Weth } from '../abis/types'
...@@ -134,10 +129,6 @@ export function useStakingContract(stakingAddress?: string, withSignerIfPossible ...@@ -134,10 +129,6 @@ export function useStakingContract(stakingAddress?: string, withSignerIfPossible
return useContract(stakingAddress, STAKING_REWARDS_ABI, withSignerIfPossible) return useContract(stakingAddress, STAKING_REWARDS_ABI, withSignerIfPossible)
} }
export function useSocksController(): Unisocks | null {
return useContract<Unisocks>(SOCKS_CONTROLLER_ADDRESSES, UNISOCKS_ABI, false)
}
export function useV3NFTPositionManagerContract(withSignerIfPossible?: boolean): NonfungiblePositionManager | null { export function useV3NFTPositionManagerContract(withSignerIfPossible?: boolean): NonfungiblePositionManager | null {
return useContract<NonfungiblePositionManager>( return useContract<NonfungiblePositionManager>(
NONFUNGIBLE_POSITION_MANAGER_ADDRESSES, NONFUNGIBLE_POSITION_MANAGER_ADDRESSES,
...@@ -146,10 +137,6 @@ export function useV3NFTPositionManagerContract(withSignerIfPossible?: boolean): ...@@ -146,10 +137,6 @@ export function useV3NFTPositionManagerContract(withSignerIfPossible?: boolean):
) )
} }
export function useV3Factory() {
return useContract<UniswapV3Factory>(V3_CORE_FACTORY_ADDRESSES, V3FactoryABI) as UniswapV3Factory | null
}
export function useV3Quoter() { export function useV3Quoter() {
return useContract<Quoter>(QUOTER_ADDRESSES, QuoterABI) return useContract<Quoter>(QUOTER_ADDRESSES, QuoterABI)
} }
...@@ -75,11 +75,11 @@ interface BaseSignatureData { ...@@ -75,11 +75,11 @@ interface BaseSignatureData {
permitType: PermitType permitType: PermitType
} }
export interface StandardSignatureData extends BaseSignatureData { interface StandardSignatureData extends BaseSignatureData {
amount: string amount: string
} }
export interface AllowedSignatureData extends BaseSignatureData { interface AllowedSignatureData extends BaseSignatureData {
allowed: true allowed: true
} }
...@@ -114,7 +114,7 @@ const PERMIT_ALLOWED_TYPE = [ ...@@ -114,7 +114,7 @@ const PERMIT_ALLOWED_TYPE = [
{ name: 'allowed', type: 'bool' }, { name: 'allowed', type: 'bool' },
] ]
export function useERC20Permit( function useERC20Permit(
currencyAmount: CurrencyAmount<Currency> | null | undefined, currencyAmount: CurrencyAmount<Currency> | null | undefined,
spender: string | null | undefined, spender: string | null | undefined,
overridePermitInfo: PermitInfo | undefined | null overridePermitInfo: PermitInfo | undefined | null
......
...@@ -12,7 +12,7 @@ import ms from 'ms.macro' ...@@ -12,7 +12,7 @@ import ms from 'ms.macro'
// maximum number of blocks past which we consider the data stale // maximum number of blocks past which we consider the data stale
const MAX_DATA_BLOCK_AGE = 10 const MAX_DATA_BLOCK_AGE = 10
export interface FeeTierDistribution { interface FeeTierDistribution {
isLoading: boolean isLoading: boolean
isError: boolean isError: boolean
largestUsageFeeTier?: FeeAmount | undefined largestUsageFeeTier?: FeeAmount | undefined
......
...@@ -19,15 +19,3 @@ export default function useLast<T>( ...@@ -19,15 +19,3 @@ export default function useLast<T>(
}, [filterFn, value]) }, [filterFn, value])
return last return last
} }
function isDefined<T>(x: T | null | undefined): x is T {
return x !== null && x !== undefined
}
/**
* Returns the last truthy value of type T
* @param value changing value
*/
export function useLastTruthy<T>(value: T | undefined | null): T | null | undefined {
return useLast(value, isDefined)
}
import JSBI from 'jsbi'
import { useMemo } from 'react' import { useMemo } from 'react'
import { NEVER_RELOAD, useSingleCallResult } from '../state/multicall/hooks'
import { useActiveWeb3React } from './web3' import { useActiveWeb3React } from './web3'
import { useSocksController } from './useContract' import { useTokenBalance } from 'state/wallet/hooks'
import { SOCKS_CONTROLLER_ADDRESSES } from 'constants/addresses'
import { Token } from '@uniswap/sdk-core'
import { SupportedChainId } from 'constants/chains'
export default function useSocksBalance(): JSBI | undefined { // technically a 721, not an ERC20, but suffices for our purposes
const { account } = useActiveWeb3React() const SOCKS = new Token(SupportedChainId.MAINNET, SOCKS_CONTROLLER_ADDRESSES[SupportedChainId.MAINNET], 0)
const socksContract = useSocksController()
const inputs = useMemo(() => [account ?? undefined], [account])
const { result } = useSingleCallResult(socksContract, 'balanceOf', inputs, NEVER_RELOAD)
const data = result?.[0]
return data ? JSBI.BigInt(data.toString()) : undefined
}
export function useHasSocks(): boolean | undefined { export function useHasSocks(): boolean | undefined {
const balance = useSocksBalance() const { account, chainId } = useActiveWeb3React()
return useMemo(() => balance && JSBI.greaterThan(balance, JSBI.BigInt(0)), [balance])
const balance = useTokenBalance(account ?? undefined, chainId === SupportedChainId.MAINNET ? SOCKS : undefined)
return useMemo(() => Boolean(balance?.greaterThan(0)), [balance])
} }
...@@ -19,7 +19,7 @@ import useTransactionDeadline from './useTransactionDeadline' ...@@ -19,7 +19,7 @@ import useTransactionDeadline from './useTransactionDeadline'
import useENS from './useENS' import useENS from './useENS'
import { Version } from './useToggledVersion' import { Version } from './useToggledVersion'
export enum SwapCallbackState { enum SwapCallbackState {
INVALID, INVALID,
LOADING, LOADING,
VALID, VALID,
...@@ -191,7 +191,7 @@ function useSwapCallArguments( ...@@ -191,7 +191,7 @@ function useSwapCallArguments(
* This object seems to be undocumented by ethers. * This object seems to be undocumented by ethers.
* @param error an error from the ethers provider * @param error an error from the ethers provider
*/ */
export function swapErrorToUserReadableMessage(error: any): string { function swapErrorToUserReadableMessage(error: any): string {
let reason: string | undefined let reason: string | undefined
while (Boolean(error)) { while (Boolean(error)) {
reason = error.reason ?? error.message ?? reason reason = error.reason ?? error.message ?? reason
......
import { Token, Price } from '@uniswap/sdk-core'
import { tickToPrice } from '@uniswap/v3-sdk'
export function getTickToPrice(
baseToken: Token | undefined,
quoteToken: Token | undefined,
tick: number | undefined
): Price<Token, Token> | undefined {
if (!baseToken || !quoteToken || !tick) {
return undefined
}
return tickToPrice(baseToken, quoteToken, tick)
}
...@@ -75,7 +75,7 @@ const plurals: LocalePlural = { ...@@ -75,7 +75,7 @@ const plurals: LocalePlural = {
'zh-TW': zh, 'zh-TW': zh,
} }
export async function dynamicActivate(locale: SupportedLocale) { async function dynamicActivate(locale: SupportedLocale) {
const { messages } = await import(`@lingui/loader!./locales/${locale}.po`) const { messages } = await import(`@lingui/loader!./locales/${locale}.po`)
i18n.loadLocaleData(locale, { plurals: () => plurals[locale] }) i18n.loadLocaleData(locale, { plurals: () => plurals[locale] })
i18n.load(locale, messages) i18n.load(locale, messages)
......
import { Currency, Percent, Price } from '@uniswap/sdk-core'
import { useContext } from 'react'
import { Text } from 'rebass'
import { ThemeContext } from 'styled-components'
import { AutoColumn } from '../../components/Column'
import { AutoRow } from '../../components/Row'
import { ONE_BIPS } from '../../constants/misc'
import { Field } from '../../state/mint/v3/actions'
import { TYPE } from '../../theme'
export function PoolPriceBar({
currencies,
noLiquidity,
poolTokenPercentage,
price,
}: {
currencies: { [field in Field]?: Currency }
noLiquidity?: boolean
poolTokenPercentage?: Percent
price?: Price<Currency, Currency>
}) {
const theme = useContext(ThemeContext)
return (
<AutoColumn gap="md">
<AutoRow justify="space-around" gap="4px">
<AutoColumn justify="center">
<TYPE.black>{price?.toSignificant(6) ?? '-'}</TYPE.black>
<Text fontWeight={500} fontSize={14} color={theme.text2} pt={1}>
{currencies[Field.CURRENCY_B]?.symbol} per {currencies[Field.CURRENCY_A]?.symbol}
</Text>
</AutoColumn>
<AutoColumn justify="center">
<TYPE.black>{price?.invert()?.toSignificant(6) ?? '-'}</TYPE.black>
<Text fontWeight={500} fontSize={14} color={theme.text2} pt={1}>
{currencies[Field.CURRENCY_A]?.symbol} per {currencies[Field.CURRENCY_B]?.symbol}
</Text>
</AutoColumn>
<AutoColumn justify="center">
<TYPE.black>
{noLiquidity && price
? '100'
: (poolTokenPercentage?.lessThan(ONE_BIPS) ? '<0.01' : poolTokenPercentage?.toFixed(2)) ?? '0'}
%
</TYPE.black>
<Text fontWeight={500} fontSize={14} color={theme.text2} pt={1}>
Share of Pool
</Text>
</AutoColumn>
</AutoRow>
</AutoColumn>
)
}
import { Field } from '../../state/mint/v3/actions' import { Field } from '../../state/mint/v3/actions'
import { AutoColumn } from 'components/Column' import { AutoColumn } from 'components/Column'
import Card from 'components/Card'
import styled from 'styled-components/macro' import styled from 'styled-components/macro'
import { Currency, CurrencyAmount, Price } from '@uniswap/sdk-core' import { Currency, CurrencyAmount, Price } from '@uniswap/sdk-core'
import { Position } from '@uniswap/v3-sdk' import { Position } from '@uniswap/v3-sdk'
...@@ -10,15 +9,6 @@ const Wrapper = styled.div` ...@@ -10,15 +9,6 @@ const Wrapper = styled.div`
padding-top: 12px; padding-top: 12px;
` `
export const Badge = styled(Card)<{ inRange?: boolean }>`
width: fit-content;
font-size: 14px;
font-weight: 500;
border-radius: 8px;
padding: 4px 6px;
background-color: ${({ inRange, theme }) => (inRange ? theme.green1 : theme.yellow2)};
`
export function Review({ export function Review({
position, position,
outOfRange, outOfRange,
...@@ -38,5 +28,3 @@ export function Review({ ...@@ -38,5 +28,3 @@ export function Review({
</Wrapper> </Wrapper>
) )
} }
export default Review
...@@ -21,7 +21,7 @@ import { useIsSwapUnsupported } from '../../hooks/useIsSwapUnsupported' ...@@ -21,7 +21,7 @@ import { useIsSwapUnsupported } from '../../hooks/useIsSwapUnsupported'
import { useUSDCValue } from '../../hooks/useUSDCPrice' import { useUSDCValue } from '../../hooks/useUSDCPrice'
import approveAmountCalldata from '../../utils/approveAmountCalldata' import approveAmountCalldata from '../../utils/approveAmountCalldata'
import { calculateGasMargin } from '../../utils/calculateGasMargin' import { calculateGasMargin } from '../../utils/calculateGasMargin'
import Review from './Review' import { Review } from './Review'
import { useActiveWeb3React } from '../../hooks/web3' import { useActiveWeb3React } from '../../hooks/web3'
import { useCurrency } from '../../hooks/Tokens' import { useCurrency } from '../../hooks/Tokens'
import { ApprovalState, useApproveCallback } from '../../hooks/useApproveCallback' import { ApprovalState, useApproveCallback } from '../../hooks/useApproveCallback'
......
import styled from 'styled-components/macro' import styled from 'styled-components/macro'
import { AutoColumn } from 'components/Column' import { AutoColumn } from 'components/Column'
import CurrencyInputPanel from 'components/CurrencyInputPanel' import CurrencyInputPanel from 'components/CurrencyInputPanel'
import { DarkGreyCard } from 'components/Card'
import Input from 'components/NumericalInput' import Input from 'components/NumericalInput'
export const Wrapper = styled.div` export const Wrapper = styled.div`
...@@ -24,20 +23,6 @@ export const ScrollablePage = styled.div` ...@@ -24,20 +23,6 @@ export const ScrollablePage = styled.div`
flex-direction: row; flex-direction: row;
` `
export const FixedPreview = styled.div`
position: relative;
padding: 16px;
width: 260px;
height: fit-content;
margin-top: 42px;
background: ${({ theme }) => theme.bg0};
box-shadow: 0px 0px 1px rgba(0, 0, 0, 0.01), 0px 4px 8px rgba(0, 0, 0, 0.04), 0px 16px 24px rgba(0, 0, 0, 0.04),
0px 24px 32px rgba(0, 0, 0, 0.01);
border-radius: 12px;
position: sticky;
top: 64px;
`
export const DynamicSection = styled(AutoColumn)<{ disabled?: boolean }>` export const DynamicSection = styled(AutoColumn)<{ disabled?: boolean }>`
opacity: ${({ disabled }) => (disabled ? '0.3' : '1')}; opacity: ${({ disabled }) => (disabled ? '0.3' : '1')};
pointer-events: ${({ disabled }) => (disabled ? 'none' : 'initial')}; pointer-events: ${({ disabled }) => (disabled ? 'none' : 'initial')};
...@@ -47,16 +32,6 @@ export const CurrencyDropdown = styled(CurrencyInputPanel)` ...@@ -47,16 +32,6 @@ export const CurrencyDropdown = styled(CurrencyInputPanel)`
width: 48.5%; width: 48.5%;
` `
export const PreviewCard = styled(DarkGreyCard)<{ disabled?: boolean }>`
padding: 8px;
border-radius: 12px;
min-height: 40px;
opacity: ${({ disabled }) => (disabled ? '0.2' : '1')};
display: flex;
align-items: center;
justify-content: center;
`
export const StyledInput = styled(Input)` export const StyledInput = styled(Input)`
background-color: ${({ theme }) => theme.bg0}; background-color: ${({ theme }) => theme.bg0};
text-align: left; text-align: left;
......
...@@ -82,13 +82,6 @@ const Label = styled(({ end, ...props }) => <TYPE.label {...props} />)<{ end?: b ...@@ -82,13 +82,6 @@ const Label = styled(({ end, ...props }) => <TYPE.label {...props} />)<{ end?: b
align-items: center; align-items: center;
` `
export const DarkBadge = styled.div`
width: fit-content;
border-radius: 8px;
background-color: ${({ theme }) => theme.bg0};
padding: 4px 6px;
`
const ExtentsText = styled.span` const ExtentsText = styled.span`
color: ${({ theme }) => theme.text2}; color: ${({ theme }) => theme.text2};
font-size: 14px; font-size: 14px;
......
...@@ -36,8 +36,6 @@ import RangeBadge from 'components/Badge/RangeBadge' ...@@ -36,8 +36,6 @@ import RangeBadge from 'components/Badge/RangeBadge'
import Toggle from 'components/Toggle' import Toggle from 'components/Toggle'
import { t, Trans } from '@lingui/macro' import { t, Trans } from '@lingui/macro'
export const UINT128MAX = BigNumber.from(2).pow(128).sub(1)
const DEFAULT_REMOVE_V3_LIQUIDITY_SLIPPAGE_TOLERANCE = new Percent(5, 100) const DEFAULT_REMOVE_V3_LIQUIDITY_SLIPPAGE_TOLERANCE = new Percent(5, 100)
// redirect invalid tokenIds // redirect invalid tokenIds
......
...@@ -24,7 +24,7 @@ import Row, { AutoRow, RowFixed } from '../../components/Row' ...@@ -24,7 +24,7 @@ import Row, { AutoRow, RowFixed } from '../../components/Row'
import BetterTradeLink from '../../components/swap/BetterTradeLink' import BetterTradeLink from '../../components/swap/BetterTradeLink'
import confirmPriceImpactWithoutFee from '../../components/swap/confirmPriceImpactWithoutFee' import confirmPriceImpactWithoutFee from '../../components/swap/confirmPriceImpactWithoutFee'
import ConfirmSwapModal from '../../components/swap/ConfirmSwapModal' import ConfirmSwapModal from '../../components/swap/ConfirmSwapModal'
import { ArrowWrapper, BottomGrouping, Dots, SwapCallbackError, Wrapper } from '../../components/swap/styleds' import { ArrowWrapper, Dots, SwapCallbackError, Wrapper } from '../../components/swap/styleds'
import SwapHeader from '../../components/swap/SwapHeader' import SwapHeader from '../../components/swap/SwapHeader'
import TradePrice from '../../components/swap/TradePrice' import TradePrice from '../../components/swap/TradePrice'
import { SwitchLocaleLink } from '../../components/SwitchLocaleLink' import { SwitchLocaleLink } from '../../components/SwitchLocaleLink'
...@@ -504,7 +504,7 @@ export default function Swap({ history }: RouteComponentProps) { ...@@ -504,7 +504,7 @@ export default function Swap({ history }: RouteComponentProps) {
</Row> </Row>
)} )}
<BottomGrouping> <div>
{swapIsUnsupported ? ( {swapIsUnsupported ? (
<ButtonPrimary disabled={true}> <ButtonPrimary disabled={true}>
<TYPE.main mb="4px"> <TYPE.main mb="4px">
...@@ -655,7 +655,7 @@ export default function Swap({ history }: RouteComponentProps) { ...@@ -655,7 +655,7 @@ export default function Swap({ history }: RouteComponentProps) {
</ButtonError> </ButtonError>
)} )}
{isExpertMode && swapErrorMessage ? <SwapCallbackError error={swapErrorMessage} /> : null} {isExpertMode && swapErrorMessage ? <SwapCallbackError error={swapErrorMessage} /> : null}
</BottomGrouping> </div>
</AutoColumn> </AutoColumn>
</Wrapper> </Wrapper>
</AppBody> </AppBody>
......
import styled from 'styled-components/macro'
export const StandardPageWrapper = styled.div`
padding-top: 160px;
width: 100%;
`
...@@ -21,16 +21,6 @@ export function useToggleModal(modal: ApplicationModal): () => void { ...@@ -21,16 +21,6 @@ export function useToggleModal(modal: ApplicationModal): () => void {
return useCallback(() => dispatch(setOpenModal(open ? null : modal)), [dispatch, modal, open]) return useCallback(() => dispatch(setOpenModal(open ? null : modal)), [dispatch, modal, open])
} }
export function useOpenModal(modal: ApplicationModal): () => void {
const dispatch = useAppDispatch()
return useCallback(() => dispatch(setOpenModal(modal)), [dispatch, modal])
}
export function useCloseModals(): () => void {
const dispatch = useAppDispatch()
return useCallback(() => dispatch(setOpenModal(null)), [dispatch])
}
export function useWalletModalToggle(): () => void { export function useWalletModalToggle(): () => void {
return useToggleModal(ApplicationModal.WALLET) return useToggleModal(ApplicationModal.WALLET)
} }
......
import { createReducer } from '@reduxjs/toolkit' import { createReducer } from '@reduxjs/toolkit'
import { Field, typeInput } from './actions' import { Field, typeInput } from './actions'
export interface BurnState { interface BurnState {
readonly independentField: Field readonly independentField: Field
readonly typedValue: string readonly typedValue: string
} }
......
import { createReducer } from '@reduxjs/toolkit' import { createReducer } from '@reduxjs/toolkit'
import { selectPercent } from './actions' import { selectPercent } from './actions'
export interface BurnV3State { interface BurnV3State {
readonly percent: number readonly percent: number
} }
......
import { ActionCreatorWithPayload, createAction } from '@reduxjs/toolkit' import { ActionCreatorWithPayload, createAction } from '@reduxjs/toolkit'
import { TokenList, Version } from '@uniswap/token-lists' import { TokenList } from '@uniswap/token-lists'
export const fetchTokenList: Readonly<{ export const fetchTokenList: Readonly<{
pending: ActionCreatorWithPayload<{ url: string; requestId: string }> pending: ActionCreatorWithPayload<{ url: string; requestId: string }>
...@@ -20,4 +20,3 @@ export const disableList = createAction<string>('lists/disableList') ...@@ -20,4 +20,3 @@ export const disableList = createAction<string>('lists/disableList')
// versioning // versioning
export const acceptListUpdate = createAction<string>('lists/acceptListUpdate') export const acceptListUpdate = createAction<string>('lists/acceptListUpdate')
export const rejectVersionUpdate = createAction<Version>('lists/rejectVersionUpdate')
...@@ -15,7 +15,7 @@ export type TokenAddressMap = Readonly<{ ...@@ -15,7 +15,7 @@ export type TokenAddressMap = Readonly<{
const listCache: WeakMap<TokenList, TokenAddressMap> | null = const listCache: WeakMap<TokenList, TokenAddressMap> | null =
typeof WeakMap !== 'undefined' ? new WeakMap<TokenList, TokenAddressMap>() : null typeof WeakMap !== 'undefined' ? new WeakMap<TokenList, TokenAddressMap>() : null
export function listToTokenMap(list: TokenList): TokenAddressMap { function listToTokenMap(list: TokenList): TokenAddressMap {
const result = listCache?.get(list) const result = listCache?.get(list)
if (result) return result if (result) return result
......
...@@ -4,7 +4,7 @@ import { TokenList } from '@uniswap/token-lists/dist/types' ...@@ -4,7 +4,7 @@ import { TokenList } from '@uniswap/token-lists/dist/types'
import { isAddress } from '../../utils' import { isAddress } from '../../utils'
type TagDetails = Tags[keyof Tags] type TagDetails = Tags[keyof Tags]
export interface TagInfo extends TagDetails { interface TagInfo extends TagDetails {
id: string id: string
} }
/** /**
......
...@@ -8,7 +8,7 @@ import { ...@@ -8,7 +8,7 @@ import {
typeRightRangeInput, typeRightRangeInput,
} from './actions' } from './actions'
export interface MintState { interface MintState {
readonly independentField: Field readonly independentField: Field
readonly typedValue: string readonly typedValue: string
readonly startPriceTypedValue: string // for the case when there's no liquidity readonly startPriceTypedValue: string // for the case when there's no liquidity
...@@ -16,7 +16,7 @@ export interface MintState { ...@@ -16,7 +16,7 @@ export interface MintState {
readonly rightRangeTypedValue: string readonly rightRangeTypedValue: string
} }
export const initialState: MintState = { const initialState: MintState = {
independentField: Field.CURRENCY_A, independentField: Field.CURRENCY_A,
typedValue: '', typedValue: '',
startPriceTypedValue: '', startPriceTypedValue: '',
......
...@@ -15,7 +15,7 @@ export interface Result extends ReadonlyArray<any> { ...@@ -15,7 +15,7 @@ export interface Result extends ReadonlyArray<any> {
type MethodArg = string | number | BigNumber type MethodArg = string | number | BigNumber
type MethodArgs = Array<MethodArg | MethodArg[]> type MethodArgs = Array<MethodArg | MethodArg[]>
export type OptionalMethodInputs = Array<MethodArg | MethodArg[] | undefined> | undefined type OptionalMethodInputs = Array<MethodArg | MethodArg[] | undefined> | undefined
function isMethodArg(x: unknown): x is MethodArg { function isMethodArg(x: unknown): x is MethodArg {
return BigNumber.isBigNumber(x) || ['string', 'number'].indexOf(typeof x) !== -1 return BigNumber.isBigNumber(x) || ['string', 'number'].indexOf(typeof x) !== -1
...@@ -102,7 +102,7 @@ function useCallsData( ...@@ -102,7 +102,7 @@ function useCallsData(
) )
} }
export interface CallState { interface CallState {
readonly valid: boolean readonly valid: boolean
// the result, or undefined if loading or errored/no data // the result, or undefined if loading or errored/no data
readonly result: Result | undefined readonly result: Result | undefined
......
...@@ -11,7 +11,7 @@ import useCurrentBlockTimestamp from 'hooks/useCurrentBlockTimestamp' ...@@ -11,7 +11,7 @@ import useCurrentBlockTimestamp from 'hooks/useCurrentBlockTimestamp'
import { Interface } from '@ethersproject/abi' import { Interface } from '@ethersproject/abi'
import { abi as STAKING_REWARDS_ABI } from '@uniswap/liquidity-staker/build/StakingRewards.json' import { abi as STAKING_REWARDS_ABI } from '@uniswap/liquidity-staker/build/StakingRewards.json'
export const STAKING_REWARDS_INTERFACE = new Interface(STAKING_REWARDS_ABI) const STAKING_REWARDS_INTERFACE = new Interface(STAKING_REWARDS_ABI)
export const STAKING_GENESIS = 1600387200 export const STAKING_GENESIS = 1600387200
...@@ -273,32 +273,3 @@ export function useDerivedStakeInfo( ...@@ -273,32 +273,3 @@ export function useDerivedStakeInfo(
error, error,
} }
} }
// based on typed value
export function useDerivedUnstakeInfo(
typedValue: string,
stakingAmount: CurrencyAmount<Token>
): {
parsedAmount?: CurrencyAmount<Token>
error?: string
} {
const { account } = useActiveWeb3React()
const parsedInput: CurrencyAmount<Token> | undefined = tryParseAmount(typedValue, stakingAmount.currency)
const parsedAmount =
parsedInput && JSBI.lessThanOrEqual(parsedInput.quotient, stakingAmount.quotient) ? parsedInput : undefined
let error: string | undefined
if (!account) {
error = t`Connect Wallet`
}
if (!parsedAmount) {
error = error ?? t`Enter an amount`
}
return {
parsedAmount,
error,
}
}
...@@ -32,4 +32,3 @@ export const removeSerializedToken = createAction<{ chainId: number; address: st ...@@ -32,4 +32,3 @@ export const removeSerializedToken = createAction<{ chainId: number; address: st
export const addSerializedPair = createAction<{ serializedPair: SerializedPair }>('user/addSerializedPair') export const addSerializedPair = createAction<{ serializedPair: SerializedPair }>('user/addSerializedPair')
export const removeSerializedPair = export const removeSerializedPair =
createAction<{ chainId: number; tokenAAddress: string; tokenBAddress: string }>('user/removeSerializedPair') createAction<{ chainId: number; tokenAAddress: string; tokenBAddress: string }>('user/removeSerializedPair')
export const toggleURLWarning = createAction<void>('app/toggleURLWarning')
...@@ -17,7 +17,6 @@ import { ...@@ -17,7 +17,6 @@ import {
removeSerializedToken, removeSerializedToken,
SerializedPair, SerializedPair,
SerializedToken, SerializedToken,
toggleURLWarning,
updateArbitrumAlphaAcknowledged, updateArbitrumAlphaAcknowledged,
updateHideClosedPositions, updateHideClosedPositions,
updateUserDarkMode, updateUserDarkMode,
...@@ -250,11 +249,6 @@ export function useURLWarningVisible(): boolean { ...@@ -250,11 +249,6 @@ export function useURLWarningVisible(): boolean {
return useAppSelector((state: AppState) => state.user.URLWarningVisible) return useAppSelector((state: AppState) => state.user.URLWarningVisible)
} }
export function useURLWarningToggle(): () => void {
const dispatch = useAppDispatch()
return useCallback(() => dispatch(toggleURLWarning()), [dispatch])
}
/** /**
* Given two tokens return the liquidity token that represents its liquidity shares * Given two tokens return the liquidity token that represents its liquidity shares
* @param tokenA one of the two tokens * @param tokenA one of the two tokens
......
...@@ -13,7 +13,6 @@ import { ...@@ -13,7 +13,6 @@ import {
updateUserExpertMode, updateUserExpertMode,
updateUserSlippageTolerance, updateUserSlippageTolerance,
updateUserDeadline, updateUserDeadline,
toggleURLWarning,
updateUserSingleHopOnly, updateUserSingleHopOnly,
updateHideClosedPositions, updateHideClosedPositions,
updateUserLocale, updateUserLocale,
...@@ -189,7 +188,4 @@ export default createReducer(initialState, (builder) => ...@@ -189,7 +188,4 @@ export default createReducer(initialState, (builder) =>
} }
state.timestamp = currentTimestamp() state.timestamp = currentTimestamp()
}) })
.addCase(toggleURLWarning, (state) => {
state.URLWarningVisible = !state.URLWarningVisible
})
) )
import { darken } from 'polished'
import React, { HTMLProps } from 'react' import React, { HTMLProps } from 'react'
import { ArrowLeft, ExternalLink as LinkIconFeather, Trash, X } from 'react-feather' import { ArrowLeft, ExternalLink as LinkIconFeather, Trash, X } from 'react-feather'
import ReactGA from 'react-ga' import ReactGA from 'react-ga'
...@@ -24,36 +23,6 @@ export const ButtonText = styled.button` ...@@ -24,36 +23,6 @@ export const ButtonText = styled.button`
} }
` `
export const Button = styled.button.attrs<{ warning: boolean }, { backgroundColor: string }>(({ warning, theme }) => ({
backgroundColor: warning ? theme.red1 : theme.primary1,
}))`
padding: 1rem 2rem 1rem 2rem;
border-radius: 3rem;
cursor: pointer;
user-select: none;
font-size: 1rem;
border: none;
outline: none;
background-color: ${({ backgroundColor }) => backgroundColor};
color: ${({ theme }) => theme.white};
width: 100%;
:hover,
:focus {
background-color: ${({ backgroundColor }) => darken(0.05, backgroundColor)};
}
:active {
background-color: ${({ backgroundColor }) => darken(0.1, backgroundColor)};
}
:disabled {
background-color: ${({ theme }) => theme.bg1};
color: ${({ theme }) => theme.text4};
cursor: auto;
}
`
export const CloseIcon = styled(X)<{ onClick: () => void }>` export const CloseIcon = styled(X)<{ onClick: () => void }>`
cursor: pointer; cursor: pointer;
` `
...@@ -159,7 +128,7 @@ const LinkIconWrapper = styled.a` ...@@ -159,7 +128,7 @@ const LinkIconWrapper = styled.a`
} }
` `
export const LinkIcon = styled(LinkIconFeather)` const LinkIcon = styled(LinkIconFeather)`
height: 16px; height: 16px;
width: 18px; width: 18px;
margin-left: 10px; margin-left: 10px;
...@@ -251,7 +220,7 @@ const rotate = keyframes` ...@@ -251,7 +220,7 @@ const rotate = keyframes`
} }
` `
export const Spinner = styled.img` const Spinner = styled.img`
animation: 2s ${rotate} linear infinite; animation: 2s ${rotate} linear infinite;
width: 16px; width: 16px;
height: 16px; height: 16px;
...@@ -291,10 +260,3 @@ export const SmallOnly = styled.span` ...@@ -291,10 +260,3 @@ export const SmallOnly = styled.span`
display: block; display: block;
`}; `};
` `
export const ExtraSmallOnly = styled.span`
display: none;
${({ theme }) => theme.mediaWidth.upToExtraSmall`
display: block;
`};
`
...@@ -35,7 +35,7 @@ const mediaWidthTemplates: { [width in keyof typeof MEDIA_WIDTHS]: typeof css } ...@@ -35,7 +35,7 @@ const mediaWidthTemplates: { [width in keyof typeof MEDIA_WIDTHS]: typeof css }
const white = '#FFFFFF' const white = '#FFFFFF'
const black = '#000000' const black = '#000000'
export function colors(darkMode: boolean): Colors { function colors(darkMode: boolean): Colors {
return { return {
// base // base
white, white,
...@@ -96,7 +96,7 @@ export function colors(darkMode: boolean): Colors { ...@@ -96,7 +96,7 @@ export function colors(darkMode: boolean): Colors {
} }
} }
export function theme(darkMode: boolean): DefaultTheme { function theme(darkMode: boolean): DefaultTheme {
return { return {
...colors(darkMode), ...colors(darkMode),
......
...@@ -57,12 +57,6 @@ export interface Colors { ...@@ -57,12 +57,6 @@ export interface Colors {
warning: Color warning: Color
} }
export interface Grids {
sm: number
md: number
lg: number
}
declare module 'styled-components' { declare module 'styled-components' {
export interface DefaultTheme extends Colors { export interface DefaultTheme extends Colors {
grids: Grids grids: Grids
......
...@@ -25,12 +25,12 @@ export function shortenAddress(address: string, chars = 4): string { ...@@ -25,12 +25,12 @@ export function shortenAddress(address: string, chars = 4): string {
} }
// account is not optional // account is not optional
export function getSigner(library: Web3Provider, account: string): JsonRpcSigner { function getSigner(library: Web3Provider, account: string): JsonRpcSigner {
return library.getSigner(account).connectUnchecked() return library.getSigner(account).connectUnchecked()
} }
// account is optional // account is optional
export function getProviderOrSigner(library: Web3Provider, account?: string): Web3Provider | JsonRpcSigner { function getProviderOrSigner(library: Web3Provider, account?: string): Web3Provider | JsonRpcSigner {
return account ? getSigner(library, account) : library return account ? getSigner(library, account) : library
} }
......
...@@ -9,7 +9,7 @@ function waitRandom(min: number, max: number): Promise<void> { ...@@ -9,7 +9,7 @@ function waitRandom(min: number, max: number): Promise<void> {
/** /**
* This error is thrown if the function is cancelled before completing * This error is thrown if the function is cancelled before completing
*/ */
export class CancelledError extends Error { class CancelledError extends Error {
public isCancelledError: true = true public isCancelledError: true = true
constructor() { constructor() {
super('Cancelled') super('Cancelled')
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment