Skip to content
This repository has been archived by the owner on Feb 8, 2020. It is now read-only.

Tips Wallet #35

Merged
merged 33 commits into from
Dec 10, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
7030436
Wallet sets owners and accepts deposits
Nov 18, 2017
8bebf81
Implement multisig using ecrecover
Nov 22, 2017
476538b
Fix code inspection issues
Nov 22, 2017
0ba611c
Refactor multisig lib
Nov 22, 2017
9c472fe
Transfer ERC20 tokens from wallet
Nov 23, 2017
f04f302
Refactor MultiSig TypeScript libs
Nov 23, 2017
23915e1
Test multiple wallet transactions at once
Nov 24, 2017
76ac01c
Add indices to Wallet events
Nov 24, 2017
d2102c5
Test repeated Wallet transactions
Nov 24, 2017
7a410c1
Clean Wallet tests
Nov 24, 2017
5233291
Test Wallet security
Nov 24, 2017
2f63c1a
Implement changing owners of Wallet
Nov 26, 2017
56a818f
Test replay and nonce reuse attacks on wallet
Nov 26, 2017
df5e4af
Refactor TipsWallet and reorganize files
Nov 26, 2017
86faacc
Implement Recoverable MultiSig
Nov 26, 2017
9a9a5f9
Reorganize MultiSig files
Dec 5, 2017
61c67d4
Make recovery confirmations configurable
Dec 5, 2017
a434fb9
Write RecoverableMultiSig tests and add events
Dec 5, 2017
8b9841f
Modularize RecoverableMultiSigTests
Dec 7, 2017
fa7b8af
Run recovery tests for TipsWallet
Dec 7, 2017
ee67b15
Move multisig test context to separate file
Dec 7, 2017
ff5045a
Modularize TransferableMultiSig
Dec 7, 2017
7006b9a
Modularize MultiSig tests
Dec 7, 2017
e6ac358
Skip duplicated base classes tests
Dec 7, 2017
bec4fbe
Remove test context duplication
Dec 7, 2017
6b9525a
Add Deposited event to MultiSig
Dec 9, 2017
e9b9b1f
Do not skip MultiSig base class tests
Dec 9, 2017
e3af2c4
Flatten RecoverableMultiSig inheritance
Dec 9, 2017
0c61614
Add scripts for testing selected contracts
Dec 9, 2017
193df12
Rename MultiSigCommand to MultiSigTransaction
Dec 9, 2017
d4ce6a3
Refactor multisig and tests
Dec 9, 2017
5bbc32b
Rename recoveryConfirmations to recoveryBlockOffset
Dec 9, 2017
748887e
Remove listOwners test duplication
Dec 9, 2017
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
65 changes: 1 addition & 64 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,68 +1,5 @@
# IDEA
.idea/

# Contracts cache
.cache

# tsc generated files
*.map
# Compiled JS
*.js

# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*

# Runtime data
pids
*.pid
*.seed
*.pid.lock

# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov

# Coverage directory used by tools like istanbul
coverage

# nyc test coverage
.nyc_output

# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
.grunt

# Bower dependency directory (https://bower.io/)
bower_components

# node-waf configuration
.lock-wscript

# Compiled binary addons (https://nodejs.org/api/addons.html)
build/Release

# Dependency directories
node_modules/
jspm_packages/

# Typescript v1 declaration files
typings/

# Optional npm cache directory
.npm

# Optional eslint cache
.eslintcache

# Optional REPL history
.node_repl_history

# Output of 'npm pack'
*.tgz

# Yarn Integrity file
.yarn-integrity

# dotenv environment variables file
.env
74 changes: 37 additions & 37 deletions bin/seed.ts
Original file line number Diff line number Diff line change
@@ -1,17 +1,36 @@
#!/usr/bin/env node

import { join } from 'path';
import { Logger, transports } from 'winston';

import { promisify } from '../utils';

import * as Web3 from 'web3';
import * as Config from 'truffle-config';
import * as TestRPC from 'ethereumjs-testrpc';
import * as Migrate from 'truffle-migrate';
import * as Resolver from 'truffle-resolver';
import * as mkdirp from 'mkdirp';
import * as Artifactor from 'truffle-artifactor';
import * as Compile from 'truffle-compile';
import * as mkdirp from 'mkdirp';
import * as Config from 'truffle-config';
import * as Migrate from 'truffle-migrate';
import * as Resolver from 'truffle-resolver';
import * as Web3 from 'web3';

(async function() {
const logger = new Logger({
colors: {
error: 'red',
info: 'blue',
verbose: 'grey',
warn: 'yellow'
},
transports: [
new transports.Console({
colorize: true,
prettyPrint: true,
timestamp: true
})
]
});

(async () => {
const config = configure();

await compileContracts(config);
Expand All @@ -21,7 +40,7 @@ import * as mkdirp from 'mkdirp';
await setupNetwork(config, deployer);
await migrate(config);
})().catch(err => {
console.error(err);
logger.error(err);
process.exit(1);
});

Expand All @@ -46,7 +65,7 @@ function configure(): Config {
}

async function compileContracts(config: Config) {
logStep(`Compiling contracts: ${config.contracts_directory}`);
logger.info(`Compiling contracts: ${config.contracts_directory}`);

const contracts = await promisify<Compile.ContractDefinitions>(cb =>
Compile.all(config, cb)
Expand All @@ -55,29 +74,29 @@ async function compileContracts(config: Config) {
await promisify<any>(cb => mkdirp(config.contracts_build_directory, cb));
await config.artifactor.saveAll(contracts);

console.log(`Saved to: ${config.contracts_build_directory}`);
logger.verbose(`Saved to: ${config.contracts_build_directory}`);
}

async function startTestRPC(port: number): Promise<TestRPC.State> {
logStep(`Starting TestRPC on port ${port}`);
logger.info(`Starting TestRPC on port ${port}`);

const options = {
secure: false,
logger: console,
mnemonic:
'try exile adapt shed width laugh similar duty neglect kick rug require',
logger: console
secure: false
};

const server = TestRPC.server(options);
const state = await promisify<TestRPC.State>(cb => server.listen(port, cb));

console.log(`Account mnemonic: ${options.mnemonic}`);
logger.verbose(`Account mnemonic: ${options.mnemonic}`);

return state;
}

async function setupNetwork(config: Config, deployer: Address) {
logStep(`Setting up network ${config.network}`);
logger.info(`Setting up network ${config.network}`);

const web3 = new Web3(config.provider);
const networkId = await promisify<string>(cb => web3.version.getNetwork(cb));
Expand All @@ -86,33 +105,14 @@ async function setupNetwork(config: Config, deployer: Address) {
networkConfig.network_id = networkId;
networkConfig.from = deployer;

console.log(`Using network: ${config.network} (${networkId})`);
console.log(`Using deployer: ${deployer}`);
logger.verbose(`Using network: ${config.network} (${networkId})`);
logger.verbose(`Using deployer: ${deployer}`);
}

async function migrate(config: Config) {
logStep(`Running migrations: ${config.migrations_directory}`);
logger.info(`Running migrations: ${config.migrations_directory}`);

await promisify<void>(cb => Migrate.run(config, cb));

logStep('Migrations completed');
}

function promisify<T>(fn: (cb: Callback<T>) => void) {
return new Promise<T>((resolve, reject) =>
fn((err: Error | null, res: T) => {
if (err) {
return reject(err);
}

return resolve(res);
})
);
}

function logStep(description: string) {
console.log();
console.log(Array(79).join('-'));
console.log(description);
console.log(Array(79).join('-'));
logger.info('Migrations completed');
}
10 changes: 5 additions & 5 deletions build/contracts/AddressSet.json
Original file line number Diff line number Diff line change
Expand Up @@ -390,7 +390,7 @@
"overloadedDeclarations": [
null
],
"referencedDeclaration": 692,
"referencedDeclaration": 1501,
"type": "function (bool) pure",
"value": "require"
},
Expand Down Expand Up @@ -1390,7 +1390,7 @@
"overloadedDeclarations": [
null
],
"referencedDeclaration": 692,
"referencedDeclaration": 1501,
"type": "function (bool) pure",
"value": "require"
},
Expand Down Expand Up @@ -4149,7 +4149,7 @@
"overloadedDeclarations": [
null
],
"referencedDeclaration": 680,
"referencedDeclaration": 1489,
"type": "function (bool) pure",
"value": "assert"
},
Expand Down Expand Up @@ -4443,7 +4443,7 @@
"overloadedDeclarations": [
null
],
"referencedDeclaration": 680,
"referencedDeclaration": 1489,
"type": "function (bool) pure",
"value": "assert"
},
Expand Down Expand Up @@ -4610,5 +4610,5 @@
},
"networks": {},
"schemaVersion": "1.0.1",
"updatedAt": "2017-11-16T23:38:29.113Z"
"updatedAt": "2017-12-09T23:00:14.493Z"
}
8 changes: 4 additions & 4 deletions build/contracts/Migrations.json
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@
"overloadedDeclarations": [
null
],
"referencedDeclaration": 689,
"referencedDeclaration": 1498,
"type": "msg",
"value": "msg"
},
Expand Down Expand Up @@ -363,7 +363,7 @@
"overloadedDeclarations": [
null
],
"referencedDeclaration": 689,
"referencedDeclaration": 1498,
"type": "msg",
"value": "msg"
},
Expand Down Expand Up @@ -823,5 +823,5 @@
},
"networks": {},
"schemaVersion": "1.0.1",
"updatedAt": "2017-11-16T23:38:29.962Z"
}
"updatedAt": "2017-12-09T23:00:14.494Z"
}
Loading