aboutsummaryrefslogtreecommitdiffstats
path: root/packages/contracts
diff options
context:
space:
mode:
authorAmir Bandeali <abandeali1@gmail.com>2018-03-13 00:52:35 +0800
committerAmir Bandeali <abandeali1@gmail.com>2018-04-21 04:56:17 +0800
commit56ade9c44e1a729d98d64b688464118be671983c (patch)
tree3e8ec74d778c2963b5278a86560b54c8328aa086 /packages/contracts
parent6db0b2e39821f27f6f31a8247159864dacd1d2bd (diff)
downloaddexon-sol-tools-56ade9c44e1a729d98d64b688464118be671983c.tar
dexon-sol-tools-56ade9c44e1a729d98d64b688464118be671983c.tar.gz
dexon-sol-tools-56ade9c44e1a729d98d64b688464118be671983c.tar.bz2
dexon-sol-tools-56ade9c44e1a729d98d64b688464118be671983c.tar.lz
dexon-sol-tools-56ade9c44e1a729d98d64b688464118be671983c.tar.xz
dexon-sol-tools-56ade9c44e1a729d98d64b688464118be671983c.tar.zst
dexon-sol-tools-56ade9c44e1a729d98d64b688464118be671983c.zip
Add private keys for testrpc mnemonic
Diffstat (limited to 'packages/contracts')
-rw-r--r--packages/contracts/scripts/testrpc.ts44
-rw-r--r--packages/contracts/src/utils/constants.ts34
-rw-r--r--packages/contracts/test/exchange/core.ts4
-rw-r--r--packages/contracts/test/exchange/helpers.ts4
-rw-r--r--packages/contracts/test/exchange/wrapper.ts4
5 files changed, 20 insertions, 70 deletions
diff --git a/packages/contracts/scripts/testrpc.ts b/packages/contracts/scripts/testrpc.ts
deleted file mode 100644
index 347673b90..000000000
--- a/packages/contracts/scripts/testrpc.ts
+++ /dev/null
@@ -1,44 +0,0 @@
-import * as testrpc from 'ganache-cli';
-import * as _ from 'lodash';
-
-import { constants } from '../src/utils/constants';
-import { utils } from '../src/utils/utils';
-
-const opts = {
- accounts: constants.TESTRPC_ACCOUNTS,
- logger: console,
-};
-
-const server = testrpc.server(opts);
-
-server.listen(constants.TESTRPC_PORT, (err: any, result: any) => {
- if (err) {
- utils.consoleLog(err);
- return;
- }
-
- const state = result ? result : server.provider.manager.state;
-
- utils.consoleLog('');
- utils.consoleLog('Available Accounts');
- utils.consoleLog('==================');
-
- const accounts = state.accounts;
- const addresses = _.keys(accounts);
-
- _.forEach(addresses, (address, index) => {
- const line = `(${index}) ${address}`;
- utils.consoleLog(line);
- });
-
- utils.consoleLog('');
- utils.consoleLog('Private Keys');
- utils.consoleLog('==================');
-
- _.forEach(addresses, (address, index) => {
- utils.consoleLog(`(${index}) ${accounts[address].secretKey.toString('hex')}`);
- });
-
- utils.consoleLog('');
- utils.consoleLog('Listening on localhost:' + constants.TESTRPC_PORT);
-});
diff --git a/packages/contracts/src/utils/constants.ts b/packages/contracts/src/utils/constants.ts
index 6f1fea2fc..d31e1e285 100644
--- a/packages/contracts/src/utils/constants.ts
+++ b/packages/contracts/src/utils/constants.ts
@@ -1,10 +1,22 @@
import * as ethUtil from 'ethereumjs-util';
+import * as _ from 'lodash';
const DUMMY_TOKEN_NAME = '';
const DUMMY_TOKEN_SYMBOL = '';
const DUMMY_TOKEN_DECIMALS = 18;
const DUMMY_TOKEN_TOTAL_SUPPLY = 0;
-const TESTRPC_INITIAL_BALANCE_HEX = parseInt('100000000000000000000', 16);
+const TESTRPC_PRIVATE_KEYS_STRINGS = [
+ '0xf2f48ee19680706196e2e339e5da3491186e0c4c5030670656b0e0164837257d',
+ '0x5d862464fe9303452126c8bc94274b8c5f9874cbd219789b3eb2128075a76f72',
+ '0xdf02719c4df8b9b8ac7f551fcb5d9ef48fa27eef7a66453879f4d8fdc6e78fb1',
+ '0xff12e391b79415e941a94de3bf3a9aee577aed0731e297d5cfa0b8a1e02fa1d0',
+ '0x752dd9cf65e68cfaba7d60225cbdbc1f4729dd5e5507def72815ed0d8abc6249',
+ '0xefb595a0178eb79a8df953f87c5148402a224cdf725e88c0146727c6aceadccd',
+ '0x83c6d2cc5ddcf9711a6d59b417dc20eb48afd58d45290099e5987e3d768f328f',
+ '0xbb2d3f7c9583780a7d3904a2f55d792707c345f21de1bacb2d389934d82796b2',
+ '0xb2fd4d29c1390b71b8795ae81196bfd60293adf99f9d32a0aff06288fcdac55f',
+ '0x23cb7121166b9a2f93ae0b7c05bde02eae50d64449b2cbb42bc84e9d38d6cc89',
+];
export const constants = {
INVALID_OPCODE: 'invalid opcode',
@@ -14,23 +26,5 @@ export const constants = {
MAX_TOKEN_TRANSFERFROM_GAS: 80000,
MAX_TOKEN_APPROVE_GAS: 60000,
DUMMY_TOKEN_ARGS: [DUMMY_TOKEN_NAME, DUMMY_TOKEN_SYMBOL, DUMMY_TOKEN_DECIMALS, DUMMY_TOKEN_TOTAL_SUPPLY],
- TESTRPC_PORT: 8545,
- TESTRPC_ACCOUNTS: [
- {
- balance: TESTRPC_INITIAL_BALANCE_HEX,
- secretKey: ethUtil.sha3('secret0'),
- },
- {
- balance: TESTRPC_INITIAL_BALANCE_HEX,
- secretKey: ethUtil.sha3('secret1'),
- },
- {
- balance: TESTRPC_INITIAL_BALANCE_HEX,
- secretKey: ethUtil.sha3('secret2'),
- },
- {
- balance: TESTRPC_INITIAL_BALANCE_HEX,
- secretKey: ethUtil.sha3('secret3'),
- },
- ],
+ TESTRPC_PRIVATE_KEYS: _.map(TESTRPC_PRIVATE_KEYS_STRINGS, privateKeyString => ethUtil.toBuffer(privateKeyString)),
};
diff --git a/packages/contracts/test/exchange/core.ts b/packages/contracts/test/exchange/core.ts
index d11be3726..1612ecdcc 100644
--- a/packages/contracts/test/exchange/core.ts
+++ b/packages/contracts/test/exchange/core.ts
@@ -95,8 +95,8 @@ describe('Exchange', () => {
makerFeeAmount: ZeroEx.toBaseUnitAmount(new BigNumber(1), 18),
takerFeeAmount: ZeroEx.toBaseUnitAmount(new BigNumber(1), 18),
};
- const secretKey = constants.TESTRPC_ACCOUNTS[0].secretKey;
- orderFactory = new OrderFactory(secretKey, defaultOrderParams);
+ const privateKey = constants.TESTRPC_PRIVATE_KEYS[0];
+ orderFactory = new OrderFactory(privateKey, defaultOrderParams);
dmyBalances = new Balances([rep, dgd, zrx], [makerAddress, takerAddress, feeRecipientAddress]);
await Promise.all([
rep.approve.sendTransactionAsync(tokenTransferProxy.address, INITIAL_ALLOWANCE, {
diff --git a/packages/contracts/test/exchange/helpers.ts b/packages/contracts/test/exchange/helpers.ts
index c52f66ca5..2880bab22 100644
--- a/packages/contracts/test/exchange/helpers.ts
+++ b/packages/contracts/test/exchange/helpers.ts
@@ -57,8 +57,8 @@ describe('Exchange', () => {
makerFeeAmount: ZeroEx.toBaseUnitAmount(new BigNumber(1), 18),
takerFeeAmount: ZeroEx.toBaseUnitAmount(new BigNumber(1), 18),
};
- const secretKey = constants.TESTRPC_ACCOUNTS[0].secretKey;
- orderFactory = new OrderFactory(secretKey, defaultOrderParams);
+ const privateKey = constants.TESTRPC_PRIVATE_KEYS[0];
+ orderFactory = new OrderFactory(privateKey, defaultOrderParams);
signedOrder = orderFactory.newSignedOrder();
});
diff --git a/packages/contracts/test/exchange/wrapper.ts b/packages/contracts/test/exchange/wrapper.ts
index 0b76c0974..02e57b922 100644
--- a/packages/contracts/test/exchange/wrapper.ts
+++ b/packages/contracts/test/exchange/wrapper.ts
@@ -91,8 +91,8 @@ describe('Exchange', () => {
takerFeeAmount: ZeroEx.toBaseUnitAmount(new BigNumber(1), 18),
};
- const secretKey = constants.TESTRPC_ACCOUNTS[0].secretKey;
- orderFactory = new OrderFactory(secretKey, defaultOrderParams);
+ const privateKey = constants.TESTRPC_PRIVATE_KEYS[0];
+ orderFactory = new OrderFactory(privateKey, defaultOrderParams);
dmyBalances = new Balances([rep, dgd, zrx], [makerAddress, takerAddress, feeRecipientAddress]);
await Promise.all([
rep.approve.sendTransactionAsync(tokenTransferProxy.address, INITIAL_ALLOWANCE, { from: makerAddress }),