From b88ff0a19ff7695086107cbcffe980dc4ad84e10 Mon Sep 17 00:00:00 2001 From: Leonid Logvinov Date: Mon, 10 Dec 2018 10:01:38 -0800 Subject: Refactor out examples --- contracts/examples/.solhint.json | 20 +++ contracts/examples/README.md | 56 +++++++++ contracts/examples/compiler.json | 22 ++++ .../contracts/ExchangeWrapper/ExchangeWrapper.sol | 100 +++++++++++++++ .../examples/contracts/Validator/Validator.sol | 56 +++++++++ contracts/examples/contracts/Wallet/Wallet.sol | 65 ++++++++++ .../examples/contracts/Whitelist/Whitelist.sol | 136 +++++++++++++++++++++ contracts/examples/package.json | 83 +++++++++++++ contracts/examples/src/artifacts/index.ts | 13 ++ contracts/examples/src/index.ts | 2 + contracts/examples/src/wrappers/index.ts | 4 + contracts/examples/tsconfig.json | 16 +++ contracts/examples/tslint.json | 6 + 13 files changed, 579 insertions(+) create mode 100644 contracts/examples/.solhint.json create mode 100644 contracts/examples/README.md create mode 100644 contracts/examples/compiler.json create mode 100644 contracts/examples/contracts/ExchangeWrapper/ExchangeWrapper.sol create mode 100644 contracts/examples/contracts/Validator/Validator.sol create mode 100644 contracts/examples/contracts/Wallet/Wallet.sol create mode 100644 contracts/examples/contracts/Whitelist/Whitelist.sol create mode 100644 contracts/examples/package.json create mode 100644 contracts/examples/src/artifacts/index.ts create mode 100644 contracts/examples/src/index.ts create mode 100644 contracts/examples/src/wrappers/index.ts create mode 100644 contracts/examples/tsconfig.json create mode 100644 contracts/examples/tslint.json (limited to 'contracts/examples') diff --git a/contracts/examples/.solhint.json b/contracts/examples/.solhint.json new file mode 100644 index 000000000..076afe9f3 --- /dev/null +++ b/contracts/examples/.solhint.json @@ -0,0 +1,20 @@ +{ + "extends": "default", + "rules": { + "avoid-low-level-calls": false, + "avoid-tx-origin": "warn", + "bracket-align": false, + "code-complexity": false, + "const-name-snakecase": "error", + "expression-indent": "error", + "function-max-lines": false, + "func-order": "error", + "indent": ["error", 4], + "max-line-length": ["warn", 160], + "no-inline-assembly": false, + "quotes": ["error", "double"], + "separate-by-one-line-in-contract": "error", + "space-after-comma": "error", + "statement-indent": "error" + } +} diff --git a/contracts/examples/README.md b/contracts/examples/README.md new file mode 100644 index 000000000..1c603bfcf --- /dev/null +++ b/contracts/examples/README.md @@ -0,0 +1,56 @@ +## Contract examples + +Smart contract examples of the 0x protocol. + +## Usage + +Contracts can be found in the [contracts](./contracts) directory. +This package contains example implementations of contracts that interact with the protocol but are _not_ intended for use in production. Examples include [filter](https://github.com/0xProject/0x-protocol-specification/blob/master/v2/v2-specification.md#filter-contracts) contracts, a [Wallet](https://github.com/0xProject/0x-protocol-specification/blob/master/v2/v2-specification.md#wallet) contract, and a [Validator](https://github.com/0xProject/0x-protocol-specification/blob/master/v2/v2-specification.md#validator) contract, among others. + +## Contributing + +We strongly recommend that the community help us make improvements and determine the future direction of the protocol. To report bugs within this package, please create an issue in this repository. + +For proposals regarding the 0x protocol's smart contract architecture, message format, or additional functionality, go to the [0x Improvement Proposals (ZEIPs)](https://github.com/0xProject/ZEIPs) repository and follow the contribution guidelines provided therein. + +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/contracts-examples yarn build +``` + +Or continuously rebuild on change: + +```bash +PKG=@0x/contracts-examples yarn watch +``` + +### Clean + +```bash +yarn clean +``` + +### Lint + +```bash +yarn lint +``` diff --git a/contracts/examples/compiler.json b/contracts/examples/compiler.json new file mode 100644 index 000000000..375fa0c55 --- /dev/null +++ b/contracts/examples/compiler.json @@ -0,0 +1,22 @@ +{ + "artifactsDir": "./generated-artifacts", + "contractsDir": "./contracts", + "compilerSettings": { + "optimizer": { + "enabled": true, + "runs": 1000000 + }, + "outputSelection": { + "*": { + "*": [ + "abi", + "evm.bytecode.object", + "evm.bytecode.sourceMap", + "evm.deployedBytecode.object", + "evm.deployedBytecode.sourceMap" + ] + } + } + }, + "contracts": ["ExchangeWrapper", "Validator", "Wallet", "Whitelist"] +} diff --git a/contracts/examples/contracts/ExchangeWrapper/ExchangeWrapper.sol b/contracts/examples/contracts/ExchangeWrapper/ExchangeWrapper.sol new file mode 100644 index 000000000..d98136922 --- /dev/null +++ b/contracts/examples/contracts/ExchangeWrapper/ExchangeWrapper.sol @@ -0,0 +1,100 @@ +/* + + Copyright 2018 ZeroEx Intl. + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + +*/ + +pragma solidity 0.4.24; +pragma experimental ABIEncoderV2; + +import "@0x/contracts-interfaces/contracts/protocol/Exchange/IExchange.sol"; +import "@0x/contracts-libs/contracts/libs/LibOrder.sol"; + + +contract ExchangeWrapper { + + // Exchange contract. + // solhint-disable-next-line var-name-mixedcase + IExchange internal EXCHANGE; + + constructor (address _exchange) + public + { + EXCHANGE = IExchange(_exchange); + } + + /// @dev Cancels all orders created by sender with a salt less than or equal to the targetOrderEpoch + /// and senderAddress equal to this contract. + /// @param targetOrderEpoch Orders created with a salt less or equal to this value will be cancelled. + /// @param salt Arbitrary value to gaurantee uniqueness of 0x transaction hash. + /// @param makerSignature Proof that maker wishes to call this function with given params. + function cancelOrdersUpTo( + uint256 targetOrderEpoch, + uint256 salt, + bytes makerSignature + ) + external + { + address makerAddress = msg.sender; + + // Encode arguments into byte array. + bytes memory data = abi.encodeWithSelector( + EXCHANGE.cancelOrdersUpTo.selector, + targetOrderEpoch + ); + + // Call `cancelOrdersUpTo` via `executeTransaction`. + EXCHANGE.executeTransaction( + salt, + makerAddress, + data, + makerSignature + ); + } + + /// @dev Fills an order using `msg.sender` as the taker. + /// @param order Order struct containing order specifications. + /// @param takerAssetFillAmount Desired amount of takerAsset to sell. + /// @param salt Arbitrary value to gaurantee uniqueness of 0x transaction hash. + /// @param orderSignature Proof that order has been created by maker. + /// @param takerSignature Proof that taker wishes to call this function with given params. + function fillOrder( + LibOrder.Order memory order, + uint256 takerAssetFillAmount, + uint256 salt, + bytes memory orderSignature, + bytes memory takerSignature + ) + public + { + address takerAddress = msg.sender; + + // Encode arguments into byte array. + bytes memory data = abi.encodeWithSelector( + EXCHANGE.fillOrder.selector, + order, + takerAssetFillAmount, + orderSignature + ); + + // Call `fillOrder` via `executeTransaction`. + EXCHANGE.executeTransaction( + salt, + takerAddress, + data, + takerSignature + ); + } +} diff --git a/contracts/examples/contracts/Validator/Validator.sol b/contracts/examples/contracts/Validator/Validator.sol new file mode 100644 index 000000000..e488a9ca7 --- /dev/null +++ b/contracts/examples/contracts/Validator/Validator.sol @@ -0,0 +1,56 @@ +/* + + Copyright 2018 ZeroEx Intl. + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + +*/ + +pragma solidity 0.4.24; + +import "@0x/contracts-interfaces/contracts/protocol/Exchange/IValidator.sol"; + + +contract Validator is + IValidator +{ + + // The single valid signer for this wallet. + // solhint-disable-next-line var-name-mixedcase + address internal VALID_SIGNER; + + /// @dev constructs a new `Validator` with a single valid signer. + /// @param validSigner The sole, valid signer. + constructor (address validSigner) public { + VALID_SIGNER = validSigner; + } + + /// @dev Verifies that a signature is valid. `signer` must match `VALID_SIGNER`. + /// @param hash Message hash that is signed. + /// @param signerAddress Address that should have signed the given hash. + /// @param signature Proof of signing. + /// @return Validity of signature. + // solhint-disable no-unused-vars + function isValidSignature( + bytes32 hash, + address signerAddress, + bytes signature + ) + external + view + returns (bool isValid) + { + return (signerAddress == VALID_SIGNER); + } + // solhint-enable no-unused-vars +} diff --git a/contracts/examples/contracts/Wallet/Wallet.sol b/contracts/examples/contracts/Wallet/Wallet.sol new file mode 100644 index 000000000..8edc74eb3 --- /dev/null +++ b/contracts/examples/contracts/Wallet/Wallet.sol @@ -0,0 +1,65 @@ +/* + + Copyright 2018 ZeroEx Intl. + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + +*/ + +pragma solidity 0.4.24; + +import "@0x/contracts-interfaces/contracts/protocol/Exchange/IWallet.sol"; +import "@0x/contracts-utils/contracts/utils/LibBytes/LibBytes.sol"; + + +contract Wallet is + IWallet +{ + using LibBytes for bytes; + + // The owner of this wallet. + // solhint-disable-next-line var-name-mixedcase + address internal WALLET_OWNER; + + /// @dev constructs a new `Wallet` with a single owner. + /// @param walletOwner The owner of this wallet. + constructor (address walletOwner) public { + WALLET_OWNER = walletOwner; + } + + /// @dev Validates an EIP712 signature. + /// The signer must match the owner of this wallet. + /// @param hash Message hash that is signed. + /// @param eip712Signature Proof of signing. + /// @return Validity of signature. + function isValidSignature( + bytes32 hash, + bytes eip712Signature + ) + external + view + returns (bool isValid) + { + require( + eip712Signature.length == 65, + "LENGTH_65_REQUIRED" + ); + + uint8 v = uint8(eip712Signature[0]); + bytes32 r = eip712Signature.readBytes32(1); + bytes32 s = eip712Signature.readBytes32(33); + address recoveredAddress = ecrecover(hash, v, r, s); + isValid = WALLET_OWNER == recoveredAddress; + return isValid; + } +} diff --git a/contracts/examples/contracts/Whitelist/Whitelist.sol b/contracts/examples/contracts/Whitelist/Whitelist.sol new file mode 100644 index 000000000..2a3d33738 --- /dev/null +++ b/contracts/examples/contracts/Whitelist/Whitelist.sol @@ -0,0 +1,136 @@ +/* + + Copyright 2018 ZeroEx Intl. + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + +*/ + +pragma solidity 0.4.24; +pragma experimental ABIEncoderV2; + +import "@0x/contracts-interfaces/contracts/protocol/Exchange/IExchange.sol"; +import "@0x/contracts-libs/contracts/libs/LibOrder.sol"; +import "@0x/contracts-utils/contracts/utils/Ownable/Ownable.sol"; + + +contract Whitelist is + Ownable +{ + + // Mapping of address => whitelist status. + mapping (address => bool) public isWhitelisted; + + // Exchange contract. + // solhint-disable var-name-mixedcase + IExchange internal EXCHANGE; + bytes internal TX_ORIGIN_SIGNATURE; + // solhint-enable var-name-mixedcase + + byte constant internal VALIDATOR_SIGNATURE_BYTE = "\x05"; + + constructor (address _exchange) + public + { + EXCHANGE = IExchange(_exchange); + TX_ORIGIN_SIGNATURE = abi.encodePacked(address(this), VALIDATOR_SIGNATURE_BYTE); + } + + /// @dev Adds or removes an address from the whitelist. + /// @param target Address to add or remove from whitelist. + /// @param isApproved Whitelist status to assign to address. + function updateWhitelistStatus( + address target, + bool isApproved + ) + external + onlyOwner + { + isWhitelisted[target] = isApproved; + } + + /// @dev Verifies signer is same as signer of current Ethereum transaction. + /// NOTE: This function can currently be used to validate signatures coming from outside of this contract. + /// Extra safety checks can be added for a production contract. + /// @param signerAddress Address that should have signed the given hash. + /// @param signature Proof of signing. + /// @return Validity of order signature. + // solhint-disable no-unused-vars + function isValidSignature( + bytes32 hash, + address signerAddress, + bytes signature + ) + external + view + returns (bool isValid) + { + // solhint-disable-next-line avoid-tx-origin + return signerAddress == tx.origin; + } + // solhint-enable no-unused-vars + + /// @dev Fills an order using `msg.sender` as the taker. + /// The transaction will revert if both the maker and taker are not whitelisted. + /// Orders should specify this contract as the `senderAddress` in order to gaurantee + /// that both maker and taker have been whitelisted. + /// @param order Order struct containing order specifications. + /// @param takerAssetFillAmount Desired amount of takerAsset to sell. + /// @param salt Arbitrary value to gaurantee uniqueness of 0x transaction hash. + /// @param orderSignature Proof that order has been created by maker. + function fillOrderIfWhitelisted( + LibOrder.Order memory order, + uint256 takerAssetFillAmount, + uint256 salt, + bytes memory orderSignature + ) + public + { + address takerAddress = msg.sender; + + // This contract must be the entry point for the transaction. + require( + // solhint-disable-next-line avoid-tx-origin + takerAddress == tx.origin, + "INVALID_SENDER" + ); + + // Check if maker is on the whitelist. + require( + isWhitelisted[order.makerAddress], + "MAKER_NOT_WHITELISTED" + ); + + // Check if taker is on the whitelist. + require( + isWhitelisted[takerAddress], + "TAKER_NOT_WHITELISTED" + ); + + // Encode arguments into byte array. + bytes memory data = abi.encodeWithSelector( + EXCHANGE.fillOrder.selector, + order, + takerAssetFillAmount, + orderSignature + ); + + // Call `fillOrder` via `executeTransaction`. + EXCHANGE.executeTransaction( + salt, + takerAddress, + data, + TX_ORIGIN_SIGNATURE + ); + } +} diff --git a/contracts/examples/package.json b/contracts/examples/package.json new file mode 100644 index 000000000..7682e0d45 --- /dev/null +++ b/contracts/examples/package.json @@ -0,0 +1,83 @@ +{ + "private": true, + "name": "@0x/contracts-examples", + "version": "1.0.0", + "engines": { + "node": ">=6.12" + }, + "description": "Smart contract examples of 0x protocol", + "main": "lib/src/index.js", + "directories": { + "test": "test" + }, + "scripts": { + "build": "yarn pre_build && tsc -b", + "build:ci": "yarn build", + "pre_build": "run-s compile generate_contract_wrappers", + "compile": "sol-compiler --contracts-dir contracts", + "clean": "shx rm -rf lib generated-artifacts generated-wrappers", + "generate_contract_wrappers": "abi-gen --abis ${npm_package_config_abis} --template ../../node_modules/@0x/abi-gen-templates/contract.handlebars --partials '../../node_modules/@0x/abi-gen-templates/partials/**/*.handlebars' --output generated-wrappers --backend ethers", + "lint": "tslint --format stylish --project . --exclude ./generated-wrappers/**/* --exclude ./generated-artifacts/**/* --exclude **/lib/**/* && yarn lint-contracts", + "lint-contracts": "solhint contracts/**/**/**/**/*.sol" + }, + "config": { + "abis": "generated-artifacts/@(ExchangeWrapper|Validator|Wallet|Whitelist).json" + }, + "repository": { + "type": "git", + "url": "https://github.com/0xProject/0x-monorepo.git" + }, + "license": "Apache-2.0", + "bugs": { + "url": "https://github.com/0xProject/0x-monorepo/issues" + }, + "homepage": "https://github.com/0xProject/0x-monorepo/contracts/core/README.md", + "devDependencies": { + "@0x/contracts-test-utils": "^1.0.0", + "@0x/abi-gen": "^1.0.17", + "@0x/dev-utils": "^1.0.19", + "@0x/sol-compiler": "^1.1.14", + "@0x/sol-cov": "^2.1.14", + "@0x/subproviders": "^2.1.6", + "@0x/tslint-config": "^1.0.10", + "@types/bn.js": "^4.11.0", + "@types/lodash": "4.14.104", + "@types/node": "*", + "@types/yargs": "^10.0.0", + "chai": "^4.0.1", + "chai-as-promised": "^7.1.0", + "chai-bignumber": "^2.0.1", + "dirty-chai": "^2.0.1", + "make-promises-safe": "^1.1.0", + "ethereumjs-abi": "0.6.5", + "mocha": "^4.1.0", + "npm-run-all": "^4.1.2", + "shx": "^0.2.2", + "solc": "^0.4.24", + "solhint": "^1.2.1", + "tslint": "5.11.0", + "typescript": "3.0.1", + "yargs": "^10.0.3" + }, + "dependencies": { + "@0x/base-contract": "^3.0.8", + "@0x/order-utils": "^3.0.4", + "@0x/contracts-multisig": "^1.0.0", + "@0x/contracts-utils": "^1.0.0", + "@0x/contracts-tokens": "^1.0.0", + "@0x/contracts-libs": "^1.0.0", + "@0x/contracts-interfaces": "^1.0.0", + "@0x/types": "^1.3.0", + "@0x/typescript-typings": "^3.0.4", + "@0x/utils": "^2.0.6", + "@0x/web3-wrapper": "^3.1.6", + "@types/js-combinatorics": "^0.5.29", + "bn.js": "^4.11.8", + "ethereum-types": "^1.1.2", + "ethereumjs-util": "^5.1.1", + "lodash": "^4.17.5" + }, + "publishConfig": { + "access": "public" + } +} diff --git a/contracts/examples/src/artifacts/index.ts b/contracts/examples/src/artifacts/index.ts new file mode 100644 index 000000000..c921fbf89 --- /dev/null +++ b/contracts/examples/src/artifacts/index.ts @@ -0,0 +1,13 @@ +import { ContractArtifact } from 'ethereum-types'; + +import * as ExchangeWrapper from '../../generated-artifacts/ExchangeWrapper.json'; +import * as Validator from '../../generated-artifacts/Validator.json'; +import * as Wallet from '../../generated-artifacts/Wallet.json'; +import * as Whitelist from '../../generated-artifacts/Whitelist.json'; + +export const artifacts = { + ExchangeWrapper: ExchangeWrapper as ContractArtifact, + Validator: Validator as ContractArtifact, + Wallet: Wallet as ContractArtifact, + Whitelist: Whitelist as ContractArtifact, +}; diff --git a/contracts/examples/src/index.ts b/contracts/examples/src/index.ts new file mode 100644 index 000000000..d55f08ea2 --- /dev/null +++ b/contracts/examples/src/index.ts @@ -0,0 +1,2 @@ +export * from './artifacts'; +export * from './wrappers'; diff --git a/contracts/examples/src/wrappers/index.ts b/contracts/examples/src/wrappers/index.ts new file mode 100644 index 000000000..dc67277d7 --- /dev/null +++ b/contracts/examples/src/wrappers/index.ts @@ -0,0 +1,4 @@ +export * from '../../generated-wrappers/exchange_wrapper'; +export * from '../../generated-wrappers/validator'; +export * from '../../generated-wrappers/wallet'; +export * from '../../generated-wrappers/whitelist'; diff --git a/contracts/examples/tsconfig.json b/contracts/examples/tsconfig.json new file mode 100644 index 000000000..63245da1e --- /dev/null +++ b/contracts/examples/tsconfig.json @@ -0,0 +1,16 @@ +{ + "extends": "../../tsconfig", + "compilerOptions": { + "outDir": "lib", + "rootDir": ".", + "resolveJsonModule": true + }, + "include": ["./src/**/*", "./test/**/*", "./generated-wrappers/**/*"], + "files": [ + "./generated-artifacts/ExchangeWrapper.json", + "./generated-artifacts/Validator.json", + "./generated-artifacts/Wallet.json", + "./generated-artifacts/Whitelist.json" + ], + "exclude": ["./deploy/solc/solc_bin"] +} diff --git a/contracts/examples/tslint.json b/contracts/examples/tslint.json new file mode 100644 index 000000000..1bb3ac2a2 --- /dev/null +++ b/contracts/examples/tslint.json @@ -0,0 +1,6 @@ +{ + "extends": ["@0x/tslint-config"], + "rules": { + "custom-no-magic-numbers": false + } +} -- cgit v1.2.3 From 9f5eeed30930eea59e9922569a15cb5d689f3eeb Mon Sep 17 00:00:00 2001 From: Leonid Logvinov Date: Mon, 10 Dec 2018 14:37:48 -0800 Subject: Rename core package to protocol --- contracts/examples/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'contracts/examples') diff --git a/contracts/examples/package.json b/contracts/examples/package.json index 7682e0d45..5413f9e61 100644 --- a/contracts/examples/package.json +++ b/contracts/examples/package.json @@ -31,7 +31,7 @@ "bugs": { "url": "https://github.com/0xProject/0x-monorepo/issues" }, - "homepage": "https://github.com/0xProject/0x-monorepo/contracts/core/README.md", + "homepage": "https://github.com/0xProject/0x-monorepo/contracts/examples/README.md", "devDependencies": { "@0x/contracts-test-utils": "^1.0.0", "@0x/abi-gen": "^1.0.17", -- cgit v1.2.3 From c580f4ddcb61844e590e0829c32cbdd15ab03beb Mon Sep 17 00:00:00 2001 From: Leonid Logvinov Date: Mon, 10 Dec 2018 15:13:36 -0800 Subject: Change contracts publish config --- contracts/examples/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'contracts/examples') diff --git a/contracts/examples/package.json b/contracts/examples/package.json index 5413f9e61..c18f1ae79 100644 --- a/contracts/examples/package.json +++ b/contracts/examples/package.json @@ -78,6 +78,6 @@ "lodash": "^4.17.5" }, "publishConfig": { - "access": "public" + "access": "private" } } -- cgit v1.2.3 From 5e6d1779cb51fc1687c46f687a2140e05b0a6559 Mon Sep 17 00:00:00 2001 From: Leonid Logvinov Date: Mon, 10 Dec 2018 15:20:52 -0800 Subject: Re-use solhint configuration --- contracts/examples/.solhint.json | 20 -------------------- contracts/examples/package.json | 4 ++-- 2 files changed, 2 insertions(+), 22 deletions(-) delete mode 100644 contracts/examples/.solhint.json (limited to 'contracts/examples') diff --git a/contracts/examples/.solhint.json b/contracts/examples/.solhint.json deleted file mode 100644 index 076afe9f3..000000000 --- a/contracts/examples/.solhint.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "extends": "default", - "rules": { - "avoid-low-level-calls": false, - "avoid-tx-origin": "warn", - "bracket-align": false, - "code-complexity": false, - "const-name-snakecase": "error", - "expression-indent": "error", - "function-max-lines": false, - "func-order": "error", - "indent": ["error", 4], - "max-line-length": ["warn", 160], - "no-inline-assembly": false, - "quotes": ["error", "double"], - "separate-by-one-line-in-contract": "error", - "space-after-comma": "error", - "statement-indent": "error" - } -} diff --git a/contracts/examples/package.json b/contracts/examples/package.json index c18f1ae79..083b47457 100644 --- a/contracts/examples/package.json +++ b/contracts/examples/package.json @@ -18,7 +18,7 @@ "clean": "shx rm -rf lib generated-artifacts generated-wrappers", "generate_contract_wrappers": "abi-gen --abis ${npm_package_config_abis} --template ../../node_modules/@0x/abi-gen-templates/contract.handlebars --partials '../../node_modules/@0x/abi-gen-templates/partials/**/*.handlebars' --output generated-wrappers --backend ethers", "lint": "tslint --format stylish --project . --exclude ./generated-wrappers/**/* --exclude ./generated-artifacts/**/* --exclude **/lib/**/* && yarn lint-contracts", - "lint-contracts": "solhint contracts/**/**/**/**/*.sol" + "lint-contracts": "solhint -c ../.solhint.json contracts/**/**/**/**/*.sol" }, "config": { "abis": "generated-artifacts/@(ExchangeWrapper|Validator|Wallet|Whitelist).json" @@ -54,7 +54,7 @@ "npm-run-all": "^4.1.2", "shx": "^0.2.2", "solc": "^0.4.24", - "solhint": "^1.2.1", + "solhint": "^1.4.1", "tslint": "5.11.0", "typescript": "3.0.1", "yargs": "^10.0.3" -- cgit v1.2.3 From 928b253c81971eb6f59efd09ab6a9063d4e6e4ca Mon Sep 17 00:00:00 2001 From: Leonid Logvinov Date: Mon, 10 Dec 2018 15:47:13 -0800 Subject: Revert access changes --- contracts/examples/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'contracts/examples') diff --git a/contracts/examples/package.json b/contracts/examples/package.json index 083b47457..541a67f2c 100644 --- a/contracts/examples/package.json +++ b/contracts/examples/package.json @@ -78,6 +78,6 @@ "lodash": "^4.17.5" }, "publishConfig": { - "access": "private" + "access": "public" } } -- cgit v1.2.3 From 184acd874e6ace8dac6b18ec52b673d07bf89ca8 Mon Sep 17 00:00:00 2001 From: Fabio B Date: Tue, 11 Dec 2018 09:31:00 -0800 Subject: Update contracts/examples/README.md Co-Authored-By: LogvinovLeon --- contracts/examples/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'contracts/examples') diff --git a/contracts/examples/README.md b/contracts/examples/README.md index 1c603bfcf..ca23d0974 100644 --- a/contracts/examples/README.md +++ b/contracts/examples/README.md @@ -1,6 +1,6 @@ ## Contract examples -Smart contract examples of the 0x protocol. +Example smart contracts that interact with 0x protocol. ## Usage -- cgit v1.2.3 From 96b8100a787d00142dcf875d940c9125571cbde6 Mon Sep 17 00:00:00 2001 From: Fabio Berger Date: Tue, 11 Dec 2018 15:38:43 -0800 Subject: Publish - 0x.js@2.0.7 - @0x/abi-gen@1.0.18 - @0x/abi-gen-wrappers@2.0.1 - @0x/assert@1.0.19 - @0x/asset-buyer@3.0.3 - @0x/base-contract@3.0.9 - @0x/connect@3.0.9 - @0x/contract-wrappers@4.1.2 - @0x/dev-tools-pages@0.0.9 - @0x/dev-utils@1.0.20 - ethereum-types@1.1.3 - @0x/fill-scenarios@1.0.15 - @0x/instant@1.0.3 - @0x/json-schemas@2.1.3 - @0x/metacoin@0.0.31 - @0x/migrations@2.2.1 - @0x/monorepo-scripts@1.0.15 - @0x/order-utils@3.0.6 - @0x/order-watcher@2.2.7 - @0x/pipeline@1.0.1 - @0x/react-docs@1.0.21 - @0x/react-shared@1.0.24 - @0x/sol-compiler@1.1.15 - @0x/sol-cov@2.1.15 - @0x/sol-doc@1.0.10 - @0x/sol-resolver@1.1.0 - @0x/sra-spec@1.0.12 - @0x/subproviders@2.1.7 - @0x/testnet-faucets@1.0.59 - @0x/types@1.4.0 - @0x/typescript-typings@3.0.5 - @0x/utils@2.0.7 - @0x/web3-wrapper@3.2.0 - @0x/website@0.0.62 - @0x/contracts-examples@1.0.1 - @0x/contracts-extensions@1.0.1 - @0x/contracts-interfaces@1.0.1 - @0x/contracts-libs@1.0.1 - @0x/contracts-multisig@1.0.1 - @0x/contracts-protocol@2.1.57 - @0x/contracts-test-utils@1.0.1 - @0x/contracts-tokens@1.0.1 - @0x/contracts-utils@1.0.1 --- contracts/examples/package.json | 40 ++++++++++++++++++++-------------------- 1 file changed, 20 insertions(+), 20 deletions(-) (limited to 'contracts/examples') diff --git a/contracts/examples/package.json b/contracts/examples/package.json index 541a67f2c..bb20fd212 100644 --- a/contracts/examples/package.json +++ b/contracts/examples/package.json @@ -1,7 +1,7 @@ { "private": true, "name": "@0x/contracts-examples", - "version": "1.0.0", + "version": "1.0.1", "engines": { "node": ">=6.12" }, @@ -33,12 +33,12 @@ }, "homepage": "https://github.com/0xProject/0x-monorepo/contracts/examples/README.md", "devDependencies": { - "@0x/contracts-test-utils": "^1.0.0", - "@0x/abi-gen": "^1.0.17", - "@0x/dev-utils": "^1.0.19", - "@0x/sol-compiler": "^1.1.14", - "@0x/sol-cov": "^2.1.14", - "@0x/subproviders": "^2.1.6", + "@0x/abi-gen": "^1.0.18", + "@0x/contracts-test-utils": "^1.0.1", + "@0x/dev-utils": "^1.0.20", + "@0x/sol-compiler": "^1.1.15", + "@0x/sol-cov": "^2.1.15", + "@0x/subproviders": "^2.1.7", "@0x/tslint-config": "^1.0.10", "@types/bn.js": "^4.11.0", "@types/lodash": "4.14.104", @@ -48,8 +48,8 @@ "chai-as-promised": "^7.1.0", "chai-bignumber": "^2.0.1", "dirty-chai": "^2.0.1", - "make-promises-safe": "^1.1.0", "ethereumjs-abi": "0.6.5", + "make-promises-safe": "^1.1.0", "mocha": "^4.1.0", "npm-run-all": "^4.1.2", "shx": "^0.2.2", @@ -60,20 +60,20 @@ "yargs": "^10.0.3" }, "dependencies": { - "@0x/base-contract": "^3.0.8", - "@0x/order-utils": "^3.0.4", - "@0x/contracts-multisig": "^1.0.0", - "@0x/contracts-utils": "^1.0.0", - "@0x/contracts-tokens": "^1.0.0", - "@0x/contracts-libs": "^1.0.0", - "@0x/contracts-interfaces": "^1.0.0", - "@0x/types": "^1.3.0", - "@0x/typescript-typings": "^3.0.4", - "@0x/utils": "^2.0.6", - "@0x/web3-wrapper": "^3.1.6", + "@0x/base-contract": "^3.0.9", + "@0x/contracts-interfaces": "^1.0.1", + "@0x/contracts-libs": "^1.0.1", + "@0x/contracts-multisig": "^1.0.1", + "@0x/contracts-tokens": "^1.0.1", + "@0x/contracts-utils": "^1.0.1", + "@0x/order-utils": "^3.0.6", + "@0x/types": "^1.4.0", + "@0x/typescript-typings": "^3.0.5", + "@0x/utils": "^2.0.7", + "@0x/web3-wrapper": "^3.2.0", "@types/js-combinatorics": "^0.5.29", "bn.js": "^4.11.8", - "ethereum-types": "^1.1.2", + "ethereum-types": "^1.1.3", "ethereumjs-util": "^5.1.1", "lodash": "^4.17.5" }, -- cgit v1.2.3 From 5a45bc5e7ba3945fe5788b7f86f885768f034f4b Mon Sep 17 00:00:00 2001 From: Leonid Logvinov Date: Thu, 13 Dec 2018 11:10:24 -0800 Subject: Revert version bump to unpublished contracts packages --- contracts/examples/package.json | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'contracts/examples') diff --git a/contracts/examples/package.json b/contracts/examples/package.json index bb20fd212..ae2769716 100644 --- a/contracts/examples/package.json +++ b/contracts/examples/package.json @@ -1,7 +1,7 @@ { "private": true, "name": "@0x/contracts-examples", - "version": "1.0.1", + "version": "1.0.0", "engines": { "node": ">=6.12" }, @@ -34,7 +34,7 @@ "homepage": "https://github.com/0xProject/0x-monorepo/contracts/examples/README.md", "devDependencies": { "@0x/abi-gen": "^1.0.18", - "@0x/contracts-test-utils": "^1.0.1", + "@0x/contracts-test-utils": "^1.0.0", "@0x/dev-utils": "^1.0.20", "@0x/sol-compiler": "^1.1.15", "@0x/sol-cov": "^2.1.15", @@ -61,11 +61,11 @@ }, "dependencies": { "@0x/base-contract": "^3.0.9", - "@0x/contracts-interfaces": "^1.0.1", - "@0x/contracts-libs": "^1.0.1", - "@0x/contracts-multisig": "^1.0.1", - "@0x/contracts-tokens": "^1.0.1", - "@0x/contracts-utils": "^1.0.1", + "@0x/contracts-interfaces": "^1.0.0", + "@0x/contracts-libs": "^1.0.0", + "@0x/contracts-multisig": "^1.0.0", + "@0x/contracts-tokens": "^1.0.0", + "@0x/contracts-utils": "^1.0.0", "@0x/order-utils": "^3.0.6", "@0x/types": "^1.4.0", "@0x/typescript-typings": "^3.0.5", -- cgit v1.2.3 From f8e84260b59c367d4f99c03b69b7c63a42735116 Mon Sep 17 00:00:00 2001 From: Leonid Logvinov Date: Thu, 13 Dec 2018 11:33:55 -0800 Subject: Bump contracts-test-utils version to match the one on npm --- contracts/examples/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'contracts/examples') diff --git a/contracts/examples/package.json b/contracts/examples/package.json index ae2769716..38bbc2859 100644 --- a/contracts/examples/package.json +++ b/contracts/examples/package.json @@ -34,7 +34,7 @@ "homepage": "https://github.com/0xProject/0x-monorepo/contracts/examples/README.md", "devDependencies": { "@0x/abi-gen": "^1.0.18", - "@0x/contracts-test-utils": "^1.0.0", + "@0x/contracts-test-utils": "^1.0.1", "@0x/dev-utils": "^1.0.20", "@0x/sol-compiler": "^1.1.15", "@0x/sol-cov": "^2.1.15", -- cgit v1.2.3 From 2abd8fe4ee860e5a4008a9f92f6d29239d14b2bc Mon Sep 17 00:00:00 2001 From: Leonid Logvinov Date: Thu, 13 Dec 2018 14:28:27 -0800 Subject: Publish - 0x.js@2.0.8 - @0x/abi-gen@1.0.19 - @0x/abi-gen-wrappers@2.0.2 - @0x/assert@1.0.20 - @0x/asset-buyer@3.0.4 - @0x/base-contract@3.0.10 - @0x/connect@3.0.10 - @0x/contract-wrappers@4.1.3 - @0x/dev-tools-pages@0.0.10 - @0x/dev-utils@1.0.21 - ethereum-types@1.1.4 - @0x/fill-scenarios@1.0.16 - @0x/instant@1.0.4 - @0x/json-schemas@2.1.4 - @0x/metacoin@0.0.32 - @0x/migrations@2.2.2 - @0x/order-utils@3.0.7 - @0x/order-watcher@2.2.8 - @0x/pipeline@1.0.2 - @0x/react-docs@1.0.22 - @0x/react-shared@1.0.25 - @0x/sol-compiler@1.1.16 - @0x/sol-cov@2.1.16 - @0x/sol-doc@1.0.11 - @0x/sol-resolver@1.1.1 - @0x/sra-spec@1.0.13 - @0x/subproviders@2.1.8 - @0x/testnet-faucets@1.0.60 - @0x/tslint-config@2.0.0 - @0x/types@1.4.1 - @0x/typescript-typings@3.0.6 - @0x/utils@2.0.8 - @0x/web3-wrapper@3.2.1 - @0x/website@0.0.63 - @0x/contracts-examples@1.0.1 - @0x/contracts-extensions@1.0.1 - @0x/contracts-interfaces@1.0.1 - @0x/contracts-libs@1.0.1 - @0x/contracts-multisig@1.0.1 - @0x/contracts-protocol@2.1.58 - @0x/contracts-test-utils@1.0.2 - @0x/contracts-tokens@1.0.1 - @0x/contracts-utils@1.0.1 --- contracts/examples/package.json | 40 ++++++++++++++++++++-------------------- 1 file changed, 20 insertions(+), 20 deletions(-) (limited to 'contracts/examples') diff --git a/contracts/examples/package.json b/contracts/examples/package.json index 38bbc2859..4e7c80441 100644 --- a/contracts/examples/package.json +++ b/contracts/examples/package.json @@ -1,7 +1,7 @@ { "private": true, "name": "@0x/contracts-examples", - "version": "1.0.0", + "version": "1.0.1", "engines": { "node": ">=6.12" }, @@ -33,13 +33,13 @@ }, "homepage": "https://github.com/0xProject/0x-monorepo/contracts/examples/README.md", "devDependencies": { - "@0x/abi-gen": "^1.0.18", - "@0x/contracts-test-utils": "^1.0.1", - "@0x/dev-utils": "^1.0.20", - "@0x/sol-compiler": "^1.1.15", - "@0x/sol-cov": "^2.1.15", - "@0x/subproviders": "^2.1.7", - "@0x/tslint-config": "^1.0.10", + "@0x/abi-gen": "^1.0.19", + "@0x/contracts-test-utils": "^1.0.2", + "@0x/dev-utils": "^1.0.21", + "@0x/sol-compiler": "^1.1.16", + "@0x/sol-cov": "^2.1.16", + "@0x/subproviders": "^2.1.8", + "@0x/tslint-config": "^2.0.0", "@types/bn.js": "^4.11.0", "@types/lodash": "4.14.104", "@types/node": "*", @@ -60,20 +60,20 @@ "yargs": "^10.0.3" }, "dependencies": { - "@0x/base-contract": "^3.0.9", - "@0x/contracts-interfaces": "^1.0.0", - "@0x/contracts-libs": "^1.0.0", - "@0x/contracts-multisig": "^1.0.0", - "@0x/contracts-tokens": "^1.0.0", - "@0x/contracts-utils": "^1.0.0", - "@0x/order-utils": "^3.0.6", - "@0x/types": "^1.4.0", - "@0x/typescript-typings": "^3.0.5", - "@0x/utils": "^2.0.7", - "@0x/web3-wrapper": "^3.2.0", + "@0x/base-contract": "^3.0.10", + "@0x/contracts-interfaces": "^1.0.1", + "@0x/contracts-libs": "^1.0.1", + "@0x/contracts-multisig": "^1.0.1", + "@0x/contracts-tokens": "^1.0.1", + "@0x/contracts-utils": "^1.0.1", + "@0x/order-utils": "^3.0.7", + "@0x/types": "^1.4.1", + "@0x/typescript-typings": "^3.0.6", + "@0x/utils": "^2.0.8", + "@0x/web3-wrapper": "^3.2.1", "@types/js-combinatorics": "^0.5.29", "bn.js": "^4.11.8", - "ethereum-types": "^1.1.3", + "ethereum-types": "^1.1.4", "ethereumjs-util": "^5.1.1", "lodash": "^4.17.5" }, -- cgit v1.2.3 From 545101f7a5155fed77f9c65153bd13bdc23387bf Mon Sep 17 00:00:00 2001 From: Leonid Logvinov Date: Thu, 13 Dec 2018 14:36:34 -0800 Subject: Make contracts packages not private --- contracts/examples/package.json | 1 - 1 file changed, 1 deletion(-) (limited to 'contracts/examples') diff --git a/contracts/examples/package.json b/contracts/examples/package.json index 4e7c80441..a7490f0f4 100644 --- a/contracts/examples/package.json +++ b/contracts/examples/package.json @@ -1,5 +1,4 @@ { - "private": true, "name": "@0x/contracts-examples", "version": "1.0.1", "engines": { -- cgit v1.2.3 From d018f6d9ccb6fd31e9dacb845a68bf6851a4cd4c Mon Sep 17 00:00:00 2001 From: Leonid Logvinov Date: Thu, 13 Dec 2018 14:58:48 -0800 Subject: Updated CHANGELOGS --- contracts/examples/CHANGELOG.json | 11 +++++++++++ contracts/examples/CHANGELOG.md | 10 ++++++++++ 2 files changed, 21 insertions(+) create mode 100644 contracts/examples/CHANGELOG.json create mode 100644 contracts/examples/CHANGELOG.md (limited to 'contracts/examples') diff --git a/contracts/examples/CHANGELOG.json b/contracts/examples/CHANGELOG.json new file mode 100644 index 000000000..19ac770af --- /dev/null +++ b/contracts/examples/CHANGELOG.json @@ -0,0 +1,11 @@ +[ + { + "timestamp": 1544741676, + "version": "1.0.2", + "changes": [ + { + "note": "Dependencies updated" + } + ] + } +] diff --git a/contracts/examples/CHANGELOG.md b/contracts/examples/CHANGELOG.md new file mode 100644 index 000000000..716353d05 --- /dev/null +++ b/contracts/examples/CHANGELOG.md @@ -0,0 +1,10 @@ + + +CHANGELOG + +## v1.0.2 - _December 13, 2018_ + + * Dependencies updated -- cgit v1.2.3 From 44e516ac65d4923cc83b0112c509317c6a6d87b6 Mon Sep 17 00:00:00 2001 From: Leonid Logvinov Date: Thu, 13 Dec 2018 14:58:57 -0800 Subject: Publish - @0x/contracts-examples@1.0.2 - @0x/contracts-extensions@1.0.2 - @0x/contracts-interfaces@1.0.2 - @0x/contracts-libs@1.0.2 - @0x/contracts-multisig@1.0.2 - @0x/contracts-protocol@2.1.59 - @0x/contracts-tokens@1.0.2 - @0x/contracts-utils@1.0.2 --- contracts/examples/package.json | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'contracts/examples') diff --git a/contracts/examples/package.json b/contracts/examples/package.json index a7490f0f4..77846241e 100644 --- a/contracts/examples/package.json +++ b/contracts/examples/package.json @@ -1,6 +1,6 @@ { "name": "@0x/contracts-examples", - "version": "1.0.1", + "version": "1.0.2", "engines": { "node": ">=6.12" }, @@ -60,11 +60,11 @@ }, "dependencies": { "@0x/base-contract": "^3.0.10", - "@0x/contracts-interfaces": "^1.0.1", - "@0x/contracts-libs": "^1.0.1", - "@0x/contracts-multisig": "^1.0.1", - "@0x/contracts-tokens": "^1.0.1", - "@0x/contracts-utils": "^1.0.1", + "@0x/contracts-interfaces": "^1.0.2", + "@0x/contracts-libs": "^1.0.2", + "@0x/contracts-multisig": "^1.0.2", + "@0x/contracts-tokens": "^1.0.2", + "@0x/contracts-utils": "^1.0.2", "@0x/order-utils": "^3.0.7", "@0x/types": "^1.4.1", "@0x/typescript-typings": "^3.0.6", -- cgit v1.2.3