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
731b3168
Commit
731b3168
authored
Nov 15, 2017
by
Hayden Adams
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix min prices
parent
77810772
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
19 additions
and
33 deletions
+19
-33
App.css
src/App.css
+8
-2
App.js
src/App.js
+11
-31
No files found.
src/App.css
View file @
731b3168
...
...
@@ -42,7 +42,7 @@
/* flip speed goes here */
.title
{
transition
:
0.6
s
;
transition
:
1
s
;
transform-style
:
preserve-3d
;
position
:
relative
;
}
...
...
@@ -255,10 +255,14 @@
border
:
1px
solid
rgb
(
180
,
81
,
179
);
border-radius
:
0
8px
8px
0
;
font-family
:
Optima
,
sans-serif
;
-webkit-transition-duration
:
0.8s
;
transition-duration
:
0.8s
;
}
.exchange-buyEthInputButton
:hover
,
.exchange-buyTokensInputButton
:hover
{
cursor
:
pointer
;
color
:
rgb
(
220
,
173
,
247
);
color
:
rgb
(
122
,
251
,
255
);
text-shadow
:
2px
2px
10px
#1c5f7c
;
background-color
:
rgba
(
209
,
151
,
245
,
0.6
);
/*border-color: rgb(122, 251, 255);*/
}
.instructions
{
...
...
@@ -271,6 +275,8 @@
text-shadow
:
2px
2px
10px
#2daae0
;
margin-left
:
35vw
;
margin-right
:
1vw
;
-webkit-transition-duration
:
0.4s
;
transition-duration
:
0.4s
;
}
.instructions
:hover
{
color
:
rgb
(
216
,
169
,
236
);
text-shadow
:
1px
1px
5px
#ff69f0
;
...
...
src/App.js
View file @
731b3168
...
...
@@ -3,32 +3,14 @@ import unicorn from './images/unicornNoBackground.png';
import
ethLogo
from
'
./images/ethLogo.png
'
;
import
'
./App.css
'
;
var
uniswapABI
=
[{
"
constant
"
:
false
,
"
inputs
"
:[{
"
name
"
:
"
tokenAmount
"
,
"
type
"
:
"
uint256
"
}],
"
name
"
:
"
ownerTokenWithdraw
"
,
"
outputs
"
:[],
"
payable
"
:
false
,
"
stateMutability
"
:
"
nonpayable
"
,
"
type
"
:
"
function
"
},{
"
constant
"
:
false
,
"
inputs
"
:[{
"
name
"
:
"
ethAmount
"
,
"
type
"
:
"
uint256
"
}],
"
name
"
:
"
ownerEthWithdraw
"
,
"
outputs
"
:[],
"
payable
"
:
false
,
"
stateMutability
"
:
"
nonpayable
"
,
"
type
"
:
"
function
"
},{
"
constant
"
:
false
,
"
inputs
"
:[{
"
name
"
:
"
sellQuantity
"
,
"
type
"
:
"
uint256
"
},{
"
name
"
:
"
minimumEth
"
,
"
type
"
:
"
uint256
"
},{
"
name
"
:
"
timeout
"
,
"
type
"
:
"
uint256
"
}],
"
name
"
:
"
tokenToEth
"
,
"
outputs
"
:[],
"
payable
"
:
false
,
"
stateMutability
"
:
"
nonpayable
"
,
"
type
"
:
"
function
"
},{
"
constant
"
:
true
,
"
inputs
"
:[],
"
name
"
:
"
totalTokenQuantity
"
,
"
outputs
"
:[{
"
name
"
:
""
,
"
type
"
:
"
uint256
"
}],
"
payable
"
:
false
,
"
stateMutability
"
:
"
view
"
,
"
type
"
:
"
function
"
},{
"
constant
"
:
false
,
"
inputs
"
:[{
"
name
"
:
"
minimumTokens
"
,
"
type
"
:
"
uint256
"
},{
"
name
"
:
"
timeout
"
,
"
type
"
:
"
uint256
"
}],
"
name
"
:
"
ethToTokens
"
,
"
outputs
"
:[],
"
payable
"
:
true
,
"
stateMutability
"
:
"
payable
"
,
"
type
"
:
"
function
"
},{
"
constant
"
:
false
,
"
inputs
"
:[{
"
name
"
:
"
initialTokenQuantity
"
,
"
type
"
:
"
uint256
"
}],
"
name
"
:
"
initiateUniswap
"
,
"
outputs
"
:[],
"
payable
"
:
false
,
"
stateMutability
"
:
"
nonpayable
"
,
"
type
"
:
"
function
"
},{
"
constant
"
:
true
,
"
inputs
"
:[],
"
name
"
:
"
owner
"
,
"
outputs
"
:[{
"
name
"
:
""
,
"
type
"
:
"
address
"
}],
"
payable
"
:
false
,
"
stateMutability
"
:
"
view
"
,
"
type
"
:
"
function
"
},{
"
constant
"
:
true
,
"
inputs
"
:[],
"
name
"
:
"
totalEthQuantity
"
,
"
outputs
"
:[{
"
name
"
:
""
,
"
type
"
:
"
uint256
"
}],
"
payable
"
:
false
,
"
stateMutability
"
:
"
view
"
,
"
type
"
:
"
function
"
},{
"
constant
"
:
true
,
"
inputs
"
:[],
"
name
"
:
"
tokenAddress
"
,
"
outputs
"
:[{
"
name
"
:
""
,
"
type
"
:
"
address
"
}],
"
payable
"
:
false
,
"
stateMutability
"
:
"
view
"
,
"
type
"
:
"
function
"
},{
"
constant
"
:
true
,
"
inputs
"
:[],
"
name
"
:
"
invariant
"
,
"
outputs
"
:[{
"
name
"
:
""
,
"
type
"
:
"
uint256
"
}],
"
payable
"
:
false
,
"
stateMutability
"
:
"
view
"
,
"
type
"
:
"
function
"
},{
"
constant
"
:
false
,
"
inputs
"
:[{
"
name
"
:
"
newOwner
"
,
"
type
"
:
"
address
"
}],
"
name
"
:
"
transferOwnership
"
,
"
outputs
"
:[],
"
payable
"
:
false
,
"
stateMutability
"
:
"
nonpayable
"
,
"
type
"
:
"
function
"
},{
"
inputs
"
:[{
"
name
"
:
"
_tokenAddress
"
,
"
type
"
:
"
address
"
}],
"
payable
"
:
true
,
"
stateMutability
"
:
"
payable
"
,
"
type
"
:
"
constructor
"
},{
"
anonymous
"
:
false
,
"
inputs
"
:[{
"
indexed
"
:
true
,
"
name
"
:
"
buyer
"
,
"
type
"
:
"
address
"
},{
"
indexed
"
:
false
,
"
name
"
:
"
tokensPurchased
"
,
"
type
"
:
"
uint256
"
},{
"
indexed
"
:
false
,
"
name
"
:
"
ethSpent
"
,
"
type
"
:
"
uint256
"
}],
"
name
"
:
"
TokenPurchase
"
,
"
type
"
:
"
event
"
},{
"
anonymous
"
:
false
,
"
inputs
"
:[{
"
indexed
"
:
true
,
"
name
"
:
"
buyer
"
,
"
type
"
:
"
address
"
},{
"
indexed
"
:
false
,
"
name
"
:
"
ethPurchased
"
,
"
type
"
:
"
uint256
"
},{
"
indexed
"
:
false
,
"
name
"
:
"
tokensSpent
"
,
"
type
"
:
"
uint256
"
}],
"
name
"
:
"
EthPurchase
"
,
"
type
"
:
"
event
"
},{
"
anonymous
"
:
false
,
"
inputs
"
:[{
"
indexed
"
:
true
,
"
name
"
:
"
previousOwner
"
,
"
type
"
:
"
address
"
},{
"
indexed
"
:
true
,
"
name
"
:
"
newOwner
"
,
"
type
"
:
"
address
"
}],
"
name
"
:
"
OwnershipTransferred
"
,
"
type
"
:
"
event
"
}]
var
uniswapAddress
=
'
0x827642f7f022bd74294fd62c1f02a07f3d4ff2bd
'
;
var
uniswapABI
=
[{
"
constant
"
:
false
,
"
inputs
"
:[{
"
name
"
:
"
tokenAmount
"
,
"
type
"
:
"
uint256
"
}],
"
name
"
:
"
ownerTokenWithdraw
"
,
"
outputs
"
:[],
"
payable
"
:
false
,
"
stateMutability
"
:
"
nonpayable
"
,
"
type
"
:
"
function
"
},{
"
constant
"
:
false
,
"
inputs
"
:[{
"
name
"
:
"
tokenAmount
"
,
"
type
"
:
"
uint256
"
}],
"
name
"
:
"
ownerTokenDeposit
"
,
"
outputs
"
:[],
"
payable
"
:
false
,
"
stateMutability
"
:
"
nonpayable
"
,
"
type
"
:
"
function
"
},{
"
constant
"
:
false
,
"
inputs
"
:[{
"
name
"
:
"
ethAmount
"
,
"
type
"
:
"
uint256
"
}],
"
name
"
:
"
ownerEthWithdraw
"
,
"
outputs
"
:[],
"
payable
"
:
false
,
"
stateMutability
"
:
"
nonpayable
"
,
"
type
"
:
"
function
"
},{
"
constant
"
:
false
,
"
inputs
"
:[{
"
name
"
:
"
sellQuantity
"
,
"
type
"
:
"
uint256
"
},{
"
name
"
:
"
minimumEth
"
,
"
type
"
:
"
uint256
"
},{
"
name
"
:
"
timeout
"
,
"
type
"
:
"
uint256
"
}],
"
name
"
:
"
tokenToEth
"
,
"
outputs
"
:[],
"
payable
"
:
false
,
"
stateMutability
"
:
"
nonpayable
"
,
"
type
"
:
"
function
"
},{
"
constant
"
:
true
,
"
inputs
"
:[],
"
name
"
:
"
totalTokenQuantity
"
,
"
outputs
"
:[{
"
name
"
:
""
,
"
type
"
:
"
uint256
"
}],
"
payable
"
:
false
,
"
stateMutability
"
:
"
view
"
,
"
type
"
:
"
function
"
},{
"
constant
"
:
false
,
"
inputs
"
:[{
"
name
"
:
"
minimumTokens
"
,
"
type
"
:
"
uint256
"
},{
"
name
"
:
"
timeout
"
,
"
type
"
:
"
uint256
"
}],
"
name
"
:
"
ethToTokens
"
,
"
outputs
"
:[],
"
payable
"
:
true
,
"
stateMutability
"
:
"
payable
"
,
"
type
"
:
"
function
"
},{
"
constant
"
:
false
,
"
inputs
"
:[{
"
name
"
:
"
initialTokenQuantity
"
,
"
type
"
:
"
uint256
"
}],
"
name
"
:
"
initiateUniswap
"
,
"
outputs
"
:[],
"
payable
"
:
false
,
"
stateMutability
"
:
"
nonpayable
"
,
"
type
"
:
"
function
"
},{
"
constant
"
:
true
,
"
inputs
"
:[],
"
name
"
:
"
owner
"
,
"
outputs
"
:[{
"
name
"
:
""
,
"
type
"
:
"
address
"
}],
"
payable
"
:
false
,
"
stateMutability
"
:
"
view
"
,
"
type
"
:
"
function
"
},{
"
constant
"
:
true
,
"
inputs
"
:[],
"
name
"
:
"
totalEthQuantity
"
,
"
outputs
"
:[{
"
name
"
:
""
,
"
type
"
:
"
uint256
"
}],
"
payable
"
:
false
,
"
stateMutability
"
:
"
view
"
,
"
type
"
:
"
function
"
},{
"
constant
"
:
true
,
"
inputs
"
:[],
"
name
"
:
"
tokenAddress
"
,
"
outputs
"
:[{
"
name
"
:
""
,
"
type
"
:
"
address
"
}],
"
payable
"
:
false
,
"
stateMutability
"
:
"
view
"
,
"
type
"
:
"
function
"
},{
"
constant
"
:
true
,
"
inputs
"
:[],
"
name
"
:
"
invariant
"
,
"
outputs
"
:[{
"
name
"
:
""
,
"
type
"
:
"
uint256
"
}],
"
payable
"
:
false
,
"
stateMutability
"
:
"
view
"
,
"
type
"
:
"
function
"
},{
"
constant
"
:
false
,
"
inputs
"
:[],
"
name
"
:
"
ownerEthDeposit
"
,
"
outputs
"
:[],
"
payable
"
:
true
,
"
stateMutability
"
:
"
payable
"
,
"
type
"
:
"
function
"
},{
"
constant
"
:
false
,
"
inputs
"
:[{
"
name
"
:
"
newOwner
"
,
"
type
"
:
"
address
"
}],
"
name
"
:
"
transferOwnership
"
,
"
outputs
"
:[],
"
payable
"
:
false
,
"
stateMutability
"
:
"
nonpayable
"
,
"
type
"
:
"
function
"
},{
"
inputs
"
:[{
"
name
"
:
"
_tokenAddress
"
,
"
type
"
:
"
address
"
}],
"
payable
"
:
true
,
"
stateMutability
"
:
"
payable
"
,
"
type
"
:
"
constructor
"
},{
"
anonymous
"
:
false
,
"
inputs
"
:[{
"
indexed
"
:
true
,
"
name
"
:
"
buyer
"
,
"
type
"
:
"
address
"
},{
"
indexed
"
:
false
,
"
name
"
:
"
tokensPurchased
"
,
"
type
"
:
"
uint256
"
},{
"
indexed
"
:
false
,
"
name
"
:
"
ethSpent
"
,
"
type
"
:
"
uint256
"
}],
"
name
"
:
"
TokenPurchase
"
,
"
type
"
:
"
event
"
},{
"
anonymous
"
:
false
,
"
inputs
"
:[{
"
indexed
"
:
true
,
"
name
"
:
"
buyer
"
,
"
type
"
:
"
address
"
},{
"
indexed
"
:
false
,
"
name
"
:
"
ethPurchased
"
,
"
type
"
:
"
uint256
"
},{
"
indexed
"
:
false
,
"
name
"
:
"
tokensSpent
"
,
"
type
"
:
"
uint256
"
}],
"
name
"
:
"
EthPurchase
"
,
"
type
"
:
"
event
"
},{
"
anonymous
"
:
false
,
"
inputs
"
:[{
"
indexed
"
:
true
,
"
name
"
:
"
previousOwner
"
,
"
type
"
:
"
address
"
},{
"
indexed
"
:
true
,
"
name
"
:
"
newOwner
"
,
"
type
"
:
"
address
"
}],
"
name
"
:
"
OwnershipTransferred
"
,
"
type
"
:
"
event
"
}]
var
uniswapAddress
=
'
0x60e5f3cd0381c501971b6fbbddaa49cfd58a4fa1
'
;
var
uniswapContract
=
window
.
web3
.
eth
.
contract
(
uniswapABI
).
at
(
uniswapAddress
);
var
tokenABI
=
[{
"
constant
"
:
true
,
"
inputs
"
:[],
"
name
"
:
"
mintingFinished
"
,
"
outputs
"
:[{
"
name
"
:
""
,
"
type
"
:
"
bool
"
}],
"
payable
"
:
false
,
"
stateMutability
"
:
"
view
"
,
"
type
"
:
"
function
"
},{
"
constant
"
:
true
,
"
inputs
"
:[],
"
name
"
:
"
name
"
,
"
outputs
"
:[{
"
name
"
:
""
,
"
type
"
:
"
string
"
}],
"
payable
"
:
false
,
"
stateMutability
"
:
"
view
"
,
"
type
"
:
"
function
"
},{
"
constant
"
:
false
,
"
inputs
"
:[{
"
name
"
:
"
_spender
"
,
"
type
"
:
"
address
"
},{
"
name
"
:
"
_value
"
,
"
type
"
:
"
uint256
"
}],
"
name
"
:
"
approve
"
,
"
outputs
"
:[{
"
name
"
:
""
,
"
type
"
:
"
bool
"
}],
"
payable
"
:
false
,
"
stateMutability
"
:
"
nonpayable
"
,
"
type
"
:
"
function
"
},{
"
constant
"
:
true
,
"
inputs
"
:[],
"
name
"
:
"
totalSupply
"
,
"
outputs
"
:[{
"
name
"
:
""
,
"
type
"
:
"
uint256
"
}],
"
payable
"
:
false
,
"
stateMutability
"
:
"
view
"
,
"
type
"
:
"
function
"
},{
"
constant
"
:
false
,
"
inputs
"
:[{
"
name
"
:
"
_from
"
,
"
type
"
:
"
address
"
},{
"
name
"
:
"
_to
"
,
"
type
"
:
"
address
"
},{
"
name
"
:
"
_value
"
,
"
type
"
:
"
uint256
"
}],
"
name
"
:
"
transferFrom
"
,
"
outputs
"
:[{
"
name
"
:
""
,
"
type
"
:
"
bool
"
}],
"
payable
"
:
false
,
"
stateMutability
"
:
"
nonpayable
"
,
"
type
"
:
"
function
"
},{
"
constant
"
:
true
,
"
inputs
"
:[],
"
name
"
:
"
decimals
"
,
"
outputs
"
:[{
"
name
"
:
""
,
"
type
"
:
"
uint8
"
}],
"
payable
"
:
false
,
"
stateMutability
"
:
"
view
"
,
"
type
"
:
"
function
"
},{
"
constant
"
:
false
,
"
inputs
"
:[{
"
name
"
:
"
_to
"
,
"
type
"
:
"
address
"
},{
"
name
"
:
"
_amount
"
,
"
type
"
:
"
uint256
"
}],
"
name
"
:
"
mint
"
,
"
outputs
"
:[{
"
name
"
:
""
,
"
type
"
:
"
bool
"
}],
"
payable
"
:
false
,
"
stateMutability
"
:
"
nonpayable
"
,
"
type
"
:
"
function
"
},{
"
constant
"
:
false
,
"
inputs
"
:[{
"
name
"
:
"
_spender
"
,
"
type
"
:
"
address
"
},{
"
name
"
:
"
_subtractedValue
"
,
"
type
"
:
"
uint256
"
}],
"
name
"
:
"
decreaseApproval
"
,
"
outputs
"
:[{
"
name
"
:
"
success
"
,
"
type
"
:
"
bool
"
}],
"
payable
"
:
false
,
"
stateMutability
"
:
"
nonpayable
"
,
"
type
"
:
"
function
"
},{
"
constant
"
:
true
,
"
inputs
"
:[{
"
name
"
:
"
_owner
"
,
"
type
"
:
"
address
"
}],
"
name
"
:
"
balanceOf
"
,
"
outputs
"
:[{
"
name
"
:
"
balance
"
,
"
type
"
:
"
uint256
"
}],
"
payable
"
:
false
,
"
stateMutability
"
:
"
view
"
,
"
type
"
:
"
function
"
},{
"
constant
"
:
false
,
"
inputs
"
:[],
"
name
"
:
"
finishMinting
"
,
"
outputs
"
:[{
"
name
"
:
""
,
"
type
"
:
"
bool
"
}],
"
payable
"
:
false
,
"
stateMutability
"
:
"
nonpayable
"
,
"
type
"
:
"
function
"
},{
"
constant
"
:
true
,
"
inputs
"
:[],
"
name
"
:
"
owner
"
,
"
outputs
"
:[{
"
name
"
:
""
,
"
type
"
:
"
address
"
}],
"
payable
"
:
false
,
"
stateMutability
"
:
"
view
"
,
"
type
"
:
"
function
"
},{
"
constant
"
:
true
,
"
inputs
"
:[],
"
name
"
:
"
symbol
"
,
"
outputs
"
:[{
"
name
"
:
""
,
"
type
"
:
"
string
"
}],
"
payable
"
:
false
,
"
stateMutability
"
:
"
view
"
,
"
type
"
:
"
function
"
},{
"
constant
"
:
false
,
"
inputs
"
:[{
"
name
"
:
"
_to
"
,
"
type
"
:
"
address
"
},{
"
name
"
:
"
_value
"
,
"
type
"
:
"
uint256
"
}],
"
name
"
:
"
transfer
"
,
"
outputs
"
:[{
"
name
"
:
""
,
"
type
"
:
"
bool
"
}],
"
payable
"
:
false
,
"
stateMutability
"
:
"
nonpayable
"
,
"
type
"
:
"
function
"
},{
"
constant
"
:
false
,
"
inputs
"
:[{
"
name
"
:
"
_spender
"
,
"
type
"
:
"
address
"
},{
"
name
"
:
"
_addedValue
"
,
"
type
"
:
"
uint256
"
}],
"
name
"
:
"
increaseApproval
"
,
"
outputs
"
:[{
"
name
"
:
"
success
"
,
"
type
"
:
"
bool
"
}],
"
payable
"
:
false
,
"
stateMutability
"
:
"
nonpayable
"
,
"
type
"
:
"
function
"
},{
"
constant
"
:
true
,
"
inputs
"
:[{
"
name
"
:
"
_owner
"
,
"
type
"
:
"
address
"
},{
"
name
"
:
"
_spender
"
,
"
type
"
:
"
address
"
}],
"
name
"
:
"
allowance
"
,
"
outputs
"
:[{
"
name
"
:
"
remaining
"
,
"
type
"
:
"
uint256
"
}],
"
payable
"
:
false
,
"
stateMutability
"
:
"
view
"
,
"
type
"
:
"
function
"
},{
"
constant
"
:
false
,
"
inputs
"
:[{
"
name
"
:
"
newOwner
"
,
"
type
"
:
"
address
"
}],
"
name
"
:
"
transferOwnership
"
,
"
outputs
"
:[],
"
payable
"
:
false
,
"
stateMutability
"
:
"
nonpayable
"
,
"
type
"
:
"
function
"
},{
"
anonymous
"
:
false
,
"
inputs
"
:[{
"
indexed
"
:
true
,
"
name
"
:
"
to
"
,
"
type
"
:
"
address
"
},{
"
indexed
"
:
false
,
"
name
"
:
"
amount
"
,
"
type
"
:
"
uint256
"
}],
"
name
"
:
"
Mint
"
,
"
type
"
:
"
event
"
},{
"
anonymous
"
:
false
,
"
inputs
"
:[],
"
name
"
:
"
MintFinished
"
,
"
type
"
:
"
event
"
},{
"
anonymous
"
:
false
,
"
inputs
"
:[{
"
indexed
"
:
true
,
"
name
"
:
"
previousOwner
"
,
"
type
"
:
"
address
"
},{
"
indexed
"
:
true
,
"
name
"
:
"
newOwner
"
,
"
type
"
:
"
address
"
}],
"
name
"
:
"
OwnershipTransferred
"
,
"
type
"
:
"
event
"
},{
"
anonymous
"
:
false
,
"
inputs
"
:[{
"
indexed
"
:
true
,
"
name
"
:
"
owner
"
,
"
type
"
:
"
address
"
},{
"
indexed
"
:
true
,
"
name
"
:
"
spender
"
,
"
type
"
:
"
address
"
},{
"
indexed
"
:
false
,
"
name
"
:
"
value
"
,
"
type
"
:
"
uint256
"
}],
"
name
"
:
"
Approval
"
,
"
type
"
:
"
event
"
},{
"
anonymous
"
:
false
,
"
inputs
"
:[{
"
indexed
"
:
true
,
"
name
"
:
"
from
"
,
"
type
"
:
"
address
"
},{
"
indexed
"
:
true
,
"
name
"
:
"
to
"
,
"
type
"
:
"
address
"
},{
"
indexed
"
:
false
,
"
name
"
:
"
value
"
,
"
type
"
:
"
uint256
"
}],
"
name
"
:
"
Transfer
"
,
"
type
"
:
"
event
"
}]
var
tokenAddress
=
'
0xca9901076d02f89794262869aad1340bd45d8489
'
;
var
tokenContract
=
window
.
web3
.
eth
.
contract
(
tokenABI
).
at
(
tokenAddress
);
/*
tokenContract.Transfer().watch((err, response) => {
console.log(response.args.from);
});
*/
/*
tokenContract.allEvents((error, event) => {
if (error) {
console.error(error)
return false
}
console.log(event)
})
*/
class
App
extends
Component
{
constructor
(
props
){
...
...
@@ -94,7 +76,6 @@ class App extends Component {
self
.
setState
({
networkMessage
:
'
MetaMask connected to Ropstein testnet. Switch to Rinkeby and refresh!
'
})
break
default
:
console
.
log
(
'
This is an unknown network.
'
)
}
})
...
...
@@ -125,7 +106,7 @@ class App extends Component {
var
self
=
this
;
tokenContract
.
balanceOf
(
this
.
state
.
currentMaskAddress
,
function
(
error
,
balance
)
{
var
tokenAmount
=
(
balance
.
toNumber
())
/
10
00000
;
var
tokenAmount
=
(
balance
.
toNumber
())
/
10
**
6
;
self
.
setState
({
tokenBalance
:
tokenAmount
});
});
}
...
...
@@ -134,7 +115,7 @@ class App extends Component {
var
self
=
this
;
tokenContract
.
allowance
(
this
.
state
.
currentMaskAddress
,
uniswapAddress
,
function
(
error
,
balance
)
{
var
tokensAllowed
=
(
balance
.
toNumber
())
/
10
00000
;
var
tokensAllowed
=
(
balance
.
toNumber
())
/
10
**
6
;
self
.
setState
({
tokenAllowance
:
tokensAllowed
});
});
}
...
...
@@ -188,7 +169,7 @@ class App extends Component {
//purchase will go through if the amount of ETH is received is within 10%
//this is will be changed by full release, and will be a selectable range
var
minEth
=
this
.
state
.
minimumEthPurchased
*
0.9
;
var
tokensSold
=
this
.
state
.
ethCost
;
var
tokensSold
=
this
.
state
.
ethCost
*
10
**
6
;
window
.
web3
.
eth
.
getBlock
(
'
latest
'
,
function
(
error
,
blockInfo
)
{
var
time
=
blockInfo
.
timestamp
;
...
...
@@ -288,12 +269,12 @@ class App extends Component {
<
div
className
=
"
back
"
>
UNISWAP
<
/div
>
<
/div
>
<
/div
>
<
div
className
=
"
noICO
"
>
UNI
is
an
ERC20
test
token
.
We
are
NOT
doing
an
ICO
.
<
/div
>
<
div
className
=
"
noICO
"
>
UNI
is
an
ERC20
test
token
.
This
is
not
an
ICO
.
<
/div
>
<
img
src
=
{
unicorn
}
className
=
"
unicorn
"
alt
=
"
unicorn
"
/>
<
img
src
=
{
ethLogo
}
className
=
"
ethLogo
"
alt
=
"
ethLogo
"
/>
<
div
className
=
"
Warning
"
>
{
this
.
state
.
networkMessage
}
<
/div
>
<
div
className
=
"
Account-info
"
>
Account
Detected
:
&
nbsp
;
&
nbsp
;
&
nbsp
;
&
nbsp
;
&
nbsp
;
&
nbsp
;
&
nbsp
;{
this
.
state
.
ethBalance
}
ETH
&
nbsp
;
&
nbsp
;
&
nbsp
;
&
nbsp
;
&
nbsp
;
&
nbsp
;
&
nbsp
;
Account
Detected
:
&
nbsp
;
&
nbsp
;
&
nbsp
;
&
nbsp
;
&
nbsp
;
{
this
.
state
.
ethBalance
}
ETH
&
nbsp
;
&
nbsp
;
&
nbsp
;
&
nbsp
;
&
nbsp
;
{
this
.
state
.
tokenBalance
.
toFixed
(
2
)}
UNI
<
br
/>
{
this
.
state
.
currentMaskAddress
}
&
nbsp
;
&
nbsp
;
...
...
@@ -313,14 +294,13 @@ class App extends Component {
and
a
Mainet
launch
!
:)
<
br
/>
<
br
/>
7
)
This
demo
was
hastily
programmed
by
a
single
developer
<
i
>
(
Hi
,
my
name
is
Hayden
!
)
<
/i>. Please reach out to me with any questions, comments, complaints, or bug reports.<br/
><
br
/>
&
nbsp
;
&
nbsp
;
Email
:
hayden
@
uniswap
.
io
&
nbsp
;
&
nbsp
;
<
span
className
=
"
instructions-link
"
><
a
href
=
"
https://
faucet.rinkeby.io/
"
>
GitHub
:
https
:
//github.com/haydenadams/uniswap<br/></a></span>
<
span
className
=
"
instructions-link
"
><
a
href
=
"
https://
github.com/haydenadams/uniswap
"
>
GitHub
:
https
:
//github.com/haydenadams/uniswap<br/></a></span>
&
nbsp
;
&
nbsp
;
ETH
Address
:
0x4779721CaC18A46DbCF148f2Dd7A8E6cc1F90078
<
br
/><
br
/>
<
/div
>
<
/div
>
<
div
className
=
"
Approval
"
>
<
button
className
=
"
approveButton
"
onClick
=
{()
=>
{
this
.
approveAllowance
(
20000
*
10
**
6
)
}}
>
Approve
<
/button><br/
><
br
/>
{
/*Tokens approved: {this.state.tokenAllowance} */
}
<
button
className
=
"
approveButton
"
onClick
=
{()
=>
{
this
.
approveAllowance
(
5000
*
10
**
6
)
}}
>
Approve
<
/button
>
{
/*<button className="approveZero" onClick={() => {this.approveAllowance(0) }}>Zero Approval</button>*/
}
<
/div
>
<
div
className
=
"
exchange
"
>
<
div
className
=
"
exchange-buyTokensButton
"
>
...
...
@@ -329,7 +309,7 @@ class App extends Component {
//value={this.state.value}
onChange
=
{
this
.
onBuyTokensInputChange
}
/
>
<
input
className
=
"
exchange-buyTokensInputButton
"
type
=
"
exchange-button
"
defaultValue
=
"
Buy UNI
"
onClick
=
{()
=>
{
this
.
buyTokens
()
}}
/
>
<
input
className
=
"
exchange-buyTokensInputButton
"
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
/>
...
...
@@ -342,7 +322,7 @@ class App extends Component {
//value={this.state.value}
onChange
=
{
this
.
onBuyEthInputChange
}
/
>
<
input
className
=
"
exchange-buyEthInputButton
"
type
=
"
exchange-button
"
defaultValue
=
"
Buy ETH
"
onClick
=
{()
=>
{
this
.
sellTokens
()
}}
/
>
<
input
className
=
"
exchange-buyEthInputButton
"
type
=
"
exchange-button
"
defaultValue
=
"
Buy ETH
"
readOnly
=
"
readOnly
"
onClick
=
{()
=>
{
this
.
sellTokens
()
}}
/
>
<
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
/>
...
...
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