Compare commits
9 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
cccf149568 | ||
|
|
604ea49567 | ||
|
|
4c0c6dfde6 | ||
|
|
a160bb8f02 | ||
|
|
e86946b104 | ||
|
|
03108b981e | ||
|
|
ae27e245b4 | ||
|
|
897f354202 | ||
|
|
4745052f0e |
2
.github/workflows/release.yaml
vendored
2
.github/workflows/release.yaml
vendored
@@ -19,7 +19,7 @@ jobs:
|
||||
|
||||
- name: Bump version and push tag
|
||||
id: github_tag_action
|
||||
uses: mathieudutour/github-tag-action@v4.5
|
||||
uses: mathieudutour/github-tag-action@331898d5052eedac9b15fec867b5ba66ebf9b692
|
||||
with:
|
||||
github_token: ${{ secrets.GITHUB_TOKEN }}
|
||||
release_branches: .*
|
||||
|
||||
15
README.md
15
README.md
@@ -41,8 +41,17 @@ yarn start
|
||||
**Please open all pull requests against the `main` branch.**
|
||||
CI checks will run against all PRs.
|
||||
|
||||
## Accessing Uniswap Interface V1
|
||||
## Accessing Uniswap V2
|
||||
|
||||
The Uniswap Interface supports swapping against, and migrating or removing liquidity from Uniswap V1. However,
|
||||
if you would like to use Uniswap V1, the Uniswap V1 interface for mainnet and testnets is accessible via IPFS gateways
|
||||
The Uniswap Interface supports swapping, adding liquidity, removing liquidity and migrating liquidity for
|
||||
Uniswap protocol V2.
|
||||
|
||||
- Swap on Uniswap V2: https://app.uniswap.org/#/swap?use=v2
|
||||
- View V2 liquidity: https://app.uniswap.org/#/pool/v2
|
||||
- Add V2 liquidity: https://app.uniswap.org/#/add/v2
|
||||
- Migrate V2 liquidity to V3: https://app.uniswap.org/#/migrate/v2
|
||||
|
||||
## Accessing Uniswap V1
|
||||
|
||||
The Uniswap V1 interface for mainnet and testnets is accessible via IPFS gateways
|
||||
linked from the [v1.0.0 release](https://github.com/Uniswap/uniswap-interface/releases/tag/v1.0.0).
|
||||
|
||||
@@ -51,7 +51,7 @@
|
||||
"@uniswap/v2-sdk": "^3.0.0-alpha.0",
|
||||
"@uniswap/v3-core": "1.0.0",
|
||||
"@uniswap/v3-periphery": "1.0.0",
|
||||
"@uniswap/v3-sdk": "^3.0.0-alpha.4",
|
||||
"@uniswap/v3-sdk": "^3.0.0-alpha.5",
|
||||
"@web3-react/core": "^6.0.9",
|
||||
"@web3-react/fortmatic-connector": "^6.0.9",
|
||||
"@web3-react/injected-connector": "^6.0.7",
|
||||
|
||||
@@ -184,7 +184,12 @@ export function TransactionErrorContent({ message, onDismiss }: { message: strin
|
||||
</RowBetween>
|
||||
<AutoColumn style={{ marginTop: 20, padding: '2rem 0' }} gap="24px" justify="center">
|
||||
<AlertTriangle color={theme.red1} style={{ strokeWidth: 1.5 }} size={64} />
|
||||
<Text fontWeight={500} fontSize={16} color={theme.red1} style={{ textAlign: 'center', width: '85%' }}>
|
||||
<Text
|
||||
fontWeight={500}
|
||||
fontSize={16}
|
||||
color={theme.red1}
|
||||
style={{ textAlign: 'center', width: '85%', wordBreak: 'break-word' }}
|
||||
>
|
||||
{message}
|
||||
</Text>
|
||||
</AutoColumn>
|
||||
|
||||
@@ -171,7 +171,7 @@ export function SwapCallbackError({ error }: { error: string }) {
|
||||
<SwapCallbackErrorInnerAlertTriangle>
|
||||
<AlertTriangle size={24} />
|
||||
</SwapCallbackErrorInnerAlertTriangle>
|
||||
<p>{error}</p>
|
||||
<p style={{ wordBreak: 'break-word' }}>{error}</p>
|
||||
</SwapCallbackErrorInner>
|
||||
)
|
||||
}
|
||||
|
||||
@@ -166,7 +166,13 @@ export function swapErrorToUserReadableMessage(error: any): string {
|
||||
case 'TF':
|
||||
return 'The output token cannot be transferred. There may be an issue with the output token. Note fee on transfer and rebase tokens are incompatible with Uniswap V3.'
|
||||
default:
|
||||
return `Unknown error${reason ? `: "${reason}"` : ''}. Please join the Discord to get help.`
|
||||
if (reason?.indexOf('undefined is not an object') !== -1) {
|
||||
console.error(error, reason)
|
||||
return 'An error occurred when trying to execute this swap. You may need to increase your slippage tolerance. If that does not work, there may be an incompatibility with the token you are trading. Note fee on transfer and rebase tokens are incompatible with Uniswap V3.'
|
||||
}
|
||||
return `Unknown error${
|
||||
reason ? `: "${reason}"` : ''
|
||||
}. Try increasing your slippage tolerance. Note fee on transfer and rebase tokens are incompatible with Uniswap V3.`
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -208,6 +208,7 @@ function V2PairMigration({
|
||||
tickUpper,
|
||||
amount0: token0Value.quotient,
|
||||
amount1: token1Value.quotient,
|
||||
useFullPrecision: false, // we don't want full precision as this is used to calculate slippage amounts
|
||||
})
|
||||
: undefined
|
||||
|
||||
|
||||
@@ -286,6 +286,7 @@ export function useV3DerivedMintInfo(
|
||||
tickLower,
|
||||
tickUpper,
|
||||
amount0: independentAmount.quotient,
|
||||
useFullPrecision: true, // we want full precision for the theoretical position
|
||||
})
|
||||
: Position.fromAmount1({
|
||||
pool: poolForPosition,
|
||||
@@ -356,7 +357,7 @@ export function useV3DerivedMintInfo(
|
||||
return undefined
|
||||
}
|
||||
|
||||
// mark as 0 if disbaled because out of range
|
||||
// mark as 0 if disabled because out of range
|
||||
const amount0 = !deposit0Disabled
|
||||
? parsedAmounts?.[tokenA.equals(poolForPosition.token0) ? Field.CURRENCY_A : Field.CURRENCY_B]?.quotient
|
||||
: BIG_INT_ZERO
|
||||
@@ -371,6 +372,7 @@ export function useV3DerivedMintInfo(
|
||||
tickUpper,
|
||||
amount0,
|
||||
amount1,
|
||||
useFullPrecision: true, // we want full precision for the theoretical position
|
||||
})
|
||||
} else {
|
||||
return undefined
|
||||
|
||||
@@ -1,6 +1,14 @@
|
||||
import { priceToClosestTick, nearestUsableTick, FeeAmount, TICK_SPACINGS } from '@uniswap/v3-sdk/dist/'
|
||||
import {
|
||||
priceToClosestTick,
|
||||
nearestUsableTick,
|
||||
FeeAmount,
|
||||
TICK_SPACINGS,
|
||||
encodeSqrtRatioX96,
|
||||
TickMath,
|
||||
} from '@uniswap/v3-sdk/dist/'
|
||||
import { Price, Token } from '@uniswap/sdk-core'
|
||||
import { tryParseAmount } from 'state/swap/hooks'
|
||||
import JSBI from 'jsbi'
|
||||
|
||||
export function tryParseTick(
|
||||
baseToken?: Token,
|
||||
@@ -12,8 +20,8 @@ export function tryParseTick(
|
||||
return undefined
|
||||
}
|
||||
|
||||
// base token fixed at 1 unit, quote token amount based on typed input
|
||||
const amount = tryParseAmount(value, quoteToken)
|
||||
|
||||
const amountOne = tryParseAmount('1', baseToken)
|
||||
|
||||
if (!amount || !amountOne) return undefined
|
||||
@@ -21,8 +29,19 @@ export function tryParseTick(
|
||||
// parse the typed value into a price
|
||||
const price = new Price(baseToken, quoteToken, amountOne.quotient, amount.quotient)
|
||||
|
||||
// this function is agnostic to the base, will always return the correct tick
|
||||
const tick = priceToClosestTick(price)
|
||||
let tick: number
|
||||
|
||||
// check price is within min/max bounds, if outside return min/max
|
||||
const sqrtRatioX96 = encodeSqrtRatioX96(price.numerator, price.denominator)
|
||||
|
||||
if (JSBI.greaterThanOrEqual(sqrtRatioX96, TickMath.MAX_SQRT_RATIO)) {
|
||||
tick = TickMath.MAX_TICK
|
||||
} else if (JSBI.lessThanOrEqual(sqrtRatioX96, TickMath.MIN_SQRT_RATIO)) {
|
||||
tick = TickMath.MIN_TICK
|
||||
} else {
|
||||
// this function is agnostic to the base, will always return the correct tick
|
||||
tick = priceToClosestTick(price)
|
||||
}
|
||||
|
||||
return nearestUsableTick(tick, TICK_SPACINGS[feeAmount])
|
||||
}
|
||||
|
||||
@@ -4478,10 +4478,10 @@
|
||||
"@uniswap/v3-core" "1.0.0"
|
||||
base64-sol "1.0.1"
|
||||
|
||||
"@uniswap/v3-sdk@^3.0.0-alpha.4":
|
||||
version "3.0.0-alpha.4"
|
||||
resolved "https://registry.yarnpkg.com/@uniswap/v3-sdk/-/v3-sdk-3.0.0-alpha.4.tgz#e8bf26291fd74e36a5a3d9b88f1809a7aceb7d3a"
|
||||
integrity sha512-BcEH8eHt+b6eaaiLDlzbFox2NquP1H7KgrgmNjAlU/et+vC4azdfNN6SsRlTFzhioPOwHlAKAAZJLq+yzboDOQ==
|
||||
"@uniswap/v3-sdk@^3.0.0-alpha.5":
|
||||
version "3.0.0-alpha.5"
|
||||
resolved "https://registry.yarnpkg.com/@uniswap/v3-sdk/-/v3-sdk-3.0.0-alpha.5.tgz#b583bd2399abee1b329debb930f903d0d87ccc7c"
|
||||
integrity sha512-swuEzbQAzNw9ZA//EZN/qT3g6V3X5kTnB8FK8xRHAn3WE4mCMHMxut4Wt6iV24VlTHuVzx9EIoHS53rXHwjv4Q==
|
||||
dependencies:
|
||||
"@ethersproject/abi" "^5.0.12"
|
||||
"@ethersproject/solidity" "^5.0.9"
|
||||
|
||||
Reference in New Issue
Block a user