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
49462fdb
Unverified
Commit
49462fdb
authored
May 07, 2020
by
Ian Lapham
Committed by
GitHub
May 07, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bug fixes (#727)
parent
3c112b57
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
93 additions
and
47 deletions
+93
-47
index.tsx
src/components/CreatePool/index.tsx
+1
-1
index.tsx
src/components/ExchangePage/index.tsx
+1
-1
index.js
src/components/Header/index.js
+8
-8
index.js
src/components/SearchModal/index.js
+1
-1
index.ts
src/constants/index.ts
+4
-1
App.js
src/pages/App.js
+19
-19
AddLiquidity.tsx
src/pages/Pool/AddLiquidity.tsx
+59
-16
RemoveLiquidity.tsx
src/pages/Pool/RemoveLiquidity.tsx
+0
-0
index.js
src/pages/Pool/index.js
+0
-0
No files found.
src/components/CreatePool/index.tsx
View file @
49462fdb
...
@@ -5,7 +5,7 @@ import { Token, JSBI, WETH } from '@uniswap/sdk'
...
@@ -5,7 +5,7 @@ import { Token, JSBI, WETH } from '@uniswap/sdk'
import
Row
,
{
AutoRow
}
from
'
../Row
'
import
Row
,
{
AutoRow
}
from
'
../Row
'
import
TokenLogo
from
'
../TokenLogo
'
import
TokenLogo
from
'
../TokenLogo
'
import
SearchModal
from
'
../SearchModal
'
import
SearchModal
from
'
../SearchModal
'
import
AddLiquidity
from
'
../../pages/
Supply
/AddLiquidity
'
import
AddLiquidity
from
'
../../pages/
Pool
/AddLiquidity
'
import
{
Text
}
from
'
rebass
'
import
{
Text
}
from
'
rebass
'
import
{
Plus
}
from
'
react-feather
'
import
{
Plus
}
from
'
react-feather
'
import
{
TYPE
,
Link
}
from
'
../../theme
'
import
{
TYPE
,
Link
}
from
'
../../theme
'
...
...
src/components/ExchangePage/index.tsx
View file @
49462fdb
...
@@ -1115,7 +1115,7 @@ function ExchangePage({ sendingInput = false, history, params }) {
...
@@ -1115,7 +1115,7 @@ function ExchangePage({ sendingInput = false, history, params }) {
<
TYPE
.
black
fontSize=
{
14
}
fontWeight=
{
400
}
>
<
TYPE
.
black
fontSize=
{
14
}
fontWeight=
{
400
}
>
Liquidity Provider Fee
Liquidity Provider Fee
</
TYPE
.
black
>
</
TYPE
.
black
>
<
QuestionHelper
text=
"A portion of each trade (0.
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
>
</
RowFixed
>
<
TYPE
.
black
fontSize=
{
14
}
>
<
TYPE
.
black
fontSize=
{
14
}
>
{
feeTimesInputFormatted
{
feeTimesInputFormatted
...
...
src/components/Header/index.js
View file @
49462fdb
import
React
from
'
react
'
import
React
from
'
react
'
import
styled
from
'
styled-components
'
import
styled
from
'
styled-components
'
import
{
withRouter
}
from
'
react-router-dom
'
import
Row
from
'
../Row
'
import
Row
from
'
../Row
'
import
Menu
from
'
../Menu
'
import
Menu
from
'
../Menu
'
...
@@ -104,7 +105,7 @@ const Alpha = styled(GreyCard)`
...
@@ -104,7 +105,7 @@ const Alpha = styled(GreyCard)`
font-weight: 600;
font-weight: 600;
`
`
const
UniIcon
=
styled
(
Link
)
`
const
UniIcon
=
styled
.
div
`
transition: transform 0.3s ease;
transition: transform 0.3s ease;
:hover {
:hover {
transform: rotate(-5deg);
transform: rotate(-5deg);
...
@@ -130,7 +131,7 @@ const MigrateBanner = styled(AutoColumn)`
...
@@ -130,7 +131,7 @@ const MigrateBanner = styled(AutoColumn)`
`
}
;
`
}
;
`
`
export
default
function
Header
(
)
{
function
Header
({
history
}
)
{
const
{
account
,
chainId
}
=
useWeb3React
()
const
{
account
,
chainId
}
=
useWeb3React
()
const
userEthBalance
=
useAddressBalance
(
account
,
WETH
[
chainId
])
const
userEthBalance
=
useAddressBalance
(
account
,
WETH
[
chainId
])
...
@@ -152,14 +153,12 @@ export default function Header() {
...
@@ -152,14 +153,12 @@ export default function Header() {
<
RowBetween
padding
=
"
1rem
"
>
<
RowBetween
padding
=
"
1rem
"
>
<
HeaderElement
>
<
HeaderElement
>
<
Title
>
<
Title
>
<
UniIcon
id
=
"
link
"
href
=
"
/
"
>
<
UniIcon
onClick
=
{()
=>
history
.
push
(
'
/
'
)}
>
<
img
src
=
{
Logo
}
alt
=
"
logo
"
/>
<
img
src
=
{
Logo
}
alt
=
"
logo
"
/>
<
/UniIcon
>
<
/UniIcon
>
{
!
isMobile
&&
(
{
!
isMobile
&&
(
<
TitleText
>
<
TitleText
onClick
=
{()
=>
history
.
push
(
'
/
'
)}
>
<
Link
id
=
"
link
"
href
=
"
/
"
>
<
img
style
=
{{
marginLeft
:
'
4px
'
,
marginTop
:
'
4px
'
}}
src
=
{
Wordmark
}
alt
=
"
logo
"
/>
<
img
style
=
{{
marginLeft
:
'
4px
'
,
marginTop
:
'
4px
'
}}
src
=
{
Wordmark
}
alt
=
"
logo
"
/>
<
/Link
>
<
/TitleText
>
<
/TitleText
>
)}
)}
<
/Title
>
<
/Title
>
...
@@ -187,6 +186,7 @@ export default function Header() {
...
@@ -187,6 +186,7 @@ export default function Header() {
<
/HeaderElement
>
<
/HeaderElement
>
<
/RowBetween
>
<
/RowBetween
>
<
/HeaderFrame
>
<
/HeaderFrame
>
// </AutoColumn>
)
)
}
}
export
default
withRouter
(
Header
)
src/components/SearchModal/index.js
View file @
49462fdb
...
@@ -592,7 +592,7 @@ function SearchModal({
...
@@ -592,7 +592,7 @@ function SearchModal({
<
QuestionHelper
text
=
"
These tokens are commonly used in pairs.
"
/>
<
QuestionHelper
text
=
"
These tokens are commonly used in pairs.
"
/>
<
/AutoRow
>
<
/AutoRow
>
<
AutoRow
gap
=
"
10px
"
>
<
AutoRow
gap
=
"
10px
"
>
{
COMMON_BASES
[
chainId
].
map
(
token
=>
{
{
COMMON_BASES
[
chainId
]
?
.
map
(
token
=>
{
return
(
return
(
<
BaseWrapper
<
BaseWrapper
gap
=
"
6px
"
gap
=
"
6px
"
...
...
src/constants/index.ts
View file @
49462fdb
...
@@ -5,10 +5,13 @@ export const ROUTER_ADDRESS = '0xf164fC0Ec4E93095b804a4795bBe1e041497b92a'
...
@@ -5,10 +5,13 @@ export const ROUTER_ADDRESS = '0xf164fC0Ec4E93095b804a4795bBe1e041497b92a'
export
const
COMMON_BASES
=
{
export
const
COMMON_BASES
=
{
1
:
[
WETH
[
ChainId
.
MAINNET
]],
1
:
[
WETH
[
ChainId
.
MAINNET
]],
3
:
[
WETH
[
ChainId
.
ROPSTEN
]],
4
:
[
4
:
[
WETH
[
ChainId
.
RINKEBY
],
WETH
[
ChainId
.
RINKEBY
],
new
Token
(
ChainId
.
RINKEBY
,
'
0xc7AD46e0b8a400Bb3C915120d284AafbA8fc4735
'
,
18
,
'
DAI
'
,
'
Dai Stablecoin
'
)
new
Token
(
ChainId
.
RINKEBY
,
'
0xc7AD46e0b8a400Bb3C915120d284AafbA8fc4735
'
,
18
,
'
DAI
'
,
'
Dai Stablecoin
'
)
]
],
5
:
[
WETH
[
ChainId
.
G
Ö
RLI
]],
42
:
[
WETH
[
ChainId
.
KOVAN
]]
}
}
export
const
SUPPORTED_THEMES
=
{
export
const
SUPPORTED_THEMES
=
{
...
...
src/pages/App.js
View file @
49462fdb
...
@@ -12,9 +12,9 @@ import { isAddress, getAllQueryParams } from '../utils'
...
@@ -12,9 +12,9 @@ import { isAddress, getAllQueryParams } from '../utils'
const
Swap
=
lazy
(()
=>
import
(
'
./Swap
'
))
const
Swap
=
lazy
(()
=>
import
(
'
./Swap
'
))
const
Send
=
lazy
(()
=>
import
(
'
./Send
'
))
const
Send
=
lazy
(()
=>
import
(
'
./Send
'
))
const
Pool
=
lazy
(()
=>
import
(
'
./
Supply
'
))
const
Pool
=
lazy
(()
=>
import
(
'
./
Pool
'
))
const
Add
=
lazy
(()
=>
import
(
'
./
Supply
/AddLiquidity
'
))
const
Add
=
lazy
(()
=>
import
(
'
./
Pool
/AddLiquidity
'
))
const
Remove
=
lazy
(()
=>
import
(
'
./
Supply
/RemoveLiquidity
'
))
const
Remove
=
lazy
(()
=>
import
(
'
./
Pool
/RemoveLiquidity
'
))
const
Find
=
lazy
(()
=>
import
(
'
../components/PoolFinder
'
))
const
Find
=
lazy
(()
=>
import
(
'
../components/PoolFinder
'
))
const
Create
=
lazy
(()
=>
import
(
'
../components/CreatePool
'
))
const
Create
=
lazy
(()
=>
import
(
'
../components/CreatePool
'
))
...
@@ -97,15 +97,15 @@ export default function App() {
...
@@ -97,15 +97,15 @@ export default function App() {
return
(
return
(
<>
<>
<
Suspense
fallback
=
{
null
}
>
<
Suspense
fallback
=
{
null
}
>
<
AppWrapp
er
>
<
BrowserRout
er
>
<
Header
Wrapper
>
<
App
Wrapper
>
<
Header
/
>
<
Header
Wrapper
>
<
/HeaderWrapper
>
<
Header
/
>
<
Body
Wrapper
>
<
/Header
Wrapper
>
<
Popups
/
>
<
BodyWrapper
>
<
Body
>
<
Popups
/
>
<
Web3ReactManager
>
<
Body
>
<
BrowserRout
er
>
<
Web3ReactManag
er
>
<
NavigationTabs
/>
<
NavigationTabs
/>
{
/* this Suspense is for route code-splitting */
}
{
/* this Suspense is for route code-splitting */
}
<
Suspense
fallback
=
{
null
}
>
<
Suspense
fallback
=
{
null
}
>
...
@@ -153,13 +153,13 @@ export default function App() {
...
@@ -153,13 +153,13 @@ export default function App() {
<
Redirect
to
=
"
/
"
/>
<
Redirect
to
=
"
/
"
/>
<
/Switch
>
<
/Switch
>
<
/Suspense
>
<
/Suspense
>
<
/
BrowserRout
er
>
<
/
Web3ReactManag
er
>
<
/
Web3ReactManager
>
<
/
Body
>
<
/Body
>
<
Footer
><
/Footer
>
<
Footer
><
/Foot
er
>
<
/BodyWrapp
er
>
<
/BodyWrapper
>
<
StyledRed
/
>
<
StyledRed
/
>
<
/AppWrapper
>
<
/
AppWrapp
er
>
<
/
BrowserRout
er
>
<
/Suspense
>
<
/Suspense
>
<
/
>
<
/
>
)
)
...
...
src/pages/
Supply
/AddLiquidity.tsx
→
src/pages/
Pool
/AddLiquidity.tsx
View file @
49462fdb
...
@@ -210,14 +210,23 @@ function AddLiquidity({ token0, token1, step = false }) {
...
@@ -210,14 +210,23 @@ function AddLiquidity({ token0, token1, step = false }) {
[
Field
.
INPUT
]:
null
,
[
Field
.
INPUT
]:
null
,
[
Field
.
OUTPUT
]:
null
[
Field
.
OUTPUT
]:
null
})
})
useEffect
(()
=>
{
useEffect
(()
=>
{
if
(
typedValue
!==
'
'
&&
typedValue
!==
'
.
'
&&
tokens
[
independentField
]
&&
noLiquidity
)
{
if
(
typedValue
!==
'
.
'
&&
tokens
[
independentField
]
&&
noLiquidity
)
{
const
newNonRelationalAmounts
=
nonrelationalAmounts
const
newNonRelationalAmounts
=
nonrelationalAmounts
const
typedValueParsed
=
parseUnits
(
typedValue
,
tokens
[
independentField
].
decimals
).
toString
()
if
(
typedValue
===
''
)
{
if
(
independentField
===
Field
.
OUTPUT
)
{
if
(
independentField
===
Field
.
OUTPUT
)
{
newNonRelationalAmounts
[
Field
.
OUTPUT
]
=
new
TokenAmount
(
tokens
[
independentField
],
typedValueParsed
)
newNonRelationalAmounts
[
Field
.
OUTPUT
]
=
null
}
else
{
newNonRelationalAmounts
[
Field
.
INPUT
]
=
null
}
}
else
{
}
else
{
newNonRelationalAmounts
[
Field
.
INPUT
]
=
new
TokenAmount
(
tokens
[
independentField
],
typedValueParsed
)
const
typedValueParsed
=
parseUnits
(
typedValue
,
tokens
[
independentField
].
decimals
).
toString
()
if
(
independentField
===
Field
.
OUTPUT
)
{
newNonRelationalAmounts
[
Field
.
OUTPUT
]
=
new
TokenAmount
(
tokens
[
independentField
],
typedValueParsed
)
}
else
{
newNonRelationalAmounts
[
Field
.
INPUT
]
=
new
TokenAmount
(
tokens
[
independentField
],
typedValueParsed
)
}
}
}
setNonrelationalAmounts
(
newNonRelationalAmounts
)
setNonrelationalAmounts
(
newNonRelationalAmounts
)
}
}
...
@@ -255,15 +264,20 @@ function AddLiquidity({ token0, token1, step = false }) {
...
@@ -255,15 +264,20 @@ function AddLiquidity({ token0, token1, step = false }) {
}
}
// used for displaying approximate starting price in UI
// used for displaying approximate starting price in UI
const
derivedPrice
=
const
derivedPrice
=
parsedAmounts
[
Field
.
INPUT
]
&&
parsedAmounts
[
Field
.
INPUT
]
&&
parsedAmounts
[
Field
.
OUTPUT
]
&&
parsedAmounts
[
Field
.
OUTPUT
]
&&
new
Price
(
nonrelationalAmounts
[
Field
.
INPUT
]
&&
parsedAmounts
[
Field
.
INPUT
].
token
,
nonrelationalAmounts
[
Field
.
OUTPUT
]
&&
parsedAmounts
[
Field
.
OUTPUT
].
token
,
typedValue
!==
''
parsedAmounts
[
Field
.
INPUT
].
raw
,
?
new
Price
(
parsedAmounts
[
Field
.
OUTPUT
].
raw
parsedAmounts
[
Field
.
INPUT
].
token
,
)
parsedAmounts
[
Field
.
OUTPUT
].
token
,
parsedAmounts
[
Field
.
INPUT
].
raw
,
parsedAmounts
[
Field
.
OUTPUT
].
raw
)
:
null
// check for estimated liquidity minted
// check for estimated liquidity minted
const
liquidityMinted
:
TokenAmount
=
const
liquidityMinted
:
TokenAmount
=
...
@@ -603,12 +617,41 @@ function AddLiquidity({ token0, token1, step = false }) {
...
@@ -603,12 +617,41 @@ function AddLiquidity({ token0, token1, step = false }) {
</>
</>
)
)
}
}
const
displayPriceInput
=
noLiquidity
?
parsedAmounts
[
0
]
&&
parsedAmounts
[
1
]
&&
derivedPrice
&&
JSBI
.
greaterThan
(
parsedAmounts
[
0
].
raw
,
JSBI
.
BigInt
(
0
))
&&
JSBI
.
greaterThan
(
parsedAmounts
[
1
].
raw
,
JSBI
.
BigInt
(
0
))
?
derivedPrice
?.
toSignificant
(
6
)
:
'
-
'
:
pair
&&
route
&&
tokens
[
Field
.
INPUT
]
?
route
?.
input
.
equals
(
tokens
[
Field
.
INPUT
])
?
route
.
midPrice
.
toSignificant
(
6
)
:
route
.
midPrice
.
invert
().
toSignificant
(
6
)
:
'
-
'
const
displayPriceOutput
=
noLiquidity
?
parsedAmounts
[
0
]
&&
parsedAmounts
[
1
]
&&
derivedPrice
&&
JSBI
.
greaterThan
(
parsedAmounts
[
0
].
raw
,
JSBI
.
BigInt
(
0
))
&&
JSBI
.
greaterThan
(
parsedAmounts
[
1
].
raw
,
JSBI
.
BigInt
(
0
))
?
derivedPrice
?.
invert
().
toSignificant
(
6
)
:
'
-
'
:
pair
&&
route
&&
tokens
[
Field
.
OUTPUT
]
?
route
?.
input
.
equals
(
tokens
[
Field
.
OUTPUT
])
?
route
.
midPrice
.
toSignificant
(
6
)
:
route
.
midPrice
.
invert
().
toSignificant
(
6
)
:
'
-
'
const
PriceBar
=
()
=>
{
const
PriceBar
=
()
=>
{
return
(
return
(
<
AutoRow
justify=
"space-between"
>
<
AutoRow
justify=
"space-between"
>
<
AutoColumn
justify=
"center"
>
<
AutoColumn
justify=
"center"
>
<
Text
fontWeight=
{
500
}
fontSize=
{
16
}
color=
"#000000"
>
<
Text
fontWeight=
{
500
}
fontSize=
{
16
}
color=
"#000000"
>
{
pair
?
`${route.midPrice.toSignificant(6)} `
:
'
-
'
}
{
displayPriceInput
}
</
Text
>
</
Text
>
<
Text
fontWeight=
{
500
}
fontSize=
{
14
}
color=
"#888D9B"
pt=
{
1
}
>
<
Text
fontWeight=
{
500
}
fontSize=
{
14
}
color=
"#888D9B"
pt=
{
1
}
>
{
tokens
[
Field
.
OUTPUT
]?.
symbol
}
per
{
tokens
[
Field
.
INPUT
]?.
symbol
}
{
tokens
[
Field
.
OUTPUT
]?.
symbol
}
per
{
tokens
[
Field
.
INPUT
]?.
symbol
}
...
@@ -616,7 +659,7 @@ function AddLiquidity({ token0, token1, step = false }) {
...
@@ -616,7 +659,7 @@ function AddLiquidity({ token0, token1, step = false }) {
</
AutoColumn
>
</
AutoColumn
>
<
AutoColumn
justify=
"center"
>
<
AutoColumn
justify=
"center"
>
<
Text
fontWeight=
{
500
}
fontSize=
{
16
}
color=
"#000000"
>
<
Text
fontWeight=
{
500
}
fontSize=
{
16
}
color=
"#000000"
>
{
pair
?
`${route.midPrice.invert().toSignificant(6)} `
:
'
-
'
}
{
displayPriceOutput
}
</
Text
>
</
Text
>
<
Text
fontWeight=
{
500
}
fontSize=
{
14
}
color=
"#888D9B"
pt=
{
1
}
>
<
Text
fontWeight=
{
500
}
fontSize=
{
14
}
color=
"#888D9B"
pt=
{
1
}
>
{
tokens
[
Field
.
INPUT
]?.
symbol
}
per
{
tokens
[
Field
.
OUTPUT
]?.
symbol
}
{
tokens
[
Field
.
INPUT
]?.
symbol
}
per
{
tokens
[
Field
.
OUTPUT
]?.
symbol
}
...
@@ -624,7 +667,7 @@ function AddLiquidity({ token0, token1, step = false }) {
...
@@ -624,7 +667,7 @@ function AddLiquidity({ token0, token1, step = false }) {
</
AutoColumn
>
</
AutoColumn
>
<
AutoColumn
justify=
"center"
>
<
AutoColumn
justify=
"center"
>
<
Text
fontWeight=
{
500
}
fontSize=
{
16
}
color=
"#000000"
>
<
Text
fontWeight=
{
500
}
fontSize=
{
16
}
color=
"#000000"
>
{
poolTokenPercentage
?
poolTokenPercentage
?.
toFixed
(
2
)
:
'
0.0
'
}
{
noLiquidity
&&
derivedPrice
?
'
100
'
:
poolTokenPercentage
?
poolTokenPercentage
?.
toFixed
(
2
)
:
'
0.0
'
}
{
'
%
'
}
{
'
%
'
}
</
Text
>
</
Text
>
<
Text
fontWeight=
{
500
}
fontSize=
{
14
}
color=
"#888D9B"
pt=
{
1
}
>
<
Text
fontWeight=
{
500
}
fontSize=
{
14
}
color=
"#888D9B"
pt=
{
1
}
>
...
@@ -712,7 +755,7 @@ function AddLiquidity({ token0, token1, step = false }) {
...
@@ -712,7 +755,7 @@ function AddLiquidity({ token0, token1, step = false }) {
{showOutputApprove ? (
{showOutputApprove ? (
<ButtonLight
<ButtonLight
onClick={() => {
onClick={() => {
approveAmount(Field.OUTPUT)
!pendingApprovalOutput &&
approveAmount(Field.OUTPUT)
}}
}}
>
>
{pendingApprovalOutput ? (
{pendingApprovalOutput ? (
...
@@ -724,7 +767,7 @@ function AddLiquidity({ token0, token1, step = false }) {
...
@@ -724,7 +767,7 @@ function AddLiquidity({ token0, token1, step = false }) {
) : showInputApprove ? (
) : showInputApprove ? (
<ButtonLight
<ButtonLight
onClick={() => {
onClick={() => {
approveAmount(Field.INPUT)
!pendingApprovalInput &&
approveAmount(Field.INPUT)
}}
}}
>
>
{pendingApprovalInput ? (
{pendingApprovalInput ? (
...
...
src/pages/
Supply
/RemoveLiquidity.tsx
→
src/pages/
Pool
/RemoveLiquidity.tsx
View file @
49462fdb
File moved
src/pages/
Supply
/index.js
→
src/pages/
Pool
/index.js
View file @
49462fdb
File moved
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