This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'use strict'; | |
const db = require('../lib/db'); | |
const { argv } = require('yargs'); | |
const { | |
method, | |
bindKey, | |
partialRight, | |
property | |
} = require('lodash'); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'use strict'; | |
const expect = require('chai').expect; | |
const eth = require('./eth'); | |
const { join } = require('path'); | |
const util = require('./util'); | |
const { generate } = require('ethereumjs-wallet'); | |
const { | |
unitMap, | |
soliditySha3 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const BN = require('bignumber.js'); | |
const buyAmount = new BN('1000').mul(new BN(10).pow(8)).toPrecision(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function generateSignature(...signingData) { | |
const raw = web3Util.soliditySha3(...signingData); | |
const salted = ethUtil.hashPersonalMessage(ethUtil.toBuffer(raw)); | |
const { | |
v, | |
r, | |
s | |
} = lodash.mapValues(ethUtil.ecsign(salted, ethUtil.toBuffer('0x'+user.pk.trim())), (value, key) => key === 'v' ? value : ethUtil.bufferToHex(value)); | |
//console.log("Signature complete! ", v, r, s); | |
return {v: v, r: r, s: s}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const mapToMarkets = map(property('market')); | |
const fetchTickers = () => { | |
const markets = mapToMarkets(store.getState().targetedMarkets); | |
return mapSeries(markets, bindKey(liqui, 'getTicker')).then(zipObject(markets)); | |
}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Client Modals: | |
client/eth.js — | |
1. Transaction is already pending from this address | |
happens when the client tries to send a new tx while one is pending | |
2. Error: User denied transaction signature. | |
happens when metamask rejects signing a message |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
TradeError -- | |
'1': 'Order not found', | |
This happens when the client tries to fill an order that has been sniped during his attempt to match and sign and dispatch | |
'2': 'Trade signature invalid. Please try again.', | |
Self explanatory, invalid signature from the client (probably due to ledger issues) | |
'3': 'You have insufficient funds to place this order.', | |
Taker has insufficient funds to execute trade |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- Selectable markets | |
- For each market | |
-- percentage of total ETH appropriated for market | |
-- percentage of total coin balance appropriated for market making with | |
-- For both buy and sell side | |
--- Amount of orders | |
--- Curve to use for setting prices | |
--- Curve to use for setting amount of total supply (spread out across orders) | |
- Curves | |
- For each curve |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// using [email protected], bluebird, bignumber.js, and lodash | |
'use strict'; | |
const BN = require('bignumber.js'); | |
const Web3 = require('web3'); | |
const web3 = new Web3(new Web3.providers.HttpProvider('https://mainnet.infura.io/aR7WPNCrZhhnYRnn8yRT')); | |
const { bindKey } = require('lodash'); | |
const { promisify } = require('bluebird'); | |
const encodeFunctionCall = bindKey(web3.eth.abi, 'encodeFunctionCall'); | |
const payload = encodeFunctionCall({ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function () { | |
'use strict'; | |
var RPC = 'https://mainnet.infura.io/aR7WPNCrZhhnYRnn8yRT'; | |
RPC = 'http://159.203.127.98:9176'; | |
var saleAddress = '0x0d845706DdC11f181303a80828219c714ceb3687'; | |
var dvipAddress = '0xadc46ff5434910bd17b24ffb429e585223287d7f'; | |
var beneficiaryAddress = '0x532cc8b8AA6d61Da69c17E7C6197B0e43862a468'; | |
var auraPerDvip = '50000'; | |
var totalSaleDvip = '1600'; | |
var pollInterval = 10000; |