Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
I
interface
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
LuckySwap
interface
Commits
edf4c474
Unverified
Commit
edf4c474
authored
Mar 31, 2021
by
Jordan Frankfurt
Committed by
GitHub
Mar 31, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add external abi types (#37)
parent
c0ce6a55
Changes
21
Hide whitespace changes
Inline
Side-by-side
Showing
21 changed files
with
62 additions
and
70 deletions
+62
-70
.eslintrc.json
.eslintrc.json
+2
-1
.gitignore
.gitignore
+1
-0
package.json
package.json
+3
-1
argent-wallet-detector.json
src/abis/argent-wallet-detector.json
+0
-0
ens-public-resolver.json
src/abis/ens-public-resolver.json
+0
-0
ens-registrar.json
src/abis/ens-registrar.json
+0
-0
erc20.json
src/abis/erc20.json
+0
-0
erc20_bytes32.json
src/abis/erc20_bytes32.json
+0
-0
migrator.json
src/abis/migrator.json
+0
-0
staking-rewards.ts
src/abis/staking-rewards.ts
+0
-0
unisocks.json
src/abis/unisocks.json
+20
-20
weth.json
src/abis/weth.json
+0
-0
argent-wallet-detector.ts
src/constants/abis/argent-wallet-detector.ts
+0
-5
erc20.ts
src/constants/abis/erc20.ts
+0
-10
migrator.ts
src/constants/abis/migrator.ts
+0
-5
index.ts
src/constants/index.ts
+4
-0
useContract.ts
src/hooks/useContract.ts
+21
-17
MigrateV1Exchange.tsx
src/pages/MigrateV1/MigrateV1Exchange.tsx
+1
-2
react-app-env.d.ts
src/react-app-env.d.ts
+1
-1
hooks.ts
src/state/stake/hooks.ts
+1
-1
hooks.ts
src/state/wallet/hooks.ts
+8
-7
No files found.
.eslintrc.json
View file @
edf4c474
...
@@ -26,6 +26,7 @@
...
@@ -26,6 +26,7 @@
"prettier/prettier"
:
"error"
,
"prettier/prettier"
:
"error"
,
"@typescript-eslint/no-explicit-any"
:
"off"
,
"@typescript-eslint/no-explicit-any"
:
"off"
,
"@typescript-eslint/ban-ts-comment"
:
"off"
,
"@typescript-eslint/ban-ts-comment"
:
"off"
,
"@typescript-eslint/ban-ts-ignore"
:
"off"
"@typescript-eslint/ban-ts-ignore"
:
"off"
,
"@typescript-eslint/explicit-module-boundary-types"
:
"off"
}
}
}
}
.gitignore
View file @
edf4c474
...
@@ -2,6 +2,7 @@
...
@@ -2,6 +2,7 @@
# generated contract types
# generated contract types
/src/types/v3
/src/types/v3
/src/abis/types
# dependencies
# dependencies
/node_modules
/node_modules
...
...
package.json
View file @
edf4c474
...
@@ -117,7 +117,9 @@
...
@@ -117,7 +117,9 @@
"@walletconnect/web3-provider"
:
"1.1.1-alpha.0"
"@walletconnect/web3-provider"
:
"1.1.1-alpha.0"
},
},
"scripts"
:
{
"scripts"
:
{
"compile-contract-types"
:
"npx typechain --target ethers-v5 --outDir src/types/v3 './node_modules/@uniswap/?(v3-core|v3-periphery)/artifacts/contracts/**/*.json'"
,
"compile-contract-types"
:
"yarn compile-external-abi-types && yarn compile-v3-contract-types"
,
"compile-external-abi-types"
:
"npx typechain --target ethers-v5 --outDir src/abis/types './src/abis/**/*.json'"
,
"compile-v3-contract-types"
:
"npx typechain --target ethers-v5 --outDir src/types/v3 './node_modules/@uniswap/?(v3-core|v3-periphery)/artifacts/contracts/**/*.json'"
,
"build"
:
"yarn compile-contract-types && react-scripts build"
,
"build"
:
"yarn compile-contract-types && react-scripts build"
,
"eject"
:
"react-scripts eject"
,
"eject"
:
"react-scripts eject"
,
"integration-test"
:
"start-server-and-test 'serve build -l 3000' http://localhost:3000 'cypress run'"
,
"integration-test"
:
"start-server-and-test 'serve build -l 3000' http://localhost:3000 'cypress run'"
,
...
...
src/
constants/
abis/argent-wallet-detector.json
→
src/abis/argent-wallet-detector.json
View file @
edf4c474
File moved
src/
constants/
abis/ens-public-resolver.json
→
src/abis/ens-public-resolver.json
View file @
edf4c474
File moved
src/
constants/
abis/ens-registrar.json
→
src/abis/ens-registrar.json
View file @
edf4c474
File moved
src/
constants/
abis/erc20.json
→
src/abis/erc20.json
View file @
edf4c474
File moved
src/
constants/
abis/erc20_bytes32.json
→
src/abis/erc20_bytes32.json
View file @
edf4c474
File moved
src/
constants/
abis/migrator.json
→
src/abis/migrator.json
View file @
edf4c474
File moved
src/
constants/
abis/staking-rewards.ts
→
src/abis/staking-rewards.ts
View file @
edf4c474
File moved
src/
constants/
abis/unisocks.json
→
src/abis/unisocks.json
View file @
edf4c474
...
@@ -89,7 +89,7 @@
...
@@ -89,7 +89,7 @@
"constant"
:
true
,
"constant"
:
true
,
"payable"
:
false
,
"payable"
:
false
,
"type"
:
"function"
,
"type"
:
"function"
,
"gas"
:
22405
"gas"
:
"22405"
},
},
{
{
"name"
:
"tokenByIndex"
,
"name"
:
"tokenByIndex"
,
...
@@ -108,7 +108,7 @@
...
@@ -108,7 +108,7 @@
"constant"
:
true
,
"constant"
:
true
,
"payable"
:
false
,
"payable"
:
false
,
"type"
:
"function"
,
"type"
:
"function"
,
"gas"
:
631
"gas"
:
"631"
},
},
{
{
"name"
:
"tokenOfOwnerByIndex"
,
"name"
:
"tokenOfOwnerByIndex"
,
...
@@ -131,7 +131,7 @@
...
@@ -131,7 +131,7 @@
"constant"
:
true
,
"constant"
:
true
,
"payable"
:
false
,
"payable"
:
false
,
"type"
:
"function"
,
"type"
:
"function"
,
"gas"
:
1248
"gas"
:
"1248"
},
},
{
{
"name"
:
"transferFrom"
,
"name"
:
"transferFrom"
,
...
@@ -153,7 +153,7 @@
...
@@ -153,7 +153,7 @@
"constant"
:
false
,
"constant"
:
false
,
"payable"
:
false
,
"payable"
:
false
,
"type"
:
"function"
,
"type"
:
"function"
,
"gas"
:
259486
"gas"
:
"259486"
},
},
{
{
"name"
:
"safeTransferFrom"
,
"name"
:
"safeTransferFrom"
,
...
@@ -217,7 +217,7 @@
...
@@ -217,7 +217,7 @@
"constant"
:
false
,
"constant"
:
false
,
"payable"
:
false
,
"payable"
:
false
,
"type"
:
"function"
,
"type"
:
"function"
,
"gas"
:
38422
"gas"
:
"38422"
},
},
{
{
"name"
:
"setApprovalForAll"
,
"name"
:
"setApprovalForAll"
,
...
@@ -235,7 +235,7 @@
...
@@ -235,7 +235,7 @@
"constant"
:
false
,
"constant"
:
false
,
"payable"
:
false
,
"payable"
:
false
,
"type"
:
"function"
,
"type"
:
"function"
,
"gas"
:
38016
"gas"
:
"38016"
},
},
{
{
"name"
:
"mint"
,
"name"
:
"mint"
,
...
@@ -254,7 +254,7 @@
...
@@ -254,7 +254,7 @@
"constant"
:
false
,
"constant"
:
false
,
"payable"
:
false
,
"payable"
:
false
,
"type"
:
"function"
,
"type"
:
"function"
,
"gas"
:
182636
"gas"
:
"182636"
},
},
{
{
"name"
:
"changeMinter"
,
"name"
:
"changeMinter"
,
...
@@ -268,7 +268,7 @@
...
@@ -268,7 +268,7 @@
"constant"
:
false
,
"constant"
:
false
,
"payable"
:
false
,
"payable"
:
false
,
"type"
:
"function"
,
"type"
:
"function"
,
"gas"
:
35897
"gas"
:
"35897"
},
},
{
{
"name"
:
"changeURI"
,
"name"
:
"changeURI"
,
...
@@ -282,7 +282,7 @@
...
@@ -282,7 +282,7 @@
"constant"
:
false
,
"constant"
:
false
,
"payable"
:
false
,
"payable"
:
false
,
"type"
:
"function"
,
"type"
:
"function"
,
"gas"
:
35927
"gas"
:
"35927"
},
},
{
{
"name"
:
"name"
,
"name"
:
"name"
,
...
@@ -296,7 +296,7 @@
...
@@ -296,7 +296,7 @@
"constant"
:
true
,
"constant"
:
true
,
"payable"
:
false
,
"payable"
:
false
,
"type"
:
"function"
,
"type"
:
"function"
,
"gas"
:
6612
"gas"
:
"6612"
},
},
{
{
"name"
:
"symbol"
,
"name"
:
"symbol"
,
...
@@ -310,7 +310,7 @@
...
@@ -310,7 +310,7 @@
"constant"
:
true
,
"constant"
:
true
,
"payable"
:
false
,
"payable"
:
false
,
"type"
:
"function"
,
"type"
:
"function"
,
"gas"
:
6642
"gas"
:
"6642"
},
},
{
{
"name"
:
"totalSupply"
,
"name"
:
"totalSupply"
,
...
@@ -324,7 +324,7 @@
...
@@ -324,7 +324,7 @@
"constant"
:
true
,
"constant"
:
true
,
"payable"
:
false
,
"payable"
:
false
,
"type"
:
"function"
,
"type"
:
"function"
,
"gas"
:
873
"gas"
:
"873"
},
},
{
{
"name"
:
"minter"
,
"name"
:
"minter"
,
...
@@ -338,7 +338,7 @@
...
@@ -338,7 +338,7 @@
"constant"
:
true
,
"constant"
:
true
,
"payable"
:
false
,
"payable"
:
false
,
"type"
:
"function"
,
"type"
:
"function"
,
"gas"
:
903
"gas"
:
"903"
},
},
{
{
"name"
:
"socks"
,
"name"
:
"socks"
,
...
@@ -353,7 +353,7 @@
...
@@ -353,7 +353,7 @@
"constant"
:
true
,
"constant"
:
true
,
"payable"
:
false
,
"payable"
:
false
,
"type"
:
"function"
,
"type"
:
"function"
,
"gas"
:
933
"gas"
:
"933"
},
},
{
{
"name"
:
"newURI"
,
"name"
:
"newURI"
,
...
@@ -367,7 +367,7 @@
...
@@ -367,7 +367,7 @@
"constant"
:
true
,
"constant"
:
true
,
"payable"
:
false
,
"payable"
:
false
,
"type"
:
"function"
,
"type"
:
"function"
,
"gas"
:
963
"gas"
:
"963"
},
},
{
{
"name"
:
"ownerOf"
,
"name"
:
"ownerOf"
,
...
@@ -386,7 +386,7 @@
...
@@ -386,7 +386,7 @@
"constant"
:
true
,
"constant"
:
true
,
"payable"
:
false
,
"payable"
:
false
,
"type"
:
"function"
,
"type"
:
"function"
,
"gas"
:
1126
"gas"
:
"1126"
},
},
{
{
"name"
:
"balanceOf"
,
"name"
:
"balanceOf"
,
...
@@ -405,7 +405,7 @@
...
@@ -405,7 +405,7 @@
"constant"
:
true
,
"constant"
:
true
,
"payable"
:
false
,
"payable"
:
false
,
"type"
:
"function"
,
"type"
:
"function"
,
"gas"
:
1195
"gas"
:
"1195"
},
},
{
{
"name"
:
"getApproved"
,
"name"
:
"getApproved"
,
...
@@ -424,7 +424,7 @@
...
@@ -424,7 +424,7 @@
"constant"
:
true
,
"constant"
:
true
,
"payable"
:
false
,
"payable"
:
false
,
"type"
:
"function"
,
"type"
:
"function"
,
"gas"
:
1186
"gas"
:
"1186"
},
},
{
{
"name"
:
"isApprovedForAll"
,
"name"
:
"isApprovedForAll"
,
...
@@ -447,7 +447,7 @@
...
@@ -447,7 +447,7 @@
"constant"
:
true
,
"constant"
:
true
,
"payable"
:
false
,
"payable"
:
false
,
"type"
:
"function"
,
"type"
:
"function"
,
"gas"
:
1415
"gas"
:
"1415"
},
},
{
{
"name"
:
"supportsInterface"
,
"name"
:
"supportsInterface"
,
...
@@ -466,6 +466,6 @@
...
@@ -466,6 +466,6 @@
"constant"
:
true
,
"constant"
:
true
,
"payable"
:
false
,
"payable"
:
false
,
"type"
:
"function"
,
"type"
:
"function"
,
"gas"
:
1246
"gas"
:
"1246"
}
}
]
]
src/
constants/
abis/weth.json
→
src/abis/weth.json
View file @
edf4c474
File moved
src/constants/abis/argent-wallet-detector.ts
deleted
100644 → 0
View file @
c0ce6a55
import
ARGENT_WALLET_DETECTOR_ABI
from
'
./argent-wallet-detector.json
'
const
ARGENT_WALLET_DETECTOR_MAINNET_ADDRESS
=
'
0xeca4B0bDBf7c55E9b7925919d03CbF8Dc82537E8
'
export
{
ARGENT_WALLET_DETECTOR_ABI
,
ARGENT_WALLET_DETECTOR_MAINNET_ADDRESS
}
src/constants/abis/erc20.ts
deleted
100644 → 0
View file @
c0ce6a55
import
{
Interface
}
from
'
@ethersproject/abi
'
import
ERC20_ABI
from
'
./erc20.json
'
import
ERC20_BYTES32_ABI
from
'
./erc20_bytes32.json
'
const
ERC20_INTERFACE
=
new
Interface
(
ERC20_ABI
)
const
ERC20_BYTES32_INTERFACE
=
new
Interface
(
ERC20_BYTES32_ABI
)
export
default
ERC20_INTERFACE
export
{
ERC20_ABI
,
ERC20_BYTES32_INTERFACE
,
ERC20_BYTES32_ABI
}
src/constants/abis/migrator.ts
deleted
100644 → 0
View file @
c0ce6a55
import
MIGRATOR_ABI
from
'
./migrator.json
'
const
MIGRATOR_ADDRESS
=
'
0x16D4F26C15f3658ec65B1126ff27DD3dF2a2996b
'
export
{
MIGRATOR_ADDRESS
,
MIGRATOR_ABI
}
src/constants/index.ts
View file @
edf4c474
...
@@ -214,3 +214,7 @@ export const BLOCKED_ADDRESSES: string[] = [
...
@@ -214,3 +214,7 @@ export const BLOCKED_ADDRESSES: string[] = [
'
0xA7e5d5A720f06526557c513402f2e6B5fA20b008
'
,
'
0xA7e5d5A720f06526557c513402f2e6B5fA20b008
'
,
'
0x8576aCC5C05D6Ce88f4e49bf65BdF0C62F91353C
'
,
'
0x8576aCC5C05D6Ce88f4e49bf65BdF0C62F91353C
'
,
]
]
export
const
ARGENT_WALLET_DETECTOR_MAINNET_ADDRESS
=
'
0xeca4B0bDBf7c55E9b7925919d03CbF8Dc82537E8
'
export
const
MIGRATOR_ADDRESS
=
'
0x16D4F26C15f3658ec65B1126ff27DD3dF2a2996b
'
src/hooks/useContract.ts
View file @
edf4c474
...
@@ -6,24 +6,28 @@ import { abi as MERKLE_DISTRIBUTOR_ABI } from '@uniswap/merkle-distributor/build
...
@@ -6,24 +6,28 @@ import { abi as MERKLE_DISTRIBUTOR_ABI } from '@uniswap/merkle-distributor/build
import
{
ChainId
,
WETH9
}
from
'
@uniswap/sdk-core
'
import
{
ChainId
,
WETH9
}
from
'
@uniswap/sdk-core
'
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
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
ARGENT_WALLET_DETECTOR_ABI
from
'
abis/argent-wallet-detector.json
'
import
ENS_PUBLIC_RESOLVER_ABI
from
'
abis/ens-public-resolver.json
'
import
ENS_ABI
from
'
abis/ens-registrar.json
'
import
ERC20_ABI
from
'
abis/erc20.json
'
import
ERC20_BYTES32_ABI
from
'
abis/erc20_bytes32.json
'
import
MIGRATOR_ABI
from
'
abis/migrator.json
'
import
{
Unisocks
}
from
'
abis/types/Unisocks
'
import
UNISOCKS_ABI
from
'
abis/unisocks.json
'
import
WETH_ABI
from
'
abis/weth.json
'
import
{
ARGENT_WALLET_DETECTOR_MAINNET_ADDRESS
,
GOVERNANCE_ADDRESS
,
MERKLE_DISTRIBUTOR_ADDRESS
,
MIGRATOR_ADDRESS
,
UNI
,
}
from
'
constants/index
'
import
{
MULTICALL_ABI
,
MULTICALL_NETWORKS
}
from
'
constants/multicall
'
import
{
V1_EXCHANGE_ABI
,
V1_FACTORY_ABI
,
V1_FACTORY_ADDRESSES
}
from
'
constants/v1
'
import
{
NONFUNGIBLE_POSITION_MANAGER_ADDRESSES
}
from
'
constants/v3
'
import
{
NONFUNGIBLE_POSITION_MANAGER_ADDRESSES
}
from
'
constants/v3
'
import
{
useMemo
}
from
'
react
'
import
{
useMemo
}
from
'
react
'
import
{
NonfungiblePositionManager
}
from
'
types/v3/NonfungiblePositionManager
'
import
{
NonfungiblePositionManager
}
from
'
types/v3/NonfungiblePositionManager
'
import
{
GOVERNANCE_ADDRESS
,
MERKLE_DISTRIBUTOR_ADDRESS
,
UNI
}
from
'
../constants
'
import
{
getContract
}
from
'
utils
'
import
{
ARGENT_WALLET_DETECTOR_ABI
,
ARGENT_WALLET_DETECTOR_MAINNET_ADDRESS
,
}
from
'
../constants/abis/argent-wallet-detector
'
import
ENS_PUBLIC_RESOLVER_ABI
from
'
../constants/abis/ens-public-resolver.json
'
import
ENS_ABI
from
'
../constants/abis/ens-registrar.json
'
import
{
ERC20_BYTES32_ABI
}
from
'
../constants/abis/erc20
'
import
ERC20_ABI
from
'
../constants/abis/erc20.json
'
import
{
MIGRATOR_ABI
,
MIGRATOR_ADDRESS
}
from
'
../constants/abis/migrator
'
import
UNISOCKS_ABI
from
'
../constants/abis/unisocks.json
'
import
WETH_ABI
from
'
../constants/abis/weth.json
'
import
{
MULTICALL_ABI
,
MULTICALL_NETWORKS
}
from
'
../constants/multicall
'
import
{
V1_EXCHANGE_ABI
,
V1_FACTORY_ABI
,
V1_FACTORY_ADDRESSES
}
from
'
../constants/v1
'
import
{
getContract
}
from
'
../utils
'
import
{
useActiveWeb3React
}
from
'
./index
'
import
{
useActiveWeb3React
}
from
'
./index
'
// returns null on errors
// returns null on errors
...
@@ -123,13 +127,13 @@ export function useStakingContract(stakingAddress?: string, withSignerIfPossible
...
@@ -123,13 +127,13 @@ export function useStakingContract(stakingAddress?: string, withSignerIfPossible
return
useContract
(
stakingAddress
,
STAKING_REWARDS_ABI
,
withSignerIfPossible
)
return
useContract
(
stakingAddress
,
STAKING_REWARDS_ABI
,
withSignerIfPossible
)
}
}
export
function
useSocksController
():
Contract
|
null
{
export
function
useSocksController
():
Unisocks
|
null
{
const
{
chainId
}
=
useActiveWeb3React
()
const
{
chainId
}
=
useActiveWeb3React
()
return
useContract
(
return
useContract
(
chainId
===
ChainId
.
MAINNET
?
'
0x65770b5283117639760beA3F867b69b3697a91dd
'
:
undefined
,
chainId
===
ChainId
.
MAINNET
?
'
0x65770b5283117639760beA3F867b69b3697a91dd
'
:
undefined
,
UNISOCKS_ABI
,
UNISOCKS_ABI
,
false
false
)
)
as
Unisocks
|
null
}
}
export
function
useV3NFTPositionManagerContract
():
NonfungiblePositionManager
|
null
{
export
function
useV3NFTPositionManagerContract
():
NonfungiblePositionManager
|
null
{
...
...
src/pages/MigrateV1/MigrateV1Exchange.tsx
View file @
edf4c474
...
@@ -14,8 +14,7 @@ import FormattedCurrencyAmount from '../../components/FormattedCurrencyAmount'
...
@@ -14,8 +14,7 @@ import FormattedCurrencyAmount from '../../components/FormattedCurrencyAmount'
import
QuestionHelper
from
'
../../components/QuestionHelper
'
import
QuestionHelper
from
'
../../components/QuestionHelper
'
import
{
AutoRow
,
RowBetween
,
RowFixed
}
from
'
../../components/Row
'
import
{
AutoRow
,
RowBetween
,
RowFixed
}
from
'
../../components/Row
'
import
{
Dots
}
from
'
../../components/swap/styleds
'
import
{
Dots
}
from
'
../../components/swap/styleds
'
import
{
DEFAULT_DEADLINE_FROM_NOW
,
INITIAL_ALLOWED_SLIPPAGE
}
from
'
../../constants
'
import
{
DEFAULT_DEADLINE_FROM_NOW
,
INITIAL_ALLOWED_SLIPPAGE
,
MIGRATOR_ADDRESS
}
from
'
constants/index
'
import
{
MIGRATOR_ADDRESS
}
from
'
../../constants/abis/migrator
'
import
{
PairState
,
usePair
}
from
'
../../data/Reserves
'
import
{
PairState
,
usePair
}
from
'
../../data/Reserves
'
import
{
useTotalSupply
}
from
'
../../data/TotalSupply
'
import
{
useTotalSupply
}
from
'
../../data/TotalSupply
'
import
{
useActiveWeb3React
}
from
'
../../hooks
'
import
{
useActiveWeb3React
}
from
'
../../hooks
'
...
...
src/react-app-env.d.ts
View file @
edf4c474
...
@@ -13,7 +13,7 @@ interface Window {
...
@@ -13,7 +13,7 @@ interface Window {
removeListener
?:
(...
args
:
any
[])
=>
void
removeListener
?:
(...
args
:
any
[])
=>
void
autoRefreshOnNetworkChange
?:
boolean
autoRefreshOnNetworkChange
?:
boolean
}
}
web3
?:
{}
web3
?:
Record
<
string
,
unknown
>
}
}
declare
module
'
content-hash
'
{
declare
module
'
content-hash
'
{
...
...
src/state/stake/hooks.ts
View file @
edf4c474
...
@@ -3,7 +3,7 @@ import { Pair } from '@uniswap/v2-sdk'
...
@@ -3,7 +3,7 @@ import { Pair } from '@uniswap/v2-sdk'
import
JSBI
from
'
jsbi
'
import
JSBI
from
'
jsbi
'
import
{
useMemo
}
from
'
react
'
import
{
useMemo
}
from
'
react
'
import
{
DAI
,
UNI
,
USDC
,
USDT
,
WBTC
}
from
'
../../constants
'
import
{
DAI
,
UNI
,
USDC
,
USDT
,
WBTC
}
from
'
../../constants
'
import
{
STAKING_REWARDS_INTERFACE
}
from
'
../../
constants/
abis/staking-rewards
'
import
{
STAKING_REWARDS_INTERFACE
}
from
'
../../abis/staking-rewards
'
import
{
useActiveWeb3React
}
from
'
../../hooks
'
import
{
useActiveWeb3React
}
from
'
../../hooks
'
import
{
NEVER_RELOAD
,
useMultipleContractSingleData
}
from
'
../multicall/hooks
'
import
{
NEVER_RELOAD
,
useMultipleContractSingleData
}
from
'
../multicall/hooks
'
import
{
tryParseAmount
}
from
'
../swap/hooks
'
import
{
tryParseAmount
}
from
'
../swap/hooks
'
...
...
src/state/wallet/hooks.ts
View file @
edf4c474
import
{
UNI
}
from
'
./../../constants/index
'
import
{
Currency
,
CurrencyAmount
,
ETHER
,
Token
,
TokenAmount
}
from
'
@uniswap/sdk-core
'
import
{
Currency
,
CurrencyAmount
,
ETHER
,
Token
,
TokenAmount
}
from
'
@uniswap/sdk-core
'
import
{
JSBI
}
from
'
@uniswap/v2-sdk
'
import
{
JSBI
}
from
'
@uniswap/v2-sdk
'
import
{
useMemo
}
from
'
react
'
import
{
useMemo
}
from
'
react
'
import
ERC20_INTERFACE
from
'
../../constants/abis/erc20
'
import
{
useAllTokens
}
from
'
../../hooks/Tokens
'
import
{
useActiveWeb3React
}
from
'
../../hooks
'
import
{
useActiveWeb3React
}
from
'
../../hooks
'
import
{
useAllTokens
}
from
'
../../hooks/Tokens
'
import
{
useMulticallContract
}
from
'
../../hooks/useContract
'
import
{
useMulticallContract
}
from
'
../../hooks/useContract
'
import
{
isAddress
}
from
'
../../utils
'
import
{
isAddress
}
from
'
../../utils
'
import
{
useSingleContractMultipleData
,
useMultipleContractSingleData
}
from
'
../multicall/hooks
'
import
{
useUserUnclaimedAmount
}
from
'
../claim/hooks
'
import
{
useUserUnclaimedAmount
}
from
'
../claim/hooks
'
import
{
useMultipleContractSingleData
,
useSingleContractMultipleData
}
from
'
../multicall/hooks
'
import
{
useTotalUniEarned
}
from
'
../stake/hooks
'
import
{
useTotalUniEarned
}
from
'
../stake/hooks
'
import
{
UNI
}
from
'
./../../constants/index
'
import
{
Interface
}
from
'
@ethersproject/abi
'
import
ERC20ABI
from
'
abis/erc20.json
'
import
{
Erc20Interface
}
from
'
abis/types/Erc20
'
/**
/**
* Returns a map of the given addresses to their eventually consistent ETH balances.
* Returns a map of the given addresses to their eventually consistent ETH balances.
*/
*/
...
@@ -60,8 +61,8 @@ export function useTokenBalancesWithLoadingIndicator(
...
@@ -60,8 +61,8 @@ export function useTokenBalancesWithLoadingIndicator(
)
)
const
validatedTokenAddresses
=
useMemo
(()
=>
validatedTokens
.
map
((
vt
)
=>
vt
.
address
),
[
validatedTokens
])
const
validatedTokenAddresses
=
useMemo
(()
=>
validatedTokens
.
map
((
vt
)
=>
vt
.
address
),
[
validatedTokens
])
const
ERC20Interface
=
new
Interface
(
ERC20ABI
)
as
Erc20Interface
const
balances
=
useMultipleContractSingleData
(
validatedTokenAddresses
,
ERC20
_INTERFACE
,
'
balanceOf
'
,
[
address
])
const
balances
=
useMultipleContractSingleData
(
validatedTokenAddresses
,
ERC20
Interface
,
'
balanceOf
'
,
[
address
])
const
anyLoading
:
boolean
=
useMemo
(()
=>
balances
.
some
((
callState
)
=>
callState
.
loading
),
[
balances
])
const
anyLoading
:
boolean
=
useMemo
(()
=>
balances
.
some
((
callState
)
=>
callState
.
loading
),
[
balances
])
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment