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
9ea789bb
Commit
9ea789bb
authored
Nov 27, 2017
by
Hayden Adams
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix minEth to wei bug
parent
29620e5f
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
16 deletions
+13
-16
App.js
src/App.js
+13
-16
No files found.
src/App.js
View file @
9ea789bb
...
...
@@ -192,13 +192,14 @@ class App extends Component {
buyEth
()
{
var
self
=
this
;
var
minEth
=
this
.
state
.
minimumEthPurchased
;
var
minWei
=
localweb3
.
utils
.
toWei
(
minEth
);
var
tokensSold
=
this
.
state
.
ethCost
*
10
**
6
;
localweb3
.
eth
.
getBlock
(
'
latest
'
,
function
(
error
,
blockInfo
)
{
var
time
=
blockInfo
.
timestamp
;
var
maxTime
=
time
+
300
;
//current block time + 5mins
uniswapContract
.
methods
.
tokenToEth
(
tokensSold
,
min
Eth
,
maxTime
).
send
(
uniswapContract
.
methods
.
tokenToEth
(
tokensSold
,
min
Wei
,
maxTime
).
send
(
{
from
:
self
.
state
.
currentMaskAddress
},
function
(
err
,
txHash
)
{})
});
...
...
@@ -209,8 +210,6 @@ class App extends Component {
if
(
buyTokensInput
&&
buyTokensInput
!==
0
){
this
.
setState
({
minimumTokensPurchased
:
buyTokensInput
});
this
.
tokenBuyRate
(
buyTokensInput
);
this
.
getEthBalance
();
this
.
getTokenBalance
();
}
}
...
...
@@ -219,8 +218,6 @@ class App extends Component {
if
(
buyEthInput
&&
buyEthInput
!==
0
){
this
.
setState
({
minimumEthPurchased
:
buyEthInput
});
this
.
ethBuyRate
(
buyEthInput
);
this
.
getEthBalance
();
this
.
getTokenBalance
();
}
}
...
...
@@ -295,35 +292,35 @@ class App extends Component {
<
br
/>
<
/div
>
<
Instructions
/>
<
div
className
=
"
Approval
"
>
<
div
className
=
"
approveButtonContainer
"
>
<
button
className
=
"
approveButton
"
onClick
=
{()
=>
{
this
.
approveAllowance
(
20000
*
10
**
6
)
}}
>
Approve
<
/button><br/
><
br
/>
{
/*Tokens approved: {this.state.tokenAllowance} */
}
<
/div
>
<
div
className
=
"
exchange
"
>
<
div
className
=
"
exchange-buyTokens
Button
"
>
<
div
className
=
"
exchange-buyTokens
"
>
<
input
className
=
"
exchange-buyTokensInput
"
//value={this.state.value}
onChange
=
{
this
.
onBuyTokensInputChange
}
/
>
<
input
className
=
"
exchange-buyTokens
Input
Button
"
type
=
"
exchange-button
"
defaultValue
=
"
Buy UNI
"
readOnly
=
"
readOnly
"
onClick
=
{()
=>
{
this
.
buyTokens
()
}}
/
>
<
input
className
=
"
exchange-buyTokensButton
"
type
=
"
exchange-button
"
defaultValue
=
"
Buy UNI
"
readOnly
=
"
readOnly
"
onClick
=
{()
=>
{
this
.
buyTokens
()
}}
/
>
<
p
className
=
"
pinkText
"
>
&
nbsp
;
&
nbsp
;
Rate
:
&
nbsp
;
&
nbsp
;
&
nbsp
;
{
this
.
state
.
tokenBuyRate
.
toFixed
(
3
)}
UNI
/
ETH
<
br
/>
&
nbsp
;
&
nbsp
;
Cost
:
&
nbsp
;
&
nbsp
;
&
nbsp
;
{
this
.
state
.
tokenCost
.
toFixed
(
5
)}
ETH
<
br
/>
&
nbsp
;
&
nbsp
;
Fee
:
&
nbsp
;
&
nbsp
;
&
nbsp
;
&
nbsp
;
&
nbsp
;
{
this
.
state
.
tokenFee
.
toFixed
(
5
)}
ETH
<
br
/>
&
nbsp
;
&
nbsp
;
Rate
:
&
nbsp
;
&
nbsp
;{
this
.
state
.
tokenBuyRate
.
toFixed
(
3
)}
UNI
/
ETH
<
br
/>
&
nbsp
;
&
nbsp
;
Cost
:
&
nbsp
;
&
nbsp
;{
this
.
state
.
tokenCost
.
toFixed
(
5
)}
ETH
<
br
/>
&
nbsp
;
&
nbsp
;
Fee
:
&
nbsp
;
&
nbsp
;
&
nbsp
;
&
nbsp
;{
this
.
state
.
tokenFee
.
toFixed
(
5
)}
ETH
<
br
/>
<
/p
>
<
/div
>
<
div
className
=
"
exchange-buyEth
Button
"
>
<
div
className
=
"
exchange-buyEth
"
>
<
input
className
=
"
exchange-buyEthInput
"
//value={this.state.value}
onChange
=
{
this
.
onBuyEthInputChange
}
/
>
<
input
className
=
"
exchange-buyEth
Input
Button
"
type
=
"
exchange-button
"
defaultValue
=
"
Buy ETH
"
readOnly
=
"
readOnly
"
onClick
=
{()
=>
{
this
.
buyEth
()
}}
/
>
<
input
className
=
"
exchange-buyEthButton
"
type
=
"
exchange-button
"
defaultValue
=
"
Buy ETH
"
readOnly
=
"
readOnly
"
onClick
=
{()
=>
{
this
.
buyEth
()
}}
/
>
<
p
className
=
"
pinkText
"
>
&
nbsp
;
&
nbsp
;
Rate
:
&
nbsp
;
&
nbsp
;
&
nbsp
;
{
this
.
state
.
ethBuyRate
.
toFixed
(
4
)}
ETH
/
UNI
<
br
/>
&
nbsp
;
&
nbsp
;
Cost
:
&
nbsp
;
&
nbsp
;
&
nbsp
;
{
this
.
state
.
ethCost
.
toFixed
(
5
)}
UNI
<
br
/>
&
nbsp
;
&
nbsp
;
Fee
:
&
nbsp
;
&
nbsp
;
&
nbsp
;
&
nbsp
;
&
nbsp
;
{
this
.
state
.
ethFee
.
toFixed
(
5
)}
UNI
&
nbsp
;
&
nbsp
;
Rate
:
&
nbsp
;
&
nbsp
;{
this
.
state
.
ethBuyRate
.
toFixed
(
4
)}
ETH
/
UNI
<
br
/>
&
nbsp
;
&
nbsp
;
Cost
:
&
nbsp
;
&
nbsp
;{
this
.
state
.
ethCost
.
toFixed
(
5
)}
UNI
<
br
/>
&
nbsp
;
&
nbsp
;
Fee
:
&
nbsp
;
&
nbsp
;
&
nbsp
;
&
nbsp
;{
this
.
state
.
ethFee
.
toFixed
(
5
)}
UNI
<
/p
>
<
/div
>
<
/div
>
...
...
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