diff --git a/apps/shared/json-abis/address-book.json b/apps/shared/json-abis/address-book.json deleted file mode 100644 index b6d7b7dad..000000000 --- a/apps/shared/json-abis/address-book.json +++ /dev/null @@ -1,56 +0,0 @@ -{ - "contractName": "AddressBook", - "abi": [ - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "name": "addr", - "type": "address" - } - ], - "name": "EntryAdded", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "name": "addr", - "type": "address" - } - ], - "name": "EntryRemoved", - "type": "event" - }, - { - "constant": true, - "inputs": [ - { - "name": "_addr", - "type": "address" - } - ], - "name": "getEntry", - "outputs": [ - { - "name": "_entryAddress", - "type": "address" - }, - { - "name": "_name", - "type": "string" - }, - { - "name": "_entryType", - "type": "string" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - } - ] -} diff --git a/apps/shared/json-abis/allocations.json b/apps/shared/json-abis/allocations.json deleted file mode 100644 index 368602579..000000000 --- a/apps/shared/json-abis/allocations.json +++ /dev/null @@ -1,31 +0,0 @@ -[{ - "constant": true, - "inputs": [ - { - "name": "_accountId", - "type": "uint64" - } - ], - "name": "getAccount", - "outputs": [ - { - "name": "metadata", - "type": "string" - }, - { - "name": "token", - "type": "address" - }, - { - "name": "hasBudget", - "type": "bool" - }, - { - "name": "budget", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }] diff --git a/apps/shared/json-abis/token-balanceof.json b/apps/shared/json-abis/token-balanceof.json deleted file mode 100644 index 84756e7eb..000000000 --- a/apps/shared/json-abis/token-balanceof.json +++ /dev/null @@ -1,21 +0,0 @@ -[ - { - "constant": true, - "inputs": [ - { - "name": "_owner", - "type": "address" - } - ], - "name": "balanceOf", - "outputs": [ - { - "name": "balance", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - } -] diff --git a/apps/shared/json-abis/token-balanceofat.json b/apps/shared/json-abis/token-balanceofat.json deleted file mode 100644 index e7f0aa85d..000000000 --- a/apps/shared/json-abis/token-balanceofat.json +++ /dev/null @@ -1,25 +0,0 @@ -[ - { - "constant": true, - "inputs": [ - { - "name": "_owner", - "type": "address" - }, - { - "name": "_blockNumber", - "type": "uint256" - } - ], - "name": "balanceOfAt", - "outputs": [ - { - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, -] diff --git a/apps/shared/json-abis/token-creationblock.json b/apps/shared/json-abis/token-creationblock.json deleted file mode 100644 index bd6694272..000000000 --- a/apps/shared/json-abis/token-creationblock.json +++ /dev/null @@ -1,16 +0,0 @@ -[ - { - "constant": true, - "inputs": [], - "name": "creationBlock", - "outputs": [ - { - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - } -] diff --git a/apps/shared/json-abis/token-decimals.json b/apps/shared/json-abis/token-decimals.json deleted file mode 100644 index 4a66289b3..000000000 --- a/apps/shared/json-abis/token-decimals.json +++ /dev/null @@ -1,16 +0,0 @@ -[ - { - "constant": true, - "inputs": [], - "name": "decimals", - "outputs": [ - { - "name": "", - "type": "uint8" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - } -] diff --git a/apps/shared/json-abis/token-name-bytes.json b/apps/shared/json-abis/token-name-bytes.json deleted file mode 100644 index afce630ad..000000000 --- a/apps/shared/json-abis/token-name-bytes.json +++ /dev/null @@ -1,16 +0,0 @@ -[ - { - "constant": true, - "inputs": [], - "name": "name", - "outputs": [ - { - "name": "", - "type": "bytes32" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - } -] diff --git a/apps/shared/json-abis/token-name.json b/apps/shared/json-abis/token-name.json deleted file mode 100644 index 2433c8212..000000000 --- a/apps/shared/json-abis/token-name.json +++ /dev/null @@ -1,16 +0,0 @@ -[ - { - "constant": true, - "inputs": [], - "name": "name", - "outputs": [ - { - "name": "", - "type": "string" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - } -] diff --git a/apps/shared/json-abis/token-symbol-bytes.json b/apps/shared/json-abis/token-symbol-bytes.json deleted file mode 100644 index 3bc2d46d3..000000000 --- a/apps/shared/json-abis/token-symbol-bytes.json +++ /dev/null @@ -1,16 +0,0 @@ -[ - { - "constant": true, - "inputs": [], - "name": "symbol", - "outputs": [ - { - "name": "", - "type": "bytes32" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - } -] diff --git a/apps/shared/json-abis/token-symbol.json b/apps/shared/json-abis/token-symbol.json deleted file mode 100644 index 4d88ad3d2..000000000 --- a/apps/shared/json-abis/token-symbol.json +++ /dev/null @@ -1,16 +0,0 @@ -[ - { - "constant": true, - "inputs": [], - "name": "symbol", - "outputs": [ - { - "name": "", - "type": "string" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - } -] diff --git a/apps/shared/json-abis/token-transferable.json b/apps/shared/json-abis/token-transferable.json deleted file mode 100644 index 992ef027b..000000000 --- a/apps/shared/json-abis/token-transferable.json +++ /dev/null @@ -1,16 +0,0 @@ -[ - { - "constant": true, - "inputs": [], - "name": "transfersEnabled", - "outputs": [ - { - "name": "", - "type": "bool" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - } -] diff --git a/apps/shared/json-abis/vault.json b/apps/shared/json-abis/vault.json deleted file mode 100644 index 8b7f4af1a..000000000 --- a/apps/shared/json-abis/vault.json +++ /dev/null @@ -1,361 +0,0 @@ -{ - "contractName": "Vault", - "abi": [ - { - "constant": true, - "inputs": [], - "name": "hasInitialized", - "outputs": [ - { - "name": "", - "type": "bool" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "TRANSFER_ROLE", - "outputs": [ - { - "name": "", - "type": "bytes32" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [ - { - "name": "_script", - "type": "bytes" - } - ], - "name": "getEVMScriptExecutor", - "outputs": [ - { - "name": "", - "type": "address" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "getRecoveryVault", - "outputs": [ - { - "name": "", - "type": "address" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "isDepositable", - "outputs": [ - { - "name": "", - "type": "bool" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "appId", - "outputs": [ - { - "name": "", - "type": "bytes32" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "getInitializationBlock", - "outputs": [ - { - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "_token", - "type": "address" - } - ], - "name": "transferToVault", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": true, - "inputs": [ - { - "name": "_sender", - "type": "address" - }, - { - "name": "_role", - "type": "bytes32" - }, - { - "name": "_params", - "type": "uint256[]" - } - ], - "name": "canPerform", - "outputs": [ - { - "name": "", - "type": "bool" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "getEVMScriptRegistry", - "outputs": [ - { - "name": "", - "type": "address" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "kernel", - "outputs": [ - { - "name": "", - "type": "address" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "isPetrified", - "outputs": [ - { - "name": "", - "type": "bool" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "payable": true, - "stateMutability": "payable", - "type": "fallback" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "name": "token", - "type": "address" - }, - { - "indexed": true, - "name": "to", - "type": "address" - }, - { - "indexed": false, - "name": "amount", - "type": "uint256" - } - ], - "name": "VaultTransfer", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "name": "token", - "type": "address" - }, - { - "indexed": true, - "name": "sender", - "type": "address" - }, - { - "indexed": false, - "name": "amount", - "type": "uint256" - } - ], - "name": "VaultDeposit", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "name": "executor", - "type": "address" - }, - { - "indexed": false, - "name": "script", - "type": "bytes" - }, - { - "indexed": false, - "name": "input", - "type": "bytes" - }, - { - "indexed": false, - "name": "returnData", - "type": "bytes" - } - ], - "name": "ScriptResult", - "type": "event" - }, - { - "constant": false, - "inputs": [], - "name": "initialize", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "_token", - "type": "address" - }, - { - "name": "_value", - "type": "uint256" - } - ], - "name": "deposit", - "outputs": [], - "payable": true, - "stateMutability": "payable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "_token", - "type": "address" - }, - { - "name": "_to", - "type": "address" - }, - { - "name": "_value", - "type": "uint256" - } - ], - "name": "transfer", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": true, - "inputs": [ - { - "name": "_token", - "type": "address" - } - ], - "name": "balance", - "outputs": [ - { - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [ - { - "name": "", - "type": "address" - } - ], - "name": "allowRecoverability", - "outputs": [ - { - "name": "", - "type": "bool" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - } - ], - "compiler": { - "name": "solc", - "version": "0.4.24+commit.e67f0147.Emscripten.clang" - }, - "networks": {}, - "schemaVersion": "2.0.1", - "updatedAt": "2019-02-21T23:09:50.150Z" -} diff --git a/apps/shared/json-abis/vault/vault-balance.json b/apps/shared/json-abis/vault/vault-balance.json deleted file mode 100644 index 429b52b55..000000000 --- a/apps/shared/json-abis/vault/vault-balance.json +++ /dev/null @@ -1,21 +0,0 @@ -[ - { - "constant": true, - "inputs": [ - { - "name": "_token", - "type": "address" - } - ], - "name": "balance", - "outputs": [ - { - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - } -] diff --git a/apps/shared/json-abis/vault/vault-events.json b/apps/shared/json-abis/vault/vault-events.json deleted file mode 100644 index 591e18289..000000000 --- a/apps/shared/json-abis/vault/vault-events.json +++ /dev/null @@ -1,46 +0,0 @@ -[ - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "name": "token", - "type": "address" - }, - { - "indexed": true, - "name": "to", - "type": "address" - }, - { - "indexed": false, - "name": "amount", - "type": "uint256" - } - ], - "name": "VaultTransfer", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "name": "token", - "type": "address" - }, - { - "indexed": true, - "name": "sender", - "type": "address" - }, - { - "indexed": false, - "name": "amount", - "type": "uint256" - } - ], - "name": "VaultDeposit", - "type": "event" - } -] diff --git a/apps/shared/json-abis/vault/vault-getinitializationblock.json b/apps/shared/json-abis/vault/vault-getinitializationblock.json deleted file mode 100644 index dda929a18..000000000 --- a/apps/shared/json-abis/vault/vault-getinitializationblock.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "constant": true, - "inputs": [], - "name": "getInitializationBlock", - "outputs": [ - { - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" -} diff --git a/apps/shared/test-helpers/.soliumignore b/apps/shared/test-helpers/.soliumignore deleted file mode 100644 index b512c09d4..000000000 --- a/apps/shared/test-helpers/.soliumignore +++ /dev/null @@ -1 +0,0 @@ -node_modules \ No newline at end of file diff --git a/apps/shared/test-helpers/.soliumrc.json b/apps/shared/test-helpers/.soliumrc.json deleted file mode 100644 index 18e29dd9f..000000000 --- a/apps/shared/test-helpers/.soliumrc.json +++ /dev/null @@ -1,37 +0,0 @@ -{ - "extends": "solium:all", - "plugins": ["security"], - "rules": { - "security/no-low-level-calls": "off", - "security/no-inline-assembly": "off", - "emit": "off", - "error-reason": "off", - "imports-on-top": "error", - "variable-declarations": "error", - "array-declarations": "error", - "operator-whitespace": "error", - "conditionals-whitespace": "error", - "comma-whitespace": "error", - "semicolon-whitespace": "error", - "function-whitespace": "error", - "lbrace": "error", - "mixedcase": "error", - "camelcase": "error", - "uppercase": "error", - "no-empty-blocks": "error", - "no-unused-vars": "error", - "quotes": "error", - "blank-lines": "error", - "indentation": "error", - "arg-overflow": ["error", 8], - "whitespace": "error", - "deprecated-suicide": "error", - "pragma-on-top": "error", - "function-order": "error", - "no-constant": "error", - "value-in-payable": "error", - "max-len": "error", - "visibility-first": "error", - "linebreak-style": "error" - } -} diff --git a/apps/shared/test-helpers/artifacts.js b/apps/shared/test-helpers/artifacts.js deleted file mode 100644 index 413fc72d9..000000000 --- a/apps/shared/test-helpers/artifacts.js +++ /dev/null @@ -1,10 +0,0 @@ -module.exports = { - ACL: artifacts.require('./acl/ACL'), - DAOFactory: artifacts.require('./factory/DAOFactory'), - EVMScriptRegistryFactory: artifacts.require( - './factory/EVMScriptRegistryFactory' - ), - Kernel: artifacts.require('./kernel/Kernel'), - MiniMeToken: artifacts.require('./lib/minime/MiniMeToken'), - getContract: name => artifacts.require(name) -} diff --git a/apps/shared/test-helpers/assertThrow.js b/apps/shared/test-helpers/assertThrow.js deleted file mode 100644 index 3ec0f2fb3..000000000 --- a/apps/shared/test-helpers/assertThrow.js +++ /dev/null @@ -1,26 +0,0 @@ -function assertError(error, s, message) { - assert.isAbove(error.message.search(s), -1, message) -} - -async function assertThrows(block, message, errorCode) { - try { - await block() - } catch (e) { - return assertError(e, errorCode, message) - } - assert.fail('should have thrown before') -} - -module.exports = { - async assertJump(block, message = 'should have failed with invalid JUMP') { - return assertThrows(block, message, 'invalid JUMP') - }, - - async assertInvalidOpcode(block, message = 'should have failed with invalid opcode') { - return assertThrows(block, message, 'invalid opcode') - }, - - async assertRevert(block, message = 'should have failed by reverting') { - return assertThrows(block, message, 'revert') - }, -} diff --git a/apps/shared/test-helpers/balance.js b/apps/shared/test-helpers/balance.js deleted file mode 100644 index 030b3a060..000000000 --- a/apps/shared/test-helpers/balance.js +++ /dev/null @@ -1,8 +0,0 @@ -module.exports = web3 => addr => { - return new Promise((resolve, reject) => { - web3.eth.getBalance(addr, async (err, res) => { - if (err || !res) return reject(err) - resolve(res) - }) - }) -} diff --git a/apps/shared/test-helpers/block.js b/apps/shared/test-helpers/block.js deleted file mode 100644 index dbf805422..000000000 --- a/apps/shared/test-helpers/block.js +++ /dev/null @@ -1,8 +0,0 @@ -module.exports = web3 => n => { - return new Promise(async (resolve, reject) => { - web3.eth.getBlock(n, (err, res) => { - if (err || !res) return reject(err) - resolve(res) - }) - }) -} diff --git a/apps/shared/test-helpers/blockNumber.js b/apps/shared/test-helpers/blockNumber.js deleted file mode 100644 index 4d3f44d71..000000000 --- a/apps/shared/test-helpers/blockNumber.js +++ /dev/null @@ -1,8 +0,0 @@ -module.exports = web3 => () => { - return new Promise((resolve, reject) => { - web3.eth.getBlockNumber(async (err, res) => { - if (err || !res) return reject(err) - resolve(res) - }) - }) -} diff --git a/apps/shared/test-helpers/develop-kit.sh b/apps/shared/test-helpers/develop-kit.sh deleted file mode 100755 index dc685ca13..000000000 --- a/apps/shared/test-helpers/develop-kit.sh +++ /dev/null @@ -1,111 +0,0 @@ -#!/usr/bin/env bash - -# Exit script as soon as a command fails. -set -o errexit - -testrpc_port=8545 - -testrpc_running() { - nc -z localhost "$testrpc_port" -} - -start_testrpc() { - if [ "$RESET" = true ]; then - echo "RESET=true -> Will delete ~/.aragon folder ctrl+c to abort now" && sleep 2 - rm -rf ~/.aragon - aragon devchain --reset & - else - aragon devchain --port "$testrpc_port" & - fi - - testrpc_pid=$! -} - -if testrpc_running; then - echo "Killing testrpc instance at port $testrpc_port" - kill -9 "$(lsof -i:"$testrpc_port" -t)" -fi - -echo "Starting our own testrpc instance at port $testrpc_port" -start_testrpc -sleep 5 - -replace_manifest_path() { - file=$PWD/manifest.json - output=$PWD/dist/manifest.json - sed "s/dist\\///g" "$file" >"$output" -} - -export -f replace_manifest_path - -# TODO: This is not needed anymore and images/icon.svg needs to be replaced -copy_assets() { - mkdir -p dist/images && cp images/icon.svg dist/images/ -} - -export -f copy_assets - -deploy_contract() { - # TODO: Are we sure we want to mute truffle output? we should discuss this maybe - truffle compile >/dev/null - deployed_at=$(truffle migrate --reset | tail -4 | head -1 | awk '{ print $NF }') - echo "Deployed at:" "$deployed_at" - published=$(npm run publish:http -- --contract "$deployed_at" | tail -2) - echo "$published" - replace_manifest_path - copy_assets - sleep 2 -} - -export -f deploy_contract - -multi_parcel_running() { - nc -z localhost "1111" -} - -if multi_parcel_running; then - for i in $(seq 1 4); do - parcel_port=$(printf "%4s | tr" "$i") - echo "Killing parcel instance at port" "$parcel_port" - kill -9 "$(lsof -i:"$parcel_port" -t)" - done -fi - -start_multi_parcel() { - lerna run dev --log-level=silent --parallel "$@" & - parallel_pid=$! -} - -start_kit() { - # Exit error mode so the testrpc and parallel parcel instances always gets killed - set +e - result=0 - npm run start:kit "$@" - echo "Terminated, wait the cleaning up..." - result=$? - - echo "Terminating testrpc..." - kill -9 $testrpc_pid - echo "Terminating parcel instances..." - kill -9 $parallel_pid - - exit $result -} - -echo "Compiling and getting deployed contract address" -lerna exec --scope=@tps/apps-* --concurrency=1 -- deploy_contract -lerna exec --scope=@tps/apps-* -- aragon apm versions -echo "Starting multi parcel instances in parallel execution" -start_multi_parcel "$@" -sleep 10 - -kit_running() { - nc -z localhost "3000" -} - -if kit_running; then - echo "Killing kit instance at port 3000" - kill -9 "$(lsof -i:'3000' -t)" -fi - -start_kit diff --git a/apps/shared/test-helpers/evmScript.js b/apps/shared/test-helpers/evmScript.js deleted file mode 100644 index 0d15e5470..000000000 --- a/apps/shared/test-helpers/evmScript.js +++ /dev/null @@ -1,20 +0,0 @@ -const abi = require('ethereumjs-abi') - -module.exports = { - EMPTY_SCRIPT: '0x00000001', - // Encodes an array of actions ({ to: address, calldata: bytes}) into the EVM call script format - // Sets spec id 1 = 0x00000001 and - // Concatenates per call [ 20 bytes (address) ] + [ 4 bytes (uint32: calldata length) ] + [ calldataLength bytes (payload) ] - encodeCallScript: actions => { - return actions.reduce((script, { to, calldata }) => { - const addr = abi.rawEncode(['address'], [to]).toString('hex') - const length = abi.rawEncode(['uint256'], [(calldata.length - 2) / 2]).toString('hex') - - // Remove 12 first 0s of padding for addr and 28 0s for uint32 - return script + addr.slice(24) + length.slice(56) + calldata.slice(2) - }, '0x00000001') // spec 1 - }, - - encodeDelegate: addr => '0x00000002' + addr.slice(2), // remove 0x from addr - encodeDeploy: contract => '0x00000003' + contract.binary.slice(2), -} diff --git a/apps/shared/test-helpers/ganache-cli.sh b/apps/shared/test-helpers/ganache-cli.sh deleted file mode 100755 index f51a985b9..000000000 --- a/apps/shared/test-helpers/ganache-cli.sh +++ /dev/null @@ -1,105 +0,0 @@ -#!/usr/bin/env bash - -# Exit script as soon as a command fails. -set -o errexit - -# get_script_dir () { -# SOURCE="${BASH_SOURCE[0]}" -# # While $SOURCE is a symlink, resolve it -# while [ -h "$SOURCE" ]; do -# DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )" -# SOURCE="$( readlink "$SOURCE" )" -# # If $SOURCE was a relative symlink (so no "/" as prefix, need to resolve it relative to the symlink base directory -# [[ $SOURCE != /* ]] && SOURCE="$DIR/$SOURCE" -# done -# DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )" -# echo "$DIR/node_modules/.bin" -# } - -if [ "$SOLIDITY_COVERAGE" = true ]; then - testrpc_port=8555 -else - testrpc_port=8545 -fi - -testrpc_running() { - nc -z localhost "$testrpc_port" -} - -start_testrpc() { - if [ "$SOLIDITY_COVERAGE" = true ]; then - testrpc-sc -i 16 --gasLimit 0xfffffffffff --port "$testrpc_port" >/dev/null & - elif [ "$TRUFFLE_TEST" = true ]; then - ganache-cli -i 15 --gasLimit 50000000 --port "$testrpc_port" >/dev/null & - elif [ "$START_KIT" = true ]; then - aragon devchain --port "$testrpc_port" & - elif [ "$RESTART_KIT" = true ] || [ "$CYPRESS" = true ]; then - aragon devchain --reset --port "$testrpc_port" & - elif [ "$DEV" = true ]; then - aragon devchain --reset --port "$testrpc_port" & - sleep 10 # wait for devchain to start TODO: modify cli to return rather than require interruption - npm run frontend & - elif [ "$NO_CLIENT" = true ]; then - npm run frontend & - aragon devchain --reset --port "$testrpc_port" & - fi - - testrpc_pid=$! -} - -if testrpc_running; then - echo "Killing testrpc instance at port $testrpc_port" - kill -9 "$(lsof -i:"$testrpc_port" -sTCP:LISTEN -t)" -fi - -echo "Starting our own testrpc instance at port $testrpc_port" -start_testrpc -sleep 5 - -# Exit error mode so the testrpc instance always gets killed -set +e -result=0 -if [ "$SOLIDITY_COVERAGE" = true ]; then - solidity-coverage "$@" - result=$? -elif [ "$TRUFFLE_TEST" = true ]; then - truffle test --network rpc "$@" | grep -v 'Compiling' - result=$? -elif [ "$START_KIT" = true ] || [ "$RESTART_KIT" = true ]; then - npm run publish:apps && npm run start:template - result=$? -elif [ "$DEV" = true ]; then - npm run publish:http && npm run start:dev-template - result=$? -elif [ "$NO_CLIENT" = true ]; then - npm run publish:http && npm run start:kit:no:client - result=$? -elif [ "$CYPRESS" = true ]; then - npm run frontend 2> /dev/null & - app_pgid=$! - aragon ipfs install - aragon ipfs start & - wait-on http://localhost:3333 # wait for bulkiest app service to load (Projects) - npm run publish:http && npm run start:dev-template - pushd . && cd .. - git clone https://github.com/aragon/aragon.git a-client - cd a-client - git checkout bdf5d44bf1b3da72130c086b7a802470533058a1 # latest client commit tested thoroughly with OE - npm i - npm run start:local 2> /dev/null & popd - npm run cypress:run - result=$? - kill -9 "$(lsof -i:3000 -sTCP:LISTEN -t)" # kill parcel dev server - kill -9 "$(lsof -i:8080 -sTCP:LISTEN -t)" # kill IPFS daemon - kill -2 -- $app_pgid # kill app file services - kill -9 "$(lsof -i:1111 -sTCP:LISTEN -t)" # kill app service file descriptor - kill -9 "$(lsof -i:2222 -sTCP:LISTEN -t)" # kill app service file descriptor - kill -9 "$(lsof -i:3333 -sTCP:LISTEN -t)" # kill app service file descriptor - kill -9 "$(lsof -i:4444 -sTCP:LISTEN -t)" # kill app service file descriptor - kill -9 "$(lsof -i:5555 -sTCP:LISTEN -t)" # kill app service file descriptor - rm -rf ../a-client -fi - -kill -9 $testrpc_pid - -exit $result diff --git a/apps/shared/test-helpers/mine.js b/apps/shared/test-helpers/mine.js deleted file mode 100644 index 1912c78c4..000000000 --- a/apps/shared/test-helpers/mine.js +++ /dev/null @@ -1,70 +0,0 @@ -const mineBlock = require("./mineBlock") -const getBlock = require("./blockNumber") - -const getWeb3 = () => { - const Web3 = require("web3"); - const PrivateKeyProvider = require("truffle-privatekey-provider"); - const provider = new PrivateKeyProvider( - "A8A54B2D8197BC0B19BB8A084031BE71835580A01E70A45A13BABD16C9BC1563", - "http://localhost:8545" - ); - return new Web3(provider); -} - -// truffle script: can be run with `truffle exec` -const mine = async (cb) => { - const root = this - let activeWeb3 - let argIdx - if (typeof cb !== 'function') { - activeWeb3 = getWeb3() - argIdx = 2 - } else { - activeWeb3 = web3 - argIdx = 4 - } - const mineBlockFn = mineBlock(activeWeb3) - const getBlockFn = getBlock(activeWeb3) - - const mineBlocks = async (blocks) => { - const blockArr = new Array(Number(blocks)).fill(0) - blockArr.forEach(async () => { - try { - await mineBlockFn() - } - catch(e) { - console.error('error: ',e) - } - }) - } - - const mineToBlock = async (blockNumber) => { - while (blockNumber > await getBlockFn()) { - try { - await mineBlockFn() - } - catch(e) { - console.error('error: ',e) - } - } - } - if (!Number(process.argv[argIdx])) { - await mineToBlock(process.argv[argIdx + 1]) - } - else { - await mineBlocks(process.argv[argIdx]) - } - - console.log('\nblock',await getBlockFn(), 'mined') - - if (typeof cb === 'function') { - cb() - } else { - process.exit() - } -} - -module.exports = mine -if (!process.argv[1].includes('truffle')) { - mine() -} diff --git a/apps/shared/test-helpers/mineBlock.js b/apps/shared/test-helpers/mineBlock.js deleted file mode 100644 index 40ddc72ca..000000000 --- a/apps/shared/test-helpers/mineBlock.js +++ /dev/null @@ -1,11 +0,0 @@ -module.exports = web3 => async () => { - await web3.currentProvider.sendAsync( - { - jsonrpc: '2.0', - method: 'evm_mine', - }, - (error, result) =>{ - if (error) console.log('mineBlock error: ',error) - } - ) -} diff --git a/apps/shared/test-helpers/package.json b/apps/shared/test-helpers/package.json deleted file mode 100644 index 9ab97560f..000000000 --- a/apps/shared/test-helpers/package.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "private": true, - "name": "@tps/test-helpers", - "version": "0.0.1", - "description": "Helper scripts for Planning Suite", - "devDependencies": { - "eth-gas-reporter": "0.1.12", - "ethereumjs-abi": "0.6.5", - "ganache-cli": "6.1.8", - "homedir": "^0.6.0", - "solidity-coverage": "0.5.11", - "solium": "1.1.8", - "truffle": "4.1.14", - "truffle-hdwallet-provider": "0.0.3", - "truffle-hdwallet-provider-privkey": "0.3.0" - } -} diff --git a/apps/shared/test-helpers/timeTravel.js b/apps/shared/test-helpers/timeTravel.js deleted file mode 100644 index f005f99fb..000000000 --- a/apps/shared/test-helpers/timeTravel.js +++ /dev/null @@ -1,15 +0,0 @@ -module.exports = web3 => s => { - return new Promise((resolve, reject) => { - web3.currentProvider.send({ - jsonrpc: '2.0', - method: 'evm_increaseTime', - params: [s], - id: new Date().getTime() - }, function(err) { - if (err) { - return reject(err) - } - resolve(result) - }) - }) -} diff --git a/apps/shared/test-helpers/truffle-config.js b/apps/shared/test-helpers/truffle-config.js deleted file mode 100644 index 65fa40bb7..000000000 --- a/apps/shared/test-helpers/truffle-config.js +++ /dev/null @@ -1,97 +0,0 @@ -const homedir = require('homedir') -const path = require('path') - -const HDWalletProvider = require('truffle-hdwallet-provider') -const HDWalletProviderPrivkey = require('truffle-hdwallet-provider-privkey') - -const DEFAULT_MNEMONIC = - 'explain tackle mirror kit van hammer degree position ginger unfair soup bonus' - -const mochaGasSettings = { - reporter: 'eth-gas-reporter', - reporterOptions: { - currency: 'USD', - gasPrice: 3, - }, -} -const mocha = process.env.GAS_REPORTER ? mochaGasSettings : {} - -const defaultRPC = network => `https://${network}.infura.io` - -const configFilePath = filename => path.join(homedir(), `.aragon/${filename}`) - -const mnemonic = () => { - try { - return require(configFilePath('mnemonic.json')).mnemonic - } catch (e) { - return DEFAULT_MNEMONIC - } -} - -const settingsForNetwork = network => { - try { - return require(configFilePath(`${network}_key.json`)) - } catch (e) { - return {} - } -} - -// Lazily loaded provider -const providerForNetwork = network => () => { - let { rpc, keys } = settingsForNetwork(network) - rpc = rpc || defaultRPC(network) - - if (!keys || keys.length == 0) { - return new HDWalletProvider(mnemonic(), rpc) - } - - return new HDWalletProviderPrivkey(keys, rpc) -} - -module.exports = { - // contracts_build_directory: path.join(__dirname, './build/contracts/'), - networks: { - rpc: { - network_id: 15, - host: 'localhost', - port: 8545, - gas: 8.2e6, - }, - development: { - host: 'localhost', - port: 8545, - network_id: '*', - gas: 8.2e6, - gasPrice: 2000000000, // same as latest on Mainnet https://ethstats.net/ - }, - coverage: { - host: 'localhost', - network_id: '*', - port: 8555, - gas: 0xfffffffffff, - gasPrice: 0x01, - }, - rinkeby: { - network_id: 4, - provider: providerForNetwork('rinkeby'), - gasPrice: 6000000000, - }, - mainnet: { - network_id: 1, - provider: providerForNetwork('mainnet'), - }, - }, - build: {}, - mocha, - solc: { - optimizer: { - enabled: true, - runs: 200 - }, - }, - compilers: { - solc: { - version: "0.4.24" - } - } -}