From 5e6cbe91a7667b16e0a15a652c3c3f9b05d5f11d Mon Sep 17 00:00:00 2001
From: Pex
Date: Fri, 14 Sep 2018 11:35:10 +0200
Subject: [PATCH 01/12] Implementing EIP1102 according to the current proposal
at https://github.com/ethereum/EIPs/blob/master/EIPS/eip-1102.md
---
src/web3.js | 62 ++++++++++++++++++++++++++++++++++++-----------------
1 file changed, 42 insertions(+), 20 deletions(-)
diff --git a/src/web3.js b/src/web3.js
index e6c14f4..4bdddf2 100644
--- a/src/web3.js
+++ b/src/web3.js
@@ -7,15 +7,18 @@ import TrezorSubProvider from './vendor/trezor-subprovider';
const settings = require('./settings');
-export const getCurrentProviderName = () => {
- if (!window.web3 || typeof window.web3.currentProvider === 'undefined')
- return '';
+export const getCurrentProviderName = ( provider = window.web3.currentProvider ) => {
+ if (!provider)
+ return "";
- if (window.web3.currentProvider.isMetaMask)
- return 'metamask';
+ if (provider.isMetaMask)
+ return "metamask";
- if (window.web3.currentProvider.isTrust)
- return 'trust';
+ if (provider.isTrust)
+ return "trust";
+
+ if (window.web3.currentProvider.isStatus)
+ return "status";
if (typeof window.SOFA !== 'undefined')
return 'coinbase';
@@ -23,16 +26,16 @@ export const getCurrentProviderName = () => {
if (typeof window.__CIPHER__ !== 'undefined')
return 'cipher';
- if (window.web3.currentProvider.constructor.name === 'EthereumProvider')
+ if (provider.constructor.name === 'EthereumProvider')
return 'mist';
- if (window.web3.currentProvider.constructor.name === 'Web3FrameProvider')
+ if (provider.constructor.name === 'Web3FrameProvider')
return 'parity';
- if (window.web3.currentProvider.host && window.web3.currentProvider.host.indexOf('infura') !== -1)
+ if (provider.host && provider.host.indexOf('infura') !== -1)
return 'infura';
- if (window.web3.currentProvider.host && window.web3.currentProvider.host.indexOf('localhost') !== -1)
+ if (provider.host && provider.host.indexOf('localhost') !== -1)
return 'localhost';
return 'other';
@@ -61,25 +64,44 @@ class Web3Extended extends Web3 {
this.currentProvider.start();
this.useLogs = false;
resolve(true);
- } catch(e) {
+ } catch (e) {
reject(e);
}
});
- }
+ };
+
+ bindProvider = provider => {
+ console.log(provider);
+ this.setProvider(provider);
+ this.currentProvider.name = getCurrentProviderName(provider);
+ };
setWebClientProvider = () => {
this.stop();
return new Promise(async (resolve, reject) => {
try {
- if (window.web3) {
- this.setProvider(window.web3.currentProvider);
+ if (window.web3) { // This is the case for Provider Injectors which don't follow EIP1102 ( parity-extension ? )
+ console.log("Are we here?");
+ this.bindProvider(window.web3.currentProvider);
+ resolve();
} else {
- alert('error');
+ if (window.ethereum) { //following the new EIP1102 standard
+ window.ethereum.enable().then(
+ () => {
+ this.bindProvider(window.ethereum);
+ resolve();
+ },
+ () => {
+ alert('No Authorization!');
+ reject();
+ })
+ } else {
+ alert('No Provider found!');
+ reject();
+ }
}
- this.useLogs = true;
- this.currentProvider.name = getCurrentProviderName();
resolve(true);
- } catch(e) {
+ } catch (e) {
reject(e);
}
});
@@ -87,7 +109,7 @@ class Web3Extended extends Web3 {
}
const web3 = new Web3Extended();
-web3.BigNumber.config({EXPONENTIAL_AT:[-18,21]});
+web3.BigNumber.config({EXPONENTIAL_AT: [-18, 21]});
window.web3Provider = web3;
export default web3;
From 1e74f4b0968f527352a5c64b78e781ffb9407295 Mon Sep 17 00:00:00 2001
From: Pex
Date: Thu, 18 Oct 2018 10:25:08 +0200
Subject: [PATCH 02/12] Small modification and prioritization of provider
checks
---
src/web3.js | 37 ++++++++++++++++++++-----------------
1 file changed, 20 insertions(+), 17 deletions(-)
diff --git a/src/web3.js b/src/web3.js
index 4bdddf2..323ad25 100644
--- a/src/web3.js
+++ b/src/web3.js
@@ -80,27 +80,30 @@ class Web3Extended extends Web3 {
this.stop();
return new Promise(async (resolve, reject) => {
try {
+ // Checking if the the provider is compliant with the new EIP1102 Standard.
+ if (window.ethereum) { //following the new EIP1102 standard
+ window.ethereum.enable().then(
+ () => {
+ this.bindProvider(window.ethereum);
+ resolve();
+ },
+ () => {
+ alert('Please authorize the app to proceed!');
+ reject();
+ });
+
+ return;
+ }
+
if (window.web3) { // This is the case for Provider Injectors which don't follow EIP1102 ( parity-extension ? )
- console.log("Are we here?");
this.bindProvider(window.web3.currentProvider);
resolve();
- } else {
- if (window.ethereum) { //following the new EIP1102 standard
- window.ethereum.enable().then(
- () => {
- this.bindProvider(window.ethereum);
- resolve();
- },
- () => {
- alert('No Authorization!');
- reject();
- })
- } else {
- alert('No Provider found!');
- reject();
- }
+
+ return;
}
- resolve(true);
+
+ alert('No Provider found!');
+ reject();
} catch (e) {
reject(e);
}
From e2d6b89a87a5baf21777f91647c42a6f229e46c7 Mon Sep 17 00:00:00 2001
From: Pex
Date: Thu, 18 Oct 2018 11:29:54 +0200
Subject: [PATCH 03/12] Remove message shown to the user if the user doesn't
authorize the app.
---
src/web3.js | 1 -
1 file changed, 1 deletion(-)
diff --git a/src/web3.js b/src/web3.js
index 323ad25..cab6d40 100644
--- a/src/web3.js
+++ b/src/web3.js
@@ -88,7 +88,6 @@ class Web3Extended extends Web3 {
resolve();
},
() => {
- alert('Please authorize the app to proceed!');
reject();
});
From a2114381e2ddcff22056e9789b977b6fbf68985c Mon Sep 17 00:00:00 2001
From: Pex
Date: Thu, 18 Oct 2018 15:01:28 +0200
Subject: [PATCH 04/12] Remove redundant code.
---
src/web3.js | 2 --
1 file changed, 2 deletions(-)
diff --git a/src/web3.js b/src/web3.js
index cab6d40..bc53ed4 100644
--- a/src/web3.js
+++ b/src/web3.js
@@ -62,7 +62,6 @@ class Web3Extended extends Web3 {
this.currentProvider.addProvider(hwWalletSubProvider);
this.currentProvider.addProvider(new RpcSource({rpcUrl: settings.chain[network].nodeURL}));
this.currentProvider.start();
- this.useLogs = false;
resolve(true);
} catch (e) {
reject(e);
@@ -101,7 +100,6 @@ class Web3Extended extends Web3 {
return;
}
- alert('No Provider found!');
reject();
} catch (e) {
reject(e);
From 4e479ff4a93b04b572f5cdb341326f9d1bdb0dc5 Mon Sep 17 00:00:00 2001
From: Pex
Date: Thu, 18 Oct 2018 17:12:08 +0200
Subject: [PATCH 05/12] Remove redundant code
---
src/web3.js | 4 ----
1 file changed, 4 deletions(-)
diff --git a/src/web3.js b/src/web3.js
index bc53ed4..d3c0839 100644
--- a/src/web3.js
+++ b/src/web3.js
@@ -8,9 +8,6 @@ import TrezorSubProvider from './vendor/trezor-subprovider';
const settings = require('./settings');
export const getCurrentProviderName = ( provider = window.web3.currentProvider ) => {
- if (!provider)
- return "";
-
if (provider.isMetaMask)
return "metamask";
@@ -70,7 +67,6 @@ class Web3Extended extends Web3 {
};
bindProvider = provider => {
- console.log(provider);
this.setProvider(provider);
this.currentProvider.name = getCurrentProviderName(provider);
};
From 0a36900aebf4bbec0bd16fe0924183c36d1c119e Mon Sep 17 00:00:00 2001
From: Pex
Date: Mon, 29 Oct 2018 17:13:21 +0100
Subject: [PATCH 06/12] Compatible with the Metamask breaking changes. The user
is prompted to approve the dapp access. If the access is not granted, the
user cannot proceed with using the dapp.
---
src/components/App.jsx | 74 +++++++++++++++++++++++++-----------------
src/web3.js | 4 +--
2 files changed, 46 insertions(+), 32 deletions(-)
diff --git a/src/components/App.jsx b/src/components/App.jsx
index de35cd9..72a2b4c 100644
--- a/src/components/App.jsx
+++ b/src/components/App.jsx
@@ -93,7 +93,7 @@ class App extends Component {
network = 'private';
}
if (!this.state.network.stopIntervals // To avoid race condition
- && this.state.network.network !== network) {
+ && this.state.network.network !== network) {
this.initNetwork(network);
}
}, () => {
@@ -158,7 +158,8 @@ class App extends Component {
})
}
});
- }, () => {});
+ }, () => {
+ });
}
componentDidMount = () => {
@@ -1178,10 +1179,23 @@ class App extends Component {
network.stopIntervals = false;
return {network};
}, async () => {
- await Blockchain.setWebClientProvider();
- this.checkNetwork();
- this.checkAccountsInterval = setInterval(this.checkAccounts, 1000);
- this.checkNetworkInterval = setInterval(this.checkNetwork, 3000);
+ const isSet = await Blockchain.setWebClientProvider().catch(_ => {
+ return false;
+ });
+
+ if (isSet) {
+ this.checkNetwork();
+ this.checkAccountsInterval = setInterval(this.checkAccounts, 1000);
+ this.checkNetworkInterval = setInterval(this.checkNetwork, 3000);
+ } else {
+ this.setState(prevState => {
+ const network = {...prevState.network};
+ network.loadingAddress = false;
+ network.loadingFirstAddress = false;
+ network.stopIntervals = true;
+ return {network};
+ });
+ }
});
}
@@ -1268,30 +1282,30 @@ class App extends Component {
renderWidget = () => {
return
+ section={this.state.section}
+ network={this.state.network.network}
+ loadingAddress={this.state.network.loadingAddress}
+ loadingFirstAddress={this.state.network.loadingFirstAddress}
+ account={this.state.network.defaultAccount}
+ proxy={this.state.proxy}
+ trade={this.state.trade}
+ balances={this.state.balances}
+ showTxMessage={this.state.showTxMessage}
+ transactions={this.state.transactions}
+ setMainState={this.setMainState}
+ fasterGasPrice={this.fasterGasPrice}
+ doTrade={this.doTrade}
+ reset={this.reset}
+ calculateBuyAmount={this.calculateBuyAmount}
+ calculatePayAmount={this.calculatePayAmount}
+ cleanInputs={this.cleanInputs}
+ setWeb3WebClient={this.setWeb3WebClient}
+ hw={this.state.hw}
+ showHW={this.showHW}
+ showClientChoice={this.showClientChoice}
+ loadHWAddresses={this.loadHWAddresses}
+ selectHWAddress={this.selectHWAddress}
+ importAddress={this.importAddress}/>
}
render = () => {
diff --git a/src/web3.js b/src/web3.js
index d3c0839..796c51c 100644
--- a/src/web3.js
+++ b/src/web3.js
@@ -80,7 +80,7 @@ class Web3Extended extends Web3 {
window.ethereum.enable().then(
() => {
this.bindProvider(window.ethereum);
- resolve();
+ resolve(true);
},
() => {
reject();
@@ -91,7 +91,7 @@ class Web3Extended extends Web3 {
if (window.web3) { // This is the case for Provider Injectors which don't follow EIP1102 ( parity-extension ? )
this.bindProvider(window.web3.currentProvider);
- resolve();
+ resolve(true);
return;
}
From 92a59475bb3091ceb70fb8c9a1629111996c5f3b Mon Sep 17 00:00:00 2001
From: Pex
Date: Thu, 1 Nov 2018 17:56:03 +0100
Subject: [PATCH 07/12] Critical issue with the sorting function. We shouldn't
return boolean value but rather 1, 0 or -1.
---
src/components/App.jsx | 7 +++++--
src/components/DoTrade.jsx | 4 ++--
src/components/SetTrade.jsx | 4 ++--
src/helpers.js | 6 ++++++
4 files changed, 15 insertions(+), 6 deletions(-)
diff --git a/src/components/App.jsx b/src/components/App.jsx
index 72a2b4c..1957cc7 100644
--- a/src/components/App.jsx
+++ b/src/components/App.jsx
@@ -1,6 +1,9 @@
import React, { Component } from 'react';
import * as Blockchain from "../blockchainHandler";
-import { addressToBytes32, toBigNumber, toWei, fromWei, BigNumber, calculateTradePrice } from '../helpers';
+import {
+ addressToBytes32, toBigNumber, toWei, fromWei, BigNumber, calculateTradePrice,
+ currencyPairCompare
+} from '../helpers';
import Widget from './Widget';
import { Logo } from "./Icons";
import FAQ from "./FAQ";
@@ -696,7 +699,7 @@ class App extends Component {
doTrade = () => {
const amount = this.state.trade[this.state.trade.operation === 'sellAll' ? 'amountPay' : 'amountBuy'];
- const threshold = settings.chain[this.state.network.network].threshold[[this.state.trade.from, this.state.trade.to].sort((a, b) => a > b).join('')] * 0.01;
+ const threshold = settings.chain[this.state.network.network].threshold[[this.state.trade.from, this.state.trade.to].sort(currencyPairCompare).join('')] * 0.01;
const limit = toWei(this.state.trade.operation === 'sellAll' ? this.state.trade.amountBuy.times(1 - threshold) : this.state.trade.amountPay.times(1 + threshold)).round(0);
if (this.state.trade.from === 'eth') {
this.setState(prevState => {
diff --git a/src/components/DoTrade.jsx b/src/components/DoTrade.jsx
index 1800e75..7d1d605 100644
--- a/src/components/DoTrade.jsx
+++ b/src/components/DoTrade.jsx
@@ -4,7 +4,7 @@ import { Ether, MKR, DAI, Done, AccountIcon, Attention } from './Icons';
import Spinner from './Spinner';
import TokenAmount from './TokenAmount';
import Congratulation from './Congratulation';
-import { etherscanUrl, quotation, toBigNumber, toWei } from '../helpers';
+import { etherscanUrl, quotation, currencyPairCompare, toBigNumber, toWei } from '../helpers';
const settings = require('../settings');
@@ -221,7 +221,7 @@ class DoTrade extends Component {
Perhaps the market has moved, so your order could not be filled within the
- {settings.chain[this.props.network].threshold[[this.props.trade.from, this.props.trade.to].sort((a, b) => a > b).join('')]}% slippage limit
+ {settings.chain[this.props.network].threshold[[this.props.trade.from, this.props.trade.to].sort(currencyPairCompare).join('')]}% slippage limit
diff --git a/src/components/SetTrade.jsx b/src/components/SetTrade.jsx
index acc5ca2..4c69482 100644
--- a/src/components/SetTrade.jsx
+++ b/src/components/SetTrade.jsx
@@ -7,7 +7,7 @@ import {
} from './Icons';
import Spinner from './Spinner';
import TokenAmount from './TokenAmount';
-import { fetchETHPriceInUSD, toWei } from '../helpers'
+import { currencyPairCompare, fetchETHPriceInUSD, toWei } from '../helpers'
import * as Blockchain from "../blockchainHandler";
const settings = require('../settings');
@@ -240,7 +240,7 @@ class SetTrade extends Component {
- {settings.chain[this.props.network].threshold[[this.state.from, this.state.to].sort((a, b) => a > b).join('')]}%
+ {settings.chain[this.props.network].threshold[[this.state.from, this.state.to].sort(currencyPairCompare).join('')]}%
Gas cost
diff --git a/src/helpers.js b/src/helpers.js
index d457089..dd90108 100644
--- a/src/helpers.js
+++ b/src/helpers.js
@@ -145,4 +145,10 @@ export const calculateTradePrice = (tokenSell, amountSell, tokenBuy, amountBuy)
{price: amountBuy.div(amountSell), priceUnit: `${tokenSell}/${tokenBuy}`};
}
+export const currencyPairCompare = ( firstToken, secondToken ) => {
+ if ( firstToken > secondToken ) return 1;
+ if ( firstToken < secondToken ) return -1;
+ return 0;
+}
+
export const {toBigNumber , toWei, fromWei, isAddress, BigNumber, toHex} = web3;
From b3a65282240e7010469a90ac4ca9a54d09527c91 Mon Sep 17 00:00:00 2001
From: Gonzalo Balabasquer
Date: Mon, 5 Nov 2018 08:30:47 -0300
Subject: [PATCH 08/12] force specific version for ledger package
---
package.json | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/package.json b/package.json
index 5680ab9..7aa8d2f 100644
--- a/package.json
+++ b/package.json
@@ -4,8 +4,8 @@
"private": true,
"homepage": ".",
"dependencies": {
- "@ledgerhq/hw-app-eth": "^4.7.3",
- "@ledgerhq/hw-transport-u2f": "^4.7.3",
+ "@ledgerhq/hw-app-eth": "4.7.3",
+ "@ledgerhq/hw-transport-u2f": "4.7.3",
"bluebird": "^3.5.1",
"create-react-class": "^15.6.2",
"hdkey": "^0.8.0",
From 79e4d58ae5ea1ffb923ce0eabd7d671ce29e655c Mon Sep 17 00:00:00 2001
From: Pex
Date: Tue, 20 Nov 2018 22:19:28 +0100
Subject: [PATCH 09/12] Remove MKR support. MKR is no longer traded
---
src/components/App.jsx | 1 -
src/components/DoTrade.jsx | 8 +-------
src/components/SetTrade.jsx | 7 +------
src/components/TokensSelector.jsx | 2 +-
src/misc/faq.js | 5 ++---
src/styles/App.css | 2 +-
6 files changed, 6 insertions(+), 19 deletions(-)
diff --git a/src/components/App.jsx b/src/components/App.jsx
index 1957cc7..58f60ce 100644
--- a/src/components/App.jsx
+++ b/src/components/App.jsx
@@ -208,7 +208,6 @@ class App extends Component {
}, () => {
Blockchain.loadObject('dsproxy', this.state.proxy, 'proxy');
this.setUpToken('weth');
- this.setUpToken('mkr');
this.setUpToken('dai');
// This is necessary to finish transactions that failed after signing
this.setPendingTxInterval();
diff --git a/src/components/DoTrade.jsx b/src/components/DoTrade.jsx
index 7d1d605..62291a4 100644
--- a/src/components/DoTrade.jsx
+++ b/src/components/DoTrade.jsx
@@ -1,6 +1,6 @@
import React, { Component } from 'react';
import ReactTooltip from 'react-tooltip';
-import { Ether, MKR, DAI, Done, AccountIcon, Attention } from './Icons';
+import { Ether, DAI, Done, AccountIcon, Attention } from './Icons';
import Spinner from './Spinner';
import TokenAmount from './TokenAmount';
import Congratulation from './Congratulation';
@@ -14,11 +14,6 @@ const tokens = {
symbol: "ETH",
name: "Ether"
},
- 'mkr': {
- icon: ,
- symbol: "MKR",
- name: "Maker"
- },
'dai': {
icon: ,
symbol: "DAI",
@@ -31,7 +26,6 @@ class DoTrade extends Component {
token = (key) => {
const tokens = {
'eth': 'Ether',
- 'mkr': 'Maker',
'dai': 'Dai'
};
return tokens[key];
diff --git a/src/components/SetTrade.jsx b/src/components/SetTrade.jsx
index 4c69482..950df5a 100644
--- a/src/components/SetTrade.jsx
+++ b/src/components/SetTrade.jsx
@@ -3,7 +3,7 @@ import ReactTooltip from 'react-tooltip';
import ActiveConnection from './ActiveConnection';
import TokensSelector from './TokensSelector';
import {
- Ether, MKR, DAI, SwapArrows, IdentityIcon, Circle, Attention,
+ Ether, DAI, SwapArrows, IdentityIcon, Circle, Attention,
} from './Icons';
import Spinner from './Spinner';
import TokenAmount from './TokenAmount';
@@ -19,11 +19,6 @@ const tokens = {
symbol: "ETH",
name: "Ether",
},
- mkr: {
- icon: ,
- symbol: "MKR",
- name: "Maker"
- },
dai: {
icon: ,
symbol: "DAI",
diff --git a/src/components/TokensSelector.jsx b/src/components/TokensSelector.jsx
index 2b2f017..1617b00 100644
--- a/src/components/TokensSelector.jsx
+++ b/src/components/TokensSelector.jsx
@@ -23,7 +23,7 @@ class TokensSelector extends React.Component {
}
{
- ['mkr', 'dai'].map((token, index) => {
+ ['dai'].map((token, index) => {
return (
{
this.props.select(token)
diff --git a/src/misc/faq.js b/src/misc/faq.js
index a8ddab7..91c4175 100644
--- a/src/misc/faq.js
+++ b/src/misc/faq.js
@@ -27,11 +27,11 @@ const FAQ = [
},
{
question: "Can you list the Slippage Limit for all assets/tokens ?",
- answer: "Right now the slippage limit is 1% for MKR/ETH and MKR/DAI pairs, and 2% for ETH/DAI pair."
+ answer: "Right now the slippage limit is 2% for ETH/DAI pair."
},
{
question: "Are you going to support more trading pairs in the future ?",
- answer: "Yes, more trading pairs will be supported in the future. In the beginning the following pairs are available: DAI/ETH, MKR/DAI and ETH/MKR."
+ answer: "Yes, more trading pairs will be supported in the future. In the beginning the following pair is available: DAI/ETH"
},
{
question: "Why do I sometimes need to confirm three transactions, sometimes two transactions, and sometimes only one? ",
@@ -55,7 +55,6 @@ const FAQ = [
- 30 DAI
- 0.03 ETH
- - 0.03 MKR Note that both buy and sell amounts of a transaction need to be above the minimum trade size.
},
diff --git a/src/styles/App.css b/src/styles/App.css
index 18d8ad7..025f397 100644
--- a/src/styles/App.css
+++ b/src/styles/App.css
@@ -868,7 +868,7 @@ button[disabled] {
.token-selector .tokens {
display: flex;
flex-wrap: wrap;
- justify-content: flex-end;
+ justify-content: center;
align-items: flex-start;
padding: 0 8px;
max-height: 300px;
From 9dd27e7102224b4163673979341c31728b71a193 Mon Sep 17 00:00:00 2001
From: Pex
Date: Fri, 14 Dec 2018 10:29:00 +0100
Subject: [PATCH 10/12] New OTC addresses
---
src/settings.json | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/settings.json b/src/settings.json
index 729c4cd..5ea5554 100644
--- a/src/settings.json
+++ b/src/settings.json
@@ -4,7 +4,7 @@
"chain": {
"kovan": {
"nodeURL" : "https://kovan.infura.io/mtXsTjGvCTFRFFHwzn1f",
- "otc": "0x8cf1cab422a0b6b554077a361f8419cdf122a9f9",
+ "otc": "0xdb3b642ebc6ff85a3ab335cff9af2954f9215994",
"threshold": {
"daieth": 2,
"daimkr": 1,
@@ -36,7 +36,7 @@
},
"main": {
"nodeURL" : "https://mainnet.infura.io/mtXsTjGvCTFRFFHwzn1f",
- "otc": "0x14fbca95be7e99c15cc2996c6c9d841e54b79425",
+ "otc": "0xb7ac09c2c0217b07d7c103029b4918a2c401eecb",
"threshold": {
"daieth": 2,
"daimkr": 1,
From e142be40766a28b15e1c077f52f37907692623ec Mon Sep 17 00:00:00 2001
From: Pex
Date: Fri, 14 Dec 2018 10:35:13 +0100
Subject: [PATCH 11/12] Revert "Remove MKR support. MKR is no longer traded"
This reverts commit 79e4d58ae5ea1ffb923ce0eabd7d671ce29e655c.
---
src/components/App.jsx | 1 +
src/components/DoTrade.jsx | 8 +++++++-
src/components/SetTrade.jsx | 7 ++++++-
src/components/TokensSelector.jsx | 2 +-
src/misc/faq.js | 5 +++--
src/styles/App.css | 2 +-
6 files changed, 19 insertions(+), 6 deletions(-)
diff --git a/src/components/App.jsx b/src/components/App.jsx
index 58f60ce..1957cc7 100644
--- a/src/components/App.jsx
+++ b/src/components/App.jsx
@@ -208,6 +208,7 @@ class App extends Component {
}, () => {
Blockchain.loadObject('dsproxy', this.state.proxy, 'proxy');
this.setUpToken('weth');
+ this.setUpToken('mkr');
this.setUpToken('dai');
// This is necessary to finish transactions that failed after signing
this.setPendingTxInterval();
diff --git a/src/components/DoTrade.jsx b/src/components/DoTrade.jsx
index 62291a4..7d1d605 100644
--- a/src/components/DoTrade.jsx
+++ b/src/components/DoTrade.jsx
@@ -1,6 +1,6 @@
import React, { Component } from 'react';
import ReactTooltip from 'react-tooltip';
-import { Ether, DAI, Done, AccountIcon, Attention } from './Icons';
+import { Ether, MKR, DAI, Done, AccountIcon, Attention } from './Icons';
import Spinner from './Spinner';
import TokenAmount from './TokenAmount';
import Congratulation from './Congratulation';
@@ -14,6 +14,11 @@ const tokens = {
symbol: "ETH",
name: "Ether"
},
+ 'mkr': {
+ icon: ,
+ symbol: "MKR",
+ name: "Maker"
+ },
'dai': {
icon: ,
symbol: "DAI",
@@ -26,6 +31,7 @@ class DoTrade extends Component {
token = (key) => {
const tokens = {
'eth': 'Ether',
+ 'mkr': 'Maker',
'dai': 'Dai'
};
return tokens[key];
diff --git a/src/components/SetTrade.jsx b/src/components/SetTrade.jsx
index 950df5a..4c69482 100644
--- a/src/components/SetTrade.jsx
+++ b/src/components/SetTrade.jsx
@@ -3,7 +3,7 @@ import ReactTooltip from 'react-tooltip';
import ActiveConnection from './ActiveConnection';
import TokensSelector from './TokensSelector';
import {
- Ether, DAI, SwapArrows, IdentityIcon, Circle, Attention,
+ Ether, MKR, DAI, SwapArrows, IdentityIcon, Circle, Attention,
} from './Icons';
import Spinner from './Spinner';
import TokenAmount from './TokenAmount';
@@ -19,6 +19,11 @@ const tokens = {
symbol: "ETH",
name: "Ether",
},
+ mkr: {
+ icon: ,
+ symbol: "MKR",
+ name: "Maker"
+ },
dai: {
icon: ,
symbol: "DAI",
diff --git a/src/components/TokensSelector.jsx b/src/components/TokensSelector.jsx
index 1617b00..2b2f017 100644
--- a/src/components/TokensSelector.jsx
+++ b/src/components/TokensSelector.jsx
@@ -23,7 +23,7 @@ class TokensSelector extends React.Component {
}
{
- ['dai'].map((token, index) => {
+ ['mkr', 'dai'].map((token, index) => {
return (
{
this.props.select(token)
diff --git a/src/misc/faq.js b/src/misc/faq.js
index 91c4175..a8ddab7 100644
--- a/src/misc/faq.js
+++ b/src/misc/faq.js
@@ -27,11 +27,11 @@ const FAQ = [
},
{
question: "Can you list the Slippage Limit for all assets/tokens ?",
- answer: "Right now the slippage limit is 2% for ETH/DAI pair."
+ answer: "Right now the slippage limit is 1% for MKR/ETH and MKR/DAI pairs, and 2% for ETH/DAI pair."
},
{
question: "Are you going to support more trading pairs in the future ?",
- answer: "Yes, more trading pairs will be supported in the future. In the beginning the following pair is available: DAI/ETH"
+ answer: "Yes, more trading pairs will be supported in the future. In the beginning the following pairs are available: DAI/ETH, MKR/DAI and ETH/MKR."
},
{
question: "Why do I sometimes need to confirm three transactions, sometimes two transactions, and sometimes only one? ",
@@ -55,6 +55,7 @@ const FAQ = [
- 30 DAI
- 0.03 ETH
+ - 0.03 MKR Note that both buy and sell amounts of a transaction need to be above the minimum trade size.
},
diff --git a/src/styles/App.css b/src/styles/App.css
index 025f397..18d8ad7 100644
--- a/src/styles/App.css
+++ b/src/styles/App.css
@@ -868,7 +868,7 @@ button[disabled] {
.token-selector .tokens {
display: flex;
flex-wrap: wrap;
- justify-content: center;
+ justify-content: flex-end;
align-items: flex-start;
padding: 0 8px;
max-height: 300px;
From 0076f6e31c5c86b5a5f365e653ea593414ebfc38 Mon Sep 17 00:00:00 2001
From: Pex
Date: Mon, 17 Dec 2018 17:09:56 +0100
Subject: [PATCH 12/12] Add regenerators to the runtime transform
---
package.json | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git a/package.json b/package.json
index 7aa8d2f..06a74a9 100644
--- a/package.json
+++ b/package.json
@@ -23,5 +23,18 @@
"test": "react-scripts test --env=jsdom",
"eject": "react-scripts eject",
"surge": "npm run build && surge ./build/ https://oasis-direct.surge.sh"
+ },
+ "babel": {
+ "plugins": [
+ [
+ "transform-runtime",
+ {
+ "regenerator": true
+ }
+ ]
+ ]
+ },
+ "devDependencies": {
+ "babel-plugin-transform-runtime": "^6.23.0"
}
}