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
e90423d5
Commit
e90423d5
authored
Jan 22, 2018
by
Hayden Adams
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixed decimal values, fixed bug related to error1 not showing for token to token
parent
d9e181b2
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
24 additions
and
23 deletions
+24
-23
App.js
src/App.js
+4
-3
ConnectionHelper.js
src/components/ConnectionHelper.js
+20
-20
No files found.
src/App.js
View file @
e90423d5
...
...
@@ -371,6 +371,7 @@ class App extends Component {
this
.
setState
({
inputToken
:
selected
});
if
(
selected
.
value
===
this
.
state
.
outputToken
.
value
)
{
marketType
=
'
Invalid
'
;
this
.
setState
({
interaction
:
'
error1
'
});
}
else
if
(
selected
.
value
===
'
ETH
'
){
marketType
=
'
ETH to Token
'
;
}
else
if
(
this
.
state
.
outputToken
.
value
===
'
ETH
'
){
...
...
@@ -637,7 +638,7 @@ class App extends Component {
<
p
>
→
<
/p
>
<
/div
>
<
div
className
=
"
value border pa2
"
>
<
input
type
=
"
number
"
value
=
{
this
.
state
.
output
/
10
**
18
}
placeholder
=
"
0
"
/>
<
input
type
=
"
number
"
readOnly
=
{
true
}
value
=
{(
this
.
state
.
output
/
10
**
18
).
toFixed
(
5
)
}
placeholder
=
"
0
"
/>
<
SelectToken
token
=
{
this
.
state
.
outputToken
}
onSelectToken
=
{
this
.
onSelectToken
}
type
=
"
output
"
/>
<
p
className
=
"
dropdown
"
>
{
'
<
'
}
<
/p
>
<
/div
>
...
...
@@ -645,11 +646,11 @@ class App extends Component {
<
section
className
=
"
rate border pa2
"
>
<
span
className
=
"
rate-info
"
>
<
p
>
Rate
<
/p
>
<
p
>
{
this
.
state
.
rate
}
{
this
.
state
.
outputToken
.
value
+
"
/
"
+
this
.
state
.
inputToken
.
value
}
<
/p
>
<
p
>
{
(
this
.
state
.
rate
).
toFixed
(
5
)
}
{
this
.
state
.
outputToken
.
value
+
"
/
"
+
this
.
state
.
inputToken
.
value
}
<
/p
>
<
/span
>
<
span
className
=
"
rate-info
"
>
<
p
>
Fee
<
/p
>
<
p
>
{
this
.
state
.
fee
/
10
**
18
}
{
this
.
state
.
inputToken
.
value
}
<
/p
>
<
p
>
{
(
this
.
state
.
fee
/
10
**
18
).
toFixed
(
5
)
}
{
this
.
state
.
inputToken
.
value
}
<
/p
>
<
/span
>
<
/section
>
...
...
src/components/ConnectionHelper.js
View file @
e90423d5
...
...
@@ -22,17 +22,35 @@ function ConnectionHelper(props) {
Looks like you aren
'
t
connected
.
<
b
>
Please
unlock
Metamask
to
continue
.
<
/b></
p
>
<
/div
>
)
}
else
if
(
props
.
interaction
===
"
error1
"
)
{
return
(
<
div
className
=
"
grey-bg connection border pa2
"
>
<
p
>
You
can
'
t swap a token for itself! <span role="img" aria-label="Crying">😂</span></p>
</div>
)
} else if (props.interaction === "submitted") {
return (
<div className="grey-bg connection border pa2">
<p>{"Transaction submitted! Click on the transaction hash below to check its status?"}</p>
</div>
)
} else if (props.input > props.balance/10**18 && props.inputToken.value ===
'
ETH
'
) {
return (
<div className="grey-bg red connection border pa2">
<p>This account doesn
'
t
have
enough
balance
to
make
this
transaction
!
Get
more
{
props
.
inputToken
.
value
}
with
the
<
a
target
=
"
_blank
"
rel
=
"
noopener noreferrer
"
href
=
"
https://faucet.rinkeby.io/
"
>
Rinkeby
Faucet
.
<
/a></
p
>
<
/div
>
)
}
else
if
(
!
props
.
approved
&&
props
.
exchangeType
===
"
Token to Token
"
)
{
return
(
<
div
className
=
"
grey-bg connection border pa2
"
>
<
p
>
Our
smart
contract
has
to
be
approved
by
your
address
to
be
able
to
swap
tokens
for
tokens
.
<
br
/>
We
set
the
transfer
limit
to
250
(
<
a
onClick
=
{()
=>
{
props
.
toggleAbout
()}}
className
=
"
f-a
"
>
Why
?
<
/a>
)
.</
p
>
<
p
>
Our
smart
contract
has
to
be
approved
by
your
address
to
be
able
to
swap
this
token
for
other
tokens
.
<
br
/>
We
set
a
high
transfer
limit
for
the
demo
(
<
a
onClick
=
{()
=>
{
props
.
toggleAbout
()}}
className
=
"
f-a
"
>
Why
?
<
/a>
)
.</
p
>
<
a
className
=
"
f-a
"
onClick
=
{()
=>
props
.
approveAllowance
()}
>
Approve
⭞
<
/a
>
<
/div
>
)
}
else
if
(
!
props
.
approved
&&
props
.
exchangeType
===
"
Token to ETH
"
)
{
return
(
<
div
className
=
"
grey-bg connection border pa2
"
>
<
p
>
Our
smart
contract
has
to
be
approved
by
your
address
to
be
able
to
swap
t
okens
for
ETH
.
<
br
/>
We
set
the
transfer
limit
to
250
(
<
a
onClick
=
{()
=>
{
props
.
toggleAbout
()}}
className
=
"
f-a
"
>
Why
?
<
/a>
)
.</
p
>
<
p
>
Our
smart
contract
has
to
be
approved
by
your
address
to
be
able
to
swap
t
his
token
for
ETH
.
<
br
/>
We
set
a
high
transfer
limit
for
the
demo
(
<
a
onClick
=
{()
=>
{
props
.
toggleAbout
()}}
className
=
"
f-a
"
>
Why
?
<
/a>
)
.</
p
>
<
a
className
=
"
f-a
"
onClick
=
{()
=>
props
.
approveAllowance
()}
>
Approve
⭞
<
/a
>
<
/div
>
)
...
...
@@ -54,24 +72,6 @@ function ConnectionHelper(props) {
<a className="f-a" onClick={() => props.onCloseHelper()}>I
'
ve
added
the
token
<
/a
>
<
/div
>
)
}
else
if
(
props
.
interaction
===
"
error1
"
)
{
return
(
<
div
className
=
"
grey-bg connection border pa2
"
>
<
p
>
You
can
'
t swap a token for itself! <span role="img" aria-label="Crying">😂</span></p>
</div>
)
} else if (props.interaction === "submitted") {
return (
<div className="grey-bg connection border pa2">
<p>{"Transaction submitted! Click on the transaction hash below to check its status?"}</p>
</div>
)
} else if (props.input > props.balance/10**18 && props.inputToken.value ===
'
ETH
'
) {
return (
<div className="grey-bg red connection border pa2">
<p>This account doesn
'
t
have
enough
balance
to
make
this
transaction
!
Get
more
{
props
.
inputToken
.
value
}
with
the
<
a
target
=
"
_blank
"
rel
=
"
noopener noreferrer
"
href
=
"
https://faucet.rinkeby.io/
"
>
Rinkeby
Faucet
.
<
/a></
p
>
<
/div
>
)
}
else
if
(
props
.
input
>
props
.
balance
/
10
**
18
)
{
return
(
<
div
className
=
"
grey-bg red connection border pa2
"
>
...
...
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