Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
1 change: 0 additions & 1 deletion apps/address-book/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@
"@babel/plugin-proposal-class-properties": "^7.4.4",
"@babel/preset-env": "^7.4.5",
"@babel/preset-react": "^7.0.0",
"@tps/test-helpers": "^0.0.1",
"babel-eslint": "^10.0.1",
"babel-plugin-styled-components": "^1.10.0",
"cross-env": "^5.2.0",
Expand Down
2 changes: 1 addition & 1 deletion apps/allocations/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"copy-public-assets": "rsync -rtu ./public/ ./dist",
"coverage": "cross-env SOLIDITY_COVERAGE=true npm run ganache-cli:test",
"frontend": "npm run sync-assets && parcel app/index.html --port 2222",
"ganache-cli:test": "../shared/test-helpers/ganache-cli.sh",
"ganache-cli:test": "sh ../../node_modules/@aragon/test-helpers/ganache-cli.sh",
"lint": "solium --dir ./contracts",
"precommit": "lint-staged",
"prepublishOnly": "truffle compile",
Expand Down
8 changes: 3 additions & 5 deletions apps/discussions/.solcover.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
module.exports = {
norpc: true,
copyPackages: [],
skipFiles: [
'test',
]
}
skipFiles: ['test'],
deepSkip: true
}
25 changes: 0 additions & 25 deletions apps/discussions/contracts/misc/Migrations.sol

This file was deleted.

8 changes: 8 additions & 0 deletions apps/discussions/contracts/test/Imports.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
pragma solidity ^0.4.24;
// HACK to workaround truffle artifact loading on dependencies

// import "@aragon/os/copruentracts/factory/DAOFactory.sol";


// solium-disable-next-line no-empty-blocks
contract Imports {}
6 changes: 0 additions & 6 deletions apps/discussions/migrations/1_initial_migration.js

This file was deleted.

6 changes: 0 additions & 6 deletions apps/discussions/migrations/2_deploy_contracts.js

This file was deleted.

1 change: 0 additions & 1 deletion apps/discussions/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
"@babel/plugin-proposal-class-properties": "^7.4.4",
"@babel/preset-env": "^7.4.5",
"@aragon/test-helpers": "^2.0.0",
"@tps/test-helpers": "^0.0.1",
"babel-eslint": "^10.0.1",
"eslint": "^5.16.0",
"eslint-config-prettier": "^6.0.0",
Expand Down
103 changes: 0 additions & 103 deletions apps/discussions/test/app.js

This file was deleted.

2 changes: 1 addition & 1 deletion apps/discussions/truffle-config.js
Original file line number Diff line number Diff line change
@@ -1 +1 @@
module.exports = require('@tps/test-helpers/truffle-config')
module.exports = require('@aragon/os/truffle-config')
1 change: 0 additions & 1 deletion apps/dot-voting/.solcover.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
module.exports = {
copyPackages: ['@tps/test-helpers/contracts/common'],
deepSkip: true,
norpc: true,
skipFiles: ['test'],
Expand Down
1 change: 0 additions & 1 deletion apps/dot-voting/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@
"@babel/plugin-proposal-class-properties": "^7.4.4",
"@babel/preset-env": "^7.4.5",
"@babel/preset-react": "^7.0.0",
"@tps/test-helpers": "^0.0.1",
"babel-eslint": "^10.0.1",
"babel-plugin-styled-components": "^1.10.0",
"cross-env": "^5.2.0",
Expand Down
5 changes: 4 additions & 1 deletion apps/dot-voting/truffle-config.js
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
module.exports = require('@aragon/os/truffle-config')
module.exports = {
...require('@aragon/os/truffle-config'),
migrations_directory: 'contracts' // this just disables using migrations
}
1 change: 0 additions & 1 deletion apps/rewards/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@
"@babel/plugin-proposal-class-properties": "^7.4.4",
"@babel/preset-env": "^7.4.5",
"@babel/preset-react": "^7.0.0",
"@tps/test-helpers": "^0.0.1",
"babel-eslint": "^10.0.1",
"babel-plugin-styled-components": "^1.10.0",
"cross-env": "^5.2.0",
Expand Down
8 changes: 8 additions & 0 deletions apps/rewards/test/helpers/blockNumber.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
module.exports = web3 => () => {
return new Promise((resolve, reject) => {
web3.eth.getBlockNumber(async (err, res) => {
if (err || !res) return reject(err)
resolve(res)
})
})
}
73 changes: 73 additions & 0 deletions apps/rewards/test/helpers/mine.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
// TODO: Import these both from aragon/os
const mineBlock = require('./mineBlock')
const getBlock = require('./blockNumber')

// TODO: Correct errors

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()
}
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@
"lint:fix": "lerna exec --scope=@tps/apps-* --stream -- eslint app --fix",
"lint:projects": "cd apps/projects && npm run lint",
"lint": "npm run lint:contracts && lerna exec --scope=@tps/apps-* --stream -- eslint app",
"mine": "lerna exec --scope=@tps/test-helpers truffle exec ./mine.js",
"mine": "lerna exec --scope=@tps/apps-rewards truffle exec ./test/helpers/mine.js -- --network rpc",
"postinstall": "npm run bootstrap",
"publish:cd": "lerna run publish:cd --no-ci --stream --no-bail --scope=@tps/apps*",
"publish:apps": "lerna run publish",
Expand Down
Loading