diff options
author | Leonid Logvinov <logvinov.leon@gmail.com> | 2018-12-12 02:04:17 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-12-12 02:04:17 +0800 |
commit | e6c1c2a658cb6f821d200c5471d0a1d05a5d0042 (patch) | |
tree | bd0308705ff59708174d75c91b837029393952cd | |
parent | eec9957831c3f12a0e3088b213cb765c2418b9c4 (diff) | |
parent | 36736f82d4cb2dcaef550ea593ed38a12fcf213a (diff) | |
download | dexon-0x-contracts-e6c1c2a658cb6f821d200c5471d0a1d05a5d0042.tar.gz dexon-0x-contracts-e6c1c2a658cb6f821d200c5471d0a1d05a5d0042.tar.zst dexon-0x-contracts-e6c1c2a658cb6f821d200c5471d0a1d05a5d0042.zip |
Merge pull request #1413 from 0xProject/feature/contracts-monorepo-7
Contracts monorepo 7
-rw-r--r-- | .circleci/config.yml | 6 | ||||
-rw-r--r-- | .gitignore | 8 | ||||
-rw-r--r-- | .prettierignore | 8 | ||||
-rw-r--r-- | contracts/.solhint.json (renamed from contracts/core/.solhint.json) | 0 | ||||
-rw-r--r-- | contracts/core/test/tutorials/arbitrage.ts | 260 | ||||
-rw-r--r-- | contracts/examples/README.md | 56 | ||||
-rw-r--r-- | contracts/examples/compiler.json | 22 | ||||
-rw-r--r-- | contracts/examples/contracts/ExchangeWrapper/ExchangeWrapper.sol (renamed from contracts/core/contracts/examples/ExchangeWrapper/ExchangeWrapper.sol) | 0 | ||||
-rw-r--r-- | contracts/examples/contracts/Validator/Validator.sol (renamed from contracts/core/contracts/examples/Validator/Validator.sol) | 0 | ||||
-rw-r--r-- | contracts/examples/contracts/Wallet/Wallet.sol (renamed from contracts/core/contracts/examples/Wallet/Wallet.sol) | 0 | ||||
-rw-r--r-- | contracts/examples/contracts/Whitelist/Whitelist.sol (renamed from contracts/core/contracts/examples/Whitelist/Whitelist.sol) | 0 | ||||
-rw-r--r-- | contracts/examples/package.json | 83 | ||||
-rw-r--r-- | contracts/examples/src/artifacts/index.ts | 13 | ||||
-rw-r--r-- | contracts/examples/src/index.ts (renamed from contracts/core/src/index.ts) | 0 | ||||
-rw-r--r-- | contracts/examples/src/wrappers/index.ts | 4 | ||||
-rw-r--r-- | contracts/examples/tsconfig.json | 16 | ||||
-rw-r--r-- | contracts/examples/tslint.json (renamed from contracts/core/tslint.json) | 0 | ||||
-rw-r--r-- | contracts/extensions/README.md | 69 | ||||
-rw-r--r-- | contracts/extensions/compiler.json | 22 | ||||
-rw-r--r-- | contracts/extensions/contracts/DutchAuction/DutchAuction.sol (renamed from contracts/core/contracts/extensions/DutchAuction/DutchAuction.sol) | 0 | ||||
-rw-r--r-- | contracts/extensions/contracts/Forwarder/Forwarder.sol (renamed from contracts/core/contracts/extensions/Forwarder/Forwarder.sol) | 0 | ||||
-rw-r--r-- | contracts/extensions/contracts/Forwarder/MixinAssets.sol (renamed from contracts/core/contracts/extensions/Forwarder/MixinAssets.sol) | 0 | ||||
-rw-r--r-- | contracts/extensions/contracts/Forwarder/MixinExchangeWrapper.sol (renamed from contracts/core/contracts/extensions/Forwarder/MixinExchangeWrapper.sol) | 0 | ||||
-rw-r--r-- | contracts/extensions/contracts/Forwarder/MixinForwarderCore.sol (renamed from contracts/core/contracts/extensions/Forwarder/MixinForwarderCore.sol) | 0 | ||||
-rw-r--r-- | contracts/extensions/contracts/Forwarder/MixinWeth.sol (renamed from contracts/core/contracts/extensions/Forwarder/MixinWeth.sol) | 0 | ||||
-rw-r--r-- | contracts/extensions/contracts/Forwarder/interfaces/IAssets.sol (renamed from contracts/core/contracts/extensions/Forwarder/interfaces/IAssets.sol) | 0 | ||||
-rw-r--r-- | contracts/extensions/contracts/Forwarder/interfaces/IForwarder.sol (renamed from contracts/core/contracts/extensions/Forwarder/interfaces/IForwarder.sol) | 0 | ||||
-rw-r--r-- | contracts/extensions/contracts/Forwarder/interfaces/IForwarderCore.sol (renamed from contracts/core/contracts/extensions/Forwarder/interfaces/IForwarderCore.sol) | 0 | ||||
-rw-r--r-- | contracts/extensions/contracts/Forwarder/libs/LibConstants.sol (renamed from contracts/core/contracts/extensions/Forwarder/libs/LibConstants.sol) | 0 | ||||
-rw-r--r-- | contracts/extensions/contracts/Forwarder/libs/LibForwarderErrors.sol (renamed from contracts/core/contracts/extensions/Forwarder/libs/LibForwarderErrors.sol) | 0 | ||||
-rw-r--r-- | contracts/extensions/contracts/Forwarder/mixins/MAssets.sol (renamed from contracts/core/contracts/extensions/Forwarder/mixins/MAssets.sol) | 0 | ||||
-rw-r--r-- | contracts/extensions/contracts/Forwarder/mixins/MExchangeWrapper.sol (renamed from contracts/core/contracts/extensions/Forwarder/mixins/MExchangeWrapper.sol) | 0 | ||||
-rw-r--r-- | contracts/extensions/contracts/Forwarder/mixins/MWeth.sol (renamed from contracts/core/contracts/extensions/Forwarder/mixins/MWeth.sol) | 0 | ||||
-rw-r--r-- | contracts/extensions/package.json | 95 | ||||
-rw-r--r-- | contracts/extensions/src/artifacts/index.ts | 9 | ||||
-rw-r--r-- | contracts/extensions/src/index.ts | 2 | ||||
-rw-r--r-- | contracts/extensions/src/wrappers/index.ts | 2 | ||||
-rw-r--r-- | contracts/extensions/test/extensions/dutch_auction.ts (renamed from contracts/core/test/extensions/dutch_auction.ts) | 13 | ||||
-rw-r--r-- | contracts/extensions/test/extensions/forwarder.ts (renamed from contracts/core/test/extensions/forwarder.ts) | 16 | ||||
-rw-r--r-- | contracts/extensions/test/global_hooks.ts (renamed from contracts/core/test/global_hooks.ts) | 0 | ||||
-rw-r--r-- | contracts/extensions/test/utils/forwarder_wrapper.ts (renamed from contracts/core/test/utils/forwarder_wrapper.ts) | 7 | ||||
-rw-r--r-- | contracts/extensions/tsconfig.json | 11 | ||||
-rw-r--r-- | contracts/extensions/tslint.json | 6 | ||||
-rw-r--r-- | contracts/interfaces/.solhint.json | 20 | ||||
-rw-r--r-- | contracts/interfaces/package.json | 4 | ||||
-rw-r--r-- | contracts/libs/.solhint.json | 20 | ||||
-rw-r--r-- | contracts/libs/package.json | 4 | ||||
-rw-r--r-- | contracts/multisig/.solhint.json | 20 | ||||
-rw-r--r-- | contracts/multisig/package.json | 6 | ||||
-rw-r--r-- | contracts/protocol/CHANGELOG.json (renamed from contracts/core/CHANGELOG.json) | 0 | ||||
-rw-r--r-- | contracts/protocol/README.md (renamed from contracts/core/README.md) | 8 | ||||
-rw-r--r-- | contracts/protocol/compiler.json (renamed from contracts/core/compiler.json) | 8 | ||||
-rw-r--r-- | contracts/protocol/contracts/protocol/AssetProxy/ERC20Proxy.sol (renamed from contracts/core/contracts/protocol/AssetProxy/ERC20Proxy.sol) | 0 | ||||
-rw-r--r-- | contracts/protocol/contracts/protocol/AssetProxy/ERC721Proxy.sol (renamed from contracts/core/contracts/protocol/AssetProxy/ERC721Proxy.sol) | 0 | ||||
-rw-r--r-- | contracts/protocol/contracts/protocol/AssetProxy/MixinAuthorizable.sol (renamed from contracts/core/contracts/protocol/AssetProxy/MixinAuthorizable.sol) | 0 | ||||
-rw-r--r-- | contracts/protocol/contracts/protocol/AssetProxy/MultiAssetProxy.sol (renamed from contracts/core/contracts/protocol/AssetProxy/MultiAssetProxy.sol) | 0 | ||||
-rw-r--r-- | contracts/protocol/contracts/protocol/AssetProxy/mixins/MAuthorizable.sol (renamed from contracts/core/contracts/protocol/AssetProxy/mixins/MAuthorizable.sol) | 0 | ||||
-rw-r--r-- | contracts/protocol/contracts/protocol/AssetProxyOwner/AssetProxyOwner.sol (renamed from contracts/core/contracts/protocol/AssetProxyOwner/AssetProxyOwner.sol) | 0 | ||||
-rw-r--r-- | contracts/protocol/contracts/protocol/Exchange/Exchange.sol (renamed from contracts/core/contracts/protocol/Exchange/Exchange.sol) | 0 | ||||
-rw-r--r-- | contracts/protocol/contracts/protocol/Exchange/MixinAssetProxyDispatcher.sol (renamed from contracts/core/contracts/protocol/Exchange/MixinAssetProxyDispatcher.sol) | 0 | ||||
-rw-r--r-- | contracts/protocol/contracts/protocol/Exchange/MixinExchangeCore.sol (renamed from contracts/core/contracts/protocol/Exchange/MixinExchangeCore.sol) | 0 | ||||
-rw-r--r-- | contracts/protocol/contracts/protocol/Exchange/MixinMatchOrders.sol (renamed from contracts/core/contracts/protocol/Exchange/MixinMatchOrders.sol) | 0 | ||||
-rw-r--r-- | contracts/protocol/contracts/protocol/Exchange/MixinSignatureValidator.sol (renamed from contracts/core/contracts/protocol/Exchange/MixinSignatureValidator.sol) | 0 | ||||
-rw-r--r-- | contracts/protocol/contracts/protocol/Exchange/MixinTransactions.sol (renamed from contracts/core/contracts/protocol/Exchange/MixinTransactions.sol) | 0 | ||||
-rw-r--r-- | contracts/protocol/contracts/protocol/Exchange/MixinWrapperFunctions.sol (renamed from contracts/core/contracts/protocol/Exchange/MixinWrapperFunctions.sol) | 0 | ||||
-rw-r--r-- | contracts/protocol/contracts/protocol/Exchange/mixins/MAssetProxyDispatcher.sol (renamed from contracts/core/contracts/protocol/Exchange/mixins/MAssetProxyDispatcher.sol) | 0 | ||||
-rw-r--r-- | contracts/protocol/contracts/protocol/Exchange/mixins/MExchangeCore.sol (renamed from contracts/core/contracts/protocol/Exchange/mixins/MExchangeCore.sol) | 0 | ||||
-rw-r--r-- | contracts/protocol/contracts/protocol/Exchange/mixins/MMatchOrders.sol (renamed from contracts/core/contracts/protocol/Exchange/mixins/MMatchOrders.sol) | 0 | ||||
-rw-r--r-- | contracts/protocol/contracts/protocol/Exchange/mixins/MSignatureValidator.sol (renamed from contracts/core/contracts/protocol/Exchange/mixins/MSignatureValidator.sol) | 0 | ||||
-rw-r--r-- | contracts/protocol/contracts/protocol/Exchange/mixins/MTransactions.sol (renamed from contracts/core/contracts/protocol/Exchange/mixins/MTransactions.sol) | 0 | ||||
-rw-r--r-- | contracts/protocol/contracts/protocol/Exchange/mixins/MWrapperFunctions.sol (renamed from contracts/core/contracts/protocol/Exchange/mixins/MWrapperFunctions.sol) | 0 | ||||
-rw-r--r-- | contracts/protocol/contracts/protocol/OrderValidator/OrderValidator.sol (renamed from contracts/core/contracts/extensions/OrderValidator/OrderValidator.sol) | 0 | ||||
-rw-r--r-- | contracts/protocol/contracts/test/TestAssetProxyDispatcher/TestAssetProxyDispatcher.sol (renamed from contracts/core/contracts/test/TestAssetProxyDispatcher/TestAssetProxyDispatcher.sol) | 0 | ||||
-rw-r--r-- | contracts/protocol/contracts/test/TestAssetProxyOwner/TestAssetProxyOwner.sol (renamed from contracts/core/contracts/test/TestAssetProxyOwner/TestAssetProxyOwner.sol) | 0 | ||||
-rw-r--r-- | contracts/protocol/contracts/test/TestExchangeInternals/TestExchangeInternals.sol (renamed from contracts/core/contracts/test/TestExchangeInternals/TestExchangeInternals.sol) | 0 | ||||
-rw-r--r-- | contracts/protocol/contracts/test/TestSignatureValidator/TestSignatureValidator.sol (renamed from contracts/core/contracts/test/TestSignatureValidator/TestSignatureValidator.sol) | 0 | ||||
-rw-r--r-- | contracts/protocol/contracts/test/TestStaticCallReceiver/TestStaticCallReceiver.sol (renamed from contracts/core/contracts/test/TestStaticCallReceiver/TestStaticCallReceiver.sol) | 0 | ||||
-rw-r--r-- | contracts/protocol/package.json (renamed from contracts/core/package.json) | 11 | ||||
-rw-r--r-- | contracts/protocol/src/artifacts/index.ts (renamed from contracts/core/src/artifacts/index.ts) | 12 | ||||
-rw-r--r-- | contracts/protocol/src/index.ts | 3 | ||||
-rw-r--r-- | contracts/protocol/src/wrappers/index.ts (renamed from contracts/core/src/wrappers/index.ts) | 6 | ||||
-rw-r--r-- | contracts/protocol/test/asset_proxy/authorizable.ts (renamed from contracts/core/test/asset_proxy/authorizable.ts) | 0 | ||||
-rw-r--r-- | contracts/protocol/test/asset_proxy/proxies.ts (renamed from contracts/core/test/asset_proxy/proxies.ts) | 0 | ||||
-rw-r--r-- | contracts/protocol/test/exchange/core.ts (renamed from contracts/core/test/exchange/core.ts) | 0 | ||||
-rw-r--r-- | contracts/protocol/test/exchange/dispatcher.ts (renamed from contracts/core/test/exchange/dispatcher.ts) | 0 | ||||
-rw-r--r-- | contracts/protocol/test/exchange/fill_order.ts (renamed from contracts/core/test/exchange/fill_order.ts) | 0 | ||||
-rw-r--r-- | contracts/protocol/test/exchange/internal.ts (renamed from contracts/core/test/exchange/internal.ts) | 0 | ||||
-rw-r--r-- | contracts/protocol/test/exchange/match_orders.ts (renamed from contracts/core/test/exchange/match_orders.ts) | 0 | ||||
-rw-r--r-- | contracts/protocol/test/exchange/order_validator.ts (renamed from contracts/core/test/extensions/order_validator.ts) | 18 | ||||
-rw-r--r-- | contracts/protocol/test/exchange/signature_validator.ts (renamed from contracts/core/test/exchange/signature_validator.ts) | 7 | ||||
-rw-r--r-- | contracts/protocol/test/exchange/transactions.ts (renamed from contracts/core/test/exchange/transactions.ts) | 7 | ||||
-rw-r--r-- | contracts/protocol/test/exchange/wrapper.ts (renamed from contracts/core/test/exchange/wrapper.ts) | 0 | ||||
-rw-r--r-- | contracts/protocol/test/global_hooks.ts | 17 | ||||
-rw-r--r-- | contracts/protocol/test/multisig/asset_proxy_owner.ts (renamed from contracts/core/test/multisig/asset_proxy_owner.ts) | 0 | ||||
-rw-r--r-- | contracts/protocol/test/utils/asset_proxy_owner_wrapper.ts (renamed from contracts/core/test/utils/asset_proxy_owner_wrapper.ts) | 0 | ||||
-rw-r--r-- | contracts/protocol/test/utils/asset_wrapper.ts (renamed from contracts/core/test/utils/asset_wrapper.ts) | 0 | ||||
-rw-r--r-- | contracts/protocol/test/utils/erc20_wrapper.ts (renamed from contracts/core/test/utils/erc20_wrapper.ts) | 0 | ||||
-rw-r--r-- | contracts/protocol/test/utils/erc721_wrapper.ts (renamed from contracts/core/test/utils/erc721_wrapper.ts) | 0 | ||||
-rw-r--r-- | contracts/protocol/test/utils/exchange_wrapper.ts (renamed from contracts/core/test/utils/exchange_wrapper.ts) | 0 | ||||
-rw-r--r-- | contracts/protocol/test/utils/fill_order_combinatorial_utils.ts (renamed from contracts/core/test/utils/fill_order_combinatorial_utils.ts) | 0 | ||||
-rw-r--r-- | contracts/protocol/test/utils/index.ts | 3 | ||||
-rw-r--r-- | contracts/protocol/test/utils/match_order_tester.ts (renamed from contracts/core/test/utils/match_order_tester.ts) | 0 | ||||
-rw-r--r-- | contracts/protocol/test/utils/order_factory_from_scenario.ts (renamed from contracts/core/test/utils/order_factory_from_scenario.ts) | 0 | ||||
-rw-r--r-- | contracts/protocol/test/utils/simple_asset_balance_and_proxy_allowance_fetcher.ts (renamed from contracts/core/test/utils/simple_asset_balance_and_proxy_allowance_fetcher.ts) | 0 | ||||
-rw-r--r-- | contracts/protocol/test/utils/simple_order_filled_cancelled_fetcher.ts (renamed from contracts/core/test/utils/simple_order_filled_cancelled_fetcher.ts) | 0 | ||||
-rw-r--r-- | contracts/protocol/tsconfig.json (renamed from contracts/core/tsconfig.json) | 8 | ||||
-rw-r--r-- | contracts/protocol/tslint.json | 6 | ||||
-rw-r--r-- | contracts/tokens/.solhint.json | 20 | ||||
-rw-r--r-- | contracts/tokens/package.json | 4 | ||||
-rw-r--r-- | contracts/utils/.solhint.json | 20 | ||||
-rw-r--r-- | contracts/utils/package.json | 4 | ||||
-rw-r--r-- | yarn.lock | 6 |
112 files changed, 519 insertions, 451 deletions
diff --git a/.circleci/config.yml b/.circleci/config.yml index 6bb8d903d..6e018c62d 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -44,7 +44,8 @@ jobs: - run: yarn wsrun test:circleci @0x/contracts-utils - run: yarn wsrun test:circleci @0x/contracts-libs - run: yarn wsrun test:circleci @0x/contracts-tokens - - run: yarn wsrun test:circleci @0x/contracts-core + - run: yarn wsrun test:circleci @0x/contracts-extensions + - run: yarn wsrun test:circleci @0x/contracts-protocol test-contracts-geth: docker: - image: circleci/node:9 @@ -60,7 +61,8 @@ jobs: - run: TEST_PROVIDER=geth yarn wsrun test @0x/contracts-utils - run: TEST_PROVIDER=geth yarn wsrun test @0x/contracts-libs - run: TEST_PROVIDER=geth yarn wsrun test @0x/contracts-tokens - - run: TEST_PROVIDER=geth yarn wsrun test @0x/contracts-core + - run: TEST_PROVIDER=geth yarn wsrun test @0x/contracts-extensions + - run: TEST_PROVIDER=geth yarn wsrun test @0x/contracts-protocol test-publish: resource_class: medium+ docker: diff --git a/.gitignore b/.gitignore index 207739cda..1d4410e25 100644 --- a/.gitignore +++ b/.gitignore @@ -83,23 +83,27 @@ packages/react-docs/example/public/bundle* packages/testnet-faucets/server/ # generated contract artifacts/ -contracts/core/generated-artifacts/ +contracts/protocol/generated-artifacts/ contracts/multisig/generated-artifacts/ contracts/utils/generated-artifacts/ contracts/libs/generated-artifacts/ contracts/interfaces/generated-artifacts/ contracts/tokens/generated-artifacts/ +contracts/examples/generated-artifacts/ +contracts/extensions/generated-artifacts/ packages/sol-cov/test/fixtures/artifacts/ packages/metacoin/artifacts/ # generated contract wrappers packages/abi-gen-wrappers/wrappers -contracts/core/generated-wrappers/ +contracts/protocol/generated-wrappers/ contracts/multisig/generated-wrappers/ contracts/utils/generated-wrappers/ contracts/libs/generated-wrappers/ contracts/interfaces/generated-wrappers/ contracts/tokens/generated-wrappers/ +contracts/examples/generated-wrappers/ +contracts/extensions/generated-wrappers/ packages/metacoin/src/contract_wrappers # solc-bin in sol-compiler diff --git a/.prettierignore b/.prettierignore index 4da37ae6e..7f8662b0a 100644 --- a/.prettierignore +++ b/.prettierignore @@ -1,7 +1,7 @@ lib .nyc_output -/contracts/core/generated-wrappers -/contracts/core/generated-artifacts +/contracts/protocol/generated-wrappers +/contracts/protocol/generated-artifacts /contracts/multisig/generated-wrappers /contracts/multisig/generated-artifacts /contracts/utils/generated-wrappers @@ -12,6 +12,10 @@ lib /contracts/interfaces/generated-artifacts /contracts/tokens/generated-wrappers /contracts/tokens/generated-artifacts +/contracts/examples/generated-wrappers +/contracts/examples/generated-artifacts +/contracts/extensions/generated-wrappers +/contracts/extensions/generated-artifacts /packages/abi-gen-wrappers/src/generated-wrappers /packages/contract-artifacts/artifacts /python-packages/order_utils/src/zero_ex/contract_artifacts/artifacts diff --git a/contracts/core/.solhint.json b/contracts/.solhint.json index 076afe9f3..076afe9f3 100644 --- a/contracts/core/.solhint.json +++ b/contracts/.solhint.json diff --git a/contracts/core/test/tutorials/arbitrage.ts b/contracts/core/test/tutorials/arbitrage.ts deleted file mode 100644 index 78e0bc238..000000000 --- a/contracts/core/test/tutorials/arbitrage.ts +++ /dev/null @@ -1,260 +0,0 @@ -// import { ECSignature, SignedOrder, ZeroEx } from '0x.js'; -// import { BlockchainLifecycle, devConstants, web3Factory } from '@0x/dev-utils'; -// import { ExchangeContractErrs } from 'ethereum-types'; -// import { BigNumber } from '@0x/utils'; -// import { Web3Wrapper } from '@0x/web3-wrapper'; -// import * as chai from 'chai'; -// import ethUtil = require('ethereumjs-util'); -// import * as Web3 from 'web3'; - -// import { AccountLevelsContract } from '../../src/generated_contract_wrappers/account_levels'; -// import { ArbitrageContract } from '../../src/generated_contract_wrappers/arbitrage'; -// import { DummyTokenContract } from '../../src/generated_contract_wrappers/dummy_token'; -// import { EtherDeltaContract } from '../../src/generated_contract_wrappers/ether_delta'; -// import { ExchangeContract } from '../../src/generated_contract_wrappers/exchange'; -// import { TokenTransferProxyContract } from '../../src/generated_contract_wrappers/token_transfer_proxy'; -// import { artifacts } from '../../util/artifacts'; -// import { Balances } from '../../util/balances'; -// import { constants } from '../../util/constants'; -// import { crypto } from '../../util/crypto'; -// import { ExchangeWrapper } from '../../util/exchange_wrapper'; -// import { OrderFactory } from '../../util/order_factory'; -// import { BalancesByOwner, ContractName } from '../../util/types'; -// import { chaiSetup } from '../utils/chai_setup'; - -// import { provider, txDefaults, web3Wrapper } from '../utils/web3_wrapper'; - -// chaiSetup.configure(); -// const expect = chai.expect; -// const blockchainLifecycle = new BlockchainLifecycle(web3Wrapper); - -// describe('Arbitrage', () => { -// let coinbase: string; -// let maker: string; -// let edMaker: string; -// let edFrontRunner: string; -// let amountGet: BigNumber; -// let amountGive: BigNumber; -// let makerTokenAmount: BigNumber; -// let takerTokenAmount: BigNumber; -// const feeRecipient = constants.NULL_ADDRESS; -// const INITIAL_BALANCE = ZeroEx.toBaseUnitAmount(new BigNumber(10000), 18); -// const INITIAL_ALLOWANCE = ZeroEx.toBaseUnitAmount(new BigNumber(10000), 18); - -// let weth: DummyTokenContract; -// let zrx: DummyTokenContract; -// let arbitrage: ArbitrageContract; -// let etherDelta: EtherDeltaContract; - -// let signedOrder: SignedOrder; -// let exWrapper: ExchangeWrapper; -// let orderFactory: OrderFactory; - -// let zeroEx: ZeroEx; - -// // From a bird's eye view - we create two orders. -// // 0x order of 1 ZRX (maker) for 1 WETH (taker) -// // ED order of 2 WETH (tokenGive) for 1 ZRX (tokenGet) -// // And then we do an atomic arbitrage between them which gives us 1 WETH. -// before(async () => { -// const accounts = await web3Wrapper.getAvailableAddressesAsync(); -// [coinbase, maker, edMaker, edFrontRunner] = accounts; -// weth = await DummyTokenContract.deployFrom0xArtifactAsync( -// artifacts.DummyToken, -// provider, -// txDefaults, -// constants.DUMMY_TOKEN_NAME, -// constants.DUMMY_TOKEN_SYMBOL, -// constants.DUMMY_TOKEN_DECIMALS, -// constants.DUMMY_TOKEN_TOTAL_SUPPLY, -// ); -// zrx = await DummyTokenContract.deployFrom0xArtifactAsync( -// artifacts.DummyToken, -// provider, -// txDefaults, -// constants.DUMMY_TOKEN_NAME, -// constants.DUMMY_TOKEN_SYMBOL, -// constants.DUMMY_TOKEN_DECIMALS, -// constants.DUMMY_TOKEN_TOTAL_SUPPLY, -// ); -// const accountLevels = await AccountLevelsContract.deployFrom0xArtifactAsync( -// artifacts.AccountLevels, -// provider, -// txDefaults, -// ); -// const edAdminAddress = accounts[0]; -// const edMakerFee = new BigNumber(0); -// const edTakerFee = new BigNumber(0); -// const edFeeRebate = new BigNumber(0); -// etherDelta = await EtherDeltaContract.deployFrom0xArtifactAsync( -// artifacts.EtherDelta, -// provider, -// txDefaults, -// edAdminAddress, -// feeRecipient, -// accountLevels.address, -// edMakerFee, -// edTakerFee, -// edFeeRebate, -// ); -// const tokenTransferProxy = await TokenTransferProxyContract.deployFrom0xArtifactAsync( -// artifacts.TokenTransferProxy, -// provider, -// txDefaults, -// ); -// const exchange = await ExchangeContract.deployFrom0xArtifactAsync( -// artifacts.Exchange, -// provider, -// txDefaults, -// zrx.address, -// tokenTransferProxy.address, -// ); -// await tokenTransferProxy.addAuthorizedAddress.sendTransactionAsync(exchange.address, { from: accounts[0] }); -// zeroEx = new ZeroEx(provider, { -// exchangeContractAddress: exchange.address, -// networkId: constants.TESTRPC_NETWORK_ID, -// }); -// exWrapper = new ExchangeWrapper(exchange, provider); - -// makerTokenAmount = ZeroEx.toBaseUnitAmount(new BigNumber(1), 18); -// takerTokenAmount = makerTokenAmount; -// const defaultOrderParams = { -// exchangeContractAddress: exchange.address, -// maker, -// feeRecipient, -// makerTokenAddress: zrx.address, -// takerTokenAddress: weth.address, -// makerTokenAmount, -// takerTokenAmount, -// makerFee: new BigNumber(0), -// takerFee: new BigNumber(0), -// }; -// orderFactory = new OrderFactory(zeroEx, defaultOrderParams); -// arbitrage = await ArbitrageContract.deployFrom0xArtifactAsync( -// artifacts.Arbitrage, -// provider, -// txDefaults, -// exchange.address, -// etherDelta.address, -// tokenTransferProxy.address, -// ); -// // Enable arbitrage and withdrawals of tokens -// await arbitrage.setAllowances.sendTransactionAsync(weth.address, { from: coinbase }); -// await arbitrage.setAllowances.sendTransactionAsync(zrx.address, { from: coinbase }); - -// // Give some tokens to arbitrage contract -// await weth.setBalance.sendTransactionAsync(arbitrage.address, takerTokenAmount, { from: coinbase }); - -// // Fund the maker on exchange side -// await zrx.setBalance.sendTransactionAsync(maker, makerTokenAmount, { from: coinbase }); -// // Set the allowance for the maker on Exchange side -// await zrx.approve.sendTransactionAsync(tokenTransferProxy.address, INITIAL_ALLOWANCE, { from: maker }); - -// amountGive = ZeroEx.toBaseUnitAmount(new BigNumber(2), 18); -// // Fund the maker on EtherDelta side -// await weth.setBalance.sendTransactionAsync(edMaker, amountGive, { from: coinbase }); -// // Set the allowance for the maker on EtherDelta side -// await weth.approve.sendTransactionAsync(etherDelta.address, INITIAL_ALLOWANCE, { from: edMaker }); -// // Deposit maker funds into EtherDelta -// await etherDelta.depositToken.sendTransactionAsync(weth.address, amountGive, { from: edMaker }); - -// amountGet = makerTokenAmount; -// // Fund the front runner on EtherDelta side -// await zrx.setBalance.sendTransactionAsync(edFrontRunner, amountGet, { from: coinbase }); -// // Set the allowance for the front-runner on EtherDelta side -// await zrx.approve.sendTransactionAsync(etherDelta.address, INITIAL_ALLOWANCE, { from: edFrontRunner }); -// // Deposit front runner funds into EtherDelta -// await etherDelta.depositToken.sendTransactionAsync(zrx.address, amountGet, { from: edFrontRunner }); -// }); -// beforeEach(async () => { -// await blockchainLifecycle.startAsync(); -// }); -// afterEach(async () => { -// await blockchainLifecycle.revertAsync(); -// }); -// describe('makeAtomicTrade', () => { -// let addresses: string[]; -// let values: BigNumber[]; -// let v: number[]; -// let r: string[]; -// let s: string[]; -// let tokenGet: string; -// let tokenGive: string; -// let expires: BigNumber; -// let nonce: BigNumber; -// let edSignature: ECSignature; -// before(async () => { -// signedOrder = await orderFactory.newSignedOrderAsync(); -// tokenGet = zrx.address; -// tokenGive = weth.address; -// const blockNumber = await web3Wrapper.getBlockNumberAsync(); -// const ED_ORDER_EXPIRATION_IN_BLOCKS = 10; -// expires = new BigNumber(blockNumber + ED_ORDER_EXPIRATION_IN_BLOCKS); -// nonce = new BigNumber(42); -// const edOrderHash = `0x${crypto -// .solSHA256([etherDelta.address, tokenGet, amountGet, tokenGive, amountGive, expires, nonce]) -// .toString('hex')}`; -// const shouldAddPersonalMessagePrefix = false; -// edSignature = await zeroEx.signOrderHashAsync(edOrderHash, edMaker, shouldAddPersonalMessagePrefix); -// addresses = [ -// signedOrder.maker, -// signedOrder.taker, -// signedOrder.makerTokenAddress, -// signedOrder.takerTokenAddress, -// signedOrder.feeRecipient, -// edMaker, -// ]; -// const fillTakerTokenAmount = takerTokenAmount; -// const edFillAmount = makerTokenAmount; -// values = [ -// signedOrder.makerTokenAmount, -// signedOrder.takerTokenAmount, -// signedOrder.makerFee, -// signedOrder.takerFee, -// signedOrder.expirationUnixTimestampSec, -// signedOrder.salt, -// fillTakerTokenAmount, -// amountGet, -// amountGive, -// expires, -// nonce, -// edFillAmount, -// ]; -// v = [signedOrder.ecSignature.v, edSignature.v]; -// r = [signedOrder.ecSignature.r, edSignature.r]; -// s = [signedOrder.ecSignature.s, edSignature.s]; -// }); -// it('should successfully execute the arbitrage if not front-runned', async () => { -// const txHash = await arbitrage.makeAtomicTrade.sendTransactionAsync(addresses, values, v, r, s, { -// from: coinbase, -// }); -// const res = await zeroEx.awaitTransactionMinedAsync(txHash); -// const postBalance = await weth.balanceOf.callAsync(arbitrage.address); -// expect(postBalance).to.be.bignumber.equal(amountGive); -// }); -// it('should fail and revert if front-runned', async () => { -// const preBalance = await weth.balanceOf.callAsync(arbitrage.address); -// // Front-running transaction -// await etherDelta.trade.sendTransactionAsync( -// tokenGet, -// amountGet, -// tokenGive, -// amountGive, -// expires, -// nonce, -// edMaker, -// edSignature.v, -// edSignature.r, -// edSignature.s, -// amountGet, -// { from: edFrontRunner }, -// ); -// // tslint:disable-next-line:await-promise -// await expect( -// arbitrage.makeAtomicTrade.sendTransactionAsync(addresses, values, v, r, s, { from: coinbase }), -// ).to.be.rejectedWith(constants.REVERT); -// const postBalance = await weth.balanceOf.callAsync(arbitrage.address); -// expect(preBalance).to.be.bignumber.equal(postBalance); -// }); -// }); -// }); diff --git a/contracts/examples/README.md b/contracts/examples/README.md new file mode 100644 index 000000000..ca23d0974 --- /dev/null +++ b/contracts/examples/README.md @@ -0,0 +1,56 @@ +## Contract examples + +Example smart contracts that interact with 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/core/contracts/examples/ExchangeWrapper/ExchangeWrapper.sol b/contracts/examples/contracts/ExchangeWrapper/ExchangeWrapper.sol index d98136922..d98136922 100644 --- a/contracts/core/contracts/examples/ExchangeWrapper/ExchangeWrapper.sol +++ b/contracts/examples/contracts/ExchangeWrapper/ExchangeWrapper.sol diff --git a/contracts/core/contracts/examples/Validator/Validator.sol b/contracts/examples/contracts/Validator/Validator.sol index e488a9ca7..e488a9ca7 100644 --- a/contracts/core/contracts/examples/Validator/Validator.sol +++ b/contracts/examples/contracts/Validator/Validator.sol diff --git a/contracts/core/contracts/examples/Wallet/Wallet.sol b/contracts/examples/contracts/Wallet/Wallet.sol index 8edc74eb3..8edc74eb3 100644 --- a/contracts/core/contracts/examples/Wallet/Wallet.sol +++ b/contracts/examples/contracts/Wallet/Wallet.sol diff --git a/contracts/core/contracts/examples/Whitelist/Whitelist.sol b/contracts/examples/contracts/Whitelist/Whitelist.sol index 2a3d33738..2a3d33738 100644 --- a/contracts/core/contracts/examples/Whitelist/Whitelist.sol +++ b/contracts/examples/contracts/Whitelist/Whitelist.sol diff --git a/contracts/examples/package.json b/contracts/examples/package.json new file mode 100644 index 000000000..541a67f2c --- /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 -c ../.solhint.json 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/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/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.4.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/core/src/index.ts b/contracts/examples/src/index.ts index d55f08ea2..d55f08ea2 100644 --- a/contracts/core/src/index.ts +++ b/contracts/examples/src/index.ts 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/core/tslint.json b/contracts/examples/tslint.json index 1bb3ac2a2..1bb3ac2a2 100644 --- a/contracts/core/tslint.json +++ b/contracts/examples/tslint.json diff --git a/contracts/extensions/README.md b/contracts/extensions/README.md new file mode 100644 index 000000000..820f6e78a --- /dev/null +++ b/contracts/extensions/README.md @@ -0,0 +1,69 @@ +## Contract extensions + +Smart contracts that implement extensions for the 0x protocol. + +## Usage + +Contract extensions of the protocol can be found in the [contracts](./contracts) directory. This directory contains contracts that interact with the 2.0.0 contracts and will be used in production, such as the [Forwarder](https://github.com/0xProject/0x-protocol-specification/blob/master/v2/forwarder-specification.md) contract. + +## Bug bounty + +A bug bounty for the 2.0.0 contracts is ongoing! Instructions can be found [here](https://0xproject.com/wiki#Bug-Bounty). + +## 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-extensions yarn build +``` + +Or continuously rebuild on change: + +```bash +PKG=@0x/contracts-extensions yarn watch +``` + +### Clean + +```bash +yarn clean +``` + +### Lint + +```bash +yarn lint +``` + +### Run Tests + +```bash +yarn test +``` + +#### Testing options + +Contracts testing options like coverage, profiling, revert traces or backing node choosing - are described [here](../TESTING.md). diff --git a/contracts/extensions/compiler.json b/contracts/extensions/compiler.json new file mode 100644 index 000000000..69d607b3e --- /dev/null +++ b/contracts/extensions/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": ["DutchAuction", "Forwarder"] +} diff --git a/contracts/core/contracts/extensions/DutchAuction/DutchAuction.sol b/contracts/extensions/contracts/DutchAuction/DutchAuction.sol index 9c9f3990a..9c9f3990a 100644 --- a/contracts/core/contracts/extensions/DutchAuction/DutchAuction.sol +++ b/contracts/extensions/contracts/DutchAuction/DutchAuction.sol diff --git a/contracts/core/contracts/extensions/Forwarder/Forwarder.sol b/contracts/extensions/contracts/Forwarder/Forwarder.sol index 94dec40ed..94dec40ed 100644 --- a/contracts/core/contracts/extensions/Forwarder/Forwarder.sol +++ b/contracts/extensions/contracts/Forwarder/Forwarder.sol diff --git a/contracts/core/contracts/extensions/Forwarder/MixinAssets.sol b/contracts/extensions/contracts/Forwarder/MixinAssets.sol index 3ebf75161..3ebf75161 100644 --- a/contracts/core/contracts/extensions/Forwarder/MixinAssets.sol +++ b/contracts/extensions/contracts/Forwarder/MixinAssets.sol diff --git a/contracts/core/contracts/extensions/Forwarder/MixinExchangeWrapper.sol b/contracts/extensions/contracts/Forwarder/MixinExchangeWrapper.sol index 210eb14c2..210eb14c2 100644 --- a/contracts/core/contracts/extensions/Forwarder/MixinExchangeWrapper.sol +++ b/contracts/extensions/contracts/Forwarder/MixinExchangeWrapper.sol diff --git a/contracts/core/contracts/extensions/Forwarder/MixinForwarderCore.sol b/contracts/extensions/contracts/Forwarder/MixinForwarderCore.sol index bab78d79b..bab78d79b 100644 --- a/contracts/core/contracts/extensions/Forwarder/MixinForwarderCore.sol +++ b/contracts/extensions/contracts/Forwarder/MixinForwarderCore.sol diff --git a/contracts/core/contracts/extensions/Forwarder/MixinWeth.sol b/contracts/extensions/contracts/Forwarder/MixinWeth.sol index 2a281f3ae..2a281f3ae 100644 --- a/contracts/core/contracts/extensions/Forwarder/MixinWeth.sol +++ b/contracts/extensions/contracts/Forwarder/MixinWeth.sol diff --git a/contracts/core/contracts/extensions/Forwarder/interfaces/IAssets.sol b/contracts/extensions/contracts/Forwarder/interfaces/IAssets.sol index 1e034c003..1e034c003 100644 --- a/contracts/core/contracts/extensions/Forwarder/interfaces/IAssets.sol +++ b/contracts/extensions/contracts/Forwarder/interfaces/IAssets.sol diff --git a/contracts/core/contracts/extensions/Forwarder/interfaces/IForwarder.sol b/contracts/extensions/contracts/Forwarder/interfaces/IForwarder.sol index f5a26e2ba..f5a26e2ba 100644 --- a/contracts/core/contracts/extensions/Forwarder/interfaces/IForwarder.sol +++ b/contracts/extensions/contracts/Forwarder/interfaces/IForwarder.sol diff --git a/contracts/core/contracts/extensions/Forwarder/interfaces/IForwarderCore.sol b/contracts/extensions/contracts/Forwarder/interfaces/IForwarderCore.sol index eede20bb8..eede20bb8 100644 --- a/contracts/core/contracts/extensions/Forwarder/interfaces/IForwarderCore.sol +++ b/contracts/extensions/contracts/Forwarder/interfaces/IForwarderCore.sol diff --git a/contracts/core/contracts/extensions/Forwarder/libs/LibConstants.sol b/contracts/extensions/contracts/Forwarder/libs/LibConstants.sol index 4a81abf76..4a81abf76 100644 --- a/contracts/core/contracts/extensions/Forwarder/libs/LibConstants.sol +++ b/contracts/extensions/contracts/Forwarder/libs/LibConstants.sol diff --git a/contracts/core/contracts/extensions/Forwarder/libs/LibForwarderErrors.sol b/contracts/extensions/contracts/Forwarder/libs/LibForwarderErrors.sol index fb3ade1db..fb3ade1db 100644 --- a/contracts/core/contracts/extensions/Forwarder/libs/LibForwarderErrors.sol +++ b/contracts/extensions/contracts/Forwarder/libs/LibForwarderErrors.sol diff --git a/contracts/core/contracts/extensions/Forwarder/mixins/MAssets.sol b/contracts/extensions/contracts/Forwarder/mixins/MAssets.sol index 9e7f80d97..9e7f80d97 100644 --- a/contracts/core/contracts/extensions/Forwarder/mixins/MAssets.sol +++ b/contracts/extensions/contracts/Forwarder/mixins/MAssets.sol diff --git a/contracts/core/contracts/extensions/Forwarder/mixins/MExchangeWrapper.sol b/contracts/extensions/contracts/Forwarder/mixins/MExchangeWrapper.sol index d9e71786a..d9e71786a 100644 --- a/contracts/core/contracts/extensions/Forwarder/mixins/MExchangeWrapper.sol +++ b/contracts/extensions/contracts/Forwarder/mixins/MExchangeWrapper.sol diff --git a/contracts/core/contracts/extensions/Forwarder/mixins/MWeth.sol b/contracts/extensions/contracts/Forwarder/mixins/MWeth.sol index 88e77be4e..88e77be4e 100644 --- a/contracts/core/contracts/extensions/Forwarder/mixins/MWeth.sol +++ b/contracts/extensions/contracts/Forwarder/mixins/MWeth.sol diff --git a/contracts/extensions/package.json b/contracts/extensions/package.json new file mode 100644 index 000000000..c09f69e43 --- /dev/null +++ b/contracts/extensions/package.json @@ -0,0 +1,95 @@ +{ + "private": true, + "name": "@0x/contracts-extensions", + "version": "1.0.0", + "engines": { + "node": ">=6.12" + }, + "description": "Smart contract extensions 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", + "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:profiler": "SOLIDITY_PROFILER=true run-s build run_mocha profiler:report:html", + "test:trace": "SOLIDITY_REVERT_TRACE=true run-s build run_mocha", + "run_mocha": + "mocha --require source-map-support/register --require make-promises-safe 'lib/test/**/*.js' --timeout 100000 --bail --exit", + "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", + "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", + "lint-contracts": "solhint -c ../.solhint.json contracts/**/**/**/**/*.sol" + }, + "config": { + "abis": "generated-artifacts/@(DutchAuction|Forwarder).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/extensions/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.4.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-utils": "^1.0.0", + "@0x/contracts-protocol": "^2.1.56", + "@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/extensions/src/artifacts/index.ts b/contracts/extensions/src/artifacts/index.ts new file mode 100644 index 000000000..7588178f0 --- /dev/null +++ b/contracts/extensions/src/artifacts/index.ts @@ -0,0 +1,9 @@ +import { ContractArtifact } from 'ethereum-types'; + +import * as DutchAuction from '../../generated-artifacts/DutchAuction.json'; +import * as Forwarder from '../../generated-artifacts/Forwarder.json'; + +export const artifacts = { + DutchAuction: DutchAuction as ContractArtifact, + Forwarder: Forwarder as ContractArtifact, +}; diff --git a/contracts/extensions/src/index.ts b/contracts/extensions/src/index.ts new file mode 100644 index 000000000..d55f08ea2 --- /dev/null +++ b/contracts/extensions/src/index.ts @@ -0,0 +1,2 @@ +export * from './artifacts'; +export * from './wrappers'; diff --git a/contracts/extensions/src/wrappers/index.ts b/contracts/extensions/src/wrappers/index.ts new file mode 100644 index 000000000..90880e37f --- /dev/null +++ b/contracts/extensions/src/wrappers/index.ts @@ -0,0 +1,2 @@ +export * from '../../generated-wrappers/dutch_auction'; +export * from '../../generated-wrappers/forwarder'; diff --git a/contracts/core/test/extensions/dutch_auction.ts b/contracts/extensions/test/extensions/dutch_auction.ts index b396d4206..6c3b2f0f3 100644 --- a/contracts/core/test/extensions/dutch_auction.ts +++ b/contracts/extensions/test/extensions/dutch_auction.ts @@ -1,4 +1,11 @@ import { + artifacts as protocolArtifacts, + ERC20Wrapper, + ERC721Wrapper, + ExchangeContract, + ExchangeWrapper, +} from '@0x/contracts-protocol'; +import { chaiSetup, constants, ContractName, @@ -27,11 +34,7 @@ import * as ethUtil from 'ethereumjs-util'; import * as _ from 'lodash'; import { DutchAuctionContract } from '../../generated-wrappers/dutch_auction'; -import { ExchangeContract } from '../../generated-wrappers/exchange'; import { artifacts } from '../../src/artifacts'; -import { ERC20Wrapper } from '../utils/erc20_wrapper'; -import { ERC721Wrapper } from '../utils/erc721_wrapper'; -import { ExchangeWrapper } from '../utils/exchange_wrapper'; chaiSetup.configure(); const expect = chai.expect; @@ -106,7 +109,7 @@ describe(ContractName.DutchAuction, () => { const zrxAssetData = assetDataUtils.encodeERC20AssetData(zrxToken.address); const exchangeInstance = await ExchangeContract.deployFrom0xArtifactAsync( - artifacts.Exchange, + protocolArtifacts.Exchange, provider, txDefaults, zrxAssetData, diff --git a/contracts/core/test/extensions/forwarder.ts b/contracts/extensions/test/extensions/forwarder.ts index ffa015dd2..4027f493d 100644 --- a/contracts/core/test/extensions/forwarder.ts +++ b/contracts/extensions/test/extensions/forwarder.ts @@ -1,4 +1,11 @@ import { + artifacts as protocolArtifacts, + ERC20Wrapper, + ERC721Wrapper, + ExchangeContract, + ExchangeWrapper, +} from '@0x/contracts-protocol'; +import { chaiSetup, constants, ContractName, @@ -25,12 +32,9 @@ import { Web3Wrapper } from '@0x/web3-wrapper'; import * as chai from 'chai'; import { TransactionReceiptWithDecodedLogs } from 'ethereum-types'; -import { ExchangeContract } from '../../generated-wrappers/exchange'; import { ForwarderContract } from '../../generated-wrappers/forwarder'; import { artifacts } from '../../src/artifacts'; -import { ERC20Wrapper } from '../utils/erc20_wrapper'; -import { ERC721Wrapper } from '../utils/erc721_wrapper'; -import { ExchangeWrapper } from '../utils/exchange_wrapper'; + import { ForwarderWrapper } from '../utils/forwarder_wrapper'; chaiSetup.configure(); @@ -104,7 +108,7 @@ describe(ContractName.Forwarder, () => { wethAssetData = assetDataUtils.encodeERC20AssetData(wethContract.address); zrxAssetData = assetDataUtils.encodeERC20AssetData(zrxToken.address); const exchangeInstance = await ExchangeContract.deployFrom0xArtifactAsync( - artifacts.Exchange, + protocolArtifacts.Exchange, provider, txDefaults, zrxAssetData, @@ -175,7 +179,7 @@ describe(ContractName.Forwarder, () => { describe('constructor', () => { it('should revert if assetProxy is unregistered', async () => { const exchangeInstance = await ExchangeContract.deployFrom0xArtifactAsync( - artifacts.Exchange, + protocolArtifacts.Exchange, provider, txDefaults, zrxAssetData, diff --git a/contracts/core/test/global_hooks.ts b/contracts/extensions/test/global_hooks.ts index f8ace376a..f8ace376a 100644 --- a/contracts/core/test/global_hooks.ts +++ b/contracts/extensions/test/global_hooks.ts diff --git a/contracts/core/test/utils/forwarder_wrapper.ts b/contracts/extensions/test/utils/forwarder_wrapper.ts index 4c78ecd79..9e44ff6b9 100644 --- a/contracts/core/test/utils/forwarder_wrapper.ts +++ b/contracts/extensions/test/utils/forwarder_wrapper.ts @@ -1,3 +1,4 @@ +import { artifacts as protocolArtifacts } from '@0x/contracts-protocol'; import { constants, formatters, LogDecoder, MarketSellOrders } from '@0x/contracts-test-utils'; import { artifacts as tokensArtifacts } from '@0x/contracts-tokens'; import { SignedOrder } from '@0x/types'; @@ -59,7 +60,11 @@ export class ForwarderWrapper { constructor(contractInstance: ForwarderContract, provider: Provider) { this._forwarderContract = contractInstance; this._web3Wrapper = new Web3Wrapper(provider); - this._logDecoder = new LogDecoder(this._web3Wrapper, { ...artifacts, ...tokensArtifacts }); + this._logDecoder = new LogDecoder(this._web3Wrapper, { + ...artifacts, + ...tokensArtifacts, + ...protocolArtifacts, + }); } public async marketSellOrdersWithEthAsync( orders: SignedOrder[], diff --git a/contracts/extensions/tsconfig.json b/contracts/extensions/tsconfig.json new file mode 100644 index 000000000..a4ce1e002 --- /dev/null +++ b/contracts/extensions/tsconfig.json @@ -0,0 +1,11 @@ +{ + "extends": "../../tsconfig", + "compilerOptions": { + "outDir": "lib", + "rootDir": ".", + "resolveJsonModule": true + }, + "include": ["./src/**/*", "./test/**/*", "./generated-wrappers/**/*"], + "files": ["./generated-artifacts/DutchAuction.json", "./generated-artifacts/Forwarder.json"], + "exclude": ["./deploy/solc/solc_bin"] +} diff --git a/contracts/extensions/tslint.json b/contracts/extensions/tslint.json new file mode 100644 index 000000000..1bb3ac2a2 --- /dev/null +++ b/contracts/extensions/tslint.json @@ -0,0 +1,6 @@ +{ + "extends": ["@0x/tslint-config"], + "rules": { + "custom-no-magic-numbers": false + } +} diff --git a/contracts/interfaces/.solhint.json b/contracts/interfaces/.solhint.json deleted file mode 100644 index 076afe9f3..000000000 --- a/contracts/interfaces/.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/interfaces/package.json b/contracts/interfaces/package.json index b79ae20ff..04d307f5d 100644 --- a/contracts/interfaces/package.json +++ b/contracts/interfaces/package.json @@ -15,7 +15,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/@(IAssetData|IAssetProxy|IAuthorizable|IAssetProxyDispatcher|IExchange|IExchangeCore|IMatchOrders|ISignatureValidator|ITransactions|IValidator|IWallet|IWrapperFunctions).json" @@ -35,7 +35,7 @@ "@0x/tslint-config": "^1.0.10", "npm-run-all": "^4.1.2", "shx": "^0.2.2", - "solhint": "^1.2.1", + "solhint": "^1.4.1", "tslint": "5.11.0", "typescript": "3.0.1", "yargs": "^10.0.3" diff --git a/contracts/libs/.solhint.json b/contracts/libs/.solhint.json deleted file mode 100644 index 076afe9f3..000000000 --- a/contracts/libs/.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/libs/package.json b/contracts/libs/package.json index 74288be76..6ea91cad4 100644 --- a/contracts/libs/package.json +++ b/contracts/libs/package.json @@ -30,7 +30,7 @@ "profiler:report:html": "istanbul report html && open coverage/index.html", "coverage:report:lcov": "istanbul report lcov", "test:circleci": "yarn test", - "lint-contracts": "solhint contracts/**/**/**/**/*.sol" + "lint-contracts": "solhint -c ../.solhint.json contracts/**/**/**/**/*.sol" }, "config": { "abis": "generated-artifacts/@(LibMath|LibOrder|LibFillResults|LibAbiEncoder|TestLibs|LibEIP712).json" @@ -66,7 +66,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" diff --git a/contracts/multisig/.solhint.json b/contracts/multisig/.solhint.json deleted file mode 100644 index 076afe9f3..000000000 --- a/contracts/multisig/.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/multisig/package.json b/contracts/multisig/package.json index 37d064fef..936473142 100644 --- a/contracts/multisig/package.json +++ b/contracts/multisig/package.json @@ -29,7 +29,7 @@ "profiler:report:html": "istanbul report html && open coverage/index.html", "coverage:report:lcov": "istanbul report lcov", "test:circleci": "yarn test", - "lint-contracts": "solhint contracts/**/**/**/**/*.sol" + "lint-contracts": "solhint -c ../.solhint.json contracts/**/**/**/**/*.sol" }, "config": { "abis": "generated-artifacts/@(MultiSigWallet|MultiSigWalletWithTimeLock|TestRejectEther).json" @@ -42,7 +42,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/multisig/README.md", "devDependencies": { "@0x/contracts-test-utils": "^1.0.0", "@0x/abi-gen": "^1.0.17", @@ -65,7 +65,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" diff --git a/contracts/core/CHANGELOG.json b/contracts/protocol/CHANGELOG.json index 371f18cd4..371f18cd4 100644 --- a/contracts/core/CHANGELOG.json +++ b/contracts/protocol/CHANGELOG.json diff --git a/contracts/core/README.md b/contracts/protocol/README.md index 8371d8041..5fc9c0a89 100644 --- a/contracts/core/README.md +++ b/contracts/protocol/README.md @@ -8,10 +8,6 @@ Contracts that make up and interact with version 2.0.0 of the protocol can be fo * [protocol](./contracts/protocol) * This directory contains the contracts that make up version 2.0.0. A full specification can be found [here](https://github.com/0xProject/0x-protocol-specification/blob/master/v2/v2-specification.md). -* [extensions](./contracts/extensions) - * This directory contains contracts that interact with the 2.0.0 contracts and will be used in production, such as the [Forwarder](https://github.com/0xProject/0x-protocol-specification/blob/master/v2/forwarder-specification.md) contract. -* [examples](./contracts/examples) - * This directory 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. * [test](./contracts/test) * This directory contains mocks and other contracts that are used solely for testing contracts within the other directories. @@ -46,13 +42,13 @@ yarn install 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-core yarn build +PKG=@0x/contracts-protocol yarn build ``` Or continuously rebuild on change: ```bash -PKG=@0x/contracts-core yarn watch +PKG=@0x/contracts-protocol yarn watch ``` ### Clean diff --git a/contracts/core/compiler.json b/contracts/protocol/compiler.json index 606208e49..c05d62aba 100644 --- a/contracts/core/compiler.json +++ b/contracts/protocol/compiler.json @@ -20,12 +20,9 @@ }, "contracts": [ "AssetProxyOwner", - "DutchAuction", "ERC20Proxy", "ERC721Proxy", "Exchange", - "ExchangeWrapper", - "Forwarder", "MixinAuthorizable", "MultiAssetProxy", "OrderValidator", @@ -33,9 +30,6 @@ "TestAssetProxyDispatcher", "TestExchangeInternals", "TestSignatureValidator", - "TestStaticCallReceiver", - "Validator", - "Wallet", - "Whitelist" + "TestStaticCallReceiver" ] } diff --git a/contracts/core/contracts/protocol/AssetProxy/ERC20Proxy.sol b/contracts/protocol/contracts/protocol/AssetProxy/ERC20Proxy.sol index 258443bca..258443bca 100644 --- a/contracts/core/contracts/protocol/AssetProxy/ERC20Proxy.sol +++ b/contracts/protocol/contracts/protocol/AssetProxy/ERC20Proxy.sol diff --git a/contracts/core/contracts/protocol/AssetProxy/ERC721Proxy.sol b/contracts/protocol/contracts/protocol/AssetProxy/ERC721Proxy.sol index 65b664b8b..65b664b8b 100644 --- a/contracts/core/contracts/protocol/AssetProxy/ERC721Proxy.sol +++ b/contracts/protocol/contracts/protocol/AssetProxy/ERC721Proxy.sol diff --git a/contracts/core/contracts/protocol/AssetProxy/MixinAuthorizable.sol b/contracts/protocol/contracts/protocol/AssetProxy/MixinAuthorizable.sol index 08f9b94dc..08f9b94dc 100644 --- a/contracts/core/contracts/protocol/AssetProxy/MixinAuthorizable.sol +++ b/contracts/protocol/contracts/protocol/AssetProxy/MixinAuthorizable.sol diff --git a/contracts/core/contracts/protocol/AssetProxy/MultiAssetProxy.sol b/contracts/protocol/contracts/protocol/AssetProxy/MultiAssetProxy.sol index 42231e73b..42231e73b 100644 --- a/contracts/core/contracts/protocol/AssetProxy/MultiAssetProxy.sol +++ b/contracts/protocol/contracts/protocol/AssetProxy/MultiAssetProxy.sol diff --git a/contracts/core/contracts/protocol/AssetProxy/mixins/MAuthorizable.sol b/contracts/protocol/contracts/protocol/AssetProxy/mixins/MAuthorizable.sol index fe77048ce..fe77048ce 100644 --- a/contracts/core/contracts/protocol/AssetProxy/mixins/MAuthorizable.sol +++ b/contracts/protocol/contracts/protocol/AssetProxy/mixins/MAuthorizable.sol diff --git a/contracts/core/contracts/protocol/AssetProxyOwner/AssetProxyOwner.sol b/contracts/protocol/contracts/protocol/AssetProxyOwner/AssetProxyOwner.sol index bfc7b5a66..bfc7b5a66 100644 --- a/contracts/core/contracts/protocol/AssetProxyOwner/AssetProxyOwner.sol +++ b/contracts/protocol/contracts/protocol/AssetProxyOwner/AssetProxyOwner.sol diff --git a/contracts/core/contracts/protocol/Exchange/Exchange.sol b/contracts/protocol/contracts/protocol/Exchange/Exchange.sol index 65ca742ea..65ca742ea 100644 --- a/contracts/core/contracts/protocol/Exchange/Exchange.sol +++ b/contracts/protocol/contracts/protocol/Exchange/Exchange.sol diff --git a/contracts/core/contracts/protocol/Exchange/MixinAssetProxyDispatcher.sol b/contracts/protocol/contracts/protocol/Exchange/MixinAssetProxyDispatcher.sol index 36ab39b45..36ab39b45 100644 --- a/contracts/core/contracts/protocol/Exchange/MixinAssetProxyDispatcher.sol +++ b/contracts/protocol/contracts/protocol/Exchange/MixinAssetProxyDispatcher.sol diff --git a/contracts/core/contracts/protocol/Exchange/MixinExchangeCore.sol b/contracts/protocol/contracts/protocol/Exchange/MixinExchangeCore.sol index 68d6a3897..68d6a3897 100644 --- a/contracts/core/contracts/protocol/Exchange/MixinExchangeCore.sol +++ b/contracts/protocol/contracts/protocol/Exchange/MixinExchangeCore.sol diff --git a/contracts/core/contracts/protocol/Exchange/MixinMatchOrders.sol b/contracts/protocol/contracts/protocol/Exchange/MixinMatchOrders.sol index fc6d73482..fc6d73482 100644 --- a/contracts/core/contracts/protocol/Exchange/MixinMatchOrders.sol +++ b/contracts/protocol/contracts/protocol/Exchange/MixinMatchOrders.sol diff --git a/contracts/core/contracts/protocol/Exchange/MixinSignatureValidator.sol b/contracts/protocol/contracts/protocol/Exchange/MixinSignatureValidator.sol index 80b4c0755..80b4c0755 100644 --- a/contracts/core/contracts/protocol/Exchange/MixinSignatureValidator.sol +++ b/contracts/protocol/contracts/protocol/Exchange/MixinSignatureValidator.sol diff --git a/contracts/core/contracts/protocol/Exchange/MixinTransactions.sol b/contracts/protocol/contracts/protocol/Exchange/MixinTransactions.sol index 87c614382..87c614382 100644 --- a/contracts/core/contracts/protocol/Exchange/MixinTransactions.sol +++ b/contracts/protocol/contracts/protocol/Exchange/MixinTransactions.sol diff --git a/contracts/core/contracts/protocol/Exchange/MixinWrapperFunctions.sol b/contracts/protocol/contracts/protocol/Exchange/MixinWrapperFunctions.sol index 2d43432ff..2d43432ff 100644 --- a/contracts/core/contracts/protocol/Exchange/MixinWrapperFunctions.sol +++ b/contracts/protocol/contracts/protocol/Exchange/MixinWrapperFunctions.sol diff --git a/contracts/core/contracts/protocol/Exchange/mixins/MAssetProxyDispatcher.sol b/contracts/protocol/contracts/protocol/Exchange/mixins/MAssetProxyDispatcher.sol index fe3d03326..fe3d03326 100644 --- a/contracts/core/contracts/protocol/Exchange/mixins/MAssetProxyDispatcher.sol +++ b/contracts/protocol/contracts/protocol/Exchange/mixins/MAssetProxyDispatcher.sol diff --git a/contracts/core/contracts/protocol/Exchange/mixins/MExchangeCore.sol b/contracts/protocol/contracts/protocol/Exchange/mixins/MExchangeCore.sol index 215284900..215284900 100644 --- a/contracts/core/contracts/protocol/Exchange/mixins/MExchangeCore.sol +++ b/contracts/protocol/contracts/protocol/Exchange/mixins/MExchangeCore.sol diff --git a/contracts/core/contracts/protocol/Exchange/mixins/MMatchOrders.sol b/contracts/protocol/contracts/protocol/Exchange/mixins/MMatchOrders.sol index 1eb4be329..1eb4be329 100644 --- a/contracts/core/contracts/protocol/Exchange/mixins/MMatchOrders.sol +++ b/contracts/protocol/contracts/protocol/Exchange/mixins/MMatchOrders.sol diff --git a/contracts/core/contracts/protocol/Exchange/mixins/MSignatureValidator.sol b/contracts/protocol/contracts/protocol/Exchange/mixins/MSignatureValidator.sol index a933976d1..a933976d1 100644 --- a/contracts/core/contracts/protocol/Exchange/mixins/MSignatureValidator.sol +++ b/contracts/protocol/contracts/protocol/Exchange/mixins/MSignatureValidator.sol diff --git a/contracts/core/contracts/protocol/Exchange/mixins/MTransactions.sol b/contracts/protocol/contracts/protocol/Exchange/mixins/MTransactions.sol index a6b0fdc85..a6b0fdc85 100644 --- a/contracts/core/contracts/protocol/Exchange/mixins/MTransactions.sol +++ b/contracts/protocol/contracts/protocol/Exchange/mixins/MTransactions.sol diff --git a/contracts/core/contracts/protocol/Exchange/mixins/MWrapperFunctions.sol b/contracts/protocol/contracts/protocol/Exchange/mixins/MWrapperFunctions.sol index 101e7cb82..101e7cb82 100644 --- a/contracts/core/contracts/protocol/Exchange/mixins/MWrapperFunctions.sol +++ b/contracts/protocol/contracts/protocol/Exchange/mixins/MWrapperFunctions.sol diff --git a/contracts/core/contracts/extensions/OrderValidator/OrderValidator.sol b/contracts/protocol/contracts/protocol/OrderValidator/OrderValidator.sol index 33dd1326c..33dd1326c 100644 --- a/contracts/core/contracts/extensions/OrderValidator/OrderValidator.sol +++ b/contracts/protocol/contracts/protocol/OrderValidator/OrderValidator.sol diff --git a/contracts/core/contracts/test/TestAssetProxyDispatcher/TestAssetProxyDispatcher.sol b/contracts/protocol/contracts/test/TestAssetProxyDispatcher/TestAssetProxyDispatcher.sol index ad71fc9a1..ad71fc9a1 100644 --- a/contracts/core/contracts/test/TestAssetProxyDispatcher/TestAssetProxyDispatcher.sol +++ b/contracts/protocol/contracts/test/TestAssetProxyDispatcher/TestAssetProxyDispatcher.sol diff --git a/contracts/core/contracts/test/TestAssetProxyOwner/TestAssetProxyOwner.sol b/contracts/protocol/contracts/test/TestAssetProxyOwner/TestAssetProxyOwner.sol index 52c66cb56..52c66cb56 100644 --- a/contracts/core/contracts/test/TestAssetProxyOwner/TestAssetProxyOwner.sol +++ b/contracts/protocol/contracts/test/TestAssetProxyOwner/TestAssetProxyOwner.sol diff --git a/contracts/core/contracts/test/TestExchangeInternals/TestExchangeInternals.sol b/contracts/protocol/contracts/test/TestExchangeInternals/TestExchangeInternals.sol index 27187f8f8..27187f8f8 100644 --- a/contracts/core/contracts/test/TestExchangeInternals/TestExchangeInternals.sol +++ b/contracts/protocol/contracts/test/TestExchangeInternals/TestExchangeInternals.sol diff --git a/contracts/core/contracts/test/TestSignatureValidator/TestSignatureValidator.sol b/contracts/protocol/contracts/test/TestSignatureValidator/TestSignatureValidator.sol index ea3e2de59..ea3e2de59 100644 --- a/contracts/core/contracts/test/TestSignatureValidator/TestSignatureValidator.sol +++ b/contracts/protocol/contracts/test/TestSignatureValidator/TestSignatureValidator.sol diff --git a/contracts/core/contracts/test/TestStaticCallReceiver/TestStaticCallReceiver.sol b/contracts/protocol/contracts/test/TestStaticCallReceiver/TestStaticCallReceiver.sol index d08da7303..d08da7303 100644 --- a/contracts/core/contracts/test/TestStaticCallReceiver/TestStaticCallReceiver.sol +++ b/contracts/protocol/contracts/test/TestStaticCallReceiver/TestStaticCallReceiver.sol diff --git a/contracts/core/package.json b/contracts/protocol/package.json index fd844ae16..1dba64681 100644 --- a/contracts/core/package.json +++ b/contracts/protocol/package.json @@ -1,6 +1,6 @@ { "private": true, - "name": "@0x/contracts-core", + "name": "@0x/contracts-protocol", "version": "2.1.56", "engines": { "node": ">=6.12" @@ -30,10 +30,10 @@ "profiler:report:html": "istanbul report html && open coverage/index.html", "coverage:report:lcov": "istanbul report lcov", "test:circleci": "yarn test", - "lint-contracts": "solhint contracts/**/**/**/**/*.sol" + "lint-contracts": "solhint -c ../.solhint.json contracts/**/**/**/**/*.sol" }, "config": { - "abis": "generated-artifacts/@(AssetProxyOwner|DutchAuction|ERC20Proxy|ERC721Proxy|Forwarder|Exchange|ExchangeWrapper|MixinAuthorizable|MultiAssetProxy|OrderValidator|TestAssetProxyOwner|TestAssetProxyDispatcher|TestExchangeInternals|TestSignatureValidator|TestStaticCallReceiver|Validator|Wallet|Whitelist).json" + "abis": "generated-artifacts/@(AssetProxyOwner|ERC20Proxy|ERC721Proxy|Exchange|MixinAuthorizable|MultiAssetProxy|OrderValidator|TestSignatureValidator|TestAssetProxyOwner|TestAssetProxyDispatcher|TestExchangeInternals|TestStaticCallReceiver).json" }, "repository": { "type": "git", @@ -43,7 +43,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/protocol/README.md", "devDependencies": { "@0x/contracts-test-utils": "^1.0.0", "@0x/abi-gen": "^1.0.17", @@ -66,7 +66,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" @@ -77,6 +77,7 @@ "@0x/contracts-multisig": "^1.0.0", "@0x/contracts-utils": "^1.0.0", "@0x/contracts-tokens": "^1.0.0", + "@0x/contracts-examples": "^1.0.0", "@0x/contracts-libs": "^1.0.0", "@0x/contracts-interfaces": "^1.0.0", "@0x/types": "^1.3.0", diff --git a/contracts/core/src/artifacts/index.ts b/contracts/protocol/src/artifacts/index.ts index ac334c173..1d53ceb04 100644 --- a/contracts/core/src/artifacts/index.ts +++ b/contracts/protocol/src/artifacts/index.ts @@ -1,12 +1,9 @@ import { ContractArtifact } from 'ethereum-types'; import * as AssetProxyOwner from '../../generated-artifacts/AssetProxyOwner.json'; -import * as DutchAuction from '../../generated-artifacts/DutchAuction.json'; import * as ERC20Proxy from '../../generated-artifacts/ERC20Proxy.json'; import * as ERC721Proxy from '../../generated-artifacts/ERC721Proxy.json'; import * as Exchange from '../../generated-artifacts/Exchange.json'; -import * as ExchangeWrapper from '../../generated-artifacts/ExchangeWrapper.json'; -import * as Forwarder from '../../generated-artifacts/Forwarder.json'; import * as MixinAuthorizable from '../../generated-artifacts/MixinAuthorizable.json'; import * as MultiAssetProxy from '../../generated-artifacts/MultiAssetProxy.json'; import * as OrderValidator from '../../generated-artifacts/OrderValidator.json'; @@ -15,18 +12,12 @@ import * as TestAssetProxyOwner from '../../generated-artifacts/TestAssetProxyOw import * as TestExchangeInternals from '../../generated-artifacts/TestExchangeInternals.json'; import * as TestSignatureValidator from '../../generated-artifacts/TestSignatureValidator.json'; import * as TestStaticCallReceiver from '../../generated-artifacts/TestStaticCallReceiver.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 = { AssetProxyOwner: AssetProxyOwner as ContractArtifact, - DutchAuction: DutchAuction as ContractArtifact, ERC20Proxy: ERC20Proxy as ContractArtifact, ERC721Proxy: ERC721Proxy as ContractArtifact, Exchange: Exchange as ContractArtifact, - ExchangeWrapper: ExchangeWrapper as ContractArtifact, - Forwarder: Forwarder as ContractArtifact, MixinAuthorizable: MixinAuthorizable as ContractArtifact, MultiAssetProxy: MultiAssetProxy as ContractArtifact, OrderValidator: OrderValidator as ContractArtifact, @@ -35,7 +26,4 @@ export const artifacts = { TestExchangeInternals: TestExchangeInternals as ContractArtifact, TestSignatureValidator: TestSignatureValidator as ContractArtifact, TestStaticCallReceiver: TestStaticCallReceiver as ContractArtifact, - Validator: Validator as ContractArtifact, - Wallet: Wallet as ContractArtifact, - Whitelist: Whitelist as ContractArtifact, }; diff --git a/contracts/protocol/src/index.ts b/contracts/protocol/src/index.ts new file mode 100644 index 000000000..ba813e7ca --- /dev/null +++ b/contracts/protocol/src/index.ts @@ -0,0 +1,3 @@ +export * from './artifacts'; +export * from './wrappers'; +export * from '../test/utils'; diff --git a/contracts/core/src/wrappers/index.ts b/contracts/protocol/src/wrappers/index.ts index ff26a171e..ac951d269 100644 --- a/contracts/core/src/wrappers/index.ts +++ b/contracts/protocol/src/wrappers/index.ts @@ -1,10 +1,7 @@ export * from '../../generated-wrappers/asset_proxy_owner'; -export * from '../../generated-wrappers/dutch_auction'; export * from '../../generated-wrappers/erc20_proxy'; export * from '../../generated-wrappers/erc721_proxy'; export * from '../../generated-wrappers/exchange'; -export * from '../../generated-wrappers/exchange_wrapper'; -export * from '../../generated-wrappers/forwarder'; export * from '../../generated-wrappers/mixin_authorizable'; export * from '../../generated-wrappers/order_validator'; export * from '../../generated-wrappers/test_asset_proxy_dispatcher'; @@ -12,6 +9,3 @@ export * from '../../generated-wrappers/test_asset_proxy_owner'; export * from '../../generated-wrappers/test_exchange_internals'; export * from '../../generated-wrappers/test_signature_validator'; export * from '../../generated-wrappers/test_static_call_receiver'; -export * from '../../generated-wrappers/validator'; -export * from '../../generated-wrappers/wallet'; -export * from '../../generated-wrappers/whitelist'; diff --git a/contracts/core/test/asset_proxy/authorizable.ts b/contracts/protocol/test/asset_proxy/authorizable.ts index 853d18be0..853d18be0 100644 --- a/contracts/core/test/asset_proxy/authorizable.ts +++ b/contracts/protocol/test/asset_proxy/authorizable.ts diff --git a/contracts/core/test/asset_proxy/proxies.ts b/contracts/protocol/test/asset_proxy/proxies.ts index c4bd95905..c4bd95905 100644 --- a/contracts/core/test/asset_proxy/proxies.ts +++ b/contracts/protocol/test/asset_proxy/proxies.ts diff --git a/contracts/core/test/exchange/core.ts b/contracts/protocol/test/exchange/core.ts index 9b948f991..9b948f991 100644 --- a/contracts/core/test/exchange/core.ts +++ b/contracts/protocol/test/exchange/core.ts diff --git a/contracts/core/test/exchange/dispatcher.ts b/contracts/protocol/test/exchange/dispatcher.ts index 5b1ac1e20..5b1ac1e20 100644 --- a/contracts/core/test/exchange/dispatcher.ts +++ b/contracts/protocol/test/exchange/dispatcher.ts diff --git a/contracts/core/test/exchange/fill_order.ts b/contracts/protocol/test/exchange/fill_order.ts index 2bdbe4855..2bdbe4855 100644 --- a/contracts/core/test/exchange/fill_order.ts +++ b/contracts/protocol/test/exchange/fill_order.ts diff --git a/contracts/core/test/exchange/internal.ts b/contracts/protocol/test/exchange/internal.ts index 972f5efb6..972f5efb6 100644 --- a/contracts/core/test/exchange/internal.ts +++ b/contracts/protocol/test/exchange/internal.ts diff --git a/contracts/core/test/exchange/match_orders.ts b/contracts/protocol/test/exchange/match_orders.ts index 8e943c237..8e943c237 100644 --- a/contracts/core/test/exchange/match_orders.ts +++ b/contracts/protocol/test/exchange/match_orders.ts diff --git a/contracts/core/test/extensions/order_validator.ts b/contracts/protocol/test/exchange/order_validator.ts index 622710c98..8f53426db 100644 --- a/contracts/core/test/extensions/order_validator.ts +++ b/contracts/protocol/test/exchange/order_validator.ts @@ -15,14 +15,16 @@ import { BigNumber } from '@0x/utils'; import * as chai from 'chai'; import * as _ from 'lodash'; -import { ERC20ProxyContract } from '../../generated-wrappers/erc20_proxy'; -import { ERC721ProxyContract } from '../../generated-wrappers/erc721_proxy'; -import { ExchangeContract } from '../../generated-wrappers/exchange'; -import { OrderValidatorContract } from '../../generated-wrappers/order_validator'; -import { artifacts } from '../../src/artifacts'; -import { ERC20Wrapper } from '../utils/erc20_wrapper'; -import { ERC721Wrapper } from '../utils/erc721_wrapper'; -import { ExchangeWrapper } from '../utils/exchange_wrapper'; +import { + artifacts, + ERC20ProxyContract, + ERC20Wrapper, + ERC721ProxyContract, + ERC721Wrapper, + ExchangeContract, + ExchangeWrapper, + OrderValidatorContract, +} from '../../src'; chaiSetup.configure(); const expect = chai.expect; diff --git a/contracts/core/test/exchange/signature_validator.ts b/contracts/protocol/test/exchange/signature_validator.ts index a968570b6..3f1786b5b 100644 --- a/contracts/core/test/exchange/signature_validator.ts +++ b/contracts/protocol/test/exchange/signature_validator.ts @@ -1,3 +1,4 @@ +import { artifacts as examplesArtifacts, ValidatorContract, WalletContract } from '@0x/contracts-examples'; import { addressUtils, chaiSetup, @@ -22,8 +23,6 @@ import { TestSignatureValidatorContract, TestSignatureValidatorSignatureValidatorApprovalEventArgs, TestStaticCallReceiverContract, - ValidatorContract, - WalletContract, } from '../../src'; chaiSetup.configure(); @@ -62,13 +61,13 @@ describe('MixinSignatureValidator', () => { txDefaults, ); testWallet = await WalletContract.deployFrom0xArtifactAsync( - artifacts.Wallet, + examplesArtifacts.Wallet, provider, txDefaults, signerAddress, ); testValidator = await ValidatorContract.deployFrom0xArtifactAsync( - artifacts.Validator, + examplesArtifacts.Validator, provider, txDefaults, signerAddress, diff --git a/contracts/core/test/exchange/transactions.ts b/contracts/protocol/test/exchange/transactions.ts index ad0ca41c2..746f3cb04 100644 --- a/contracts/core/test/exchange/transactions.ts +++ b/contracts/protocol/test/exchange/transactions.ts @@ -1,3 +1,4 @@ +import { artifacts as examplesArtifacts, ExchangeWrapperContract, WhitelistContract } from '@0x/contracts-examples'; import { chaiSetup, constants, @@ -21,8 +22,6 @@ import * as _ from 'lodash'; import { ERC20ProxyContract } from '../../generated-wrappers/erc20_proxy'; import { ExchangeContract } from '../../generated-wrappers/exchange'; -import { ExchangeWrapperContract } from '../../generated-wrappers/exchange_wrapper'; -import { WhitelistContract } from '../../generated-wrappers/whitelist'; import { artifacts } from '../../src/artifacts'; import { ERC20Wrapper } from '../utils/erc20_wrapper'; import { ExchangeWrapper } from '../utils/exchange_wrapper'; @@ -222,7 +221,7 @@ describe('Exchange transactions', () => { before(async () => { exchangeWrapperContract = await ExchangeWrapperContract.deployFrom0xArtifactAsync( - artifacts.ExchangeWrapper, + examplesArtifacts.ExchangeWrapper, provider, txDefaults, exchange.address, @@ -336,7 +335,7 @@ describe('Exchange transactions', () => { before(async () => { whitelist = await WhitelistContract.deployFrom0xArtifactAsync( - artifacts.Whitelist, + examplesArtifacts.Whitelist, provider, txDefaults, exchange.address, diff --git a/contracts/core/test/exchange/wrapper.ts b/contracts/protocol/test/exchange/wrapper.ts index c9efb0c9d..c9efb0c9d 100644 --- a/contracts/core/test/exchange/wrapper.ts +++ b/contracts/protocol/test/exchange/wrapper.ts diff --git a/contracts/protocol/test/global_hooks.ts b/contracts/protocol/test/global_hooks.ts new file mode 100644 index 000000000..f8ace376a --- /dev/null +++ b/contracts/protocol/test/global_hooks.ts @@ -0,0 +1,17 @@ +import { env, EnvVars } from '@0x/dev-utils'; + +import { coverage, profiler, provider } from '@0x/contracts-test-utils'; +before('start web3 provider', () => { + provider.start(); +}); +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/contracts/core/test/multisig/asset_proxy_owner.ts b/contracts/protocol/test/multisig/asset_proxy_owner.ts index daebfb7fb..daebfb7fb 100644 --- a/contracts/core/test/multisig/asset_proxy_owner.ts +++ b/contracts/protocol/test/multisig/asset_proxy_owner.ts diff --git a/contracts/core/test/utils/asset_proxy_owner_wrapper.ts b/contracts/protocol/test/utils/asset_proxy_owner_wrapper.ts index df23658d8..df23658d8 100644 --- a/contracts/core/test/utils/asset_proxy_owner_wrapper.ts +++ b/contracts/protocol/test/utils/asset_proxy_owner_wrapper.ts diff --git a/contracts/core/test/utils/asset_wrapper.ts b/contracts/protocol/test/utils/asset_wrapper.ts index e4090ad74..e4090ad74 100644 --- a/contracts/core/test/utils/asset_wrapper.ts +++ b/contracts/protocol/test/utils/asset_wrapper.ts diff --git a/contracts/core/test/utils/erc20_wrapper.ts b/contracts/protocol/test/utils/erc20_wrapper.ts index e5ab0e36c..e5ab0e36c 100644 --- a/contracts/core/test/utils/erc20_wrapper.ts +++ b/contracts/protocol/test/utils/erc20_wrapper.ts diff --git a/contracts/core/test/utils/erc721_wrapper.ts b/contracts/protocol/test/utils/erc721_wrapper.ts index 1f658ce86..1f658ce86 100644 --- a/contracts/core/test/utils/erc721_wrapper.ts +++ b/contracts/protocol/test/utils/erc721_wrapper.ts diff --git a/contracts/core/test/utils/exchange_wrapper.ts b/contracts/protocol/test/utils/exchange_wrapper.ts index cb6dce901..cb6dce901 100644 --- a/contracts/core/test/utils/exchange_wrapper.ts +++ b/contracts/protocol/test/utils/exchange_wrapper.ts diff --git a/contracts/core/test/utils/fill_order_combinatorial_utils.ts b/contracts/protocol/test/utils/fill_order_combinatorial_utils.ts index 5d0ea07a8..5d0ea07a8 100644 --- a/contracts/core/test/utils/fill_order_combinatorial_utils.ts +++ b/contracts/protocol/test/utils/fill_order_combinatorial_utils.ts diff --git a/contracts/protocol/test/utils/index.ts b/contracts/protocol/test/utils/index.ts new file mode 100644 index 000000000..75cd88666 --- /dev/null +++ b/contracts/protocol/test/utils/index.ts @@ -0,0 +1,3 @@ +export * from './exchange_wrapper'; +export * from './erc20_wrapper'; +export * from './erc721_wrapper'; diff --git a/contracts/core/test/utils/match_order_tester.ts b/contracts/protocol/test/utils/match_order_tester.ts index 8f574704e..8f574704e 100644 --- a/contracts/core/test/utils/match_order_tester.ts +++ b/contracts/protocol/test/utils/match_order_tester.ts diff --git a/contracts/core/test/utils/order_factory_from_scenario.ts b/contracts/protocol/test/utils/order_factory_from_scenario.ts index ecb4b2e28..ecb4b2e28 100644 --- a/contracts/core/test/utils/order_factory_from_scenario.ts +++ b/contracts/protocol/test/utils/order_factory_from_scenario.ts diff --git a/contracts/core/test/utils/simple_asset_balance_and_proxy_allowance_fetcher.ts b/contracts/protocol/test/utils/simple_asset_balance_and_proxy_allowance_fetcher.ts index 64b7dedbe..64b7dedbe 100644 --- a/contracts/core/test/utils/simple_asset_balance_and_proxy_allowance_fetcher.ts +++ b/contracts/protocol/test/utils/simple_asset_balance_and_proxy_allowance_fetcher.ts diff --git a/contracts/core/test/utils/simple_order_filled_cancelled_fetcher.ts b/contracts/protocol/test/utils/simple_order_filled_cancelled_fetcher.ts index af959e00e..af959e00e 100644 --- a/contracts/core/test/utils/simple_order_filled_cancelled_fetcher.ts +++ b/contracts/protocol/test/utils/simple_order_filled_cancelled_fetcher.ts diff --git a/contracts/core/tsconfig.json b/contracts/protocol/tsconfig.json index ea493cbb8..989d3ef2b 100644 --- a/contracts/core/tsconfig.json +++ b/contracts/protocol/tsconfig.json @@ -8,12 +8,9 @@ "include": ["./src/**/*", "./test/**/*", "./generated-wrappers/**/*"], "files": [ "./generated-artifacts/AssetProxyOwner.json", - "./generated-artifacts/DutchAuction.json", "./generated-artifacts/ERC20Proxy.json", "./generated-artifacts/ERC721Proxy.json", "./generated-artifacts/Exchange.json", - "./generated-artifacts/ExchangeWrapper.json", - "./generated-artifacts/Forwarder.json", "./generated-artifacts/MixinAuthorizable.json", "./generated-artifacts/MultiAssetProxy.json", "./generated-artifacts/OrderValidator.json", @@ -21,10 +18,7 @@ "./generated-artifacts/TestAssetProxyOwner.json", "./generated-artifacts/TestExchangeInternals.json", "./generated-artifacts/TestSignatureValidator.json", - "./generated-artifacts/TestStaticCallReceiver.json", - "./generated-artifacts/Validator.json", - "./generated-artifacts/Wallet.json", - "./generated-artifacts/Whitelist.json" + "./generated-artifacts/TestStaticCallReceiver.json" ], "exclude": ["./deploy/solc/solc_bin"] } diff --git a/contracts/protocol/tslint.json b/contracts/protocol/tslint.json new file mode 100644 index 000000000..1bb3ac2a2 --- /dev/null +++ b/contracts/protocol/tslint.json @@ -0,0 +1,6 @@ +{ + "extends": ["@0x/tslint-config"], + "rules": { + "custom-no-magic-numbers": false + } +} diff --git a/contracts/tokens/.solhint.json b/contracts/tokens/.solhint.json deleted file mode 100644 index 076afe9f3..000000000 --- a/contracts/tokens/.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/tokens/package.json b/contracts/tokens/package.json index 0666ea89a..05fe3272b 100644 --- a/contracts/tokens/package.json +++ b/contracts/tokens/package.json @@ -30,7 +30,7 @@ "profiler:report:html": "istanbul report html && open coverage/index.html", "coverage:report:lcov": "istanbul report lcov", "test:circleci": "yarn test", - "lint-contracts": "solhint contracts/**/**/**/**/*.sol" + "lint-contracts": "solhint -c ../.solhint.json contracts/**/**/**/**/*.sol" }, "config": { "abis": "generated-artifacts/@(DummyERC20Token|DummyMultipleReturnERC20Token|DummyNoReturnERC20Token|DummyERC721Receiver|InvalidERC721Receiver|DummyERC721Token|ReentrantERC20Token|ERC20Token|IERC20Token|MintableERC20Token|UnlimitedAllowanceERC20Token|ERC721Token|IERC721Receiver|IERC721Token|MintableERC721Token|IEtherToken|WETH9|ERC20Token_v1|Token_v1|UnlimitedAllowanceToken_v1|ZRXToken).json" @@ -66,7 +66,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" diff --git a/contracts/utils/.solhint.json b/contracts/utils/.solhint.json deleted file mode 100644 index 076afe9f3..000000000 --- a/contracts/utils/.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/utils/package.json b/contracts/utils/package.json index c0bc8bfcf..1581e3284 100644 --- a/contracts/utils/package.json +++ b/contracts/utils/package.json @@ -30,7 +30,7 @@ "profiler:report:html": "istanbul report html && open coverage/index.html", "coverage:report:lcov": "istanbul report lcov", "test:circleci": "yarn test", - "lint-contracts": "solhint contracts/**/**/**/**/*.sol" + "lint-contracts": "solhint -c ../.solhint.json contracts/**/**/**/**/*.sol" }, "config": { "abis": "generated-artifacts/@(IOwnable|Ownable|LibBytes|ReentrancyGuard|SafeMath|TestConstants|TestLibBytes).json" @@ -67,7 +67,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" @@ -14450,9 +14450,9 @@ solc@^0.4.24: semver "^5.3.0" yargs "^4.7.1" -solhint@^1.2.1: - version "1.4.0" - resolved "https://registry.yarnpkg.com/solhint/-/solhint-1.4.0.tgz#59018cfc86e2fc268c8b520322ab1e0db1fdb94b" +solhint@^1.4.1: + version "1.4.1" + resolved "https://registry.yarnpkg.com/solhint/-/solhint-1.4.1.tgz#921ef9fed83dc945853079865140730d4d2140b2" dependencies: antlr4 "4.7.1" commander "2.18.0" |