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
cb00e0ba
Unverified
Commit
cb00e0ba
authored
May 07, 2020
by
Noah Zinsmeister
Committed by
GitHub
May 07, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
migrate full away from ethers v4 to v5 (#728)
move some pacakges from dependencies to dev dependencies bump versions
parent
4ccbd0c3
Changes
7
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
385 additions
and
379 deletions
+385
-379
package.json
package.json
+24
-17
index.tsx
src/components/ExchangePage/index.tsx
+160
-169
index.tsx
src/index.tsx
+8
-9
AddLiquidity.tsx
src/pages/Pool/AddLiquidity.tsx
+36
-40
RemoveLiquidity.tsx
src/pages/Pool/RemoveLiquidity.tsx
+26
-31
index.ts
src/utils/index.ts
+23
-26
yarn.lock
yarn.lock
+108
-87
No files found.
package.json
View file @
cb00e0ba
...
...
@@ -5,28 +5,29 @@
"homepage"
:
"
https://uniswap.exchange
"
,
"private"
:
true
,
"dependencies"
:
{
"
@ethersproject/address
"
:
"
^5.0.0-beta.134
"
,
"
@ethersproject/bignumber
"
:
"
^5.0.0-beta.138
"
,
"
@ethersproject/constants
"
:
"
^5.0.0-beta.133
"
,
"
@ethersproject/contracts
"
:
"
^5.0.0-beta.151
"
,
"
@ethersproject/providers
"
:
"
5.0.0-beta.162
"
,
"
@ethersproject/strings
"
:
"
^5.0.0-beta.136
"
,
"
@ethersproject/units
"
:
"
^5.0.0-beta.132
"
,
"
@material-ui/core
"
:
"
^4.9.5
"
,
"
@reach/dialog
"
:
"
^0.2.8
"
,
"
@reach/tooltip
"
:
"
^0.2.0
"
,
"
@types/jest
"
:
"
^25.1.3
"
,
"
@types/node
"
:
"
^13.7.4
"
,
"
@types/react
"
:
"
^16.9.21
"
,
"
@types/react-dom
"
:
"
^16.9.5
"
,
"
@uniswap/sdk
"
:
"
^2.0.3
"
,
"
@uniswap/v2-core
"
:
"
1.0.0
"
,
"
@uniswap/v2-periphery
"
:
"
1.0.0-beta.0
"
,
"
@web3-react/core
"
:
"
^6.0.
2
"
,
"
@web3-react/fortmatic-connector
"
:
"
^6.0.
2
"
,
"
@web3-react/injected-connector
"
:
"
^6.0.
3
"
,
"
@web3-react/network-connector
"
:
"
^6.0.
4
"
,
"
@web3-react/portis-connector
"
:
"
^6.0.
2
"
,
"
@web3-react/walletconnect-connector
"
:
"
^6.0.
2
"
,
"
@web3-react/walletlink-connector
"
:
"
^6.0.
2
"
,
"
@web3-react/core
"
:
"
^6.0.
9
"
,
"
@web3-react/fortmatic-connector
"
:
"
^6.0.
9
"
,
"
@web3-react/injected-connector
"
:
"
^6.0.
7
"
,
"
@web3-react/network-connector
"
:
"
^6.0.
9
"
,
"
@web3-react/portis-connector
"
:
"
^6.0.
9
"
,
"
@web3-react/walletconnect-connector
"
:
"
^6.0.
9
"
,
"
@web3-react/walletlink-connector
"
:
"
^6.0.
9
"
,
"
copy-to-clipboard
"
:
"
^3.2.0
"
,
"
cross-env
"
:
"
^7.0.2
"
,
"
escape-string-regexp
"
:
"
^2.0.0
"
,
"
ethers
"
:
"
^4.0.44
"
,
"
history
"
:
"
^4.9.0
"
,
"
i18next
"
:
"
^15.0.9
"
,
"
i18next-browser-languagedetector
"
:
"
^3.0.1
"
,
...
...
@@ -35,22 +36,28 @@
"
polished
"
:
"
^3.3.2
"
,
"
prettier
"
:
"
^1.17.0
"
,
"
qrcode.react
"
:
"
^0.9.3
"
,
"
react
"
:
"
^16.
8.6
"
,
"
react
"
:
"
^16.
13.1
"
,
"
react-device-detect
"
:
"
^1.6.2
"
,
"
react-dom
"
:
"
^16.
8.6
"
,
"
react-dom
"
:
"
^16.
13.1
"
,
"
react-feather
"
:
"
^2.0.8
"
,
"
react-ga
"
:
"
^2.5.7
"
,
"
react-i18next
"
:
"
^10.7.0
"
,
"
react-router-dom
"
:
"
^5.0.0
"
,
"
react-scripts
"
:
"
^3.
0
.1
"
,
"
react-scripts
"
:
"
^3.
4
.1
"
,
"
react-spring
"
:
"
^8.0.27
"
,
"
react-switch
"
:
"
^5.0.1
"
,
"
react-use-gesture
"
:
"
^6.0.14
"
,
"
rebass
"
:
"
^4.0.7
"
,
"
styled-components
"
:
"
^4.2.0
"
,
"
typescript
"
:
"
^3.7.5
"
,
"
use-media
"
:
"
^1.4.0
"
},
"devDependencies"
:
{
"
@types/jest
"
:
"
^25.2.1
"
,
"
@types/node
"
:
"
^13.13.5
"
,
"
@types/react
"
:
"
^16.9.34
"
,
"
@types/react-dom
"
:
"
^16.9.7
"
,
"
prettier
"
:
"
^1.17.0
"
,
"
typescript
"
:
"
^3.8.3
"
},
"scripts"
:
{
"start"
:
"cross-env REACT_APP_GIT_COMMIT_HASH=$(git show -s --format=%H) react-scripts start"
,
"build"
:
"cross-env REACT_APP_GIT_COMMIT_HASH=$(git show -s --format=%H) react-scripts build"
,
...
...
src/components/ExchangePage/index.tsx
View file @
cb00e0ba
import
React
,
{
useState
,
useReducer
,
useCallback
,
useEffect
}
from
'
react
'
import
{
ethers
}
from
'
ethers
'
import
{
withRouter
}
from
'
react-router-dom
'
import
{
parseUnits
,
parseEther
}
from
'
@ethersproject/units
'
import
{
Field
,
initializeSwapState
,
reducer
,
SwapAction
}
from
'
./swap-store
'
import
{
BigNumber
}
from
'
@ethersproject/bignumber
'
import
{
Zero
,
MaxUint256
}
from
'
@ethersproject/constants
'
import
{
Contract
}
from
'
@ethersproject/contracts
'
import
{
WETH
,
TradeType
,
Pair
,
Trade
,
TokenAmount
,
JSBI
,
Percent
,
Fraction
}
from
'
@uniswap/sdk
'
import
{
Field
,
initializeSwapState
,
reducer
,
SwapAction
}
from
'
./swap-store
'
import
{
AdvancedDropwdown
,
ArrowWrapper
,
...
...
@@ -51,7 +54,7 @@ import { useLocalStorageTokens } from '../../contexts/LocalStorage'
import
{
useDarkModeManager
}
from
'
../../contexts/LocalStorage
'
function
hex
(
value
:
JSBI
)
{
return
ethers
.
utils
.
bigNumberify
(
value
.
toString
())
return
BigNumber
.
from
(
value
.
toString
())
}
enum
SwapType
{
...
...
@@ -63,8 +66,6 @@ enum SwapType {
ETH_FOR_EXACT_TOKENS
}
const
GAS_MARGIN
=
ethers
.
utils
.
bigNumberify
(
1000
)
// default allowed slippage, in bips
const
INITIAL_ALLOWED_SLIPPAGE
=
50
...
...
@@ -154,8 +155,8 @@ function ExchangePage({ sendingInput = false, history, params }) {
},
[
outputTokenAddress
,
allTokens
,
fetchTokenByAddress
,
addToken
])
// token contracts for approvals and direct sends
const
tokenContractInput
:
ethers
.
Contract
=
useTokenContract
(
tokens
[
Field
.
INPUT
]?.
address
)
const
tokenContractOutput
:
ethers
.
Contract
=
useTokenContract
(
tokens
[
Field
.
OUTPUT
]?.
address
)
const
tokenContractInput
:
Contract
=
useTokenContract
(
tokens
[
Field
.
INPUT
]?.
address
)
const
tokenContractOutput
:
Contract
=
useTokenContract
(
tokens
[
Field
.
OUTPUT
]?.
address
)
// check on pending approvals for token amounts
const
pendingApprovalInput
=
usePendingApproval
(
tokens
[
Field
.
INPUT
]?.
address
)
...
...
@@ -208,8 +209,7 @@ function ExchangePage({ sendingInput = false, history, params }) {
!!
route
&&
!!
parsedAmounts
[
independentField
]
?
new
Trade
(
route
,
parsedAmounts
[
independentField
],
tradeType
)
:
undefined
}
catch
(
error
)
{
}
}
catch
(
error
)
{}
const
slippageFromTrade
:
Percent
=
trade
&&
trade
.
slippage
...
...
@@ -295,8 +295,7 @@ function ExchangePage({ sendingInput = false, history, params }) {
?
userBalances
[
Field
.
INPUT
].
subtract
(
MIN_ETHER
)
:
userBalances
[
Field
.
INPUT
]
:
undefined
}
catch
{
}
}
catch
{}
const
atMaxAmountInput
:
boolean
=
!!
maxAmountInput
&&
!!
parsedAmounts
[
Field
.
INPUT
]
...
...
@@ -385,18 +384,16 @@ function ExchangePage({ sendingInput = false, history, params }) {
setShowConfirm
(
false
)
})
}
else
{
estimate
=
tokenContractInput
.
estimate
.
transfer
estimate
=
tokenContractInput
.
estimate
Gas
.
transfer
method
=
tokenContractInput
.
transfer
args
=
[
recipient
,
parsedAmounts
[
Field
.
INPUT
].
raw
.
toString
()]
value
=
ethers
.
constants
.
Zero
const
estimatedGasLimit
=
await
estimate
(...
args
,
{
value
}).
catch
(
e
=>
{
console
.
log
(
'
error getting gas limit
'
)
})
value
=
Zero
await
estimate
(...
args
,
{
value
})
.
then
(
estimatedGasLimit
=>
method
(...
args
,
{
value
,
gasLimit
:
calculateGasMargin
(
estimatedGasLimit
,
GAS_MARGIN
)
})
.
then
(
response
=>
{
gasLimit
:
calculateGasMargin
(
estimatedGasLimit
)
}).
then
(
response
=>
{
setTxHash
(
response
.
hash
)
addTransaction
(
response
,
...
...
@@ -409,6 +406,7 @@ function ExchangePage({ sendingInput = false, history, params }) {
)
setPendingConfirmation
(
false
)
})
)
.
catch
(()
=>
{
resetModal
()
setShowConfirm
(
false
)
...
...
@@ -418,19 +416,19 @@ function ExchangePage({ sendingInput = false, history, params }) {
// covers swap or swap with send
async
function
onSwap
()
{
const
routerContract
:
ethers
.
Contract
=
getRouterContract
(
chainId
,
library
,
account
)
const
routerContract
:
Contract
=
getRouterContract
(
chainId
,
library
,
account
)
setAttemptingTxn
(
true
)
// mark that user is attempting transaction
const
path
=
Object
.
keys
(
route
.
path
).
map
(
key
=>
{
return
route
.
path
[
key
].
address
})
let
estimate
:
Function
,
method
:
Function
,
args
:
any
[],
value
:
ethers
.
utils
.
BigNumber
let
estimate
:
Function
,
method
:
Function
,
args
:
any
[],
value
:
BigNumber
const
deadlineFromNow
:
number
=
Math
.
ceil
(
Date
.
now
()
/
1000
)
+
deadline
switch
(
getSwapType
())
{
case
SwapType
.
EXACT_TOKENS_FOR_TOKENS
:
estimate
=
routerContract
.
estimate
.
swapExactTokensForTokens
estimate
=
routerContract
.
estimate
Gas
.
swapExactTokensForTokens
method
=
routerContract
.
swapExactTokensForTokens
args
=
[
slippageAdjustedAmounts
[
Field
.
INPUT
].
raw
.
toString
(),
...
...
@@ -439,10 +437,10 @@ function ExchangePage({ sendingInput = false, history, params }) {
sending
?
recipient
:
account
,
deadlineFromNow
]
value
=
ethers
.
constants
.
Zero
value
=
Zero
break
case
SwapType
.
TOKENS_FOR_EXACT_TOKENS
:
estimate
=
routerContract
.
estimate
.
swapTokensForExactTokens
estimate
=
routerContract
.
estimate
Gas
.
swapTokensForExactTokens
method
=
routerContract
.
swapTokensForExactTokens
args
=
[
slippageAdjustedAmounts
[
Field
.
OUTPUT
].
raw
.
toString
(),
...
...
@@ -451,10 +449,10 @@ function ExchangePage({ sendingInput = false, history, params }) {
sending
?
recipient
:
account
,
deadlineFromNow
]
value
=
ethers
.
constants
.
Zero
value
=
Zero
break
case
SwapType
.
EXACT_ETH_FOR_TOKENS
:
estimate
=
routerContract
.
estimate
.
swapExactETHForTokens
estimate
=
routerContract
.
estimate
Gas
.
swapExactETHForTokens
method
=
routerContract
.
swapExactETHForTokens
args
=
[
slippageAdjustedAmounts
[
Field
.
OUTPUT
].
raw
.
toString
(),
...
...
@@ -465,7 +463,7 @@ function ExchangePage({ sendingInput = false, history, params }) {
value
=
hex
(
slippageAdjustedAmounts
[
Field
.
INPUT
].
raw
)
break
case
SwapType
.
TOKENS_FOR_EXACT_ETH
:
estimate
=
routerContract
.
estimate
.
swapTokensForExactETH
estimate
=
routerContract
.
estimate
Gas
.
swapTokensForExactETH
method
=
routerContract
.
swapTokensForExactETH
args
=
[
slippageAdjustedAmounts
[
Field
.
OUTPUT
].
raw
.
toString
(),
...
...
@@ -474,10 +472,10 @@ function ExchangePage({ sendingInput = false, history, params }) {
sending
?
recipient
:
account
,
deadlineFromNow
]
value
=
ethers
.
constants
.
Zero
value
=
Zero
break
case
SwapType
.
EXACT_TOKENS_FOR_ETH
:
estimate
=
routerContract
.
estimate
.
swapExactTokensForETH
estimate
=
routerContract
.
estimate
Gas
.
swapExactTokensForETH
method
=
routerContract
.
swapExactTokensForETH
args
=
[
slippageAdjustedAmounts
[
Field
.
INPUT
].
raw
.
toString
(),
...
...
@@ -486,10 +484,10 @@ function ExchangePage({ sendingInput = false, history, params }) {
sending
?
recipient
:
account
,
deadlineFromNow
]
value
=
ethers
.
constants
.
Zero
value
=
Zero
break
case
SwapType
.
ETH_FOR_EXACT_TOKENS
:
estimate
=
routerContract
.
estimate
.
swapETHForExactTokens
estimate
=
routerContract
.
estimate
Gas
.
swapETHForExactTokens
method
=
routerContract
.
swapETHForExactTokens
args
=
[
slippageAdjustedAmounts
[
Field
.
OUTPUT
].
raw
.
toString
(),
...
...
@@ -501,15 +499,12 @@ function ExchangePage({ sendingInput = false, history, params }) {
break
}
const
estimatedGasLimit
=
await
estimate
(...
args
,
{
value
}).
catch
(
e
=>
{
console
.
log
(
e
)
})
await
estimate
(...
args
,
{
value
})
.
then
(
estimatedGasLimit
=>
method
(...
args
,
{
value
,
gasLimit
:
calculateGasMargin
(
estimatedGasLimit
,
GAS_MARGIN
)
})
.
then
(
response
=>
{
gasLimit
:
calculateGasMargin
(
estimatedGasLimit
)
}).
then
(
response
=>
{
setTxHash
(
response
.
hash
)
addTransaction
(
response
,
...
...
@@ -524,6 +519,7 @@ function ExchangePage({ sendingInput = false, history, params }) {
)
setPendingConfirmation
(
false
)
})
)
.
catch
(()
=>
{
resetModal
()
setShowConfirm
(
false
)
...
...
@@ -531,21 +527,18 @@ function ExchangePage({ sendingInput = false, history, params }) {
}
async
function
approveAmount
(
field
:
Field
)
{
let
estimatedGas
let
useUserBalance
=
false
const
tokenContract
=
field
===
Field
.
INPUT
?
tokenContractInput
:
tokenContractOutput
estimatedGas
=
await
tokenContract
.
estimate
.
approve
(
ROUTER_ADDRESS
,
ethers
.
constants
.
MaxUint256
).
catch
(
e
=>
{
console
.
log
(
'
Error setting max token approval.
'
)
})
if
(
!
estimatedGas
)
{
const
estimatedGas
=
await
tokenContract
.
estimateGas
.
approve
(
ROUTER_ADDRESS
,
MaxUint256
).
catch
(()
=>
{
// general fallback for tokens who restrict approval amounts
estimatedGas
=
await
tokenContract
.
estimate
.
approve
(
ROUTER_ADDRESS
,
userBalances
[
field
])
useUserBalance
=
true
}
return
tokenContract
.
estimateGas
.
approve
(
ROUTER_ADDRESS
,
userBalances
[
field
])
})
tokenContract
.
approve
(
ROUTER_ADDRESS
,
useUserBalance
?
userBalances
[
field
]
:
ethers
.
constants
.
MaxUint256
,
{
gasLimit
:
calculateGasMargin
(
estimatedGas
,
GAS_MARGIN
)
.
approve
(
ROUTER_ADDRESS
,
useUserBalance
?
userBalances
[
field
]
:
MaxUint256
,
{
gasLimit
:
calculateGasMargin
(
estimatedGas
)
})
.
then
(
response
=>
{
addTransaction
(
response
,
'
Approve
'
+
tokens
[
field
]?.
symbol
,
{
approval
:
tokens
[
field
]?.
address
})
...
...
@@ -676,7 +669,7 @@ function ExchangePage({ sendingInput = false, history, params }) {
<
Text
fontSize=
{
36
}
fontWeight=
{
500
}
>
{
parsedAmounts
[
Field
.
INPUT
]?.
toSignificant
(
6
)
}
{
tokens
[
Field
.
INPUT
]?.
symbol
}
</
Text
>
<
TokenLogo
address=
{
tokens
[
Field
.
INPUT
]?.
address
}
size=
{
'
30px
'
}
/>
<
TokenLogo
address=
{
tokens
[
Field
.
INPUT
]?.
address
}
size=
{
'
30px
'
}
/>
</
RowBetween
>
<
TYPE
.
darkGray
fontSize=
{
20
}
>
To
</
TYPE
.
darkGray
>
{
ENS
?
(
...
...
@@ -688,7 +681,7 @@ function ExchangePage({ sendingInput = false, history, params }) {
{
recipient
?.
slice
(
0
,
8
)
}
...
{
recipient
?.
slice
(
34
,
42
)
}
↗
</
TYPE
.
blue
>
</
Link
>
<
Copy
toCopy=
{
recipient
}
/>
<
Copy
toCopy=
{
recipient
}
/>
</
AutoRow
>
</
AutoColumn
>
)
:
(
...
...
@@ -698,7 +691,7 @@ function ExchangePage({ sendingInput = false, history, params }) {
{
recipient
?.
slice
(
0
,
6
)
}
...
{
recipient
?.
slice
(
36
,
42
)
}
↗
</
TYPE
.
blue
>
</
Link
>
<
Copy
toCopy=
{
recipient
}
/>
<
Copy
toCopy=
{
recipient
}
/>
</
AutoRow
>
)
}
</
AutoColumn
>
...
...
@@ -710,7 +703,7 @@ function ExchangePage({ sendingInput = false, history, params }) {
<
AutoColumn
gap=
"lg"
style=
{
{
marginTop
:
'
40px
'
}
}
>
<
AutoColumn
gap=
"sm"
>
<
AutoRow
gap=
"10px"
>
<
TokenLogo
address=
{
tokens
[
Field
.
OUTPUT
]?.
address
}
size=
{
'
30px
'
}
/>
<
TokenLogo
address=
{
tokens
[
Field
.
OUTPUT
]?.
address
}
size=
{
'
30px
'
}
/>
<
Text
fontSize=
{
36
}
fontWeight=
{
500
}
>
{
slippageAdjustedAmounts
[
Field
.
OUTPUT
]?.
toSignificant
(
4
)
}
{
tokens
[
Field
.
OUTPUT
]?.
symbol
}
</
Text
>
...
...
@@ -738,14 +731,14 @@ function ExchangePage({ sendingInput = false, history, params }) {
{
/* {!!slippageAdjustedAmounts[Field.INPUT] && slippageAdjustedAmounts[Field.INPUT].toSignificant(6)} */
}
</
TruncatedText
>
<
RowFixed
gap=
"4px"
>
<
TokenLogo
address=
{
tokens
[
Field
.
INPUT
]?.
address
}
size=
{
'
24px
'
}
/>
<
TokenLogo
address=
{
tokens
[
Field
.
INPUT
]?.
address
}
size=
{
'
24px
'
}
/>
<
Text
fontSize=
{
24
}
fontWeight=
{
500
}
style=
{
{
marginLeft
:
'
10px
'
}
}
>
{
tokens
[
Field
.
INPUT
]?.
symbol
||
''
}
</
Text
>
</
RowFixed
>
</
RowBetween
>
<
RowFixed
>
<
ArrowDown
size=
"16"
color=
{
theme
(
isDark
).
text2
}
/>
<
ArrowDown
size=
"16"
color=
{
theme
(
isDark
).
text2
}
/>
</
RowFixed
>
<
RowBetween
align=
"flex-end"
>
<
TruncatedText
fontSize=
{
24
}
fontWeight=
{
500
}
color=
{
warningHigh
?
theme
(
isDark
).
red1
:
''
}
>
...
...
@@ -754,7 +747,7 @@ function ExchangePage({ sendingInput = false, history, params }) {
{
/* {!!slippageAdjustedAmounts[Field.OUTPUT] && slippageAdjustedAmounts[Field.OUTPUT].toSignificant(6)} */
}
</
TruncatedText
>
<
RowFixed
gap=
"4px"
>
<
TokenLogo
address=
{
tokens
[
Field
.
OUTPUT
]?.
address
}
size=
{
'
24px
'
}
/>
<
TokenLogo
address=
{
tokens
[
Field
.
OUTPUT
]?.
address
}
size=
{
'
24px
'
}
/>
<
Text
fontSize=
{
24
}
fontWeight=
{
500
}
style=
{
{
marginLeft
:
'
10px
'
}
}
>
{
tokens
[
Field
.
OUTPUT
]?.
symbol
||
''
}
</
Text
>
...
...
@@ -824,7 +817,7 @@ function ExchangePage({ sendingInput = false, history, params }) {
'
/
'
+
tokens
[
Field
.
INPUT
]?.
symbol
}
<
StyledBalanceMaxMini
onClick=
{
()
=>
setShowInverted
(
!
showInverted
)
}
>
<
Repeat
size=
{
14
}
/>
<
Repeat
size=
{
14
}
/>
</
StyledBalanceMaxMini
>
</
Text
>
</
RowBetween
>
...
...
@@ -834,8 +827,7 @@ function ExchangePage({ sendingInput = false, history, params }) {
<
TYPE
.
black
fontSize=
{
14
}
fontWeight=
{
400
}
>
{
independentField
===
Field
.
INPUT
?
(
sending
?
'
Min sent
'
:
'
Minimum received
'
)
:
'
Maximum sold
'
}
</
TYPE
.
black
>
<
QuestionHelper
text=
"A boundary is set so you are protected from large price movements after you submit your trade."
/>
<
QuestionHelper
text=
"A boundary is set so you are protected from large price movements after you submit your trade."
/>
</
RowFixed
>
<
RowFixed
>
<
TYPE
.
black
fontSize=
{
14
}
>
...
...
@@ -865,7 +857,7 @@ function ExchangePage({ sendingInput = false, history, params }) {
<
TYPE
.
black
color=
{
theme
(
isDark
).
text1
}
fontSize=
{
14
}
fontWeight=
{
400
}
>
Price impact
</
TYPE
.
black
>
<
QuestionHelper
text=
"The difference between the market price and your price due to trade size."
/>
<
QuestionHelper
text=
"The difference between the market price and your price due to trade size."
/>
</
RowFixed
>
<
ErrorText
fontWeight=
{
500
}
...
...
@@ -886,8 +878,7 @@ function ExchangePage({ sendingInput = false, history, params }) {
<
TYPE
.
black
fontSize=
{
14
}
fontWeight=
{
400
}
>
Liquidity Provider Fee
</
TYPE
.
black
>
<
QuestionHelper
text=
"A portion of each trade (0.3%) goes to liquidity providers to incentivize liquidity on the protocol."
/>
<
QuestionHelper
text=
"A portion of each trade (0.3%) goes to liquidity providers to incentivize liquidity on the protocol."
/>
</
RowFixed
>
<
TYPE
.
black
fontSize=
{
14
}
>
{
feeTimesInputFormatted
...
...
@@ -909,7 +900,7 @@ function ExchangePage({ sendingInput = false, history, params }) {
}
}
const
PriceBar
=
function
()
{
const
PriceBar
=
function
()
{
return
(
<
AutoRow
justify=
"space-between"
>
<
AutoColumn
justify=
"center"
>
...
...
@@ -1011,7 +1002,7 @@ function ExchangePage({ sendingInput = false, history, params }) {
Max
</MaxButton>
)}
<StyledNumerical value={formattedAmounts[Field.INPUT]} onUserInput={val => onUserInput(Field.INPUT, val)}/>
<StyledNumerical value={formattedAmounts[Field.INPUT]} onUserInput={val => onUserInput(Field.INPUT, val)}
/>
<CurrencyInputPanel
field={Field.INPUT}
value={formattedAmounts[Field.INPUT]}
...
...
@@ -1057,7 +1048,7 @@ function ExchangePage({ sendingInput = false, history, params }) {
<ColumnCenter>
<RowBetween padding="0 12px">
<ArrowWrapper onClick={onSwapTokens}>
<ArrowDown size="16" color={theme(isDark).text2} onClick={onSwapTokens}/>
<ArrowDown size="16" color={theme(isDark).text2} onClick={onSwapTokens}
/>
</ArrowWrapper>
<StyledBalanceMaxMini onClick={() => setSendingWithSwap(false)} style={{ marginRight: '0px' }}>
<TYPE.blue>Remove Swap</TYPE.blue>
...
...
@@ -1095,7 +1086,7 @@ function ExchangePage({ sendingInput = false, history, params }) {
/>
{sendingWithSwap && (
<RowBetween padding="0 12px">
<ArrowDown size="16"/>
<ArrowDown size="16"
/>
</RowBetween>
)}
</>
...
...
@@ -1127,7 +1118,7 @@ function ExchangePage({ sendingInput = false, history, params }) {
{!noRoute && tokens[Field.OUTPUT] && tokens[Field.INPUT] && (
<Card padding={advanced ? '.25rem 1.25rem 0 .75rem' : '.25rem .7rem .25rem 1.25rem'} borderRadius={'20px'}>
{advanced ? (
<PriceBar/>
<PriceBar
/>
) : (
<AutoColumn gap="4px">
{' '}
...
...
@@ -1153,7 +1144,7 @@ function ExchangePage({ sendingInput = false, history, params }) {
' per ' +
tokens[Field.INPUT]?.symbol}
<StyledBalanceMaxMini onClick={() => setShowInverted(!showInverted)}>
<Repeat size={14}/>
<Repeat size={14}
/>
</StyledBalanceMaxMini>
</Text>
</RowBetween>
...
...
@@ -1173,8 +1164,7 @@ function ExchangePage({ sendingInput = false, history, params }) {
: priceSlippage.toFixed(4) + '%'
: '-'}{' '}
</ErrorText>
<QuestionHelper
text="The difference between the market price and your quoted price due to trade size."/>
<QuestionHelper text="The difference between the market price and your quoted price due to trade size." />
</RowFixed>
</RowBetween>
)}
...
...
@@ -1250,7 +1240,7 @@ function ExchangePage({ sendingInput = false, history, params }) {
<Text fontSize={16} fontWeight={500} style={{ userSelect: 'none' }}>
Show Advanced
</Text>
<ChevronDown color={theme(isDark).text2}/>
<ChevronDown color={theme(isDark).text2}
/>
</RowBetween>
</Hover>
)}
...
...
@@ -1261,10 +1251,10 @@ function ExchangePage({ sendingInput = false, history, params }) {
<Text fontSize={16} color={theme(isDark).text2} fontWeight={500} style={{ userSelect: 'none' }}>
Hide Advanced
</Text>
<ChevronUp color={theme(isDark).text2}/>
<ChevronUp color={theme(isDark).text2}
/>
</RowBetween>
</Hover>
<SectionBreak/>
<SectionBreak
/>
<AutoColumn style={{ padding: '0 20px' }}>
<RowBetween>
<RowFixed>
...
...
@@ -1289,12 +1279,16 @@ function ExchangePage({ sendingInput = false, history, params }) {
<TYPE.black color={theme(isDark).text1} fontSize={14}>
{independentField === Field.INPUT
? slippageAdjustedAmounts[Field.OUTPUT]
? slippageAdjustedAmounts[Field.OUTPUT]?.lessThan(new Fraction(JSBI.BigInt(1), JSBI.BigInt(10000)))
? slippageAdjustedAmounts[Field.OUTPUT]?.lessThan(
new Fraction(JSBI.BigInt(1), JSBI.BigInt(10000))
)
? '<0.00001'
: slippageAdjustedAmounts[Field.OUTPUT]?.toFixed(5)
: '-'
: slippageAdjustedAmounts[Field.INPUT]
? slippageAdjustedAmounts[Field.INPUT]?.lessThan(new Fraction(JSBI.BigInt(1), JSBI.BigInt(10000)))
? slippageAdjustedAmounts[Field.INPUT]?.lessThan(
new Fraction(JSBI.BigInt(1), JSBI.BigInt(10000))
)
? '<0.00001'
: slippageAdjustedAmounts[Field.INPUT]?.toFixed(5)
: '-'}
...
...
@@ -1313,8 +1307,7 @@ function ExchangePage({ sendingInput = false, history, params }) {
<TYPE.black fontSize={14} fontWeight={400} color={theme(isDark).text1}>
Price Impact
</TYPE.black>
<QuestionHelper
text="The difference between the market price and your quoted price due to trade size."/>
<QuestionHelper text="The difference between the market price and your quoted price due to trade size." />
</RowFixed>
<ErrorText
fontWeight={500}
...
...
@@ -1335,8 +1328,7 @@ function ExchangePage({ sendingInput = false, history, params }) {
<TYPE.black fontSize={14} fontWeight={400} color={theme(isDark).text1}>
Liquidity Provider Fee
</TYPE.black>
<QuestionHelper
text="A portion of each trade (0.03%) goes to liquidity providers to incentivize liquidity on the protocol."/>
<QuestionHelper text="A portion of each trade (0.03%) goes to liquidity providers to incentivize liquidity on the protocol." />
</RowFixed>
<TYPE.black fontSize={14} color={theme(isDark).text1}>
{feeTimesInputFormatted
...
...
@@ -1345,13 +1337,12 @@ function ExchangePage({ sendingInput = false, history, params }) {
</TYPE.black>
</RowBetween>
</AutoColumn>
<SectionBreak/>
<SectionBreak
/>
<RowFixed padding={'0 20px'}>
<TYPE.black fontWeight={400} fontSize={14} color={theme(isDark).text1}>
Set front running resistance
</TYPE.black>
<QuestionHelper
text="Your transaction will revert if the price changes more than this amount after you submit your trade."/>
<QuestionHelper text="Your transaction will revert if the price changes more than this amount after you submit your trade." />
</RowFixed>
<SlippageTabs
rawSlippage={allowedSlippage}
...
...
src/index.tsx
View file @
cb00e0ba
...
...
@@ -2,8 +2,7 @@ import React from 'react'
import
ReactDOM
from
'
react-dom
'
import
ReactGA
from
'
react-ga
'
import
{
Web3ReactProvider
,
createWeb3ReactRoot
}
from
'
@web3-react/core
'
import
{
ethers
}
from
'
ethers
'
import
{
Web3Provider
}
from
'
ethers/providers
'
import
{
Web3Provider
}
from
'
@ethersproject/providers
'
import
{
NetworkContextName
}
from
'
./constants
'
import
{
isMobile
}
from
'
react-device-detect
'
...
...
@@ -21,7 +20,7 @@ import './i18n'
const
Web3ProviderNetwork
=
createWeb3ReactRoot
(
NetworkContextName
)
function
getLibrary
(
provider
):
Web3Provider
{
const
library
=
new
ethers
.
providers
.
Web3Provider
(
provider
)
const
library
=
new
Web3Provider
(
provider
)
library
.
pollingInterval
=
10000
return
library
}
...
...
@@ -58,9 +57,9 @@ function ContextProviders({ children }) {
function
Updaters
()
{
return
(
<>
<
ApplicationContextUpdater
/>
<
TransactionContextUpdater
/>
<
BalancesContextUpdater
/>
<
ApplicationContextUpdater
/>
<
TransactionContextUpdater
/>
<
BalancesContextUpdater
/>
</>
)
}
...
...
@@ -69,11 +68,11 @@ ReactDOM.render(
<
Web3ReactProvider
getLibrary=
{
getLibrary
}
>
<
Web3ProviderNetwork
getLibrary=
{
getLibrary
}
>
<
ContextProviders
>
<
Updaters
/>
<
Updaters
/>
<
ThemeProvider
>
<>
<
GlobalStyle
/>
<
App
/>
<
GlobalStyle
/>
<
App
/>
</>
</
ThemeProvider
>
</
ContextProviders
>
...
...
src/pages/Pool/AddLiquidity.tsx
View file @
cb00e0ba
import
React
,
{
useReducer
,
useState
,
useCallback
,
useEffect
}
from
'
react
'
import
styled
from
'
styled-components
'
import
{
ethers
}
from
'
ethers
'
import
{
withRouter
}
from
'
react-router-dom
'
import
{
parseUnits
,
parseEther
}
from
'
@ethersproject/units
'
import
{
MaxUint256
,
Zero
}
from
'
@ethersproject/constants
'
import
{
Contract
}
from
'
@ethersproject/contracts
'
import
{
WETH
,
TokenAmount
,
JSBI
,
Percent
,
Route
,
Token
,
Pair
,
Price
}
from
'
@uniswap/sdk
'
import
TokenLogo
from
'
../../components/TokenLogo
'
...
...
@@ -26,9 +27,9 @@ import { usePair, useTotalSupply } from '../../contexts/Pairs'
import
{
useWeb3React
,
useTokenContract
}
from
'
../../hooks
'
import
{
useTransactionAdder
,
usePendingApproval
}
from
'
../../contexts/Transactions
'
import
{
BigNumber
}
from
'
ethers/utils
'
import
{
ROUTER_ADDRESS
}
from
'
../../constants
'
import
{
getRouterContract
,
calculateGasMargin
,
isWETH
}
from
'
../../utils
'
import
{
BigNumber
}
from
'
@ethersproject/bignumber
'
// denominated in bips
const
ALLOWED_SLIPPAGE
=
50
...
...
@@ -36,8 +37,6 @@ const ALLOWED_SLIPPAGE = 50
// denominated in seconds
const
DEADLINE_FROM_NOW
=
60
*
20
const
GAS_MARGIN
:
BigNumber
=
ethers
.
utils
.
bigNumberify
(
1000
)
const
Wrapper
=
styled
.
div
`
position: relative;
`
...
...
@@ -179,8 +178,8 @@ function AddLiquidity({ token0, token1, step = false }) {
}
// token contracts for approvals and direct sends
const
tokenContractInput
:
ethers
.
Contract
=
useTokenContract
(
tokens
[
Field
.
INPUT
]?.
address
)
const
tokenContractOutput
:
ethers
.
Contract
=
useTokenContract
(
tokens
[
Field
.
OUTPUT
]?.
address
)
const
tokenContractInput
:
Contract
=
useTokenContract
(
tokens
[
Field
.
INPUT
]?.
address
)
const
tokenContractOutput
:
Contract
=
useTokenContract
(
tokens
[
Field
.
OUTPUT
]?.
address
)
// check on pending approvals for token amounts
const
pendingApprovalInput
=
usePendingApproval
(
tokens
[
Field
.
INPUT
]?.
address
)
...
...
@@ -409,7 +408,7 @@ function AddLiquidity({ token0, token1, step = false }) {
// format ETH value for transaction
function
hex
(
value
:
JSBI
)
{
return
ethers
.
utils
.
bigNumberify
(
value
.
toString
())
return
BigNumber
.
from
(
value
.
toString
())
}
// calculate slippage bounds based on current reserves
...
...
@@ -435,7 +434,7 @@ function AddLiquidity({ token0, token1, step = false }) {
if
(
tokens
[
Field
.
INPUT
]
===
WETH
[
chainId
]
||
tokens
[
Field
.
OUTPUT
]
===
WETH
[
chainId
])
{
method
=
router
.
addLiquidityETH
estimate
=
router
.
estimate
.
addLiquidityETH
estimate
=
router
.
estimate
Gas
.
addLiquidityETH
args
=
[
tokens
[
Field
.
OUTPUT
]
===
WETH
[
chainId
]
?
tokens
[
Field
.
INPUT
].
address
:
tokens
[
Field
.
OUTPUT
].
address
,
// token
...
...
@@ -454,7 +453,7 @@ function AddLiquidity({ token0, token1, step = false }) {
)
}
else
{
method
=
router
.
addLiquidity
estimate
=
router
.
estimate
.
addLiquidity
estimate
=
router
.
estimate
Gas
.
addLiquidity
args
=
[
tokens
[
Field
.
INPUT
].
address
,
tokens
[
Field
.
OUTPUT
].
address
,
...
...
@@ -465,18 +464,17 @@ function AddLiquidity({ token0, token1, step = false }) {
account
,
deadline
]
value
=
ethers
.
constants
.
Zero
value
=
Zero
}
const
estimatedGasLimit
=
await
estimate
(...
args
,
{
await
estimate
(...
args
,
{
value
:
value
})
.
then
(
estimatedGasLimit
=>
method
(...
args
,
{
gasLimit
:
calculateGasMargin
(
estimatedGasLimit
,
GAS_MARGIN
),
gasLimit
:
calculateGasMargin
(
estimatedGasLimit
),
value
:
value
})
.
then
(
response
=>
{
}).
then
(
response
=>
{
setTxHash
(
response
.
hash
)
addTransaction
(
response
,
...
...
@@ -491,6 +489,7 @@ function AddLiquidity({ token0, token1, step = false }) {
)
setPendingConfirmation
(
false
)
})
)
.
catch
((
e
:
Error
)
=>
{
console
.
log
(
e
)
setPendingConfirmation
(
true
)
...
...
@@ -500,21 +499,18 @@ function AddLiquidity({ token0, token1, step = false }) {
}
async
function
approveAmount
(
field
)
{
let
estimatedGas
let
useUserBalance
=
false
const
tokenContract
=
field
===
Field
.
INPUT
?
tokenContractInput
:
tokenContractOutput
estimatedGas
=
await
tokenContract
.
estimate
.
approve
(
ROUTER_ADDRESS
,
ethers
.
constants
.
MaxUint256
).
catch
(
e
=>
{
console
.
log
(
'
Error setting max token approval.
'
)
})
if
(
!
estimatedGas
)
{
const
estimatedGas
=
await
tokenContract
.
estimateGas
.
approve
(
ROUTER_ADDRESS
,
MaxUint256
).
catch
(()
=>
{
// general fallback for tokens who restrict approval amounts
estimatedGas
=
await
tokenContract
.
estimate
.
approve
(
ROUTER_ADDRESS
,
userBalances
[
field
])
useUserBalance
=
true
}
return
tokenContract
.
estimateGas
.
approve
(
ROUTER_ADDRESS
,
userBalances
[
field
])
})
tokenContract
.
approve
(
ROUTER_ADDRESS
,
useUserBalance
?
userBalances
[
field
]
:
ethers
.
constants
.
MaxUint256
,
{
gasLimit
:
calculateGasMargin
(
estimatedGas
,
GAS_MARGIN
)
.
approve
(
ROUTER_ADDRESS
,
useUserBalance
?
userBalances
[
field
]
:
MaxUint256
,
{
gasLimit
:
calculateGasMargin
(
estimatedGas
)
})
.
then
(
response
=>
{
addTransaction
(
response
,
'
Approve
'
+
tokens
[
field
]?.
symbol
,
{
approval
:
tokens
[
field
]?.
address
})
...
...
src/pages/Pool/RemoveLiquidity.tsx
View file @
cb00e0ba
import
React
,
{
useReducer
,
useState
,
useCallback
,
useEffect
}
from
'
react
'
import
styled
from
'
styled-components
'
import
{
ethers
}
from
'
ethers
'
import
{
parseUnits
}
from
'
@ethersproject/units
'
import
{
Zero
}
from
'
@ethersproject/constants
'
import
{
Contract
}
from
'
@ethersproject/contracts
'
import
{
TokenAmount
,
JSBI
,
Route
,
WETH
,
Percent
,
Token
,
Pair
}
from
'
@uniswap/sdk
'
import
Slider
from
'
../../components/Slider
'
...
...
@@ -26,7 +27,6 @@ import { usePairContract } from '../../hooks'
import
{
useTransactionAdder
}
from
'
../../contexts/Transactions
'
import
{
usePair
,
useTotalSupply
}
from
'
../../contexts/Pairs
'
import
{
BigNumber
}
from
'
ethers/utils
'
import
{
splitSignature
}
from
'
@ethersproject/bytes
'
import
{
ROUTER_ADDRESS
}
from
'
../../constants
'
import
{
getRouterContract
,
calculateGasMargin
}
from
'
../../utils
'
...
...
@@ -34,8 +34,6 @@ import { getRouterContract, calculateGasMargin } from '../../utils'
// denominated in seconds
const
DEADLINE_FROM_NOW
=
60
*
20
const
GAS_MARGIN
:
BigNumber
=
ethers
.
utils
.
bigNumberify
(
1000
)
const
Wrapper
=
styled
.
div
`
position: relative;
`
...
...
@@ -167,7 +165,7 @@ export default function RemoveLiquidity({ token0, token1 }) {
}
const
pair
:
Pair
=
usePair
(
inputToken
,
outputToken
)
const
pairContract
:
ethers
.
Contract
=
usePairContract
(
pair
?.
liquidityToken
.
address
)
const
pairContract
:
Contract
=
usePairContract
(
pair
?.
liquidityToken
.
address
)
// pool token data
const
totalPoolTokens
:
TokenAmount
=
useTotalSupply
(
tokens
[
Field
.
TOKEN0
],
tokens
[
Field
.
TOKEN1
])
...
...
@@ -435,7 +433,7 @@ export default function RemoveLiquidity({ token0, token1 }) {
// removal with ETH
if
(
tokens
[
Field
.
TOKEN0
]
===
WETH
[
chainId
]
||
tokens
[
Field
.
TOKEN1
]
===
WETH
[
chainId
])
{
method
=
router
.
removeLiquidityETHWithPermit
estimate
=
router
.
estimate
.
removeLiquidityETHWithPermit
estimate
=
router
.
estimate
Gas
.
removeLiquidityETHWithPermit
args
=
[
tokens
[
Field
.
TOKEN1
]
===
WETH
[
chainId
]
?
tokens
[
Field
.
TOKEN0
].
address
:
tokens
[
Field
.
TOKEN1
].
address
,
parsedAmounts
[
Field
.
LIQUIDITY
].
raw
.
toString
(),
...
...
@@ -456,7 +454,7 @@ export default function RemoveLiquidity({ token0, token1 }) {
//removal without ETH
else
{
method
=
router
.
removeLiquidityWithPermit
estimate
=
router
.
estimate
.
removeLiquidityWithPermit
estimate
=
router
.
estimate
Gas
.
removeLiquidityWithPermit
args
=
[
tokens
[
Field
.
TOKEN0
].
address
,
tokens
[
Field
.
TOKEN1
].
address
,
...
...
@@ -472,17 +470,13 @@ export default function RemoveLiquidity({ token0, token1 }) {
]
}
const
estimatedGasLimit
=
await
estimate
(...
args
,
{
value
:
ethers
.
constants
.
Zero
}).
catch
(()
=>
{
resetModalState
()
setShowConfirm
(
false
)
await
estimate
(...
args
,
{
value
:
Zero
})
.
then
(
estimatedGasLimit
=>
method
(...
args
,
{
gasLimit
:
calculateGasMargin
(
estimatedGasLimit
,
GAS_MARGIN
)
})
.
then
(
response
=>
{
gasLimit
:
calculateGasMargin
(
estimatedGasLimit
)
}).
then
(
response
=>
{
setPendingConfirmation
(
false
)
setTxHash
(
response
.
hash
)
addTransaction
(
...
...
@@ -497,6 +491,7 @@ export default function RemoveLiquidity({ token0, token1 }) {
tokens
[
Field
.
TOKEN1
]?.
symbol
)
})
)
.
catch
(
e
=>
{
console
.
log
(
e
)
resetModalState
()
...
...
src/utils/index.ts
View file @
cb00e0ba
import
{
Contract
}
from
'
@ethersproject/contracts
'
import
{
getAddress
}
from
'
@ethersproject/address
'
import
{
AddressZero
}
from
'
@ethersproject/constants
'
import
{
parseBytes32String
}
from
'
@ethersproject/strings
'
import
{
BigNumber
}
from
'
@ethersproject/bignumber
'
import
{
WETH
}
from
'
@uniswap/sdk
'
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
IUniswapV2Router01ABI
}
from
'
@uniswap/v2-periphery/build/IUniswapV2Router01.json
'
import
{
Contract
,
ethers
,
Signer
}
from
'
ethers
'
import
{
JsonRpcProvider
,
Provider
}
from
'
ethers/providers
'
import
{
ROUTER_ADDRESS
,
SUPPORTED_THEMES
}
from
'
../constants
'
import
ERC20_ABI
from
'
../constants/abis/erc20.json
'
import
ERC20_BYTES32_ABI
from
'
../constants/abis/erc20_bytes32.json
'
import
UncheckedJsonRpcSigner
from
'
./signer
'
export
enum
ERROR_CODES
{
TOKEN_SYMBOL
=
1
,
TOKEN_DECIMALS
=
2
...
...
@@ -80,7 +81,7 @@ export function getAllQueryParams(): QueryParams {
inputTokenAddress
:
parseUrlAddress
(
'
inputTokenAddress
'
),
outputTokenAddress
:
parseUrlAddress
(
'
outputTokenAddress
'
),
inputTokenAmount
:
parseUrlTokenAmount
(
'
inputTokenAmount
'
),
outputTokenAmount
:
parseUrlTokenAmount
(
'
outputTokenAmount
'
)
,
outputTokenAmount
:
parseUrlTokenAmount
(
'
outputTokenAmount
'
)
}
}
...
...
@@ -125,34 +126,30 @@ export function shortenTransactionHash(hash, digits = 4) {
return
`
${
hash
.
substring
(
0
,
digits
+
2
)}
...
${
hash
.
substring
(
66
-
digits
)}
`
}
export
function
isAddress
(
value
):
string
|
false
{
export
function
isAddress
(
value
:
any
):
string
|
false
{
try
{
return
ethers
.
utils
.
getAddress
(
value
.
toLowerCase
())
return
getAddress
(
value
.
toLowerCase
())
}
catch
{
return
false
}
}
export
function
calculateGasMargin
(
value
,
margin
)
{
if
(
value
)
{
const
offset
=
value
.
mul
(
margin
).
div
(
ethers
.
utils
.
bigNumberify
(
10000
))
return
value
.
add
(
offset
)
}
return
null
export
function
calculateGasMargin
(
value
:
BigNumber
)
{
return
value
.
mul
(
BigNumber
.
from
(
10000
).
add
(
BigNumber
.
from
(
1000
))).
div
(
BigNumber
.
from
(
10000
))
// add 10%
}
// account is optional
export
function
getProviderOrSigner
(
library
:
JsonRpcProvider
,
account
?:
string
):
Signer
|
Provider
{
return
account
?
new
UncheckedJsonRpcSigner
(
library
.
getSigner
(
account
)
)
:
library
export
function
getProviderOrSigner
(
library
:
any
,
account
?:
string
):
any
{
return
account
?
library
.
getSigner
(
account
).
connectUnchecked
(
)
:
library
}
// account is optional
export
function
getContract
(
address
:
string
,
ABI
:
any
,
library
:
JsonRpcProvider
,
account
?:
string
):
Contract
{
if
(
!
isAddress
(
address
)
||
address
===
ethers
.
constants
.
AddressZero
)
{
export
function
getContract
(
address
:
string
,
ABI
:
any
,
library
:
any
,
account
?:
string
):
Contract
{
if
(
!
isAddress
(
address
)
||
address
===
AddressZero
)
{
throw
Error
(
`Invalid 'address' parameter '
${
address
}
'.`
)
}
return
new
ethers
.
Contract
(
address
,
ABI
,
getProviderOrSigner
(
library
,
account
))
return
new
Contract
(
address
,
ABI
,
getProviderOrSigner
(
library
,
account
))
}
// account is optional
...
...
@@ -176,7 +173,7 @@ export async function getTokenName(tokenAddress, library) {
.
catch
(()
=>
getContract
(
tokenAddress
,
ERC20_BYTES32_ABI
,
library
)
.
name
()
.
then
(
bytes32
=>
ethers
.
utils
.
parseBytes32String
(
bytes32
)
)
.
then
(
parseBytes32String
)
)
.
catch
(
error
=>
{
error
.
code
=
ERROR_CODES
.
TOKEN_SYMBOL
...
...
@@ -194,7 +191,7 @@ export async function getTokenSymbol(tokenAddress, library) {
.
symbol
()
.
catch
(()
=>
{
const
contractBytes32
=
getContract
(
tokenAddress
,
ERC20_BYTES32_ABI
,
library
)
return
contractBytes32
.
symbol
().
then
(
bytes32
=>
ethers
.
utils
.
parseBytes32String
(
bytes32
)
)
return
contractBytes32
.
symbol
().
then
(
parseBytes32String
)
})
.
catch
(
error
=>
{
error
.
code
=
ERROR_CODES
.
TOKEN_SYMBOL
...
...
@@ -237,7 +234,7 @@ export async function getTokenBalance(tokenAddress, address, library) {
export
async
function
getTokenAllowance
(
address
,
tokenAddress
,
spenderAddress
,
library
)
{
if
(
!
isAddress
(
address
)
||
!
isAddress
(
tokenAddress
)
||
!
isAddress
(
spenderAddress
))
{
throw
Error
(
'
Invalid
\'
address
\'
or
\'
tokenAddress
\'
or
\'
spenderAddress
\'
parameter
'
+
"
Invalid 'address' or 'tokenAddress' or 'spenderAddress' parameter
"
+
`'
${
address
}
' or '
${
tokenAddress
}
' or '
${
spenderAddress
}
'.`
)
}
...
...
yarn.lock
View file @
cb00e0ba
...
...
@@ -1268,9 +1268,9 @@
integrity sha512-6U71C2Wp7r5XtFtQzYrW5iKFT67OixrSxjI4MptCHzdSVlgabczzqLe0ZSgnub/5Kp4hSbpDB1tMytZY9pwxxA==
"@ethersproject/abi@>=5.0.0-beta.137":
version "5.0.0-beta.15
2
"
resolved "https://registry.yarnpkg.com/@ethersproject/abi/-/abi-5.0.0-beta.15
2.tgz#371cd363c9d2df7ca23dcf970cd9c47ac776f1e9
"
integrity sha512-
+1+ukofyBYNJo8IdIK8lBENkEycgXW1ny1zWT7oYD8GKvczYYrgucRQnJPgt3u9MJYZdje4yxDQFoGd6d4BpRA
==
version "5.0.0-beta.15
3
"
resolved "https://registry.yarnpkg.com/@ethersproject/abi/-/abi-5.0.0-beta.15
3.tgz#43a37172b33794e4562999f6e2d555b7599a8eee
"
integrity sha512-
aXweZ1Z7vMNzJdLpR1CZUAIgnwjrZeUSvN9syCwlBaEBUFJmFY+HHnfuTI5vIhVs/mRkfJVrbEyl51JZQqyjAg
==
dependencies:
"@ethersproject/address" ">=5.0.0-beta.128"
"@ethersproject/bignumber" ">=5.0.0-beta.130"
...
...
@@ -1296,9 +1296,9 @@
"@ethersproject/web" ">=5.0.0-beta.129"
"@ethersproject/abstract-signer@>=5.0.0-beta.132":
version "5.0.0-beta.14
1
"
resolved "https://registry.yarnpkg.com/@ethersproject/abstract-signer/-/abstract-signer-5.0.0-beta.14
1.tgz#e8cf65cea082905db6b678f0dd35d35c4869063b
"
integrity sha512-
94ldEV+H2BI00lBEWKf0HlX7IrbMcPPFYbSnj2f1/cqB2y8RNttEe0gR39ALrCUeqY+ceLnKxIz2tOY9sllMFw
==
version "5.0.0-beta.14
2
"
resolved "https://registry.yarnpkg.com/@ethersproject/abstract-signer/-/abstract-signer-5.0.0-beta.14
2.tgz#99a0aadbcb587142c1a3cf21ef6b9c423bc96792
"
integrity sha512-
5DeGLRjjOKuwGcOHnLp7L9JqsOs6h6Y4/ge0DgDuwtQwIgo03jIeEb+IPLKsjJp8VJWOYSaodreyXFVLuA5ZwA
==
dependencies:
"@ethersproject/abstract-provider" ">=5.0.0-beta.131"
"@ethersproject/bignumber" ">=5.0.0-beta.130"
...
...
@@ -1325,7 +1325,7 @@
dependencies:
"@ethersproject/bytes" ">=5.0.0-beta.129"
"@ethersproject/bignumber@>=5.0.0-beta.130":
"@ethersproject/bignumber@>=5.0.0-beta.130"
, "@ethersproject/bignumber@^5.0.0-beta.138"
:
version "5.0.0-beta.138"
resolved "https://registry.yarnpkg.com/@ethersproject/bignumber/-/bignumber-5.0.0-beta.138.tgz#a635f2f9a6f1b262cc38e1c7ee561fb13d79fda4"
integrity sha512-DTlOEJw6jAFz7/qkY8p4mPGGHVwgYUUC5rk1Pbg2/gR/gHPFDim+uBY+XGavh0QSWd1i3hXKafVPre92j4fs5g==
...
...
@@ -1349,17 +1349,17 @@
dependencies:
"@ethersproject/logger" ">=5.0.0-beta.129"
"@ethersproject/constants@>=5.0.0-beta.128":
"@ethersproject/constants@>=5.0.0-beta.128"
, "@ethersproject/constants@^5.0.0-beta.133"
:
version "5.0.0-beta.133"
resolved "https://registry.yarnpkg.com/@ethersproject/constants/-/constants-5.0.0-beta.133.tgz#af4ccd7232f3ed73aebe066a695ede32c497a394"
integrity sha512-VCTpk3AF00mlWQw1vg+fI6qCo0qO5EVWK574t4HNBKW6X748jc9UJPryKUz9JgZ64ZQupyLM92wHilsG/YTpNQ==
dependencies:
"@ethersproject/bignumber" ">=5.0.0-beta.130"
"@ethersproject/contracts@^5.0.0-beta.143":
version "5.0.0-beta.15
0
"
resolved "https://registry.yarnpkg.com/@ethersproject/contracts/-/contracts-5.0.0-beta.15
0.tgz#0038ddbacdabbd3061dd69bbd3dd009561fe6c75
"
integrity sha512-
ODHv8o3dJPXo2vTtQ1dmla6KhykTtYlgQxwgyyYXt/r2PhMVyFQsljVYkJRUuHgC17WYBopmWGeVeYAxNeOht
Q==
"@ethersproject/contracts@^5.0.0-beta.143"
, "@ethersproject/contracts@^5.0.0-beta.151"
:
version "5.0.0-beta.15
1
"
resolved "https://registry.yarnpkg.com/@ethersproject/contracts/-/contracts-5.0.0-beta.15
1.tgz#4cee195c01b6865e8e7d8849777427864819e931
"
integrity sha512-
ELmsmZ/vE/rz5ydJNlU04aXsh7sw22tzmy7vM5JXCgMm5nEFhGoRF+dRIrUFCuUV2Mxe0bALN11qGkRqFKlXR
Q==
dependencies:
"@ethersproject/abi" ">=5.0.0-beta.137"
"@ethersproject/abstract-provider" ">=5.0.0-beta.131"
...
...
@@ -1403,16 +1403,38 @@
"@ethersproject/logger" ">=5.0.0-beta.129"
"@ethersproject/properties@>=5.0.0-beta.131":
version "5.0.0-beta.1
39
"
resolved "https://registry.yarnpkg.com/@ethersproject/properties/-/properties-5.0.0-beta.1
39.tgz#b56c494bbeb47b2d1bab95a52bbf1ee0a8040274
"
integrity sha512-
IFMEWxWkx8ATeGtY56pnHXK40eJgfO9UeEsK/24Qzwyl5jA5Lhz6OoElaW3UG5LLupHmLoRuLyuG1WNg2olC3
A==
version "5.0.0-beta.1
40
"
resolved "https://registry.yarnpkg.com/@ethersproject/properties/-/properties-5.0.0-beta.1
40.tgz#c9b082f05ba0af65fc0846cf0bd1a2a8e5ef8573
"
integrity sha512-
0VH4JZvDWjYClByFl+xr2g3CrQ1D0helmM5IOP8ZFCxiAGnyQee+vwORKdVISZ5IlTJYJYXD5UrYHRF3LxTsH
A==
dependencies:
"@ethersproject/logger" ">=5.0.0-beta.129"
"@ethersproject/providers@5.0.0-beta.162":
version "5.0.0-beta.162"
resolved "https://registry.yarnpkg.com/@ethersproject/providers/-/providers-5.0.0-beta.162.tgz#cb4efbeea2c776d0ce97712e05ffaa3e0a8df215"
integrity sha512-mXT5pQLOmRkXP5pza6TuV9RitaI50b1O2r0og8VzUIHcjO9bq4yppVbWs0Zcxn4KQAiIrAd2xXbYE3q2KdfUYQ==
dependencies:
"@ethersproject/abstract-provider" ">=5.0.0-beta.131"
"@ethersproject/abstract-signer" ">=5.0.0-beta.132"
"@ethersproject/address" ">=5.0.0-beta.128"
"@ethersproject/bignumber" ">=5.0.0-beta.130"
"@ethersproject/bytes" ">=5.0.0-beta.129"
"@ethersproject/constants" ">=5.0.0-beta.128"
"@ethersproject/hash" ">=5.0.0-beta.128"
"@ethersproject/logger" ">=5.0.0-beta.129"
"@ethersproject/networks" ">=5.0.0-beta.129"
"@ethersproject/properties" ">=5.0.0-beta.131"
"@ethersproject/random" ">=5.0.0-beta.128"
"@ethersproject/rlp" ">=5.0.0-beta.126"
"@ethersproject/strings" ">=5.0.0-beta.130"
"@ethersproject/transactions" ">=5.0.0-beta.128"
"@ethersproject/web" ">=5.0.0-beta.129"
ws "7.2.3"
"@ethersproject/providers@^5.0.0-beta.153":
version "5.0.0-beta.16
4
"
resolved "https://registry.yarnpkg.com/@ethersproject/providers/-/providers-5.0.0-beta.16
4.tgz#eecfc7a5bb67249d0c36c3e98ec25a7eb1c9e00b
"
integrity sha512-
c8pu+eYROr88dfDuW9aImESq2nHupzE5fFERHwLMQnl5eW20iEy37/1CEIRhjhBsHtRA/JpFPSRKPr4o1RcF4Q
==
version "5.0.0-beta.16
5
"
resolved "https://registry.yarnpkg.com/@ethersproject/providers/-/providers-5.0.0-beta.16
5.tgz#62d83facfbdb2a6b0a882bdf018ea21f92649dd7
"
integrity sha512-
SgQHvy/Yaar0WEqP2Yo6U6r6CiVytXkX49DgN3wDsRi2J21yHX2js+ODfabTTRDw7l/tyn5UmDJow84jju/eRg
==
dependencies:
"@ethersproject/abstract-provider" ">=5.0.0-beta.131"
"@ethersproject/abstract-signer" ">=5.0.0-beta.132"
...
...
@@ -1477,7 +1499,7 @@
"@ethersproject/sha2" ">=5.0.0-beta.129"
"@ethersproject/strings" ">=5.0.0-beta.130"
"@ethersproject/strings@5.0.0-beta.136", "@ethersproject/strings@>=5.0.0-beta.130":
"@ethersproject/strings@5.0.0-beta.136", "@ethersproject/strings@>=5.0.0-beta.130"
, "@ethersproject/strings@^5.0.0-beta.136"
:
version "5.0.0-beta.136"
resolved "https://registry.yarnpkg.com/@ethersproject/strings/-/strings-5.0.0-beta.136.tgz#053cbf4f9f96a7537cbc50300597f2d707907f51"
integrity sha512-Hb9RvTrgGcOavHvtQZz+AuijB79BO3g1cfF2MeMfCU9ID4j3mbZv/olzDMS2pK9r4aERJpAS94AmlWzCgoY2LQ==
...
...
@@ -1511,9 +1533,9 @@
"@ethersproject/logger" ">=5.0.0-beta.129"
"@ethersproject/web@>=5.0.0-beta.129":
version "5.0.0-beta.13
7
"
resolved "https://registry.yarnpkg.com/@ethersproject/web/-/web-5.0.0-beta.13
7.tgz#fed0f0640bc5f59a2b4da82d69c7bd106cbf558e
"
integrity sha512-
A5pyWFSVjUHK/etvAkX3tOTMe6Vn1oOReFUCZ/wUzECJE4fLLLPs1e+MKkkcEKtJygeo8rc0sDuNj/EjN8U7+
Q==
version "5.0.0-beta.13
8
"
resolved "https://registry.yarnpkg.com/@ethersproject/web/-/web-5.0.0-beta.13
8.tgz#09e693984bd7b86c9bd1ca50cc00bff2c1564a07
"
integrity sha512-
FoiUdnhq7nyvtlLE2eZGWNm3BZmz8NGSGaKyMmxAlvZofLCWfvditNijUzF143HueDkDD9tglDvig/6QJCj0a
Q==
dependencies:
"@ethersproject/base64" ">=5.0.0-beta.126"
"@ethersproject/logger" ">=5.0.0-beta.129"
...
...
@@ -2306,7 +2328,7 @@
"@types/istanbul-lib-coverage" "*"
"@types/istanbul-lib-report" "*"
"@types/jest@^25.
1.3
":
"@types/jest@^25.
2.1
":
version "25.2.1"
resolved "https://registry.yarnpkg.com/@types/jest/-/jest-25.2.1.tgz#9544cd438607955381c1bdbdb97767a249297db5"
integrity sha512-msra1bCaAeEdkSyA0CZ6gW1ukMIvZ5YoJkdXw/qhQdsuuDlFTcEUrUw8CLCPt2rVRUfXlClVvK2gvPs9IokZaA==
...
...
@@ -2324,10 +2346,10 @@
resolved "https://registry.yarnpkg.com/@types/minimatch/-/minimatch-3.0.3.tgz#3dca0e3f33b200fc7d1139c0cd96c1268cadfd9d"
integrity sha512-tHq6qdbT9U1IRSGf14CL0pUlULksvY9OZ+5eEgl1N7t+OA3tGvNpxJCzuKQlsNgCVwbAs670L1vcVQi8j9HjnA==
"@types/node@*", "@types/node@^13.
7.4
":
version "13.13.
4
"
resolved "https://registry.yarnpkg.com/@types/node/-/node-13.13.
4.tgz#1581d6c16e3d4803eb079c87d4ac893ee7501c2c
"
integrity sha512-
x26ur3dSXgv5AwKS0lNfbjpCakGIduWU1DU91Zz58ONRWrIKGunmZBNv4P7N+e27sJkiGDsw/3fT4AtsqQBrBA
==
"@types/node@*", "@types/node@^13.
13.5
":
version "13.13.
5
"
resolved "https://registry.yarnpkg.com/@types/node/-/node-13.13.
5.tgz#96ec3b0afafd64a4ccea9107b75bf8489f0e5765
"
integrity sha512-
3ySmiBYJPqgjiHA7oEaIo2Rzz0HrOZ7yrNO5HWyaE5q0lQ3BppDZ3N53Miz8bw2I7gh1/zir2MGVZBvpb1zq9g
==
"@types/node@^10.12.18", "@types/node@^10.3.2":
version "10.17.21"
...
...
@@ -2335,9 +2357,9 @@
integrity sha512-PQKsydPxYxF1DsAFWmunaxd3sOi3iMt6Zmx/tgaagHYmwJ/9cRH91hQkeJZaUGWbvn0K5HlSVEXkn5U/llWPpQ==
"@types/node@^12.6.1":
version "12.12.3
7
"
resolved "https://registry.yarnpkg.com/@types/node/-/node-12.12.3
7.tgz#cb4782d847f801fa58316da5b4801ca3a59ae790
"
integrity sha512-
4mXKoDptrXAwZErQHrLzpe0FN/0Wmf5JRniSVIdwUrtDf9wnmEV1teCNLBo/TwuXhkK/bVegoEn/wmb+x0AuPg
==
version "12.12.3
8
"
resolved "https://registry.yarnpkg.com/@types/node/-/node-12.12.3
8.tgz#58841a382f231ad005dbb935c36d44aa1118a26b
"
integrity sha512-
75eLjX0pFuTcUXnnWmALMzzkYorjND0ezNEycaKesbUBg9eGZp4GHPuDmkRc4mQQvIpe29zrzATNRA6hkYqwmA
==
"@types/parse-json@^4.0.0":
version "4.0.0"
...
...
@@ -2354,7 +2376,7 @@
resolved "https://registry.yarnpkg.com/@types/q/-/q-1.5.2.tgz#690a1475b84f2a884fd07cd797c00f5f31356ea8"
integrity sha512-ce5d3q03Ex0sy4R14722Rmt6MT07Ua+k4FwDfdcToYJcMKNtRVQvJ6JCAPdAmAnbRb6CsX6aYb9m96NGod9uTw==
"@types/react-dom@^16.9.
5
":
"@types/react-dom@^16.9.
7
":
version "16.9.7"
resolved "https://registry.yarnpkg.com/@types/react-dom/-/react-dom-16.9.7.tgz#60844d48ce252d7b2dccf0c7bb937130e27c0cd2"
integrity sha512-GHTYhM8/OwUCf254WO5xqR/aqD3gC9kSTLpopWGpQLpnw23jk44RvMHsyUSEplvRJZdHxhJGMMLF0kCPYHPhQA==
...
...
@@ -2368,7 +2390,7 @@
dependencies:
"@types/react" "*"
"@types/react@*", "@types/react@^16.9.
21
":
"@types/react@*", "@types/react@^16.9.
34
":
version "16.9.34"
resolved "https://registry.yarnpkg.com/@types/react/-/react-16.9.34.tgz#f7d5e331c468f53affed17a8a4d488cd44ea9349"
integrity sha512-8AJlYMOfPe1KGLKyHpflCg5z46n0b5DbRfqDksxBLBTUpB75ypDBAO9eCUcjNwE6LCUslwTz00yyG/X9gaVtow==
...
...
@@ -2564,7 +2586,7 @@
dependencies:
"@web3-react/types" "^6.0.7"
"@web3-react/core@^6.0.
2
":
"@web3-react/core@^6.0.
9
":
version "6.0.9"
resolved "https://registry.yarnpkg.com/@web3-react/core/-/core-6.0.9.tgz#0c9dd6f9dca1f54368e768130c5be0ffc9eda5ad"
integrity sha512-mhYvLLXcnzi75ksdOkPGPo6dagd+z30ziz4169C9wSukq9zozNhwAFVlx5rmXJz/EnHl+AwwYcuGVONwEzifsw==
...
...
@@ -2575,7 +2597,7 @@
tiny-invariant "^1.0.6"
tiny-warning "^1.0.3"
"@web3-react/fortmatic-connector@^6.0.
2
":
"@web3-react/fortmatic-connector@^6.0.
9
":
version "6.0.9"
resolved "https://registry.yarnpkg.com/@web3-react/fortmatic-connector/-/fortmatic-connector-6.0.9.tgz#1362f2149b639da19749bfcb08fbcab84407f786"
integrity sha512-RBnPg1aPB6AgdVaITu/XxsbdVkTn2b1mRaTbYjJnDslDy4D+bm7O3mlFTEDaEC+fT+v+/eQDXnUtWFFy6YeOew==
...
...
@@ -2585,7 +2607,7 @@
fortmatic "^1.0.0"
tiny-invariant "^1.0.6"
"@web3-react/injected-connector@^6.0.
3
":
"@web3-react/injected-connector@^6.0.
7
":
version "6.0.7"
resolved "https://registry.yarnpkg.com/@web3-react/injected-connector/-/injected-connector-6.0.7.tgz#1e0be23f51fa07fe6547fe986768a46b74c3a426"
integrity sha512-Y7aJSz6pg+MWKtvdyuqyy6LWuH+4Tqtph1LWfiyVms9II9ar/9B/de4R8wh4wjg91wmHkU+D75yP09E/Soh2RA==
...
...
@@ -2594,7 +2616,7 @@
"@web3-react/types" "^6.0.7"
tiny-warning "^1.0.3"
"@web3-react/network-connector@^6.0.
4
":
"@web3-react/network-connector@^6.0.
9
":
version "6.0.9"
resolved "https://registry.yarnpkg.com/@web3-react/network-connector/-/network-connector-6.0.9.tgz#d152626cae0fa0b73428621815ea7c920d20bc1d"
integrity sha512-B/q8dAaW7Dx4gYNb5D1qUAblA6W0yyL5dGmbwPAYRuiIyVR2m32SG0BmnGIbQcBi8F8W9X/fx7y/HNXBjjzRWQ==
...
...
@@ -2604,7 +2626,7 @@
"@web3-react/types" "^6.0.7"
tiny-invariant "^1.0.6"
"@web3-react/portis-connector@^6.0.
2
":
"@web3-react/portis-connector@^6.0.
9
":
version "6.0.9"
resolved "https://registry.yarnpkg.com/@web3-react/portis-connector/-/portis-connector-6.0.9.tgz#befd34ecac185ad9f216c603c7f9e4dbfabcea95"
integrity sha512-bERyF/RAKsh4d0EWvHAu/SXYT/r+iFEVUyk84P+A3N+JI3ROgtVZSvJxnerScLyf+N6TW/Z8lUBLMFDkX4NcIQ==
...
...
@@ -2619,7 +2641,7 @@
resolved "https://registry.yarnpkg.com/@web3-react/types/-/types-6.0.7.tgz#34a6204224467eedc6123abaf55fbb6baeb2809f"
integrity sha512-ofGmfDhxmNT1/P/MgVa8IKSkCStFiyvXe+U5tyZurKdrtTDFU+wJ/LxClPDtFerWpczNFPUSrKcuhfPX1sI6+A==
"@web3-react/walletconnect-connector@^6.0.
2
":
"@web3-react/walletconnect-connector@^6.0.
9
":
version "6.0.9"
resolved "https://registry.yarnpkg.com/@web3-react/walletconnect-connector/-/walletconnect-connector-6.0.9.tgz#76cdbf39ca670ce1a14fa254d1e5fc5a6efbe5ed"
integrity sha512-k+rjDgxaoUrMMVt4ssopVh/OMKVhgcpgeogqZnaMzCR1i07z6nH0gNrtVg0ddevbiLkMmnp4ieE8ilpZAgsDOw==
...
...
@@ -2629,7 +2651,7 @@
"@web3-react/types" "^6.0.7"
tiny-invariant "^1.0.6"
"@web3-react/walletlink-connector@^6.0.
2
":
"@web3-react/walletlink-connector@^6.0.
9
":
version "6.0.9"
resolved "https://registry.yarnpkg.com/@web3-react/walletlink-connector/-/walletlink-connector-6.0.9.tgz#62f1b79ca63f5c565863a69fbfe9a0c42d0da6d6"
integrity sha512-p5802oW+bvHcjKoq2t29f4ZwHW/Dj2Dkm/UlAgNUtaPAZNPjWSU1Yz1foJ39Z1j7xh2PflYafp49bUsXC1N0Aw==
...
...
@@ -4196,7 +4218,7 @@ bn.js@4.11.6:
resolved "https://registry.yarnpkg.com/bn.js/-/bn.js-4.11.6.tgz#53344adb14617a13f6e8dd2ce28905d1c0ba3215"
integrity sha1-UzRK2xRhehP26N0s4okF0cC6MhU=
bn.js@4.11.8, bn.js@^4.0.0, bn.js@^4.1.0, bn.js@^4.1
.1, bn.js@^4.1
0.0, bn.js@^4.11.0, bn.js@^4.11.1, bn.js@^4.11.6, bn.js@^4.11.8, bn.js@^4.4.0, bn.js@^4.8.0:
bn.js@4.11.8, bn.js@^4.0.0, bn.js@^4.1.0, bn.js@^4.10.0, bn.js@^4.11.0, bn.js@^4.11.1, bn.js@^4.11.6, bn.js@^4.11.8, bn.js@^4.4.0, bn.js@^4.8.0:
version "4.11.8"
resolved "https://registry.yarnpkg.com/bn.js/-/bn.js-4.11.8.tgz#2cde09eb5ee341f484746bb0309b3253b1b1442f"
integrity sha512-ItfYfPLkWHUjckQCk8xC+LwxgK8NYcXywGigJgSwOP8Y2iyWT4f2vsZnoOXTTbo+o5yXmIUJ4gn5538SO5S3gA==
...
...
@@ -4318,7 +4340,7 @@ browserify-des@^1.0.0:
inherits "^2.0.1"
safe-buffer "^5.1.2"
browserify-rsa@^4.0.0:
browserify-rsa@^4.0.0
, browserify-rsa@^4.0.1
:
version "4.0.1"
resolved "https://registry.yarnpkg.com/browserify-rsa/-/browserify-rsa-4.0.1.tgz#21e0abfaf6f2029cf2fafb133567a701d4135524"
integrity sha1-IeCr+vbyApzy+vsTNWenAdQTVSQ=
...
...
@@ -4335,17 +4357,18 @@ browserify-sha3@^0.0.4:
safe-buffer "^5.1.1"
browserify-sign@^4.0.0:
version "4.
0.4
"
resolved "https://registry.yarnpkg.com/browserify-sign/-/browserify-sign-4.
0.4.tgz#aa4eb68e5d7b658baa6bf6a57e630cbd7a93d298
"
integrity sha
1-qk62jl17ZYuqa/alfmMMvXqT0pg
=
version "4.
1.0
"
resolved "https://registry.yarnpkg.com/browserify-sign/-/browserify-sign-4.
1.0.tgz#4fe971b379a5aeb4925e06779f9fa1f41d249d70
"
integrity sha
512-VYxo7cDCeYUoBZ0ZCy4UyEUCP3smyBd4DRQM5nrFS1jJjPJjX7rP3oLRpPoWfkhQfyJ0I9ZbHbKafrFD/SGlrg=
=
dependencies:
bn.js "^4.1.1"
browserify-rsa "^4.0.0"
create-hash "^1.1.0"
create-hmac "^1.1.2"
elliptic "^6.0.0"
inherits "^2.0.1"
parse-asn1 "^5.0.0"
bn.js "^5.1.1"
browserify-rsa "^4.0.1"
create-hash "^1.2.0"
create-hmac "^1.1.7"
elliptic "^6.5.2"
inherits "^2.0.4"
parse-asn1 "^5.1.5"
readable-stream "^3.6.0"
browserify-zlib@^0.2.0:
version "0.2.0"
...
...
@@ -4659,9 +4682,9 @@ caniuse-api@^3.0.0:
lodash.uniq "^4.5.0"
caniuse-lite@^1.0.0, caniuse-lite@^1.0.30000844, caniuse-lite@^1.0.30000981, caniuse-lite@^1.0.30001035, caniuse-lite@^1.0.30001039, caniuse-lite@^1.0.30001043:
version "1.0.3000105
0
"
resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.3000105
0.tgz#11218af4b6b85dc1089536f31e10e3181e849e71
"
integrity sha512-
OvGZqalCwmapci76ISq5q4kuAskb1ebqF3FEQBv1LE1kWht0pojlDDqzFlmk5jgYkuZN7MNZ1n+ULwe/7MaDNQ
==
version "1.0.3000105
3
"
resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.3000105
3.tgz#b7ae027567ce2665b965b0437e4512b296ccd20d
"
integrity sha512-
HtV4wwIZl6GA4Oznse8aR274XUOYGZnQLcf/P8vHgmlfqSNelwD+id8CyHOceqLqt9yfKmo7DUZTh1EuS9pukg
==
capture-exit@^2.0.0:
version "2.0.0"
...
...
@@ -5264,7 +5287,7 @@ create-hash@^1.1.0, create-hash@^1.1.1, create-hash@^1.1.2, create-hash@^1.2.0:
ripemd160 "^2.0.1"
sha.js "^2.4.0"
create-hmac@^1.1.0, create-hmac@^1.1.
2, create-hmac@^1.1.4
:
create-hmac@^1.1.0, create-hmac@^1.1.
4, create-hmac@^1.1.7
:
version "1.1.7"
resolved "https://registry.yarnpkg.com/create-hmac/-/create-hmac-1.1.7.tgz#69170c78b3ab957147b2b8b04572e47ead2243ff"
integrity sha512-MJG9liiZ+ogc4TzUwuvbER1JRdgvUFSB5+VR/g5h82fGaIRWMWddtKBHi7/sVhfjQZ6SehlyhvQYrcYkaUIpLg==
...
...
@@ -6126,9 +6149,9 @@ ee-first@1.1.1:
integrity sha1-WQxhFWsK4vTwJVcyoViyZrxWsh0=
electron-to-chromium@^1.3.378, electron-to-chromium@^1.3.413, electron-to-chromium@^1.3.47:
version "1.3.4
27
"
resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.3.4
27.tgz#ea43d02908a8c71f47ebb46e09de5a3cf8236f04
"
integrity sha512-
/rG5G7Opcw68/Yrb4qYkz07h3bESVRJjUl4X/FrKLXzoUJleKm6D7K7rTTz8V5LUWnd+BbTOyxJX2XprRqHD8A
==
version "1.3.4
30
"
resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.3.4
30.tgz#33914f7c2db771bdcf30977bd4fd6258ee8a2f37
"
integrity sha512-
HMDYkANGhx6vfbqpOf/hc6hWEmiOipOHGDeRDeUb3HLD3XIWpvKQxFgWf0tgHcr3aNv6I/8VPecplqmQsXoZSw
==
elliptic@6.3.3:
version "6.3.3"
...
...
@@ -6861,11 +6884,16 @@ ethereumjs-blockchain@^4.0.3:
rlp "^2.2.2"
semaphore "^1.1.0"
ethereumjs-common@1.5.0
, ethereumjs-common@^1.1.0, ethereumjs-common@^1.3.2, ethereumjs-common@^1.5.0
:
ethereumjs-common@1.5.0:
version "1.5.0"
resolved "https://registry.yarnpkg.com/ethereumjs-common/-/ethereumjs-common-1.5.0.tgz#d3e82fc7c47c0cef95047f431a99485abc9bb1cd"
integrity sha512-SZOjgK1356hIY7MRj3/ma5qtfr/4B5BL+G4rP/XSMYr2z1H5el4RX5GReYCKmQmYI/nSBmRnwrZ17IfHuG0viQ==
ethereumjs-common@^1.1.0, ethereumjs-common@^1.3.2, ethereumjs-common@^1.5.0:
version "1.5.1"
resolved "https://registry.yarnpkg.com/ethereumjs-common/-/ethereumjs-common-1.5.1.tgz#4e75042473a64daec0ed9fe84323dd9576aa5dba"
integrity sha512-aVUPRLgmXORGXXEVkFYgPhr9TGtpBY2tGhZ9Uh0A3lIUzUDr1x6kQx33SbjPUkLkX3eniPQnIL/2psjkjrOfcQ==
ethereumjs-tx@2.1.2, ethereumjs-tx@^2.1.1, ethereumjs-tx@^2.1.2:
version "2.1.2"
resolved "https://registry.yarnpkg.com/ethereumjs-tx/-/ethereumjs-tx-2.1.2.tgz#5dfe7688bf177b45c9a23f86cf9104d47ea35fed"
...
...
@@ -7017,7 +7045,7 @@ ethers@4.0.0-beta.3:
uuid "2.0.1"
xmlhttprequest "1.8.0"
ethers@
^4.0.44, ethers@
~4.0.4:
ethers@~4.0.4:
version "4.0.47"
resolved "https://registry.yarnpkg.com/ethers/-/ethers-4.0.47.tgz#91b9cd80473b1136dd547095ff9171bd1fc68c85"
integrity sha512-hssRYhngV4hiDNeZmVU/k5/E8xmLG8UpcNUzg6mb7lqhgpFPH/t7nuv20RjRrEf0gblzvi2XwR5Te+V3ZFc9pQ==
...
...
@@ -7720,9 +7748,9 @@ fsevents@2.1.2:
integrity sha512-R4wDiBwZ0KzpgOWetKDug1FZcYhqYnUYKtfZYt4mD5SBz76q0KR4Q9o7GIPamsVPGmW3EYPPJ0dOOjvx32ldZA==
fsevents@^1.2.7:
version "1.2.1
2
"
resolved "https://registry.yarnpkg.com/fsevents/-/fsevents-1.2.1
2.tgz#db7e0d8ec3b0b45724fd4d83d43554a8f1f0de5c
"
integrity sha512-
Ggd/Ktt7E7I8pxZRbGIs7vwqAPscSESMrCSkx2FtWeqmheJgCo2R74fTsZFCifr0VTPwqRpPv17+6b8Zp7th0Q
==
version "1.2.1
3
"
resolved "https://registry.yarnpkg.com/fsevents/-/fsevents-1.2.1
3.tgz#f325cb0455592428bcf11b383370ef70e3bfcc38
"
integrity sha512-
oWb1Z6mkHIskLzEJ/XWX0srkpkTQ7vaopMQkyaEIoq0fmtFVxOthb8cCxeT+p3ynTdkk/RZwbgG4brR5BeWECw
==
dependencies:
bindings "^1.5.0"
nan "^2.12.1"
...
...
@@ -11111,9 +11139,9 @@ node-notifier@^5.4.2:
which "^1.3.0"
node-releases@^1.1.52, node-releases@^1.1.53:
version "1.1.5
3
"
resolved "https://registry.yarnpkg.com/node-releases/-/node-releases-1.1.5
3.tgz#2d821bfa499ed7c5dffc5e2f28c88e78a08ee3f4
"
integrity sha512-
wp8zyQVwef2hpZ/dJH7SfSrIPD6YoJz6BDQDpGEkcA0s3LpAQoxBIYmfIq6QAhC1DhwsyCgTaTTcONwX8qzCuQ
==
version "1.1.5
5
"
resolved "https://registry.yarnpkg.com/node-releases/-/node-releases-1.1.5
5.tgz#8af23b7c561d8e2e6e36a46637bab84633b07cee
"
integrity sha512-
H3R3YR/8TjT5WPin/wOoHOUPHgvj8leuU/Keta/rwelEQN9pA/S2Dx8/se4pZ2LBxSd0nAGzsNzhqwa77v7F1w
==
noop-logger@^0.1.1:
version "0.1.1"
...
...
@@ -11616,7 +11644,7 @@ parent-module@^1.0.0:
dependencies:
callsites "^3.0.0"
parse-asn1@^5.0.0:
parse-asn1@^5.0.0
, parse-asn1@^5.1.5
:
version "5.1.5"
resolved "https://registry.yarnpkg.com/parse-asn1/-/parse-asn1-5.1.5.tgz#003271343da58dc94cace494faef3d2147ecea0e"
integrity sha512-jkMYn1dcJqF6d5CpU689bq7w/b5ALS9ROVSpQDPrZsqqesUJii9qutvoT5ltGedNXMO2e16YUWIghG9KxaViTQ==
...
...
@@ -11936,9 +11964,9 @@ pocket-js-core@0.0.3:
axios "^0.18.0"
polished@^3.3.2:
version "3.6.
0
"
resolved "https://registry.yarnpkg.com/polished/-/polished-3.6.
0.tgz#03eb2871c9bc4785d5199dd751cde7af6de42ff8
"
integrity sha512-
H7tsy9h5JVGXh7BdNzm/v/Q+zIasiwXnYflSmrLd+YpK+8dXKJTKl/kzCtB2kns2N5dyelRvjUtpOKK/nLCanA
==
version "3.6.
2
"
resolved "https://registry.yarnpkg.com/polished/-/polished-3.6.
2.tgz#bae682806da6400596a851ea443178ff6eec1dd2
"
integrity sha512-
V0dyaVJUM5e5wIhLHvZyyE9PhXoI0AlGT6RDww1V/v+STsocLsVGWmi+9OKTL49oaQj85XFDvsWi/uHQJ0rpWg
==
dependencies:
"@babel/runtime" "^7.9.2"
...
...
@@ -13086,7 +13114,7 @@ react-device-detect@^1.6.2:
dependencies:
ua-parser-js "^0.7.21"
react-dom@^16.
8.6
:
react-dom@^16.
13.1
:
version "16.13.1"
resolved "https://registry.yarnpkg.com/react-dom/-/react-dom-16.13.1.tgz#c1bd37331a0486c078ee54c4740720993b2e0e7f"
integrity sha512-81PIMmVLnCNLO/fFOQxdQkvEq/+Hfpv24XNJfpyZhTRfO0QcmQIF/PgCa1zCOj2w1hrn12MFLyaJ/G0+Mxtfag==
...
...
@@ -13181,7 +13209,7 @@ react-router@5.1.2:
tiny-invariant "^1.0.2"
tiny-warning "^1.0.0"
react-scripts@^3.
0
.1:
react-scripts@^3.
4
.1:
version "3.4.1"
resolved "https://registry.yarnpkg.com/react-scripts/-/react-scripts-3.4.1.tgz#f551298b5c71985cc491b9acf3c8e8c0ae3ada0a"
integrity sha512-JpTdi/0Sfd31mZA6Ukx+lq5j1JoKItX7qqEK4OiACjVQletM1P38g49d9/D0yTxp9FrSF+xpJFStkGgKEIRjlQ==
...
...
@@ -13257,17 +13285,10 @@ react-style-singleton@^1.1.0:
invariant "^2.2.4"
tslib "^1.0.0"
react-switch@^5.0.1:
version "5.0.1"
resolved "https://registry.yarnpkg.com/react-switch/-/react-switch-5.0.1.tgz#449277f4c3aed5286fffd0f50d5cbc2a23330406"
integrity sha512-Pa5kvqRfX85QUCK1Jv0rxyeElbC3aNpCP5hV0LoJpU/Y6kydf0t4kRriQ6ZYA4kxWwAYk/cH51T4/sPzV9mCgQ==
dependencies:
prop-types "^15.6.2"
react-transition-group@^4.3.0:
version "4.
3.0
"
resolved "https://registry.yarnpkg.com/react-transition-group/-/react-transition-group-4.
3.0.tgz#fea832e386cf8796c58b61874a3319704f5ce683
"
integrity sha512-
1qRV1ZuVSdxPlPf4O8t7inxUGpdyO5zG9IoNfJxSO0ImU2A1YWkEQvFPuIPZmMLkg5hYs7vv5mMOyfgSkvAwv
w==
version "4.
4.1
"
resolved "https://registry.yarnpkg.com/react-transition-group/-/react-transition-group-4.
4.1.tgz#63868f9325a38ea5ee9535d828327f85773345c9
"
integrity sha512-
Djqr7OQ2aPUiYurhPalTrVy9ddmFCCzwhqQmtN+J3+3DzLO209Fdr70QrN8Z3DsglWql6iY1lDWAfpFiBtuKG
w==
dependencies:
"@babel/runtime" "^7.5.5"
dom-helpers "^5.0.1"
...
...
@@ -13279,7 +13300,7 @@ react-use-gesture@^6.0.14:
resolved "https://registry.yarnpkg.com/react-use-gesture/-/react-use-gesture-6.0.14.tgz#ab2d35ef72a5fb6060a6160eb12568c276f8a4b1"
integrity sha512-d9cnZJ0DOFd3FIO76J776DyhtbODgbxGKu19lvc1aSNTnRV5EKr9V4Uda188l2Qh0Va3pqWGxEQlw72r2cmnFQ==
react@^16.
8.6
:
react@^16.
13.1
:
version "16.13.1"
resolved "https://registry.yarnpkg.com/react/-/react-16.13.1.tgz#2e818822f1a9743122c063d6410d85c1e3afe48e"
integrity sha512-YMZQQq32xHLX0bz5Mnibv1/LHb3Sqzngu7xstSM+vrkE5Kzr9xE0yMByK5kMoTK30YVJE61WfbxIFFvfeDKT1w==
...
...
@@ -15314,9 +15335,9 @@ ts-pnp@^1.1.6:
integrity sha512-csd+vJOb/gkzvcCHgTGSChYpy5f1/XKNsmvBGO4JXS+z1v2HobugDz4s1IeFXM3wZB44uczs+eazB5Q/ccdhQw==
tslib@^1.0.0, tslib@^1.10.0, tslib@^1.8.1, tslib@^1.9.0:
version "1.11.
1
"
resolved "https://registry.yarnpkg.com/tslib/-/tslib-1.11.
1.tgz#eb15d128827fbee2841549e171f45ed338ac7e35
"
integrity sha512-
aZW88SY8kQbU7gpV19lN24LtXh/yD4ZZg6qieAJDDg+YBsJcSmLGK9QpnUjAKVG/xefmvJGd1WUmfpT/g6AJGA
==
version "1.11.
2
"
resolved "https://registry.yarnpkg.com/tslib/-/tslib-1.11.
2.tgz#9c79d83272c9a7aaf166f73915c9667ecdde3cc9
"
integrity sha512-
tTSkux6IGPnUGUd1XAZHcpu85MOkIl5zX49pO+jfsie3eP0B6pyhOlLXm3cAC6T7s+euSDDUUV+Acop5WmtkVg
==
tsutils@^3.17.1:
version "3.17.1"
...
...
@@ -15399,7 +15420,7 @@ typedarray@^0.0.6:
resolved "https://registry.yarnpkg.com/typedarray/-/typedarray-0.0.6.tgz#867ac74e3864187b1d3d47d996a78ec5c8830777"
integrity sha1-hnrHTjhkGHsdPUfZlqeOxciDB3c=
typescript@^3.
7.5
:
typescript@^3.
8.3
:
version "3.8.3"
resolved "https://registry.yarnpkg.com/typescript/-/typescript-3.8.3.tgz#409eb8544ea0335711205869ec458ab109ee1061"
integrity sha512-MYlEfn5VrLNsgudQTVJeNaQFUAI7DkhnOjdpAp4T+ku1TfQClewlbSuTVHiA+8skNBgaf02TL/kLOvig4y3G8w==
...
...
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