Skip to content
Permalink
Browse files

Marketmaker v2 (#602)

  • Loading branch information...
sindresorhus committed Jul 23, 2019
1 parent 6e081cc commit be3575b33aa165a0a1a758de9b79ed8cf760da8d
@@ -1,3 +1,4 @@
node_modules
/dist
/app/renderer-dist
/app/marketmaker/bin
@@ -56,9 +56,7 @@ exports.ignoreExternalPrice = new Set([
'SUPERNET',
]);

exports.hiddenCurrencies = [
'ETOMIC',
];
exports.hiddenCurrencies = [];

exports.appTimeStarted = Date.now();

@@ -1,7 +1,7 @@
{
"intro": {
"title": "✨ Thanks for Helping Us Test HyperDEX!",
"description": "<0>Please keep in mind <1>this project is still in Beta</1>.</0><1>Although loss of funds is unlikely, you should only trade with real currency if you can take that risk.</1><2>If you just want to test HyperDEX, try trading between the test currencies <1>MORTY</1> and <3>RICK</3> instead. You can get free <5>MORTY</5> at the <7><0>MORTY</0> faucet</7>.</2><3>HyperDEX is Open Source software provided \"as is\", without warranty of any kind. The authors or copyright holders are not liable for any damages caused as a result of using this software.</3><4>By using HyperDEX you are agreeing to the terms of the <1>MIT License</1>.</4>"
"description": "<0>Please keep in mind <1>this project is still in Beta</1>.</0><1>Although loss of funds is unlikely, you should only trade with real currency if you can take that risk.</1><2>If you just want to test HyperDEX, try trading between the test currencies <1>RICK</1> and <3>MORTY</3> instead. You can get free <5>RICK</5> <7>here</7> and free <9>MORTY</9> <11>here</11>.</2><3>HyperDEX is Open Source software provided \"as is\", without warranty of any kind. The authors or copyright holders are not liable for any damages caused as a result of using this software.</3><4>By using HyperDEX you are agreeing to the terms of the <1>MIT License</1>.</4>"
},
"activity": {
"noActivity": "No activity yet",
@@ -40,10 +40,10 @@
},
"withdraw": {
"amountLabel": "Amount",
"confirmNetworkFee": "Confirm Network Fee",
"confirmNetworkFee": "Confirm Transaction Fee",
"label": "Withdraw",
"maxAmount": "Max",
"networkFee": "Network Fee",
"networkFee": "Transaction Fee",
"recipientLabel": "Recipient",
"recipientPlaceholder": "Enter {{symbol}} Address",
"remainingBalance": "Remaining balance",
@@ -3,21 +3,18 @@
"chart": {
"depth": "{{baseCurrency}}/{{quoteCurrency}} Depth Chart"
},
"confirmQuitTitle": "Are you sure you want to quit?",
"confirmQuitDescription": "You have swaps in-progress. HyperDEX will try to continue the swaps the next time you run the app, but we recommend you leave HyperDEX running until the swaps complete.",
"intro": {
"description": " <0>HyperDEX is a decentralized exchange. It has a P2P order book and trades are made via <1>cross-chain atomic swaps</1>. This means it works slightly differently than a centralized exchange.</0><1>Orders can take a while to propagate across the P2P network. You may need to wait a while for the order book to display.</1><2>HyperDEX needs you to have correctly sized <1>UTXOs</1> to make a successful swap. For each UTXO you can make a single swap. The easiest way to ensure you can participate in a swap is to make two or three smaller deposits to your account rather than a single large deposit.</2><3>An atomic swap is comprised of six on-chain transactions. When trading a currency with high transaction fees, it's important to slightly increase your price to account for the total transaction fees. This is especially important when trading small amounts.</3>",
"title": "How Trading Works with HyperDEX"
},
"order": {
"amount": "Amount {{symbol}}",
"averageVolume": "Avg Vol",
"buy": "Buy",
"buyOrders": "Buy Orders",
"failedTrade": "Failed to {{type}} {{baseCurrency}}",
"maxOnePendingSwap": "Only one pending swap at a time, try again in {{wait}} seconds.",
"maxPrice": "MAX",
"maxVolume": "Max Vol",
"maxVolume": "Max Volume",
"price": "Price {{symbol}}",
"sell": "Sell",
"sellOrders": "Sell Orders",
@@ -4,12 +4,6 @@
"timedOut": "Swap timed out",
"title": "Swap",
"details": {
"aliceclaim": "Alice Claim",
"alicereclaim": "Alice Reclaim",
"alicepayment": "Alice Payment",
"alicespend": "Alice Spend",
"bobdeposit": "Bob Deposit",
"bobpayment": "Bob Payment",
"broadcast": "Broadcast",
"buy": "Buy",
"copyDebugData": "Copy Swap Debug Data",
@@ -29,6 +23,22 @@
"yourOffer": "Your offer",
"view": "View"
},
"swapStages": {
"TakerFeeSent": "Taker fee sent",
"MakerPaymentReceived": "Maker payment received",
"MakerPaymentWaitConfirmStarted": "Maker payment confirmation started",
"MakerPaymentValidatedAndConfirmed": "Maker payment validated and confirmed",
"TakerPaymentSent": "Taker payment sent",
"TakerPaymentSpent": "Taker payment spent",
"MakerPaymentSpent": "Maker payment spent",

"TakerFeeValidated": "Taker free validated",
"MakerPaymentSent": "Maker payment sent",
"TakerPaymentReceived": "Taker payment received",
"TakerPaymentWaitConfirmStarted": "Taker payment confirmation started",
"TakerPaymentValidatedAndConfirmed": "Taker payment validated and confirmed",
"TakerPaymentSpent": "Taker payment spent"
},
"list": {
"baseAmount": "Base amount",
"date": "Date",
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -9,6 +9,7 @@ const getPort = require('get-port');
const logger = require('electron-timber');
const makeDir = require('make-dir');
const _ = require('lodash');
const {sha256} = require('crypto-hash');
const {supportedCurrencies} = require('./supported-currencies');

// `electron-builder` uses different names
@@ -76,30 +77,48 @@ class Marketmaker {

const port = await getPort();

// We leave out `electrumServers` since it's not needed
// and to prevent issues on Windows with too long arguments
const coins = supportedCurrencies.map(currency => {
currency = _.omit(currency, ['electrumServers']);

// Translate to exepcted mm v2 format
currency.etomic = currency.contractAddress;
delete currency.contractAddress;

return currency;
});

options = {
...options,
client: 1,
gui: 'hyperdex',
userhome: os.homedir(),
netid: 9999, // TODO: Set this to `0` when mm v2 is production ready
rpcport: port,
// We leave out `electrumServers` since it's not needed
// and to prevent issues on Windows with too long arguments
coins: supportedCurrencies.map(currency => _.omit(currency, ['electrumServers'])),
rpccors: is.development ? 'http://localhost:8080' : 'app://-',
coins,
};

this.port = options.rpcport;

if (options.seedPhrase) {
// eslint-disable-next-line camelcase
options.rpc_password = await sha256(options.seedPhrase);
options.passphrase = options.seedPhrase;
delete options.seedPhrase;
} else {
throw new Error('The `seedPhrase` option is required');
}

// Marketmaker writes a lot of files directly to CWD, so we make CWD the data directory
const cwd = await makeDir(path.join(electron.app.getPath('userData'), 'marketmaker'));
// NOTE: It's very important that this is a different directory than mm v1, as the database is not compatible
// TODO: Update the path here when mm v2 is production ready
const cwd = await makeDir(path.join(electron.app.getPath('userData'), 'marketmaker2-test'));

logger.log('Spawning Marketmaker with options:', JSON.stringify({...options, passphrase: '<redacted>'}));
logger.log('Spawning Marketmaker with options:', JSON.stringify({
...options,
passphrase: '<redacted>',
rpc_password: '<redacted>', // eslint-disable-line camelcase
}));

// Uncomment this to get the command to run Marketmaker manually
// options.coins = supportedCurrencies;

0 comments on commit be3575b

Please sign in to comment.
You can’t perform that action at this time.