diff --git a/.circleci/config.yml b/.circleci/config.yml index fd4c5fed92..742cdebc8d 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -106,7 +106,6 @@ jobs: - run: yarn wsrun test:circleci @0x/contract-wrappers - run: yarn wsrun test:circleci @0x/dev-utils - run: yarn wsrun test:circleci @0x/json-schemas - - run: yarn wsrun test:circleci @0x/metacoin - run: yarn wsrun test:circleci @0x/order-utils - run: yarn wsrun test:circleci @0x/order-watcher - run: yarn wsrun test:circleci @0x/sol-compiler @@ -148,10 +147,6 @@ jobs: key: coverage-json-schemas-{{ .Environment.CIRCLE_SHA1 }} paths: - ~/repo/packages/json-schemas/coverage/lcov.info - - save_cache: - key: coverage-metacoin-{{ .Environment.CIRCLE_SHA1 }} - paths: - - ~/repo/packages/metacoin/coverage/lcov.info - save_cache: key: coverage-order-utils-{{ .Environment.CIRCLE_SHA1 }} paths: @@ -349,9 +344,6 @@ jobs: - restore_cache: keys: - coverage-json-schemas-{{ .Environment.CIRCLE_SHA1 }} - - restore_cache: - keys: - - coverage-metacoin-{{ .Environment.CIRCLE_SHA1 }} - restore_cache: keys: - coverage-order-utils-{{ .Environment.CIRCLE_SHA1 }} diff --git a/.github/autolabeler.yml b/.github/autolabeler.yml index 98478ab08e..70ba92e871 100644 --- a/.github/autolabeler.yml +++ b/.github/autolabeler.yml @@ -30,7 +30,6 @@ contracts: ['contracts'] @0x/typescript-typings: ['packages/typescript-typings'] 0x.js: ['packages/0x.js'] @0x/abi-gen-wrappers: ['packages/abi-gen-wrappers'] -@0x/metacoin: ['packages/metacoin'] @0x/contract-artifacts: ['packages/contract-artifacts'] @0x/dev-utils: ['packages/dev-utils'] @0x/contract-wrappers: ['packages/contract-wrappers'] diff --git a/.gitignore b/.gitignore index c3ccb318b8..9fde6b4c0f 100644 --- a/.gitignore +++ b/.gitignore @@ -96,7 +96,6 @@ contracts/extensions/generated-artifacts/ contracts/exchange-forwarder/generated-artifacts/ contracts/dev-utils/generated-artifacts/ packages/sol-tracing-utils/test/fixtures/artifacts/ -packages/metacoin/artifacts/ python-packages/contract_artifacts/src/zero_ex/contract_artifacts/artifacts/ # generated contract wrappers @@ -114,7 +113,6 @@ contracts/erc1155/generated-wrappers/ contracts/extensions/generated-wrappers/ contracts/exchange-forwarder/generated-wrappers/ contracts/dev-utils/generated-wrappers/ -packages/metacoin/src/contract_wrappers python-packages/contract_wrappers/src/zero_ex/contract_wrappers/erc20_token/__init__.py python-packages/contract_wrappers/src/zero_ex/contract_wrappers/exchange/__init__.py diff --git a/.prettierignore b/.prettierignore index 8957332408..f4d158c3ae 100644 --- a/.prettierignore +++ b/.prettierignore @@ -27,8 +27,6 @@ lib /packages/abi-gen/test-cli/output /packages/json-schemas/schemas /python-packages/json_schemas/src/zero_ex/json_schemas/schemas -/packages/metacoin/src/contract_wrappers -/packages/metacoin/artifacts /packages/sra-spec/public/ /packages/dev-tools-pages/ts/**/data.json package.json diff --git a/CODEOWNERS b/CODEOWNERS index e47c2c742b..f2b8910dfc 100644 --- a/CODEOWNERS +++ b/CODEOWNERS @@ -20,7 +20,6 @@ packages/contract-artifacts/ @albrow packages/dev-utils/ @LogvinovLeon @fabioberger packages/devnet/ @albrow packages/ethereum-types/ @LogvinovLeon -packages/metacoin/ @LogvinovLeon packages/monorepo-scripts/ @fabioberger packages/order-utils/ @fabioberger @LogvinovLeon packages/python-contract-wrappers/ @feuGeneA diff --git a/packages/metacoin/README.md b/packages/metacoin/README.md deleted file mode 100644 index fc16d63f91..0000000000 --- a/packages/metacoin/README.md +++ /dev/null @@ -1,81 +0,0 @@ -## @0x/metacoin - -This is an example project that demonstrates how the many Ethereum dev tools developed by 0x can be used in any Solidity/TS project. -It supports: - -- Compiling & testing smart contracts -- Generating typed contract wrappers -- Solidity coverage -- Solidity gas profiling -- Running tests against Ganache -- Running tests against our fork of Geth (it supports snapshotting & time travel) - -## Contributing - -We welcome improvements and fixes from the wider community! To report bugs within this package, please create an issue in this repository. - -Please read our [contribution guidelines](../../CONTRIBUTING.md) before getting started. - -### Install dependencies - -If you don't have yarn workspaces enabled (Yarn < v1.0) - enable them: - -```bash -yarn config set workspaces-experimental true -``` - -Then install dependencies - -```bash -yarn install -``` - -### Build - -To build this package and all other monorepo packages that it depends on, run the following from the monorepo root directory: - -```bash -PKG=@0x/metacoin yarn build -``` - -Or continuously rebuild on change: - -```bash -PKG=@0x/metacoin yarn watch -``` - -### Clean - -```bash -yarn clean -``` - -### Lint - -```bash -yarn lint -``` - -### Coverage - -```bash -yarn test:coverage -yarn coverage:report:html -``` - -### Profiling - -Please note that traces emitted by ganache have incorrect gas costs so we recommend using Geth for profiling. - -```bash -TEST_PROVIDER=geth yarn test:profile -``` - -You'll see a warning that you need to explicitly enable and disable the profiler before and after the block of code you want to profile. - -```typescript -import { profiler } from './utils/profiler'; -profiler.start(); -// Some solidity stuff -profiler.stop(); -``` diff --git a/packages/metacoin/compiler.json b/packages/metacoin/compiler.json deleted file mode 100644 index 30a76c2613..0000000000 --- a/packages/metacoin/compiler.json +++ /dev/null @@ -1,18 +0,0 @@ -{ - "artifactsDir": "artifacts", - "contractsDir": "contracts", - "compilerSettings": { - "outputSelection": { - "*": { - "*": [ - "abi", - "devdoc", - "evm.bytecode.object", - "evm.bytecode.sourceMap", - "evm.deployedBytecode.object", - "evm.deployedBytecode.sourceMap" - ] - } - } - } -} diff --git a/packages/metacoin/contracts/Metacoin.sol b/packages/metacoin/contracts/Metacoin.sol deleted file mode 100644 index 46449c3b22..0000000000 --- a/packages/metacoin/contracts/Metacoin.sol +++ /dev/null @@ -1,43 +0,0 @@ -pragma solidity ^0.4.24; -pragma experimental ABIEncoderV2; - -contract Metacoin { - mapping (address => uint) public balances; - - event Transfer(address indexed _from, address indexed _to, uint256 _value); - - struct TransferData { - address to; - uint256 amount; - } - - struct NestedTransferData { - TransferData transferData; - uint32 callback; - } - - constructor () public { - balances[msg.sender] = 10000; - } - - /// @dev This is an example devdoc - /// @param transferData Transfer data to act on. - /// @return success True if successful, otherwise false - function transfer(TransferData transferData) public returns (bool success) { - if (balances[msg.sender] < transferData.amount) return false; - balances[msg.sender] -= transferData.amount; - balances[transferData.to] += transferData.amount; - emit Transfer(msg.sender, transferData.to, transferData.amount); - return true; - } - - function transfer(TransferData transferData, uint32 callback) public returns (int) { - transfer(transferData); - return callback; - } - - function transfer(NestedTransferData nestedTransferData) public returns (int) { - return transfer(nestedTransferData.transferData, nestedTransferData.callback); - } - -} diff --git a/packages/metacoin/coverage/.gitkeep b/packages/metacoin/coverage/.gitkeep deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/packages/metacoin/package.json b/packages/metacoin/package.json deleted file mode 100644 index 3fc75dea8f..0000000000 --- a/packages/metacoin/package.json +++ /dev/null @@ -1,67 +0,0 @@ -{ - "name": "@0x/metacoin", - "version": "0.0.54", - "engines": { - "node": ">=6.12" - }, - "private": true, - "description": "Example solidity project using 0x dev tools", - "scripts": { - "lint": "tslint --format stylish --project . --exclude **/src/contract_wrappers/**/*", - "fix": "tslint --fix --format stylish --project . --exclude **/src/contract_wrappers/**/*", - "build": "yarn pre_build && tsc -b", - "build:ci": "yarn build", - "pre_build": "run-s compile generate_contract_wrappers copy_artifacts", - "clean": "shx rm -rf lib artifacts src/contract_wrappers", - "copy_artifacts": "copyfiles './artifacts/**/*' './contracts/**/*' ./lib", - "test": "yarn run_mocha", - "rebuild_and_test": "run-s build test", - "test:coverage": "SOLIDITY_COVERAGE=true run-s build run_mocha coverage:report:text coverage:report:lcov", - "test:profile": "SOLIDITY_PROFILER=true run-s build run_mocha profiler:report:html", - "run_mocha": "mocha --require source-map-support/register --require make-promises-safe lib/test/**/*_test.js lib/test/global_hooks.js --bail --exit --timeout 10000", - "generate_contract_wrappers": "abi-gen --abis 'artifacts/Metacoin.json' --template ../../node_modules/@0x/abi-gen-templates/contract.handlebars --partials '../../node_modules/@0x/abi-gen-templates/partials/**/*.handlebars' --output src/contract_wrappers --backend ethers", - "coverage:report:text": "istanbul report text", - "coverage:report:html": "istanbul report html && open coverage/index.html", - "profiler:report:html": "istanbul report html && open coverage/index.html", - "coverage:report:lcov": "istanbul report lcov", - "test:circleci": "yarn test:coverage", - "compile": "sol-compiler", - "watch": "sol-compiler -w" - }, - "author": "", - "license": "Apache-2.0", - "dependencies": { - "@0x/abi-gen": "^2.1.1", - "@0x/abi-gen-templates": "^2.2.1", - "@0x/base-contract": "^5.1.1", - "@0x/sol-coverage": "^3.0.6", - "@0x/sol-profiler": "^3.1.8", - "@0x/sol-trace": "^2.0.14", - "@0x/subproviders": "^4.1.1", - "@0x/tslint-config": "^3.0.1", - "@0x/types": "^2.4.0", - "@0x/typescript-typings": "^4.2.3", - "@0x/utils": "^4.4.0", - "@0x/web3-wrapper": "^6.0.7", - "@types/mocha": "^2.2.42", - "copyfiles": "^2.0.0", - "ethereum-types": "^2.1.3", - "ethers": "~4.0.4", - "lodash": "^4.17.11", - "run-s": "^0.0.0" - }, - "devDependencies": { - "@0x/contracts-test-utils": "^3.1.10", - "@0x/dev-utils": "^2.2.4", - "@0x/sol-compiler": "^3.1.9", - "chai": "^4.0.1", - "chai-as-promised": "^7.1.0", - "chai-bignumber": "^3.0.0", - "dirty-chai": "^2.0.1", - "make-promises-safe": "^1.1.0", - "npm-run-all": "^4.1.2", - "shx": "^0.2.2", - "tslint": "5.11.0", - "typescript": "3.0.1" - } -} diff --git a/packages/metacoin/src/global.d.ts b/packages/metacoin/src/global.d.ts deleted file mode 100644 index 783b92913c..0000000000 --- a/packages/metacoin/src/global.d.ts +++ /dev/null @@ -1,4 +0,0 @@ -declare module '*.json' { - const value: any; - export default value; -} diff --git a/packages/metacoin/test/global_hooks.ts b/packages/metacoin/test/global_hooks.ts deleted file mode 100644 index 4a54432a1c..0000000000 --- a/packages/metacoin/test/global_hooks.ts +++ /dev/null @@ -1,18 +0,0 @@ -import { env, EnvVars } from '@0x/dev-utils'; - -import { coverage, profiler, provider } from '@0x/contracts-test-utils'; -import { providerUtils } from '@0x/utils'; -before('start web3 provider', () => { - providerUtils.startProviderEngine(provider); -}); -after('generate coverage report', async () => { - if (env.parseBoolean(EnvVars.SolidityCoverage)) { - const coverageSubprovider = coverage.getCoverageSubproviderSingleton(); - await coverageSubprovider.writeCoverageAsync(); - } - if (env.parseBoolean(EnvVars.SolidityProfiler)) { - const profilerSubprovider = profiler.getProfilerSubproviderSingleton(); - await profilerSubprovider.writeProfilerOutputAsync(); - } - provider.stop(); -}); diff --git a/packages/metacoin/test/metacoin_test.ts b/packages/metacoin/test/metacoin_test.ts deleted file mode 100644 index bf7622f367..0000000000 --- a/packages/metacoin/test/metacoin_test.ts +++ /dev/null @@ -1,116 +0,0 @@ -import { chaiSetup, provider, txDefaults, web3Wrapper } from '@0x/contracts-test-utils'; -// Uncomment the next line to enable profiling -// import { profiler } from '@0x/contracts-test-utils'; -import { BlockchainLifecycle, devConstants } from '@0x/dev-utils'; -import { BigNumber } from '@0x/utils'; -import * as chai from 'chai'; -import { ContractArtifact, LogWithDecodedArgs } from 'ethereum-types'; - -import * as MetacoinArtifact from '../artifacts/Metacoin.json'; -import { MetacoinContract, MetacoinTransferEventArgs } from '../src/contract_wrappers/metacoin'; - -const artifact: ContractArtifact = MetacoinArtifact as any; - -chaiSetup.configure(); -const { expect } = chai; -const blockchainLifecycle = new BlockchainLifecycle(web3Wrapper); -// tslint:disable:no-unnecessary-type-assertion -describe('Metacoin', () => { - let metacoin: MetacoinContract; - const ownerAddress = devConstants.TESTRPC_FIRST_ADDRESS; - const INITIAL_BALANCE = new BigNumber(10000); - before(async () => { - metacoin = await MetacoinContract.deployFrom0xArtifactAsync(artifact, provider, txDefaults); - web3Wrapper.abiDecoder.addABI(metacoin.abi); - }); - beforeEach(async () => { - await blockchainLifecycle.startAsync(); - }); - afterEach(async () => { - await blockchainLifecycle.revertAsync(); - }); - describe('#constructor', () => { - it(`should initialy give ${INITIAL_BALANCE} tokens to the creator`, async () => { - const balance = await metacoin.balances.callAsync(ownerAddress); - expect(balance).to.be.bignumber.equal(INITIAL_BALANCE); - }); - }); - describe('#transfer', () => { - it(`should successfully transfer tokens (via transfer1)`, async () => { - const ZERO_ADDRESS = '0x0000000000000000000000000000000000000000'; - const amount = INITIAL_BALANCE.div(2); - const oldBalance = await metacoin.balances.callAsync(ZERO_ADDRESS); - expect(oldBalance).to.be.bignumber.equal(0); - const txHash = await metacoin.transfer1.sendTransactionAsync( - { - to: ZERO_ADDRESS, - amount, - }, - { from: devConstants.TESTRPC_FIRST_ADDRESS }, - ); - // profiler.stop(); - const txReceipt = await web3Wrapper.awaitTransactionSuccessAsync(txHash); - const transferLogs = txReceipt.logs[0] as LogWithDecodedArgs; - expect(transferLogs.args).to.be.deep.equal({ - _to: ZERO_ADDRESS, - _from: devConstants.TESTRPC_FIRST_ADDRESS, - _value: amount, - }); - const newBalance = await metacoin.balances.callAsync(ZERO_ADDRESS); - expect(newBalance).to.be.bignumber.equal(amount); - }); - - it(`should successfully transfer tokens (via transfer2)`, async () => { - const ZERO_ADDRESS = '0x0000000000000000000000000000000000000000'; - const amount = INITIAL_BALANCE.div(2); - const oldBalance = await metacoin.balances.callAsync(ZERO_ADDRESS); - expect(oldBalance).to.be.bignumber.equal(0); - const callback = 59; - const txHash = await metacoin.transfer2.sendTransactionAsync( - { - to: ZERO_ADDRESS, - amount, - }, - callback, - { from: devConstants.TESTRPC_FIRST_ADDRESS }, - ); - const txReceipt = await web3Wrapper.awaitTransactionSuccessAsync(txHash); - const transferLogs = txReceipt.logs[0] as LogWithDecodedArgs; - expect(transferLogs.args).to.be.deep.equal({ - _to: ZERO_ADDRESS, - _from: devConstants.TESTRPC_FIRST_ADDRESS, - _value: amount, - }); - const newBalance = await metacoin.balances.callAsync(ZERO_ADDRESS); - expect(newBalance).to.be.bignumber.equal(amount); - }); - - it(`should successfully transfer tokens (via transfer3)`, async () => { - const ZERO_ADDRESS = '0x0000000000000000000000000000000000000000'; - const amount = INITIAL_BALANCE.div(2); - const oldBalance = await metacoin.balances.callAsync(ZERO_ADDRESS); - expect(oldBalance).to.be.bignumber.equal(0); - const callback = 59; - const txHash = await metacoin.transfer3.sendTransactionAsync( - { - transferData: { - to: ZERO_ADDRESS, - amount, - }, - callback, - }, - { from: devConstants.TESTRPC_FIRST_ADDRESS }, - ); - const txReceipt = await web3Wrapper.awaitTransactionSuccessAsync(txHash); - const transferLogs = txReceipt.logs[0] as LogWithDecodedArgs; - expect(transferLogs.args).to.be.deep.equal({ - _to: ZERO_ADDRESS, - _from: devConstants.TESTRPC_FIRST_ADDRESS, - _value: amount, - }); - const newBalance = await metacoin.balances.callAsync(ZERO_ADDRESS); - expect(newBalance).to.be.bignumber.equal(amount); - }); - }); -}); -// tslint:enable:no-unnecessary-type-assertion diff --git a/packages/metacoin/tsconfig.json b/packages/metacoin/tsconfig.json deleted file mode 100644 index 163465cf52..0000000000 --- a/packages/metacoin/tsconfig.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "extends": "../../tsconfig", - "compilerOptions": { - "outDir": "lib", - "rootDir": ".", - "typeRoots": [ - "comment: for building within 0x-monorepo:", - "../../node_modules/@0x/typescript-typings/types", - "../../node_modules/@types", - "comment: for building in an isolated environment:", - "node_modules/@0x/typescript-typings/types", - "node_modules/@types" - ] - }, - "include": ["src/**/*", "test/**/*"] -} diff --git a/packages/metacoin/tslint.json b/packages/metacoin/tslint.json deleted file mode 100644 index dd9053357e..0000000000 --- a/packages/metacoin/tslint.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "extends": ["@0x/tslint-config"] -} diff --git a/packages/order-watcher/README.md b/packages/order-watcher/README.md index a841775b6c..b2de5450d6 100644 --- a/packages/order-watcher/README.md +++ b/packages/order-watcher/README.md @@ -1,4 +1,6 @@ -## OrderWatcher +## OrderWatcher [Deprecated] + +:no_entry: WARNING: This project is deprecated. Please use [0x Mesh](https://github.com/0xProject/0x-mesh) for all your orderbook pruning needs. It can be used with or without order sharing enabled. If you have any questions about how to use Mesh, reach out to us in the [#mesh channel on Discord](https://discordapp.com/invite/d3FTX3M) :no_entry: An order watcher daemon that watches for order validity. diff --git a/packages/order-watcher/package.json b/packages/order-watcher/package.json index 6426d3bb21..8e11224176 100644 --- a/packages/order-watcher/package.json +++ b/packages/order-watcher/package.json @@ -25,11 +25,6 @@ "run_mocha": "mocha --require source-map-support/register --require make-promises-safe lib/test/**/*_test.js lib/test/global_hooks.js --timeout 10000 --bail --exit", "docs:json": "typedoc --excludePrivate --excludeExternals --target ES5 --tsconfig typedoc-tsconfig.json --json $JSON_FILE_PATH $PROJECT_FILES" }, - "config": { - "postpublish": { - "dockerHubRepo": "order-watcher" - } - }, "repository": { "type": "git", "url": "https://github.com/0xProject/0x-monorepo" diff --git a/packages/pipeline/pipeline.env.gpg b/packages/pipeline/pipeline.env.gpg deleted file mode 100644 index d5e3f22ca5..0000000000 Binary files a/packages/pipeline/pipeline.env.gpg and /dev/null differ diff --git a/packages/website/md/docs/order_watcher/2/introduction.md b/packages/website/md/docs/order_watcher/2/introduction.md index b2d574053a..912cc55e27 100644 --- a/packages/website/md/docs/order_watcher/2/introduction.md +++ b/packages/website/md/docs/order_watcher/2/introduction.md @@ -1 +1,3 @@ +**DEPRECATED: This project is deprecated. Please use [0x Mesh](https://github.com/0xProject/0x-mesh) for all your orderbook pruning needs. It can be used with or without order sharing enabled. If you have any questions about how to use Mesh, reach out to us in the [#mesh channel on Discord](https://discordapp.com/invite/d3FTX3M)** + Welcome to the [order-watcher](https://github.com/0xProject/0x-monorepo/tree/development/packages/order-watcher) documentation! OrderWatcher is a daemon that efficiently watches a set of orders, emitting events whenever the validity of an order changes. It can be used by relayers to prune an orderbook, or by traders to keep orders fetched from a Relayer up-to-date. diff --git a/packages/website/ts/pages/documentation/docs_home.tsx b/packages/website/ts/pages/documentation/docs_home.tsx index fc7a46ebef..e240936017 100644 --- a/packages/website/ts/pages/documentation/docs_home.tsx +++ b/packages/website/ts/pages/documentation/docs_home.tsx @@ -134,7 +134,7 @@ const CATEGORY_TO_PACKAGES: ObjectMap = { description: "A daemon that watches a set of 0x orders and emits events when an order's fillability has changed. Can be used by a relayer to prune their orderbook or by a trader to keep their view of the market up-to-date.", link: { - title: '@0x/order-watcher', + title: '@0x/order-watcher [Deprecated]', to: WebsitePaths.OrderWatcher, }, }, diff --git a/tsconfig.json b/tsconfig.json index 793361f332..4d563d3116 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -46,7 +46,6 @@ { "path": "./packages/ethereum-types" }, { "path": "./packages/fill-scenarios" }, { "path": "./packages/json-schemas" }, - { "path": "./packages/metacoin" }, { "path": "./packages/migrations" }, { "path": "./packages/monorepo-scripts" }, { "path": "./packages/order-utils" },