Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
021aab6547 | ||
|
|
81af31eec1 | ||
|
|
d3898cf900 | ||
|
|
b8f61d5f90 |
@@ -202,8 +202,8 @@ export default function PositionListItem({ positionDetails }: PositionListItemPr
|
||||
// prices
|
||||
let { priceLower, priceUpper, base, quote } = getPriceOrderingFromPositionForUI(position)
|
||||
const inverted = token1 ? base?.equals(token1) : undefined
|
||||
const currencyQuote = inverted ? currency0 : currency1
|
||||
const currencyBase = inverted ? currency1 : currency0
|
||||
const currencyQuote = inverted ? currency1 : currency0
|
||||
const currencyBase = inverted ? currency0 : currency1
|
||||
|
||||
// check if price is within range
|
||||
const outOfRange: boolean = pool ? pool.tickCurrent < tickLower || pool.tickCurrent >= tickUpper : false
|
||||
|
||||
@@ -16,7 +16,7 @@ import { usePairContract, useV2MigratorContract } from '../../hooks/useContract'
|
||||
import { NEVER_RELOAD, useSingleCallResult } from '../../state/multicall/hooks'
|
||||
import { useTokenBalance } from '../../state/wallet/hooks'
|
||||
import { BackArrow, ExternalLink, TYPE } from '../../theme'
|
||||
import { getEtherscanLink, isAddress } from '../../utils'
|
||||
import { calculateGasMargin, getEtherscanLink, isAddress } from '../../utils'
|
||||
import { BodyWrapper } from '../AppBody'
|
||||
import { V3_MIGRATOR_ADDRESSES } from 'constants/v3'
|
||||
import { PoolState, usePool } from 'hooks/usePools'
|
||||
@@ -274,7 +274,7 @@ function V2PairMigration({
|
||||
|
||||
const deadlineToUse = signatureData?.deadline ?? deadline
|
||||
|
||||
const data = []
|
||||
const data: string[] = []
|
||||
|
||||
// permit if necessary
|
||||
if (signatureData) {
|
||||
@@ -324,19 +324,24 @@ function V2PairMigration({
|
||||
)
|
||||
|
||||
setConfirmingMigration(true)
|
||||
migrator
|
||||
.multicall(data)
|
||||
.then((response: TransactionResponse) => {
|
||||
ReactGA.event({
|
||||
category: 'Migrate',
|
||||
action: `${isNotUniswap ? 'SushiSwap' : 'V2'}->V3`,
|
||||
label: `${currency0.symbol}/${currency1.symbol}`,
|
||||
})
|
||||
|
||||
addTransaction(response, {
|
||||
summary: `Migrate ${currency0.symbol}/${currency1.symbol} liquidity to V3`,
|
||||
})
|
||||
setPendingMigrationHash(response.hash)
|
||||
migrator.estimateGas
|
||||
.multicall(data)
|
||||
.then((gasEstimate) => {
|
||||
return migrator
|
||||
.multicall(data, { gasLimit: calculateGasMargin(gasEstimate) })
|
||||
.then((response: TransactionResponse) => {
|
||||
ReactGA.event({
|
||||
category: 'Migrate',
|
||||
action: `${isNotUniswap ? 'SushiSwap' : 'V2'}->V3`,
|
||||
label: `${currency0.symbol}/${currency1.symbol}`,
|
||||
})
|
||||
|
||||
addTransaction(response, {
|
||||
summary: `Migrate ${currency0.symbol}/${currency1.symbol} liquidity to V3`,
|
||||
})
|
||||
setPendingMigrationHash(response.hash)
|
||||
})
|
||||
})
|
||||
.catch(() => {
|
||||
setConfirmingMigration(false)
|
||||
|
||||
@@ -1,8 +1,15 @@
|
||||
import { Web3Provider } from '@ethersproject/providers'
|
||||
import { Web3Provider, Network } from '@ethersproject/providers'
|
||||
|
||||
class WorkaroundWeb3Provider extends Web3Provider {
|
||||
private _detectNetworkResult: Promise<Network> | null = null
|
||||
|
||||
async detectNetwork(): Promise<Network> {
|
||||
return this._detectNetworkResult ?? (this._detectNetworkResult = this._uncachedDetectNetwork())
|
||||
}
|
||||
}
|
||||
|
||||
export default function getLibrary(provider: any): Web3Provider {
|
||||
// latest ethers version tries to detect the network which fails
|
||||
const library = new Web3Provider(
|
||||
const library = new WorkaroundWeb3Provider(
|
||||
provider,
|
||||
typeof provider.chainId === 'number'
|
||||
? provider.chainId
|
||||
|
||||
Reference in New Issue
Block a user