diff options
author | Fabio Berger <me@fabioberger.com> | 2018-10-16 23:59:02 +0800 |
---|---|---|
committer | Fabio Berger <me@fabioberger.com> | 2018-10-16 23:59:02 +0800 |
commit | c84c92663d1ce0227b755dc861f825c35a3c7999 (patch) | |
tree | 3800297ba0072233fe88839b675e33e6b44f9649 /packages/contracts | |
parent | 55a3bc8cb6772802672f60f22c5ed5c7e1b2dfdd (diff) | |
parent | c333d093b585fa0250a6973f2d396eb3cf227334 (diff) | |
download | dexon-0x-contracts-c84c92663d1ce0227b755dc861f825c35a3c7999.tar.gz dexon-0x-contracts-c84c92663d1ce0227b755dc861f825c35a3c7999.tar.zst dexon-0x-contracts-c84c92663d1ce0227b755dc861f825c35a3c7999.zip |
Merge branch 'dev-section-redesign' into reSkinReferenceDocs
* dev-section-redesign: (87 commits)
Added note about restriction on `testDirectory`
fix(dev-utils): Make chai a dev dependency since exported interface depends on it
Add changelog entries
fix(subproviders): make web3-provider-engine types a 'dependency' so it's available to users of the library
fix(sra-spec): make @loopback/openapi-v3-types a 'dependency' so it's available to users of the library
fix(sol-cov): make @types/solidity-parser-antlr a 'dependency' so it's available to users of the library
fix(dev-utils): make web3-provider-engine types a 'dependency' so it's available to users of the library
fix(0x.js): make web3-provider-engine types a 'dependency' so it's available to users of the library
fix(monorepo-scripts): Move the creation of the `.installation-test` directory OUTSIDE of the monorepo root, so that the installed packages can't reference the hoisted node_modules folder
Remove ContractNotFound errors in contract-wrappers
Update prettierignore
Update website to use the new unsubscribeAll method in contract-wrappers
In abi-gen-wrappers, ./wrappers -> ./src/generated-wrappers
In contract-wrappers, remove setProvider and add unsubscribeAll method.
take out explicit children definition in props
Update json-schemas for contract-wrappers
Add OrThrow suffix to getContractAddressesForNetwork
remove unused import
Update CHANGELOG.json for all changed packages
Remove ContractAddresses from packages/types (mistake after rebase)
...
Diffstat (limited to 'packages/contracts')
-rw-r--r-- | packages/contracts/.solhintignore | 3 | ||||
-rw-r--r-- | packages/contracts/compiler.json | 5 | ||||
-rw-r--r-- | packages/contracts/contracts/examples/ExchangeWrapper/ExchangeWrapper.sol (renamed from packages/contracts/src/2.0.0/examples/ExchangeWrapper/ExchangeWrapper.sol) | 0 | ||||
-rw-r--r-- | packages/contracts/contracts/examples/Validator/Validator.sol (renamed from packages/contracts/src/2.0.0/examples/Validator/Validator.sol) | 0 | ||||
-rw-r--r-- | packages/contracts/contracts/examples/Wallet/Wallet.sol (renamed from packages/contracts/src/2.0.0/examples/Wallet/Wallet.sol) | 0 | ||||
-rw-r--r-- | packages/contracts/contracts/examples/Whitelist/Whitelist.sol (renamed from packages/contracts/src/2.0.0/examples/Whitelist/Whitelist.sol) | 0 | ||||
-rw-r--r-- | packages/contracts/contracts/extensions/Forwarder/Forwarder.sol (renamed from packages/contracts/src/2.0.0/extensions/Forwarder/Forwarder.sol) | 0 | ||||
-rw-r--r-- | packages/contracts/contracts/extensions/Forwarder/MixinAssets.sol (renamed from packages/contracts/src/2.0.0/extensions/Forwarder/MixinAssets.sol) | 0 | ||||
-rw-r--r-- | packages/contracts/contracts/extensions/Forwarder/MixinExchangeWrapper.sol (renamed from packages/contracts/src/2.0.0/extensions/Forwarder/MixinExchangeWrapper.sol) | 0 | ||||
-rw-r--r-- | packages/contracts/contracts/extensions/Forwarder/MixinForwarderCore.sol (renamed from packages/contracts/src/2.0.0/extensions/Forwarder/MixinForwarderCore.sol) | 0 | ||||
-rw-r--r-- | packages/contracts/contracts/extensions/Forwarder/MixinWeth.sol (renamed from packages/contracts/src/2.0.0/extensions/Forwarder/MixinWeth.sol) | 0 | ||||
-rw-r--r-- | packages/contracts/contracts/extensions/Forwarder/interfaces/IAssets.sol (renamed from packages/contracts/src/2.0.0/extensions/Forwarder/interfaces/IAssets.sol) | 0 | ||||
-rw-r--r-- | packages/contracts/contracts/extensions/Forwarder/interfaces/IForwarder.sol (renamed from packages/contracts/src/2.0.0/extensions/Forwarder/interfaces/IForwarder.sol) | 0 | ||||
-rw-r--r-- | packages/contracts/contracts/extensions/Forwarder/interfaces/IForwarderCore.sol (renamed from packages/contracts/src/2.0.0/extensions/Forwarder/interfaces/IForwarderCore.sol) | 0 | ||||
-rw-r--r-- | packages/contracts/contracts/extensions/Forwarder/libs/LibConstants.sol (renamed from packages/contracts/src/2.0.0/extensions/Forwarder/libs/LibConstants.sol) | 0 | ||||
-rw-r--r-- | packages/contracts/contracts/extensions/Forwarder/libs/LibForwarderErrors.sol (renamed from packages/contracts/src/2.0.0/extensions/Forwarder/libs/LibForwarderErrors.sol) | 0 | ||||
-rw-r--r-- | packages/contracts/contracts/extensions/Forwarder/mixins/MAssets.sol (renamed from packages/contracts/src/2.0.0/extensions/Forwarder/mixins/MAssets.sol) | 0 | ||||
-rw-r--r-- | packages/contracts/contracts/extensions/Forwarder/mixins/MExchangeWrapper.sol (renamed from packages/contracts/src/2.0.0/extensions/Forwarder/mixins/MExchangeWrapper.sol) | 0 | ||||
-rw-r--r-- | packages/contracts/contracts/extensions/Forwarder/mixins/MWeth.sol (renamed from packages/contracts/src/2.0.0/extensions/Forwarder/mixins/MWeth.sol) | 0 | ||||
-rw-r--r-- | packages/contracts/contracts/extensions/OrderValidator/OrderValidator.sol (renamed from packages/contracts/src/2.0.0/extensions/OrderValidator/OrderValidator.sol) | 0 | ||||
-rw-r--r-- | packages/contracts/contracts/multisig/MultiSigWallet.sol (renamed from packages/contracts/src/2.0.0/multisig/MultiSigWallet.sol) | 0 | ||||
-rw-r--r-- | packages/contracts/contracts/multisig/MultiSigWalletWithTimeLock.sol (renamed from packages/contracts/src/2.0.0/multisig/MultiSigWalletWithTimeLock.sol) | 0 | ||||
-rw-r--r-- | packages/contracts/contracts/protocol/AssetProxy/ERC20Proxy.sol (renamed from packages/contracts/src/2.0.0/protocol/AssetProxy/ERC20Proxy.sol) | 0 | ||||
-rw-r--r-- | packages/contracts/contracts/protocol/AssetProxy/ERC721Proxy.sol (renamed from packages/contracts/src/2.0.0/protocol/AssetProxy/ERC721Proxy.sol) | 0 | ||||
-rw-r--r-- | packages/contracts/contracts/protocol/AssetProxy/MixinAuthorizable.sol (renamed from packages/contracts/src/2.0.0/protocol/AssetProxy/MixinAuthorizable.sol) | 0 | ||||
-rw-r--r-- | packages/contracts/contracts/protocol/AssetProxy/interfaces/IAssetData.sol (renamed from packages/contracts/src/2.0.0/protocol/AssetProxy/interfaces/IAssetData.sol) | 0 | ||||
-rw-r--r-- | packages/contracts/contracts/protocol/AssetProxy/interfaces/IAssetProxy.sol (renamed from packages/contracts/src/2.0.0/protocol/AssetProxy/interfaces/IAssetProxy.sol) | 0 | ||||
-rw-r--r-- | packages/contracts/contracts/protocol/AssetProxy/interfaces/IAuthorizable.sol (renamed from packages/contracts/src/2.0.0/protocol/AssetProxy/interfaces/IAuthorizable.sol) | 0 | ||||
-rw-r--r-- | packages/contracts/contracts/protocol/AssetProxy/libs/LibAssetProxyErrors.sol (renamed from packages/contracts/src/2.0.0/protocol/AssetProxy/libs/LibAssetProxyErrors.sol) | 0 | ||||
-rw-r--r-- | packages/contracts/contracts/protocol/AssetProxy/mixins/MAuthorizable.sol (renamed from packages/contracts/src/2.0.0/protocol/AssetProxy/mixins/MAuthorizable.sol) | 0 | ||||
-rw-r--r-- | packages/contracts/contracts/protocol/AssetProxyOwner/AssetProxyOwner.sol (renamed from packages/contracts/src/2.0.0/protocol/AssetProxyOwner/AssetProxyOwner.sol) | 0 | ||||
-rw-r--r-- | packages/contracts/contracts/protocol/Exchange/Exchange.sol (renamed from packages/contracts/src/2.0.0/protocol/Exchange/Exchange.sol) | 0 | ||||
-rw-r--r-- | packages/contracts/contracts/protocol/Exchange/MixinAssetProxyDispatcher.sol (renamed from packages/contracts/src/2.0.0/protocol/Exchange/MixinAssetProxyDispatcher.sol) | 0 | ||||
-rw-r--r-- | packages/contracts/contracts/protocol/Exchange/MixinExchangeCore.sol (renamed from packages/contracts/src/2.0.0/protocol/Exchange/MixinExchangeCore.sol) | 0 | ||||
-rw-r--r-- | packages/contracts/contracts/protocol/Exchange/MixinMatchOrders.sol (renamed from packages/contracts/src/2.0.0/protocol/Exchange/MixinMatchOrders.sol) | 0 | ||||
-rw-r--r-- | packages/contracts/contracts/protocol/Exchange/MixinSignatureValidator.sol (renamed from packages/contracts/src/2.0.0/protocol/Exchange/MixinSignatureValidator.sol) | 0 | ||||
-rw-r--r-- | packages/contracts/contracts/protocol/Exchange/MixinTransactions.sol (renamed from packages/contracts/src/2.0.0/protocol/Exchange/MixinTransactions.sol) | 0 | ||||
-rw-r--r-- | packages/contracts/contracts/protocol/Exchange/MixinWrapperFunctions.sol (renamed from packages/contracts/src/2.0.0/protocol/Exchange/MixinWrapperFunctions.sol) | 0 | ||||
-rw-r--r-- | packages/contracts/contracts/protocol/Exchange/interfaces/IAssetProxyDispatcher.sol (renamed from packages/contracts/src/2.0.0/protocol/Exchange/interfaces/IAssetProxyDispatcher.sol) | 0 | ||||
-rw-r--r-- | packages/contracts/contracts/protocol/Exchange/interfaces/IExchange.sol (renamed from packages/contracts/src/2.0.0/protocol/Exchange/interfaces/IExchange.sol) | 0 | ||||
-rw-r--r-- | packages/contracts/contracts/protocol/Exchange/interfaces/IExchangeCore.sol (renamed from packages/contracts/src/2.0.0/protocol/Exchange/interfaces/IExchangeCore.sol) | 0 | ||||
-rw-r--r-- | packages/contracts/contracts/protocol/Exchange/interfaces/IMatchOrders.sol (renamed from packages/contracts/src/2.0.0/protocol/Exchange/interfaces/IMatchOrders.sol) | 0 | ||||
-rw-r--r-- | packages/contracts/contracts/protocol/Exchange/interfaces/ISignatureValidator.sol (renamed from packages/contracts/src/2.0.0/protocol/Exchange/interfaces/ISignatureValidator.sol) | 0 | ||||
-rw-r--r-- | packages/contracts/contracts/protocol/Exchange/interfaces/ITransactions.sol (renamed from packages/contracts/src/2.0.0/protocol/Exchange/interfaces/ITransactions.sol) | 0 | ||||
-rw-r--r-- | packages/contracts/contracts/protocol/Exchange/interfaces/IValidator.sol (renamed from packages/contracts/src/2.0.0/protocol/Exchange/interfaces/IValidator.sol) | 0 | ||||
-rw-r--r-- | packages/contracts/contracts/protocol/Exchange/interfaces/IWallet.sol (renamed from packages/contracts/src/2.0.0/protocol/Exchange/interfaces/IWallet.sol) | 0 | ||||
-rw-r--r-- | packages/contracts/contracts/protocol/Exchange/interfaces/IWrapperFunctions.sol (renamed from packages/contracts/src/2.0.0/protocol/Exchange/interfaces/IWrapperFunctions.sol) | 0 | ||||
-rw-r--r-- | packages/contracts/contracts/protocol/Exchange/libs/LibAbiEncoder.sol (renamed from packages/contracts/src/2.0.0/protocol/Exchange/libs/LibAbiEncoder.sol) | 0 | ||||
-rw-r--r-- | packages/contracts/contracts/protocol/Exchange/libs/LibConstants.sol (renamed from packages/contracts/src/2.0.0/protocol/Exchange/libs/LibConstants.sol) | 0 | ||||
-rw-r--r-- | packages/contracts/contracts/protocol/Exchange/libs/LibEIP712.sol (renamed from packages/contracts/src/2.0.0/protocol/Exchange/libs/LibEIP712.sol) | 0 | ||||
-rw-r--r-- | packages/contracts/contracts/protocol/Exchange/libs/LibExchangeErrors.sol (renamed from packages/contracts/src/2.0.0/protocol/Exchange/libs/LibExchangeErrors.sol) | 0 | ||||
-rw-r--r-- | packages/contracts/contracts/protocol/Exchange/libs/LibFillResults.sol (renamed from packages/contracts/src/2.0.0/protocol/Exchange/libs/LibFillResults.sol) | 0 | ||||
-rw-r--r-- | packages/contracts/contracts/protocol/Exchange/libs/LibMath.sol (renamed from packages/contracts/src/2.0.0/protocol/Exchange/libs/LibMath.sol) | 0 | ||||
-rw-r--r-- | packages/contracts/contracts/protocol/Exchange/libs/LibOrder.sol (renamed from packages/contracts/src/2.0.0/protocol/Exchange/libs/LibOrder.sol) | 0 | ||||
-rw-r--r-- | packages/contracts/contracts/protocol/Exchange/mixins/MAssetProxyDispatcher.sol (renamed from packages/contracts/src/2.0.0/protocol/Exchange/mixins/MAssetProxyDispatcher.sol) | 0 | ||||
-rw-r--r-- | packages/contracts/contracts/protocol/Exchange/mixins/MExchangeCore.sol (renamed from packages/contracts/src/2.0.0/protocol/Exchange/mixins/MExchangeCore.sol) | 0 | ||||
-rw-r--r-- | packages/contracts/contracts/protocol/Exchange/mixins/MMatchOrders.sol (renamed from packages/contracts/src/2.0.0/protocol/Exchange/mixins/MMatchOrders.sol) | 0 | ||||
-rw-r--r-- | packages/contracts/contracts/protocol/Exchange/mixins/MSignatureValidator.sol (renamed from packages/contracts/src/2.0.0/protocol/Exchange/mixins/MSignatureValidator.sol) | 0 | ||||
-rw-r--r-- | packages/contracts/contracts/protocol/Exchange/mixins/MTransactions.sol (renamed from packages/contracts/src/2.0.0/protocol/Exchange/mixins/MTransactions.sol) | 0 | ||||
-rw-r--r-- | packages/contracts/contracts/protocol/Exchange/mixins/MWrapperFunctions.sol (renamed from packages/contracts/src/2.0.0/protocol/Exchange/mixins/MWrapperFunctions.sol) | 0 | ||||
-rw-r--r-- | packages/contracts/contracts/test/DummyERC20Token/DummyERC20Token.sol (renamed from packages/contracts/src/2.0.0/test/DummyERC20Token/DummyERC20Token.sol) | 0 | ||||
-rw-r--r-- | packages/contracts/contracts/test/DummyERC20Token/DummyMultipleReturnERC20Token.sol (renamed from packages/contracts/src/2.0.0/test/DummyERC20Token/DummyMultipleReturnERC20Token.sol) | 0 | ||||
-rw-r--r-- | packages/contracts/contracts/test/DummyERC20Token/DummyNoReturnERC20Token.sol (renamed from packages/contracts/src/2.0.0/test/DummyERC20Token/DummyNoReturnERC20Token.sol) | 0 | ||||
-rw-r--r-- | packages/contracts/contracts/test/DummyERC721Receiver/DummyERC721Receiver.sol (renamed from packages/contracts/src/2.0.0/test/DummyERC721Receiver/DummyERC721Receiver.sol) | 0 | ||||
-rw-r--r-- | packages/contracts/contracts/test/DummyERC721Receiver/InvalidERC721Receiver.sol (renamed from packages/contracts/src/2.0.0/test/DummyERC721Receiver/InvalidERC721Receiver.sol) | 0 | ||||
-rw-r--r-- | packages/contracts/contracts/test/DummyERC721Token/DummyERC721Token.sol (renamed from packages/contracts/src/2.0.0/test/DummyERC721Token/DummyERC721Token.sol) | 0 | ||||
-rw-r--r-- | packages/contracts/contracts/test/ReentrantERC20Token/ReentrantERC20Token.sol (renamed from packages/contracts/src/2.0.0/test/ReentrantERC20Token/ReentrantERC20Token.sol) | 0 | ||||
-rw-r--r-- | packages/contracts/contracts/test/TestAssetProxyDispatcher/TestAssetProxyDispatcher.sol (renamed from packages/contracts/src/2.0.0/test/TestAssetProxyDispatcher/TestAssetProxyDispatcher.sol) | 0 | ||||
-rw-r--r-- | packages/contracts/contracts/test/TestAssetProxyOwner/TestAssetProxyOwner.sol (renamed from packages/contracts/src/2.0.0/test/TestAssetProxyOwner/TestAssetProxyOwner.sol) | 0 | ||||
-rw-r--r-- | packages/contracts/contracts/test/TestConstants/TestConstants.sol (renamed from packages/contracts/src/2.0.0/test/TestConstants/TestConstants.sol) | 0 | ||||
-rw-r--r-- | packages/contracts/contracts/test/TestExchangeInternals/TestExchangeInternals.sol (renamed from packages/contracts/src/2.0.0/test/TestExchangeInternals/TestExchangeInternals.sol) | 0 | ||||
-rw-r--r-- | packages/contracts/contracts/test/TestLibBytes/TestLibBytes.sol (renamed from packages/contracts/src/2.0.0/test/TestLibBytes/TestLibBytes.sol) | 0 | ||||
-rw-r--r-- | packages/contracts/contracts/test/TestLibs/TestLibs.sol (renamed from packages/contracts/src/2.0.0/test/TestLibs/TestLibs.sol) | 0 | ||||
-rw-r--r-- | packages/contracts/contracts/test/TestSignatureValidator/TestSignatureValidator.sol (renamed from packages/contracts/src/2.0.0/test/TestSignatureValidator/TestSignatureValidator.sol) | 0 | ||||
-rw-r--r-- | packages/contracts/contracts/test/TestStaticCallReceiver/TestStaticCallReceiver.sol (renamed from packages/contracts/src/2.0.0/test/TestStaticCallReceiver/TestStaticCallReceiver.sol) | 0 | ||||
-rw-r--r-- | packages/contracts/contracts/tokens/ERC20Token/ERC20Token.sol (renamed from packages/contracts/src/2.0.0/tokens/ERC20Token/ERC20Token.sol) | 0 | ||||
-rw-r--r-- | packages/contracts/contracts/tokens/ERC20Token/IERC20Token.sol (renamed from packages/contracts/src/2.0.0/tokens/ERC20Token/IERC20Token.sol) | 0 | ||||
-rw-r--r-- | packages/contracts/contracts/tokens/ERC20Token/MintableERC20Token.sol (renamed from packages/contracts/src/2.0.0/tokens/ERC20Token/MintableERC20Token.sol) | 0 | ||||
-rw-r--r-- | packages/contracts/contracts/tokens/ERC20Token/UnlimitedAllowanceERC20Token.sol (renamed from packages/contracts/src/2.0.0/tokens/ERC20Token/UnlimitedAllowanceERC20Token.sol) | 0 | ||||
-rw-r--r-- | packages/contracts/contracts/tokens/ERC721Token/ERC721Token.sol (renamed from packages/contracts/src/2.0.0/tokens/ERC721Token/ERC721Token.sol) | 0 | ||||
-rw-r--r-- | packages/contracts/contracts/tokens/ERC721Token/IERC721Receiver.sol (renamed from packages/contracts/src/2.0.0/tokens/ERC721Token/IERC721Receiver.sol) | 0 | ||||
-rw-r--r-- | packages/contracts/contracts/tokens/ERC721Token/IERC721Token.sol (renamed from packages/contracts/src/2.0.0/tokens/ERC721Token/IERC721Token.sol) | 0 | ||||
-rw-r--r-- | packages/contracts/contracts/tokens/ERC721Token/MintableERC721Token.sol (renamed from packages/contracts/src/2.0.0/tokens/ERC721Token/MintableERC721Token.sol) | 0 | ||||
-rw-r--r-- | packages/contracts/contracts/tokens/EtherToken/IEtherToken.sol (renamed from packages/contracts/src/2.0.0/tokens/EtherToken/IEtherToken.sol) | 0 | ||||
-rw-r--r-- | packages/contracts/contracts/tokens/EtherToken/WETH9.sol (renamed from packages/contracts/src/2.0.0/tokens/EtherToken/WETH9.sol) | 0 | ||||
-rw-r--r-- | packages/contracts/contracts/tokens/ZRXToken/ERC20Token_v1.sol (renamed from packages/contracts/src/1.0.0/ERC20Token/ERC20Token_v1.sol) | 2 | ||||
-rw-r--r-- | packages/contracts/contracts/tokens/ZRXToken/Token_v1.sol (renamed from packages/contracts/src/1.0.0/Token/Token_v1.sol) | 0 | ||||
-rw-r--r-- | packages/contracts/contracts/tokens/ZRXToken/UnlimitedAllowanceToken_v1.sol (renamed from packages/contracts/src/1.0.0/UnlimitedAllowanceToken/UnlimitedAllowanceToken_v1.sol) | 2 | ||||
-rw-r--r-- | packages/contracts/contracts/tokens/ZRXToken/ZRXToken.sol (renamed from packages/contracts/src/2.0.0/tokens/ZRXToken/ZRXToken.sol) | 2 | ||||
-rw-r--r-- | packages/contracts/contracts/utils/LibBytes/LibBytes.sol (renamed from packages/contracts/src/2.0.0/utils/LibBytes/LibBytes.sol) | 0 | ||||
-rw-r--r-- | packages/contracts/contracts/utils/Ownable/IOwnable.sol (renamed from packages/contracts/src/2.0.0/utils/Ownable/IOwnable.sol) | 0 | ||||
-rw-r--r-- | packages/contracts/contracts/utils/Ownable/Ownable.sol (renamed from packages/contracts/src/2.0.0/utils/Ownable/Ownable.sol) | 0 | ||||
-rw-r--r-- | packages/contracts/contracts/utils/ReentrancyGuard/ReentrancyGuard.sol (renamed from packages/contracts/src/2.0.0/utils/ReentrancyGuard/ReentrancyGuard.sol) | 0 | ||||
-rw-r--r-- | packages/contracts/contracts/utils/SafeMath/SafeMath.sol (renamed from packages/contracts/src/2.0.0/utils/SafeMath/SafeMath.sol) | 0 | ||||
-rw-r--r-- | packages/contracts/globals.d.ts | 6 | ||||
-rw-r--r-- | packages/contracts/package.json | 21 | ||||
-rw-r--r-- | packages/contracts/src/1.0.0/Arbitrage/Arbitrage.sol | 114 | ||||
-rw-r--r-- | packages/contracts/src/1.0.0/EtherDelta/AccountLevels.sol | 11 | ||||
-rw-r--r-- | packages/contracts/src/1.0.0/EtherDelta/EtherDelta.sol | 168 | ||||
-rw-r--r-- | packages/contracts/src/1.0.0/Exchange/Exchange_v1.sol | 602 | ||||
-rw-r--r-- | packages/contracts/src/1.0.0/Exchange/IExchange_v1.sol | 226 | ||||
-rw-r--r-- | packages/contracts/src/1.0.0/MultiSigWalletWithTImeLockExceptRemoveAuthorizedAddress/MultiSigWalletWithTimeLockExceptRemoveAuthorizedAddress.sol | 82 | ||||
-rw-r--r-- | packages/contracts/src/1.0.0/Ownable/IOwnable_v1.sol | 18 | ||||
-rw-r--r-- | packages/contracts/src/1.0.0/Ownable/Ownable_v1.sol | 27 | ||||
-rw-r--r-- | packages/contracts/src/1.0.0/SafeMath/SafeMath_v1.sol | 73 | ||||
-rw-r--r-- | packages/contracts/src/1.0.0/TokenRegistry/ITokenRegistery.sol | 195 | ||||
-rw-r--r-- | packages/contracts/src/1.0.0/TokenRegistry/TokenRegistry.sol | 308 | ||||
-rw-r--r-- | packages/contracts/src/1.0.0/TokenTransferProxy/TokenTransferProxy_v1.sol | 115 | ||||
-rw-r--r-- | packages/contracts/src/artifacts/index.ts | 79 | ||||
-rw-r--r-- | packages/contracts/src/wrappers/index.ts | 34 | ||||
-rw-r--r-- | packages/contracts/test/asset_proxy/authorizable.ts | 4 | ||||
-rw-r--r-- | packages/contracts/test/asset_proxy/proxies.ts | 18 | ||||
-rw-r--r-- | packages/contracts/test/exchange/core.ts | 21 | ||||
-rw-r--r-- | packages/contracts/test/exchange/dispatcher.ts | 10 | ||||
-rw-r--r-- | packages/contracts/test/exchange/internal.ts | 4 | ||||
-rw-r--r-- | packages/contracts/test/exchange/libs.ts | 6 | ||||
-rw-r--r-- | packages/contracts/test/exchange/match_orders.ts | 16 | ||||
-rw-r--r-- | packages/contracts/test/exchange/signature_validator.ts | 10 | ||||
-rw-r--r-- | packages/contracts/test/exchange/transactions.ts | 12 | ||||
-rw-r--r-- | packages/contracts/test/exchange/wrapper.ts | 14 | ||||
-rw-r--r-- | packages/contracts/test/extensions/forwarder.ts | 14 | ||||
-rw-r--r-- | packages/contracts/test/extensions/order_validator.ts | 14 | ||||
-rw-r--r-- | packages/contracts/test/libraries/lib_bytes.ts | 4 | ||||
-rw-r--r-- | packages/contracts/test/multisig/asset_proxy_owner.ts | 8 | ||||
-rw-r--r-- | packages/contracts/test/multisig/multi_sig_with_time_lock.ts | 6 | ||||
-rw-r--r-- | packages/contracts/test/token_registry.ts | 255 | ||||
-rw-r--r-- | packages/contracts/test/tokens/erc721_token.ts | 8 | ||||
-rw-r--r-- | packages/contracts/test/tokens/unlimited_allowance_token.ts | 4 | ||||
-rw-r--r-- | packages/contracts/test/tokens/weth9.ts (renamed from packages/contracts/test/tokens/ether_token.ts) | 6 | ||||
-rw-r--r-- | packages/contracts/test/tokens/zrx_token.ts | 6 | ||||
-rw-r--r-- | packages/contracts/test/utils/artifacts.ts | 69 | ||||
-rw-r--r-- | packages/contracts/test/utils/erc20_wrapper.ts | 6 | ||||
-rw-r--r-- | packages/contracts/test/utils/erc721_wrapper.ts | 6 | ||||
-rw-r--r-- | packages/contracts/test/utils/exchange_wrapper.ts | 2 | ||||
-rw-r--r-- | packages/contracts/test/utils/fill_order_combinatorial_utils.ts | 6 | ||||
-rw-r--r-- | packages/contracts/test/utils/forwarder_wrapper.ts | 2 | ||||
-rw-r--r-- | packages/contracts/test/utils/log_decoder.ts | 3 | ||||
-rw-r--r-- | packages/contracts/test/utils/multi_sig_wrapper.ts | 4 | ||||
-rw-r--r-- | packages/contracts/test/utils/order_factory_from_scenario.ts | 2 | ||||
-rw-r--r-- | packages/contracts/test/utils/token_registry_wrapper.ts | 66 | ||||
-rw-r--r-- | packages/contracts/tsconfig.json | 48 |
141 files changed, 279 insertions, 2468 deletions
diff --git a/packages/contracts/.solhintignore b/packages/contracts/.solhintignore new file mode 100644 index 000000000..1e33ec53b --- /dev/null +++ b/packages/contracts/.solhintignore @@ -0,0 +1,3 @@ +contracts/tokens/ZRXToken/ERC20Token_v1.sol +contracts/tokens/ZRXToken/Token_v1.sol +contracts/tokens/ZRXToken/UnlimitedAllowanceToken_v1.sol diff --git a/packages/contracts/compiler.json b/packages/contracts/compiler.json index 559b7cd1f..af3980b4e 100644 --- a/packages/contracts/compiler.json +++ b/packages/contracts/compiler.json @@ -1,6 +1,6 @@ { - "artifactsDir": "../migrations/artifacts/development", - "contractsDir": "src/", + "artifactsDir": "./generated-artifacts", + "contractsDir": "./contracts", "compilerSettings": { "optimizer": { "enabled": true, @@ -50,7 +50,6 @@ "TestExchangeInternals", "TestSignatureValidator", "TestStaticCallReceiver", - "TokenRegistry", "Validator", "Wallet", "WETH9", diff --git a/packages/contracts/src/2.0.0/examples/ExchangeWrapper/ExchangeWrapper.sol b/packages/contracts/contracts/examples/ExchangeWrapper/ExchangeWrapper.sol index 2fa0e3c5e..2fa0e3c5e 100644 --- a/packages/contracts/src/2.0.0/examples/ExchangeWrapper/ExchangeWrapper.sol +++ b/packages/contracts/contracts/examples/ExchangeWrapper/ExchangeWrapper.sol diff --git a/packages/contracts/src/2.0.0/examples/Validator/Validator.sol b/packages/contracts/contracts/examples/Validator/Validator.sol index 72ed528ba..72ed528ba 100644 --- a/packages/contracts/src/2.0.0/examples/Validator/Validator.sol +++ b/packages/contracts/contracts/examples/Validator/Validator.sol diff --git a/packages/contracts/src/2.0.0/examples/Wallet/Wallet.sol b/packages/contracts/contracts/examples/Wallet/Wallet.sol index b75021a31..b75021a31 100644 --- a/packages/contracts/src/2.0.0/examples/Wallet/Wallet.sol +++ b/packages/contracts/contracts/examples/Wallet/Wallet.sol diff --git a/packages/contracts/src/2.0.0/examples/Whitelist/Whitelist.sol b/packages/contracts/contracts/examples/Whitelist/Whitelist.sol index e4e25038c..e4e25038c 100644 --- a/packages/contracts/src/2.0.0/examples/Whitelist/Whitelist.sol +++ b/packages/contracts/contracts/examples/Whitelist/Whitelist.sol diff --git a/packages/contracts/src/2.0.0/extensions/Forwarder/Forwarder.sol b/packages/contracts/contracts/extensions/Forwarder/Forwarder.sol index 94dec40ed..94dec40ed 100644 --- a/packages/contracts/src/2.0.0/extensions/Forwarder/Forwarder.sol +++ b/packages/contracts/contracts/extensions/Forwarder/Forwarder.sol diff --git a/packages/contracts/src/2.0.0/extensions/Forwarder/MixinAssets.sol b/packages/contracts/contracts/extensions/Forwarder/MixinAssets.sol index 43efb5ff3..43efb5ff3 100644 --- a/packages/contracts/src/2.0.0/extensions/Forwarder/MixinAssets.sol +++ b/packages/contracts/contracts/extensions/Forwarder/MixinAssets.sol diff --git a/packages/contracts/src/2.0.0/extensions/Forwarder/MixinExchangeWrapper.sol b/packages/contracts/contracts/extensions/Forwarder/MixinExchangeWrapper.sol index fea9a53c2..fea9a53c2 100644 --- a/packages/contracts/src/2.0.0/extensions/Forwarder/MixinExchangeWrapper.sol +++ b/packages/contracts/contracts/extensions/Forwarder/MixinExchangeWrapper.sol diff --git a/packages/contracts/src/2.0.0/extensions/Forwarder/MixinForwarderCore.sol b/packages/contracts/contracts/extensions/Forwarder/MixinForwarderCore.sol index 54487f726..54487f726 100644 --- a/packages/contracts/src/2.0.0/extensions/Forwarder/MixinForwarderCore.sol +++ b/packages/contracts/contracts/extensions/Forwarder/MixinForwarderCore.sol diff --git a/packages/contracts/src/2.0.0/extensions/Forwarder/MixinWeth.sol b/packages/contracts/contracts/extensions/Forwarder/MixinWeth.sol index d2814a49b..d2814a49b 100644 --- a/packages/contracts/src/2.0.0/extensions/Forwarder/MixinWeth.sol +++ b/packages/contracts/contracts/extensions/Forwarder/MixinWeth.sol diff --git a/packages/contracts/src/2.0.0/extensions/Forwarder/interfaces/IAssets.sol b/packages/contracts/contracts/extensions/Forwarder/interfaces/IAssets.sol index 1e034c003..1e034c003 100644 --- a/packages/contracts/src/2.0.0/extensions/Forwarder/interfaces/IAssets.sol +++ b/packages/contracts/contracts/extensions/Forwarder/interfaces/IAssets.sol diff --git a/packages/contracts/src/2.0.0/extensions/Forwarder/interfaces/IForwarder.sol b/packages/contracts/contracts/extensions/Forwarder/interfaces/IForwarder.sol index f5a26e2ba..f5a26e2ba 100644 --- a/packages/contracts/src/2.0.0/extensions/Forwarder/interfaces/IForwarder.sol +++ b/packages/contracts/contracts/extensions/Forwarder/interfaces/IForwarder.sol diff --git a/packages/contracts/src/2.0.0/extensions/Forwarder/interfaces/IForwarderCore.sol b/packages/contracts/contracts/extensions/Forwarder/interfaces/IForwarderCore.sol index 74c7da01d..74c7da01d 100644 --- a/packages/contracts/src/2.0.0/extensions/Forwarder/interfaces/IForwarderCore.sol +++ b/packages/contracts/contracts/extensions/Forwarder/interfaces/IForwarderCore.sol diff --git a/packages/contracts/src/2.0.0/extensions/Forwarder/libs/LibConstants.sol b/packages/contracts/contracts/extensions/Forwarder/libs/LibConstants.sol index 704e42ce3..704e42ce3 100644 --- a/packages/contracts/src/2.0.0/extensions/Forwarder/libs/LibConstants.sol +++ b/packages/contracts/contracts/extensions/Forwarder/libs/LibConstants.sol diff --git a/packages/contracts/src/2.0.0/extensions/Forwarder/libs/LibForwarderErrors.sol b/packages/contracts/contracts/extensions/Forwarder/libs/LibForwarderErrors.sol index fb3ade1db..fb3ade1db 100644 --- a/packages/contracts/src/2.0.0/extensions/Forwarder/libs/LibForwarderErrors.sol +++ b/packages/contracts/contracts/extensions/Forwarder/libs/LibForwarderErrors.sol diff --git a/packages/contracts/src/2.0.0/extensions/Forwarder/mixins/MAssets.sol b/packages/contracts/contracts/extensions/Forwarder/mixins/MAssets.sol index 9e7f80d97..9e7f80d97 100644 --- a/packages/contracts/src/2.0.0/extensions/Forwarder/mixins/MAssets.sol +++ b/packages/contracts/contracts/extensions/Forwarder/mixins/MAssets.sol diff --git a/packages/contracts/src/2.0.0/extensions/Forwarder/mixins/MExchangeWrapper.sol b/packages/contracts/contracts/extensions/Forwarder/mixins/MExchangeWrapper.sol index 13c26b03a..13c26b03a 100644 --- a/packages/contracts/src/2.0.0/extensions/Forwarder/mixins/MExchangeWrapper.sol +++ b/packages/contracts/contracts/extensions/Forwarder/mixins/MExchangeWrapper.sol diff --git a/packages/contracts/src/2.0.0/extensions/Forwarder/mixins/MWeth.sol b/packages/contracts/contracts/extensions/Forwarder/mixins/MWeth.sol index 88e77be4e..88e77be4e 100644 --- a/packages/contracts/src/2.0.0/extensions/Forwarder/mixins/MWeth.sol +++ b/packages/contracts/contracts/extensions/Forwarder/mixins/MWeth.sol diff --git a/packages/contracts/src/2.0.0/extensions/OrderValidator/OrderValidator.sol b/packages/contracts/contracts/extensions/OrderValidator/OrderValidator.sol index 8bfde3847..8bfde3847 100644 --- a/packages/contracts/src/2.0.0/extensions/OrderValidator/OrderValidator.sol +++ b/packages/contracts/contracts/extensions/OrderValidator/OrderValidator.sol diff --git a/packages/contracts/src/2.0.0/multisig/MultiSigWallet.sol b/packages/contracts/contracts/multisig/MultiSigWallet.sol index 516e7391c..516e7391c 100644 --- a/packages/contracts/src/2.0.0/multisig/MultiSigWallet.sol +++ b/packages/contracts/contracts/multisig/MultiSigWallet.sol diff --git a/packages/contracts/src/2.0.0/multisig/MultiSigWalletWithTimeLock.sol b/packages/contracts/contracts/multisig/MultiSigWalletWithTimeLock.sol index 9513d3b30..9513d3b30 100644 --- a/packages/contracts/src/2.0.0/multisig/MultiSigWalletWithTimeLock.sol +++ b/packages/contracts/contracts/multisig/MultiSigWalletWithTimeLock.sol diff --git a/packages/contracts/src/2.0.0/protocol/AssetProxy/ERC20Proxy.sol b/packages/contracts/contracts/protocol/AssetProxy/ERC20Proxy.sol index 258443bca..258443bca 100644 --- a/packages/contracts/src/2.0.0/protocol/AssetProxy/ERC20Proxy.sol +++ b/packages/contracts/contracts/protocol/AssetProxy/ERC20Proxy.sol diff --git a/packages/contracts/src/2.0.0/protocol/AssetProxy/ERC721Proxy.sol b/packages/contracts/contracts/protocol/AssetProxy/ERC721Proxy.sol index 65b664b8b..65b664b8b 100644 --- a/packages/contracts/src/2.0.0/protocol/AssetProxy/ERC721Proxy.sol +++ b/packages/contracts/contracts/protocol/AssetProxy/ERC721Proxy.sol diff --git a/packages/contracts/src/2.0.0/protocol/AssetProxy/MixinAuthorizable.sol b/packages/contracts/contracts/protocol/AssetProxy/MixinAuthorizable.sol index fe9bbf848..fe9bbf848 100644 --- a/packages/contracts/src/2.0.0/protocol/AssetProxy/MixinAuthorizable.sol +++ b/packages/contracts/contracts/protocol/AssetProxy/MixinAuthorizable.sol diff --git a/packages/contracts/src/2.0.0/protocol/AssetProxy/interfaces/IAssetData.sol b/packages/contracts/contracts/protocol/AssetProxy/interfaces/IAssetData.sol index 3e76e38dd..3e76e38dd 100644 --- a/packages/contracts/src/2.0.0/protocol/AssetProxy/interfaces/IAssetData.sol +++ b/packages/contracts/contracts/protocol/AssetProxy/interfaces/IAssetData.sol diff --git a/packages/contracts/src/2.0.0/protocol/AssetProxy/interfaces/IAssetProxy.sol b/packages/contracts/contracts/protocol/AssetProxy/interfaces/IAssetProxy.sol index b25d2d75a..b25d2d75a 100644 --- a/packages/contracts/src/2.0.0/protocol/AssetProxy/interfaces/IAssetProxy.sol +++ b/packages/contracts/contracts/protocol/AssetProxy/interfaces/IAssetProxy.sol diff --git a/packages/contracts/src/2.0.0/protocol/AssetProxy/interfaces/IAuthorizable.sol b/packages/contracts/contracts/protocol/AssetProxy/interfaces/IAuthorizable.sol index ba1d4aa77..ba1d4aa77 100644 --- a/packages/contracts/src/2.0.0/protocol/AssetProxy/interfaces/IAuthorizable.sol +++ b/packages/contracts/contracts/protocol/AssetProxy/interfaces/IAuthorizable.sol diff --git a/packages/contracts/src/2.0.0/protocol/AssetProxy/libs/LibAssetProxyErrors.sol b/packages/contracts/contracts/protocol/AssetProxy/libs/LibAssetProxyErrors.sol index 1d9a70cc1..1d9a70cc1 100644 --- a/packages/contracts/src/2.0.0/protocol/AssetProxy/libs/LibAssetProxyErrors.sol +++ b/packages/contracts/contracts/protocol/AssetProxy/libs/LibAssetProxyErrors.sol diff --git a/packages/contracts/src/2.0.0/protocol/AssetProxy/mixins/MAuthorizable.sol b/packages/contracts/contracts/protocol/AssetProxy/mixins/MAuthorizable.sol index d63fb7f6d..d63fb7f6d 100644 --- a/packages/contracts/src/2.0.0/protocol/AssetProxy/mixins/MAuthorizable.sol +++ b/packages/contracts/contracts/protocol/AssetProxy/mixins/MAuthorizable.sol diff --git a/packages/contracts/src/2.0.0/protocol/AssetProxyOwner/AssetProxyOwner.sol b/packages/contracts/contracts/protocol/AssetProxyOwner/AssetProxyOwner.sol index edb788fab..edb788fab 100644 --- a/packages/contracts/src/2.0.0/protocol/AssetProxyOwner/AssetProxyOwner.sol +++ b/packages/contracts/contracts/protocol/AssetProxyOwner/AssetProxyOwner.sol diff --git a/packages/contracts/src/2.0.0/protocol/Exchange/Exchange.sol b/packages/contracts/contracts/protocol/Exchange/Exchange.sol index ead36009f..ead36009f 100644 --- a/packages/contracts/src/2.0.0/protocol/Exchange/Exchange.sol +++ b/packages/contracts/contracts/protocol/Exchange/Exchange.sol diff --git a/packages/contracts/src/2.0.0/protocol/Exchange/MixinAssetProxyDispatcher.sol b/packages/contracts/contracts/protocol/Exchange/MixinAssetProxyDispatcher.sol index 87b09b6b3..87b09b6b3 100644 --- a/packages/contracts/src/2.0.0/protocol/Exchange/MixinAssetProxyDispatcher.sol +++ b/packages/contracts/contracts/protocol/Exchange/MixinAssetProxyDispatcher.sol diff --git a/packages/contracts/src/2.0.0/protocol/Exchange/MixinExchangeCore.sol b/packages/contracts/contracts/protocol/Exchange/MixinExchangeCore.sol index 736dcd0b1..736dcd0b1 100644 --- a/packages/contracts/src/2.0.0/protocol/Exchange/MixinExchangeCore.sol +++ b/packages/contracts/contracts/protocol/Exchange/MixinExchangeCore.sol diff --git a/packages/contracts/src/2.0.0/protocol/Exchange/MixinMatchOrders.sol b/packages/contracts/contracts/protocol/Exchange/MixinMatchOrders.sol index b4f6bdb26..b4f6bdb26 100644 --- a/packages/contracts/src/2.0.0/protocol/Exchange/MixinMatchOrders.sol +++ b/packages/contracts/contracts/protocol/Exchange/MixinMatchOrders.sol diff --git a/packages/contracts/src/2.0.0/protocol/Exchange/MixinSignatureValidator.sol b/packages/contracts/contracts/protocol/Exchange/MixinSignatureValidator.sol index 176e28351..176e28351 100644 --- a/packages/contracts/src/2.0.0/protocol/Exchange/MixinSignatureValidator.sol +++ b/packages/contracts/contracts/protocol/Exchange/MixinSignatureValidator.sol diff --git a/packages/contracts/src/2.0.0/protocol/Exchange/MixinTransactions.sol b/packages/contracts/contracts/protocol/Exchange/MixinTransactions.sol index 3a76ca202..3a76ca202 100644 --- a/packages/contracts/src/2.0.0/protocol/Exchange/MixinTransactions.sol +++ b/packages/contracts/contracts/protocol/Exchange/MixinTransactions.sol diff --git a/packages/contracts/src/2.0.0/protocol/Exchange/MixinWrapperFunctions.sol b/packages/contracts/contracts/protocol/Exchange/MixinWrapperFunctions.sol index cddff0e5f..cddff0e5f 100644 --- a/packages/contracts/src/2.0.0/protocol/Exchange/MixinWrapperFunctions.sol +++ b/packages/contracts/contracts/protocol/Exchange/MixinWrapperFunctions.sol diff --git a/packages/contracts/src/2.0.0/protocol/Exchange/interfaces/IAssetProxyDispatcher.sol b/packages/contracts/contracts/protocol/Exchange/interfaces/IAssetProxyDispatcher.sol index 8db8d6f6c..8db8d6f6c 100644 --- a/packages/contracts/src/2.0.0/protocol/Exchange/interfaces/IAssetProxyDispatcher.sol +++ b/packages/contracts/contracts/protocol/Exchange/interfaces/IAssetProxyDispatcher.sol diff --git a/packages/contracts/src/2.0.0/protocol/Exchange/interfaces/IExchange.sol b/packages/contracts/contracts/protocol/Exchange/interfaces/IExchange.sol index b92abba04..b92abba04 100644 --- a/packages/contracts/src/2.0.0/protocol/Exchange/interfaces/IExchange.sol +++ b/packages/contracts/contracts/protocol/Exchange/interfaces/IExchange.sol diff --git a/packages/contracts/src/2.0.0/protocol/Exchange/interfaces/IExchangeCore.sol b/packages/contracts/contracts/protocol/Exchange/interfaces/IExchangeCore.sol index 9995e0385..9995e0385 100644 --- a/packages/contracts/src/2.0.0/protocol/Exchange/interfaces/IExchangeCore.sol +++ b/packages/contracts/contracts/protocol/Exchange/interfaces/IExchangeCore.sol diff --git a/packages/contracts/src/2.0.0/protocol/Exchange/interfaces/IMatchOrders.sol b/packages/contracts/contracts/protocol/Exchange/interfaces/IMatchOrders.sol index 73447f3ae..73447f3ae 100644 --- a/packages/contracts/src/2.0.0/protocol/Exchange/interfaces/IMatchOrders.sol +++ b/packages/contracts/contracts/protocol/Exchange/interfaces/IMatchOrders.sol diff --git a/packages/contracts/src/2.0.0/protocol/Exchange/interfaces/ISignatureValidator.sol b/packages/contracts/contracts/protocol/Exchange/interfaces/ISignatureValidator.sol index 1fd0eccf0..1fd0eccf0 100644 --- a/packages/contracts/src/2.0.0/protocol/Exchange/interfaces/ISignatureValidator.sol +++ b/packages/contracts/contracts/protocol/Exchange/interfaces/ISignatureValidator.sol diff --git a/packages/contracts/src/2.0.0/protocol/Exchange/interfaces/ITransactions.sol b/packages/contracts/contracts/protocol/Exchange/interfaces/ITransactions.sol index 4446c55ce..4446c55ce 100644 --- a/packages/contracts/src/2.0.0/protocol/Exchange/interfaces/ITransactions.sol +++ b/packages/contracts/contracts/protocol/Exchange/interfaces/ITransactions.sol diff --git a/packages/contracts/src/2.0.0/protocol/Exchange/interfaces/IValidator.sol b/packages/contracts/contracts/protocol/Exchange/interfaces/IValidator.sol index 2dd69100c..2dd69100c 100644 --- a/packages/contracts/src/2.0.0/protocol/Exchange/interfaces/IValidator.sol +++ b/packages/contracts/contracts/protocol/Exchange/interfaces/IValidator.sol diff --git a/packages/contracts/src/2.0.0/protocol/Exchange/interfaces/IWallet.sol b/packages/contracts/contracts/protocol/Exchange/interfaces/IWallet.sol index c97161ca6..c97161ca6 100644 --- a/packages/contracts/src/2.0.0/protocol/Exchange/interfaces/IWallet.sol +++ b/packages/contracts/contracts/protocol/Exchange/interfaces/IWallet.sol diff --git a/packages/contracts/src/2.0.0/protocol/Exchange/interfaces/IWrapperFunctions.sol b/packages/contracts/contracts/protocol/Exchange/interfaces/IWrapperFunctions.sol index 56a533646..56a533646 100644 --- a/packages/contracts/src/2.0.0/protocol/Exchange/interfaces/IWrapperFunctions.sol +++ b/packages/contracts/contracts/protocol/Exchange/interfaces/IWrapperFunctions.sol diff --git a/packages/contracts/src/2.0.0/protocol/Exchange/libs/LibAbiEncoder.sol b/packages/contracts/contracts/protocol/Exchange/libs/LibAbiEncoder.sol index 4aad37709..4aad37709 100644 --- a/packages/contracts/src/2.0.0/protocol/Exchange/libs/LibAbiEncoder.sol +++ b/packages/contracts/contracts/protocol/Exchange/libs/LibAbiEncoder.sol diff --git a/packages/contracts/src/2.0.0/protocol/Exchange/libs/LibConstants.sol b/packages/contracts/contracts/protocol/Exchange/libs/LibConstants.sol index 8d2732cd3..8d2732cd3 100644 --- a/packages/contracts/src/2.0.0/protocol/Exchange/libs/LibConstants.sol +++ b/packages/contracts/contracts/protocol/Exchange/libs/LibConstants.sol diff --git a/packages/contracts/src/2.0.0/protocol/Exchange/libs/LibEIP712.sol b/packages/contracts/contracts/protocol/Exchange/libs/LibEIP712.sol index 203edc1fd..203edc1fd 100644 --- a/packages/contracts/src/2.0.0/protocol/Exchange/libs/LibEIP712.sol +++ b/packages/contracts/contracts/protocol/Exchange/libs/LibEIP712.sol diff --git a/packages/contracts/src/2.0.0/protocol/Exchange/libs/LibExchangeErrors.sol b/packages/contracts/contracts/protocol/Exchange/libs/LibExchangeErrors.sol index a0f75bc06..a0f75bc06 100644 --- a/packages/contracts/src/2.0.0/protocol/Exchange/libs/LibExchangeErrors.sol +++ b/packages/contracts/contracts/protocol/Exchange/libs/LibExchangeErrors.sol diff --git a/packages/contracts/src/2.0.0/protocol/Exchange/libs/LibFillResults.sol b/packages/contracts/contracts/protocol/Exchange/libs/LibFillResults.sol index 659ae9a69..659ae9a69 100644 --- a/packages/contracts/src/2.0.0/protocol/Exchange/libs/LibFillResults.sol +++ b/packages/contracts/contracts/protocol/Exchange/libs/LibFillResults.sol diff --git a/packages/contracts/src/2.0.0/protocol/Exchange/libs/LibMath.sol b/packages/contracts/contracts/protocol/Exchange/libs/LibMath.sol index c0b85ea10..c0b85ea10 100644 --- a/packages/contracts/src/2.0.0/protocol/Exchange/libs/LibMath.sol +++ b/packages/contracts/contracts/protocol/Exchange/libs/LibMath.sol diff --git a/packages/contracts/src/2.0.0/protocol/Exchange/libs/LibOrder.sol b/packages/contracts/contracts/protocol/Exchange/libs/LibOrder.sol index 0fe7c2161..0fe7c2161 100644 --- a/packages/contracts/src/2.0.0/protocol/Exchange/libs/LibOrder.sol +++ b/packages/contracts/contracts/protocol/Exchange/libs/LibOrder.sol diff --git a/packages/contracts/src/2.0.0/protocol/Exchange/mixins/MAssetProxyDispatcher.sol b/packages/contracts/contracts/protocol/Exchange/mixins/MAssetProxyDispatcher.sol index 0ddfca270..0ddfca270 100644 --- a/packages/contracts/src/2.0.0/protocol/Exchange/mixins/MAssetProxyDispatcher.sol +++ b/packages/contracts/contracts/protocol/Exchange/mixins/MAssetProxyDispatcher.sol diff --git a/packages/contracts/src/2.0.0/protocol/Exchange/mixins/MExchangeCore.sol b/packages/contracts/contracts/protocol/Exchange/mixins/MExchangeCore.sol index 742499568..742499568 100644 --- a/packages/contracts/src/2.0.0/protocol/Exchange/mixins/MExchangeCore.sol +++ b/packages/contracts/contracts/protocol/Exchange/mixins/MExchangeCore.sol diff --git a/packages/contracts/src/2.0.0/protocol/Exchange/mixins/MMatchOrders.sol b/packages/contracts/contracts/protocol/Exchange/mixins/MMatchOrders.sol index 96fa34bc0..96fa34bc0 100644 --- a/packages/contracts/src/2.0.0/protocol/Exchange/mixins/MMatchOrders.sol +++ b/packages/contracts/contracts/protocol/Exchange/mixins/MMatchOrders.sol diff --git a/packages/contracts/src/2.0.0/protocol/Exchange/mixins/MSignatureValidator.sol b/packages/contracts/contracts/protocol/Exchange/mixins/MSignatureValidator.sol index 1fe88b908..1fe88b908 100644 --- a/packages/contracts/src/2.0.0/protocol/Exchange/mixins/MSignatureValidator.sol +++ b/packages/contracts/contracts/protocol/Exchange/mixins/MSignatureValidator.sol diff --git a/packages/contracts/src/2.0.0/protocol/Exchange/mixins/MTransactions.sol b/packages/contracts/contracts/protocol/Exchange/mixins/MTransactions.sol index 4f61a4945..4f61a4945 100644 --- a/packages/contracts/src/2.0.0/protocol/Exchange/mixins/MTransactions.sol +++ b/packages/contracts/contracts/protocol/Exchange/mixins/MTransactions.sol diff --git a/packages/contracts/src/2.0.0/protocol/Exchange/mixins/MWrapperFunctions.sol b/packages/contracts/contracts/protocol/Exchange/mixins/MWrapperFunctions.sol index 4adfbde01..4adfbde01 100644 --- a/packages/contracts/src/2.0.0/protocol/Exchange/mixins/MWrapperFunctions.sol +++ b/packages/contracts/contracts/protocol/Exchange/mixins/MWrapperFunctions.sol diff --git a/packages/contracts/src/2.0.0/test/DummyERC20Token/DummyERC20Token.sol b/packages/contracts/contracts/test/DummyERC20Token/DummyERC20Token.sol index 412c5d1ad..412c5d1ad 100644 --- a/packages/contracts/src/2.0.0/test/DummyERC20Token/DummyERC20Token.sol +++ b/packages/contracts/contracts/test/DummyERC20Token/DummyERC20Token.sol diff --git a/packages/contracts/src/2.0.0/test/DummyERC20Token/DummyMultipleReturnERC20Token.sol b/packages/contracts/contracts/test/DummyERC20Token/DummyMultipleReturnERC20Token.sol index 733d4437e..733d4437e 100644 --- a/packages/contracts/src/2.0.0/test/DummyERC20Token/DummyMultipleReturnERC20Token.sol +++ b/packages/contracts/contracts/test/DummyERC20Token/DummyMultipleReturnERC20Token.sol diff --git a/packages/contracts/src/2.0.0/test/DummyERC20Token/DummyNoReturnERC20Token.sol b/packages/contracts/contracts/test/DummyERC20Token/DummyNoReturnERC20Token.sol index e16825a16..e16825a16 100644 --- a/packages/contracts/src/2.0.0/test/DummyERC20Token/DummyNoReturnERC20Token.sol +++ b/packages/contracts/contracts/test/DummyERC20Token/DummyNoReturnERC20Token.sol diff --git a/packages/contracts/src/2.0.0/test/DummyERC721Receiver/DummyERC721Receiver.sol b/packages/contracts/contracts/test/DummyERC721Receiver/DummyERC721Receiver.sol index 6c8371559..6c8371559 100644 --- a/packages/contracts/src/2.0.0/test/DummyERC721Receiver/DummyERC721Receiver.sol +++ b/packages/contracts/contracts/test/DummyERC721Receiver/DummyERC721Receiver.sol diff --git a/packages/contracts/src/2.0.0/test/DummyERC721Receiver/InvalidERC721Receiver.sol b/packages/contracts/contracts/test/DummyERC721Receiver/InvalidERC721Receiver.sol index 309633bf5..309633bf5 100644 --- a/packages/contracts/src/2.0.0/test/DummyERC721Receiver/InvalidERC721Receiver.sol +++ b/packages/contracts/contracts/test/DummyERC721Receiver/InvalidERC721Receiver.sol diff --git a/packages/contracts/src/2.0.0/test/DummyERC721Token/DummyERC721Token.sol b/packages/contracts/contracts/test/DummyERC721Token/DummyERC721Token.sol index ac9068d1d..ac9068d1d 100644 --- a/packages/contracts/src/2.0.0/test/DummyERC721Token/DummyERC721Token.sol +++ b/packages/contracts/contracts/test/DummyERC721Token/DummyERC721Token.sol diff --git a/packages/contracts/src/2.0.0/test/ReentrantERC20Token/ReentrantERC20Token.sol b/packages/contracts/contracts/test/ReentrantERC20Token/ReentrantERC20Token.sol index 99dd47a78..99dd47a78 100644 --- a/packages/contracts/src/2.0.0/test/ReentrantERC20Token/ReentrantERC20Token.sol +++ b/packages/contracts/contracts/test/ReentrantERC20Token/ReentrantERC20Token.sol diff --git a/packages/contracts/src/2.0.0/test/TestAssetProxyDispatcher/TestAssetProxyDispatcher.sol b/packages/contracts/contracts/test/TestAssetProxyDispatcher/TestAssetProxyDispatcher.sol index ad71fc9a1..ad71fc9a1 100644 --- a/packages/contracts/src/2.0.0/test/TestAssetProxyDispatcher/TestAssetProxyDispatcher.sol +++ b/packages/contracts/contracts/test/TestAssetProxyDispatcher/TestAssetProxyDispatcher.sol diff --git a/packages/contracts/src/2.0.0/test/TestAssetProxyOwner/TestAssetProxyOwner.sol b/packages/contracts/contracts/test/TestAssetProxyOwner/TestAssetProxyOwner.sol index 52c66cb56..52c66cb56 100644 --- a/packages/contracts/src/2.0.0/test/TestAssetProxyOwner/TestAssetProxyOwner.sol +++ b/packages/contracts/contracts/test/TestAssetProxyOwner/TestAssetProxyOwner.sol diff --git a/packages/contracts/src/2.0.0/test/TestConstants/TestConstants.sol b/packages/contracts/contracts/test/TestConstants/TestConstants.sol index 1275d007b..1275d007b 100644 --- a/packages/contracts/src/2.0.0/test/TestConstants/TestConstants.sol +++ b/packages/contracts/contracts/test/TestConstants/TestConstants.sol diff --git a/packages/contracts/src/2.0.0/test/TestExchangeInternals/TestExchangeInternals.sol b/packages/contracts/contracts/test/TestExchangeInternals/TestExchangeInternals.sol index 27187f8f8..27187f8f8 100644 --- a/packages/contracts/src/2.0.0/test/TestExchangeInternals/TestExchangeInternals.sol +++ b/packages/contracts/contracts/test/TestExchangeInternals/TestExchangeInternals.sol diff --git a/packages/contracts/src/2.0.0/test/TestLibBytes/TestLibBytes.sol b/packages/contracts/contracts/test/TestLibBytes/TestLibBytes.sol index 00d861e61..00d861e61 100644 --- a/packages/contracts/src/2.0.0/test/TestLibBytes/TestLibBytes.sol +++ b/packages/contracts/contracts/test/TestLibBytes/TestLibBytes.sol diff --git a/packages/contracts/src/2.0.0/test/TestLibs/TestLibs.sol b/packages/contracts/contracts/test/TestLibs/TestLibs.sol index a10f981fc..a10f981fc 100644 --- a/packages/contracts/src/2.0.0/test/TestLibs/TestLibs.sol +++ b/packages/contracts/contracts/test/TestLibs/TestLibs.sol diff --git a/packages/contracts/src/2.0.0/test/TestSignatureValidator/TestSignatureValidator.sol b/packages/contracts/contracts/test/TestSignatureValidator/TestSignatureValidator.sol index ea3e2de59..ea3e2de59 100644 --- a/packages/contracts/src/2.0.0/test/TestSignatureValidator/TestSignatureValidator.sol +++ b/packages/contracts/contracts/test/TestSignatureValidator/TestSignatureValidator.sol diff --git a/packages/contracts/src/2.0.0/test/TestStaticCallReceiver/TestStaticCallReceiver.sol b/packages/contracts/contracts/test/TestStaticCallReceiver/TestStaticCallReceiver.sol index 41aab01c8..41aab01c8 100644 --- a/packages/contracts/src/2.0.0/test/TestStaticCallReceiver/TestStaticCallReceiver.sol +++ b/packages/contracts/contracts/test/TestStaticCallReceiver/TestStaticCallReceiver.sol diff --git a/packages/contracts/src/2.0.0/tokens/ERC20Token/ERC20Token.sol b/packages/contracts/contracts/tokens/ERC20Token/ERC20Token.sol index 725d304df..725d304df 100644 --- a/packages/contracts/src/2.0.0/tokens/ERC20Token/ERC20Token.sol +++ b/packages/contracts/contracts/tokens/ERC20Token/ERC20Token.sol diff --git a/packages/contracts/src/2.0.0/tokens/ERC20Token/IERC20Token.sol b/packages/contracts/contracts/tokens/ERC20Token/IERC20Token.sol index 258d47393..258d47393 100644 --- a/packages/contracts/src/2.0.0/tokens/ERC20Token/IERC20Token.sol +++ b/packages/contracts/contracts/tokens/ERC20Token/IERC20Token.sol diff --git a/packages/contracts/src/2.0.0/tokens/ERC20Token/MintableERC20Token.sol b/packages/contracts/contracts/tokens/ERC20Token/MintableERC20Token.sol index 9dc924422..9dc924422 100644 --- a/packages/contracts/src/2.0.0/tokens/ERC20Token/MintableERC20Token.sol +++ b/packages/contracts/contracts/tokens/ERC20Token/MintableERC20Token.sol diff --git a/packages/contracts/src/2.0.0/tokens/ERC20Token/UnlimitedAllowanceERC20Token.sol b/packages/contracts/contracts/tokens/ERC20Token/UnlimitedAllowanceERC20Token.sol index 2e5bd4348..2e5bd4348 100644 --- a/packages/contracts/src/2.0.0/tokens/ERC20Token/UnlimitedAllowanceERC20Token.sol +++ b/packages/contracts/contracts/tokens/ERC20Token/UnlimitedAllowanceERC20Token.sol diff --git a/packages/contracts/src/2.0.0/tokens/ERC721Token/ERC721Token.sol b/packages/contracts/contracts/tokens/ERC721Token/ERC721Token.sol index 530f080c0..530f080c0 100644 --- a/packages/contracts/src/2.0.0/tokens/ERC721Token/ERC721Token.sol +++ b/packages/contracts/contracts/tokens/ERC721Token/ERC721Token.sol diff --git a/packages/contracts/src/2.0.0/tokens/ERC721Token/IERC721Receiver.sol b/packages/contracts/contracts/tokens/ERC721Token/IERC721Receiver.sol index 8e0e32ab2..8e0e32ab2 100644 --- a/packages/contracts/src/2.0.0/tokens/ERC721Token/IERC721Receiver.sol +++ b/packages/contracts/contracts/tokens/ERC721Token/IERC721Receiver.sol diff --git a/packages/contracts/src/2.0.0/tokens/ERC721Token/IERC721Token.sol b/packages/contracts/contracts/tokens/ERC721Token/IERC721Token.sol index ac992c80d..ac992c80d 100644 --- a/packages/contracts/src/2.0.0/tokens/ERC721Token/IERC721Token.sol +++ b/packages/contracts/contracts/tokens/ERC721Token/IERC721Token.sol diff --git a/packages/contracts/src/2.0.0/tokens/ERC721Token/MintableERC721Token.sol b/packages/contracts/contracts/tokens/ERC721Token/MintableERC721Token.sol index bc5cd2cc2..bc5cd2cc2 100644 --- a/packages/contracts/src/2.0.0/tokens/ERC721Token/MintableERC721Token.sol +++ b/packages/contracts/contracts/tokens/ERC721Token/MintableERC721Token.sol diff --git a/packages/contracts/src/2.0.0/tokens/EtherToken/IEtherToken.sol b/packages/contracts/contracts/tokens/EtherToken/IEtherToken.sol index 9e2e68766..9e2e68766 100644 --- a/packages/contracts/src/2.0.0/tokens/EtherToken/IEtherToken.sol +++ b/packages/contracts/contracts/tokens/EtherToken/IEtherToken.sol diff --git a/packages/contracts/src/2.0.0/tokens/EtherToken/WETH9.sol b/packages/contracts/contracts/tokens/EtherToken/WETH9.sol index 17876b86d..17876b86d 100644 --- a/packages/contracts/src/2.0.0/tokens/EtherToken/WETH9.sol +++ b/packages/contracts/contracts/tokens/EtherToken/WETH9.sol diff --git a/packages/contracts/src/1.0.0/ERC20Token/ERC20Token_v1.sol b/packages/contracts/contracts/tokens/ZRXToken/ERC20Token_v1.sol index e05ee2d5e..4920c4aac 100644 --- a/packages/contracts/src/1.0.0/ERC20Token/ERC20Token_v1.sol +++ b/packages/contracts/contracts/tokens/ZRXToken/ERC20Token_v1.sol @@ -1,6 +1,6 @@ pragma solidity ^0.4.11; -import { Token_v1 as Token } from "../Token/Token_v1.sol"; +import { Token_v1 as Token } from "./Token_v1.sol"; contract ERC20Token_v1 is Token { diff --git a/packages/contracts/src/1.0.0/Token/Token_v1.sol b/packages/contracts/contracts/tokens/ZRXToken/Token_v1.sol index de619fb7e..de619fb7e 100644 --- a/packages/contracts/src/1.0.0/Token/Token_v1.sol +++ b/packages/contracts/contracts/tokens/ZRXToken/Token_v1.sol diff --git a/packages/contracts/src/1.0.0/UnlimitedAllowanceToken/UnlimitedAllowanceToken_v1.sol b/packages/contracts/contracts/tokens/ZRXToken/UnlimitedAllowanceToken_v1.sol index 46379c43d..bf1b0335a 100644 --- a/packages/contracts/src/1.0.0/UnlimitedAllowanceToken/UnlimitedAllowanceToken_v1.sol +++ b/packages/contracts/contracts/tokens/ZRXToken/UnlimitedAllowanceToken_v1.sol @@ -18,7 +18,7 @@ pragma solidity ^0.4.11; -import { ERC20Token_v1 as ERC20Token } from "../ERC20Token/ERC20Token_v1.sol"; +import { ERC20Token_v1 as ERC20Token } from "./ERC20Token_v1.sol"; contract UnlimitedAllowanceToken_v1 is ERC20Token { diff --git a/packages/contracts/src/2.0.0/tokens/ZRXToken/ZRXToken.sol b/packages/contracts/contracts/tokens/ZRXToken/ZRXToken.sol index f4855759c..831e1822c 100644 --- a/packages/contracts/src/2.0.0/tokens/ZRXToken/ZRXToken.sol +++ b/packages/contracts/contracts/tokens/ZRXToken/ZRXToken.sol @@ -19,7 +19,7 @@ pragma solidity 0.4.11; // solhint-disable-next-line max-line-length -import { UnlimitedAllowanceToken_v1 as UnlimitedAllowanceToken } from "../../../1.0.0/UnlimitedAllowanceToken/UnlimitedAllowanceToken_v1.sol"; +import { UnlimitedAllowanceToken_v1 as UnlimitedAllowanceToken } from "./UnlimitedAllowanceToken_v1.sol"; contract ZRXToken is diff --git a/packages/contracts/src/2.0.0/utils/LibBytes/LibBytes.sol b/packages/contracts/contracts/utils/LibBytes/LibBytes.sol index 369f588ad..369f588ad 100644 --- a/packages/contracts/src/2.0.0/utils/LibBytes/LibBytes.sol +++ b/packages/contracts/contracts/utils/LibBytes/LibBytes.sol diff --git a/packages/contracts/src/2.0.0/utils/Ownable/IOwnable.sol b/packages/contracts/contracts/utils/Ownable/IOwnable.sol index 5deb13497..5deb13497 100644 --- a/packages/contracts/src/2.0.0/utils/Ownable/IOwnable.sol +++ b/packages/contracts/contracts/utils/Ownable/IOwnable.sol diff --git a/packages/contracts/src/2.0.0/utils/Ownable/Ownable.sol b/packages/contracts/contracts/utils/Ownable/Ownable.sol index 0c830be68..0c830be68 100644 --- a/packages/contracts/src/2.0.0/utils/Ownable/Ownable.sol +++ b/packages/contracts/contracts/utils/Ownable/Ownable.sol diff --git a/packages/contracts/src/2.0.0/utils/ReentrancyGuard/ReentrancyGuard.sol b/packages/contracts/contracts/utils/ReentrancyGuard/ReentrancyGuard.sol index 9f98a7a16..9f98a7a16 100644 --- a/packages/contracts/src/2.0.0/utils/ReentrancyGuard/ReentrancyGuard.sol +++ b/packages/contracts/contracts/utils/ReentrancyGuard/ReentrancyGuard.sol diff --git a/packages/contracts/src/2.0.0/utils/SafeMath/SafeMath.sol b/packages/contracts/contracts/utils/SafeMath/SafeMath.sol index 2855edb9d..2855edb9d 100644 --- a/packages/contracts/src/2.0.0/utils/SafeMath/SafeMath.sol +++ b/packages/contracts/contracts/utils/SafeMath/SafeMath.sol diff --git a/packages/contracts/globals.d.ts b/packages/contracts/globals.d.ts deleted file mode 100644 index 94e63a32d..000000000 --- a/packages/contracts/globals.d.ts +++ /dev/null @@ -1,6 +0,0 @@ -declare module '*.json' { - const json: any; - /* tslint:disable */ - export default json; - /* tslint:enable */ -} diff --git a/packages/contracts/package.json b/packages/contracts/package.json index 01d04e645..33ae3db9a 100644 --- a/packages/contracts/package.json +++ b/packages/contracts/package.json @@ -6,34 +6,33 @@ "node": ">=6.12" }, "description": "Smart contract components of 0x protocol", - "main": "index.js", + "main": "lib/src/index.js", "directories": { "test": "test" }, "scripts": { "build": "yarn pre_build && tsc -b", "build:ci": "yarn build", - "pre_build": "run-s compile copy_artifacts generate_contract_wrappers", - "copy_artifacts": "copyfiles -u 4 '../migrations/artifacts/development/**/*' ./lib/artifacts;", + "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 src", - "clean": "shx rm -rf lib generated_contract_wrappers", - "generate_contract_wrappers": "abi-gen --abis ${npm_package_config_abis} --template ../contract_templates/contract.handlebars --partials '../contract_templates/partials/**/*.handlebars' --output generated_contract_wrappers --backend ethers", - "lint": "tslint --project . --exclude **/src/generated_contract_wrappers/**/* --exclude **/lib/**/* && yarn lint-contracts", + "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 ../contract_templates/contract.handlebars --partials '../contract_templates/partials/**/*.handlebars' --output generated-wrappers --backend ethers", + "lint": "tslint --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 src/2.0.0/**/**/**/**/*.sol" + "lint-contracts": "solhint contracts/**/**/**/**/*.sol" }, "config": { - "abis": "../migrations/artifacts/development/@(AssetProxyOwner|DummyERC20Token|DummyERC721Receiver|DummyERC721Token|DummyMultipleReturnERC20Token|DummyNoReturnERC20Token|ERC20Proxy|ERC721Proxy|Forwarder|Exchange|ExchangeWrapper|IAssetData|IAssetProxy|InvalidERC721Receiver|MixinAuthorizable|MultiSigWallet|MultiSigWalletWithTimeLock|OrderValidator|ReentrantERC20Token|TestAssetProxyOwner|TestAssetProxyDispatcher|TestConstants|TestExchangeInternals|TestLibBytes|TestLibs|TestSignatureValidator|TestStaticCallReceiver|Validator|Wallet|TokenRegistry|Whitelist|WETH9|ZRXToken).json" + "abis": "generated-artifacts/@(AssetProxyOwner|DummyERC20Token|DummyERC721Receiver|DummyERC721Token|DummyMultipleReturnERC20Token|DummyNoReturnERC20Token|ERC20Token|ERC20Proxy|ERC721Token|ERC721Proxy|Forwarder|Exchange|ExchangeWrapper|IAssetData|IAssetProxy|InvalidERC721Receiver|MixinAuthorizable|MultiSigWallet|MultiSigWalletWithTimeLock|OrderValidator|ReentrantERC20Token|TestAssetProxyOwner|TestAssetProxyDispatcher|TestConstants|TestExchangeInternals|TestLibBytes|TestLibs|TestSignatureValidator|TestStaticCallReceiver|Validator|Wallet|Whitelist|WETH9|ZRXToken).json" }, "repository": { "type": "git", @@ -60,7 +59,6 @@ "chai": "^4.0.1", "chai-as-promised": "^7.1.0", "chai-bignumber": "^2.0.1", - "copyfiles": "^2.0.0", "dirty-chai": "^2.0.1", "make-promises-safe": "^1.1.0", "mocha": "^4.1.0", @@ -87,5 +85,8 @@ "ethers": "~4.0.4", "js-combinatorics": "^0.5.3", "lodash": "^4.17.5" + }, + "publishConfig": { + "access": "public" } } diff --git a/packages/contracts/src/1.0.0/Arbitrage/Arbitrage.sol b/packages/contracts/src/1.0.0/Arbitrage/Arbitrage.sol deleted file mode 100644 index 5054afc2f..000000000 --- a/packages/contracts/src/1.0.0/Arbitrage/Arbitrage.sol +++ /dev/null @@ -1,114 +0,0 @@ -pragma solidity ^0.4.19; - -import { IExchange_v1 as Exchange } from "../Exchange/IExchange_v1.sol"; -import { EtherDelta } from "../EtherDelta/EtherDelta.sol"; -import { Ownable_v1 as Ownable } from "../Ownable/Ownable_v1.sol"; -import { IToken_v1 as Token } from "../Token/IToken_v1.sol"; - -/// @title Arbitrage - Facilitates atomic arbitrage of ERC20 tokens between EtherDelta and 0x Exchange contract. -/// @author Leonid Logvinov - <leo@0xProject.com> -contract Arbitrage is Ownable { - - Exchange exchange; - EtherDelta etherDelta; - address proxyAddress; - - uint256 constant MAX_UINT = 2**256 - 1; - - function Arbitrage(address _exchangeAddress, address _etherDeltaAddress, address _proxyAddress) { - exchange = Exchange(_exchangeAddress); - etherDelta = EtherDelta(_etherDeltaAddress); - proxyAddress = _proxyAddress; - } - - /* - * Makes token tradeable by setting an allowance for etherDelta and 0x proxy contract. - * Also sets an allowance for the owner of the contracts therefore allowing to withdraw tokens. - */ - function setAllowances(address tokenAddress) external onlyOwner { - Token token = Token(tokenAddress); - token.approve(address(etherDelta), MAX_UINT); - token.approve(proxyAddress, MAX_UINT); - token.approve(owner, MAX_UINT); - } - - /* - * Because of the limits on the number of local variables in Solidity we need to compress parameters while loosing - * readability. Scheme of the parameter layout: - * - * addresses - * 0..4 orderAddresses - * 5 user - * - * values - * 0..5 orderValues - * 6 fillTakerTokenAmount - * 7 amountGet - * 8 amountGive - * 9 expires - * 10 nonce - * 11 amount - - * signature - * exchange then etherDelta - */ - function makeAtomicTrade( - address[6] addresses, uint[12] values, - uint8[2] v, bytes32[2] r, bytes32[2] s - ) external onlyOwner { - makeExchangeTrade(addresses, values, v, r, s); - makeEtherDeltaTrade(addresses, values, v, r, s); - } - - function makeEtherDeltaTrade( - address[6] addresses, uint[12] values, - uint8[2] v, bytes32[2] r, bytes32[2] s - ) internal { - uint amount = values[11]; - etherDelta.depositToken( - addresses[2], // tokenGet === makerToken - values[7] // amountGet - ); - etherDelta.trade( - addresses[2], // tokenGet === makerToken - values[7], // amountGet - addresses[3], // tokenGive === takerToken - values[8], // amountGive - values[9], // expires - values[10], // nonce - addresses[5], // user - v[1], - r[1], - s[1], - amount - ); - etherDelta.withdrawToken( - addresses[3], // tokenGive === tokenToken - values[8] // amountGive - ); - } - - function makeExchangeTrade( - address[6] addresses, uint[12] values, - uint8[2] v, bytes32[2] r, bytes32[2] s - ) internal { - address[5] memory orderAddresses = [ - addresses[0], // maker - addresses[1], // taker - addresses[2], // makerToken - addresses[3], // takerToken - addresses[4] // feeRecepient - ]; - uint[6] memory orderValues = [ - values[0], // makerTokenAmount - values[1], // takerTokenAmount - values[2], // makerFee - values[3], // takerFee - values[4], // expirationTimestampInSec - values[5] // salt - ]; - uint fillTakerTokenAmount = values[6]; // fillTakerTokenAmount - // Execute Exchange trade. It either succeeds in full or fails and reverts all the changes. - exchange.fillOrKillOrder(orderAddresses, orderValues, fillTakerTokenAmount, v[0], r[0], s[0]); - } -} diff --git a/packages/contracts/src/1.0.0/EtherDelta/AccountLevels.sol b/packages/contracts/src/1.0.0/EtherDelta/AccountLevels.sol deleted file mode 100644 index 8d7a930d3..000000000 --- a/packages/contracts/src/1.0.0/EtherDelta/AccountLevels.sol +++ /dev/null @@ -1,11 +0,0 @@ -pragma solidity ^0.4.19; - -contract AccountLevels { - //given a user, returns an account level - //0 = regular user (pays take fee and make fee) - //1 = market maker silver (pays take fee, no make fee, gets rebate) - //2 = market maker gold (pays take fee, no make fee, gets entire counterparty's take fee as rebate) - function accountLevel(address user) constant returns(uint) { - return 0; - } -} diff --git a/packages/contracts/src/1.0.0/EtherDelta/EtherDelta.sol b/packages/contracts/src/1.0.0/EtherDelta/EtherDelta.sol deleted file mode 100644 index fe599ca0a..000000000 --- a/packages/contracts/src/1.0.0/EtherDelta/EtherDelta.sol +++ /dev/null @@ -1,168 +0,0 @@ -pragma solidity ^0.4.19; - -import { SafeMath } from "../SafeMath/SafeMath_v1.sol"; -import { AccountLevels } from "./AccountLevels.sol"; -import { Token } from "../Token/Token_v1.sol"; - -contract EtherDelta is SafeMath { - address public admin; //the admin address - address public feeAccount; //the account that will receive fees - address public accountLevelsAddr; //the address of the AccountLevels contract - uint public feeMake; //percentage times (1 ether) - uint public feeTake; //percentage times (1 ether) - uint public feeRebate; //percentage times (1 ether) - mapping (address => mapping (address => uint)) public tokens; //mapping of token addresses to mapping of account balances (token=0 means Ether) - mapping (address => mapping (bytes32 => bool)) public orders; //mapping of user accounts to mapping of order hashes to booleans (true = submitted by user, equivalent to offchain signature) - mapping (address => mapping (bytes32 => uint)) public orderFills; //mapping of user accounts to mapping of order hashes to uints (amount of order that has been filled) - - event Order(address tokenGet, uint amountGet, address tokenGive, uint amountGive, uint expires, uint nonce, address user); - event Cancel(address tokenGet, uint amountGet, address tokenGive, uint amountGive, uint expires, uint nonce, address user, uint8 v, bytes32 r, bytes32 s); - event Trade(address tokenGet, uint amountGet, address tokenGive, uint amountGive, address get, address give); - event Deposit(address token, address user, uint amount, uint balance); - event Withdraw(address token, address user, uint amount, uint balance); - - function EtherDelta(address admin_, address feeAccount_, address accountLevelsAddr_, uint feeMake_, uint feeTake_, uint feeRebate_) { - admin = admin_; - feeAccount = feeAccount_; - accountLevelsAddr = accountLevelsAddr_; - feeMake = feeMake_; - feeTake = feeTake_; - feeRebate = feeRebate_; - } - - function() { - throw; - } - - function changeAdmin(address admin_) { - if (msg.sender != admin) throw; - admin = admin_; - } - - function changeAccountLevelsAddr(address accountLevelsAddr_) { - if (msg.sender != admin) throw; - accountLevelsAddr = accountLevelsAddr_; - } - - function changeFeeAccount(address feeAccount_) { - if (msg.sender != admin) throw; - feeAccount = feeAccount_; - } - - function changeFeeMake(uint feeMake_) { - if (msg.sender != admin) throw; - if (feeMake_ > feeMake) throw; - feeMake = feeMake_; - } - - function changeFeeTake(uint feeTake_) { - if (msg.sender != admin) throw; - if (feeTake_ > feeTake || feeTake_ < feeRebate) throw; - feeTake = feeTake_; - } - - function changeFeeRebate(uint feeRebate_) { - if (msg.sender != admin) throw; - if (feeRebate_ < feeRebate || feeRebate_ > feeTake) throw; - feeRebate = feeRebate_; - } - - function deposit() payable { - tokens[0][msg.sender] = safeAdd(tokens[0][msg.sender], msg.value); - Deposit(0, msg.sender, msg.value, tokens[0][msg.sender]); - } - - function withdraw(uint amount) { - if (tokens[0][msg.sender] < amount) throw; - tokens[0][msg.sender] = safeSub(tokens[0][msg.sender], amount); - if (!msg.sender.call.value(amount)()) throw; - Withdraw(0, msg.sender, amount, tokens[0][msg.sender]); - } - - function depositToken(address token, uint amount) { - //remember to call Token(address).approve(this, amount) or this contract will not be able to do the transfer on your behalf. - if (token==0) throw; - if (!Token(token).transferFrom(msg.sender, this, amount)) throw; - tokens[token][msg.sender] = safeAdd(tokens[token][msg.sender], amount); - Deposit(token, msg.sender, amount, tokens[token][msg.sender]); - } - - function withdrawToken(address token, uint amount) { - if (token==0) throw; - if (tokens[token][msg.sender] < amount) throw; - tokens[token][msg.sender] = safeSub(tokens[token][msg.sender], amount); - if (!Token(token).transfer(msg.sender, amount)) throw; - Withdraw(token, msg.sender, amount, tokens[token][msg.sender]); - } - - function balanceOf(address token, address user) constant returns (uint) { - return tokens[token][user]; - } - - function order(address tokenGet, uint amountGet, address tokenGive, uint amountGive, uint expires, uint nonce) { - bytes32 hash = sha256(this, tokenGet, amountGet, tokenGive, amountGive, expires, nonce); - orders[msg.sender][hash] = true; - Order(tokenGet, amountGet, tokenGive, amountGive, expires, nonce, msg.sender); - } - - function trade(address tokenGet, uint amountGet, address tokenGive, uint amountGive, uint expires, uint nonce, address user, uint8 v, bytes32 r, bytes32 s, uint amount) { - //amount is in amountGet terms - bytes32 hash = sha256(this, tokenGet, amountGet, tokenGive, amountGive, expires, nonce); - if (!( - (orders[user][hash] || ecrecover(sha3("\x19Ethereum Signed Message:\n32", hash),v,r,s) == user) && - block.number <= expires && - safeAdd(orderFills[user][hash], amount) <= amountGet - )) throw; - tradeBalances(tokenGet, amountGet, tokenGive, amountGive, user, amount); - orderFills[user][hash] = safeAdd(orderFills[user][hash], amount); - Trade(tokenGet, amount, tokenGive, amountGive * amount / amountGet, user, msg.sender); - } - - function tradeBalances(address tokenGet, uint amountGet, address tokenGive, uint amountGive, address user, uint amount) private { - uint feeMakeXfer = safeMul(amount, feeMake) / (1 ether); - uint feeTakeXfer = safeMul(amount, feeTake) / (1 ether); - uint feeRebateXfer = 0; - if (accountLevelsAddr != 0x0) { - uint accountLevel = AccountLevels(accountLevelsAddr).accountLevel(user); - if (accountLevel==1) feeRebateXfer = safeMul(amount, feeRebate) / (1 ether); - if (accountLevel==2) feeRebateXfer = feeTakeXfer; - } - tokens[tokenGet][msg.sender] = safeSub(tokens[tokenGet][msg.sender], safeAdd(amount, feeTakeXfer)); - tokens[tokenGet][user] = safeAdd(tokens[tokenGet][user], safeSub(safeAdd(amount, feeRebateXfer), feeMakeXfer)); - tokens[tokenGet][feeAccount] = safeAdd(tokens[tokenGet][feeAccount], safeSub(safeAdd(feeMakeXfer, feeTakeXfer), feeRebateXfer)); - tokens[tokenGive][user] = safeSub(tokens[tokenGive][user], safeMul(amountGive, amount) / amountGet); - tokens[tokenGive][msg.sender] = safeAdd(tokens[tokenGive][msg.sender], safeMul(amountGive, amount) / amountGet); - } - - function testTrade(address tokenGet, uint amountGet, address tokenGive, uint amountGive, uint expires, uint nonce, address user, uint8 v, bytes32 r, bytes32 s, uint amount, address sender) constant returns(bool) { - if (!( - tokens[tokenGet][sender] >= amount && - availableVolume(tokenGet, amountGet, tokenGive, amountGive, expires, nonce, user, v, r, s) >= amount - )) return false; - return true; - } - - function availableVolume(address tokenGet, uint amountGet, address tokenGive, uint amountGive, uint expires, uint nonce, address user, uint8 v, bytes32 r, bytes32 s) constant returns(uint) { - bytes32 hash = sha256(this, tokenGet, amountGet, tokenGive, amountGive, expires, nonce); - if (!( - (orders[user][hash] || ecrecover(sha3("\x19Ethereum Signed Message:\n32", hash),v,r,s) == user) && - block.number <= expires - )) return 0; - uint available1 = safeSub(amountGet, orderFills[user][hash]); - uint available2 = safeMul(tokens[tokenGive][user], amountGet) / amountGive; - if (available1<available2) return available1; - return available2; - } - - function amountFilled(address tokenGet, uint amountGet, address tokenGive, uint amountGive, uint expires, uint nonce, address user, uint8 v, bytes32 r, bytes32 s) constant returns(uint) { - bytes32 hash = sha256(this, tokenGet, amountGet, tokenGive, amountGive, expires, nonce); - return orderFills[user][hash]; - } - - function cancelOrder(address tokenGet, uint amountGet, address tokenGive, uint amountGive, uint expires, uint nonce, uint8 v, bytes32 r, bytes32 s) { - bytes32 hash = sha256(this, tokenGet, amountGet, tokenGive, amountGive, expires, nonce); - if (!(orders[msg.sender][hash] || ecrecover(sha3("\x19Ethereum Signed Message:\n32", hash),v,r,s) == msg.sender)) throw; - orderFills[msg.sender][hash] = amountGet; - Cancel(tokenGet, amountGet, tokenGive, amountGive, expires, nonce, msg.sender, v, r, s); - } -} diff --git a/packages/contracts/src/1.0.0/Exchange/Exchange_v1.sol b/packages/contracts/src/1.0.0/Exchange/Exchange_v1.sol deleted file mode 100644 index 3f8e7368d..000000000 --- a/packages/contracts/src/1.0.0/Exchange/Exchange_v1.sol +++ /dev/null @@ -1,602 +0,0 @@ -/* - - Copyright 2018 ZeroEx Intl. - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - -*/ - -pragma solidity ^0.4.14; - -import { TokenTransferProxy_v1 as TokenTransferProxy } from "../TokenTransferProxy/TokenTransferProxy_v1.sol"; -import { Token_v1 as Token } from "../Token/Token_v1.sol"; -import { SafeMath_v1 as SafeMath } from "../SafeMath/SafeMath_v1.sol"; - -/// @title Exchange - Facilitates exchange of ERC20 tokens. -/// @author Amir Bandeali - <amir@0xProject.com>, Will Warren - <will@0xProject.com> -contract Exchange_v1 is SafeMath { - - // Error Codes - enum Errors { - ORDER_EXPIRED, // Order has already expired - ORDER_FULLY_FILLED_OR_CANCELLED, // Order has already been fully filled or cancelled - ROUNDING_ERROR_TOO_LARGE, // Rounding error too large - INSUFFICIENT_BALANCE_OR_ALLOWANCE // Insufficient balance or allowance for token transfer - } - - string constant public VERSION = "1.0.0"; - uint16 constant public EXTERNAL_QUERY_GAS_LIMIT = 4999; // Changes to state require at least 5000 gas - - address public ZRX_TOKEN_CONTRACT; - address public TOKEN_TRANSFER_PROXY_CONTRACT; - - // Mappings of orderHash => amounts of takerTokenAmount filled or cancelled. - mapping (bytes32 => uint) public filled; - mapping (bytes32 => uint) public cancelled; - - event LogFill( - address indexed maker, - address taker, - address indexed feeRecipient, - address makerToken, - address takerToken, - uint filledMakerTokenAmount, - uint filledTakerTokenAmount, - uint paidMakerFee, - uint paidTakerFee, - bytes32 indexed tokens, // keccak256(makerToken, takerToken), allows subscribing to a token pair - bytes32 orderHash - ); - - event LogCancel( - address indexed maker, - address indexed feeRecipient, - address makerToken, - address takerToken, - uint cancelledMakerTokenAmount, - uint cancelledTakerTokenAmount, - bytes32 indexed tokens, - bytes32 orderHash - ); - - event LogError(uint8 indexed errorId, bytes32 indexed orderHash); - - struct Order { - address maker; - address taker; - address makerToken; - address takerToken; - address feeRecipient; - uint makerTokenAmount; - uint takerTokenAmount; - uint makerFee; - uint takerFee; - uint expirationTimestampInSec; - bytes32 orderHash; - } - - function Exchange_v1(address _zrxToken, address _tokenTransferProxy) { - ZRX_TOKEN_CONTRACT = _zrxToken; - TOKEN_TRANSFER_PROXY_CONTRACT = _tokenTransferProxy; - } - - /* - * Core exchange functions - */ - - /// @dev Fills the input order. - /// @param orderAddresses Array of order's maker, taker, makerToken, takerToken, and feeRecipient. - /// @param orderValues Array of order's makerTokenAmount, takerTokenAmount, makerFee, takerFee, expirationTimestampInSec, and salt. - /// @param fillTakerTokenAmount Desired amount of takerToken to fill. - /// @param shouldThrowOnInsufficientBalanceOrAllowance Test if transfer will fail before attempting. - /// @param v ECDSA signature parameter v. - /// @param r ECDSA signature parameters r. - /// @param s ECDSA signature parameters s. - /// @return Total amount of takerToken filled in trade. - function fillOrder( - address[5] orderAddresses, - uint[6] orderValues, - uint fillTakerTokenAmount, - bool shouldThrowOnInsufficientBalanceOrAllowance, - uint8 v, - bytes32 r, - bytes32 s) - public - returns (uint filledTakerTokenAmount) - { - Order memory order = Order({ - maker: orderAddresses[0], - taker: orderAddresses[1], - makerToken: orderAddresses[2], - takerToken: orderAddresses[3], - feeRecipient: orderAddresses[4], - makerTokenAmount: orderValues[0], - takerTokenAmount: orderValues[1], - makerFee: orderValues[2], - takerFee: orderValues[3], - expirationTimestampInSec: orderValues[4], - orderHash: getOrderHash(orderAddresses, orderValues) - }); - - require(order.taker == address(0) || order.taker == msg.sender); - require(order.makerTokenAmount > 0 && order.takerTokenAmount > 0 && fillTakerTokenAmount > 0); - require(isValidSignature( - order.maker, - order.orderHash, - v, - r, - s - )); - - if (block.timestamp >= order.expirationTimestampInSec) { - LogError(uint8(Errors.ORDER_EXPIRED), order.orderHash); - return 0; - } - - uint remainingTakerTokenAmount = safeSub(order.takerTokenAmount, getUnavailableTakerTokenAmount(order.orderHash)); - filledTakerTokenAmount = min256(fillTakerTokenAmount, remainingTakerTokenAmount); - if (filledTakerTokenAmount == 0) { - LogError(uint8(Errors.ORDER_FULLY_FILLED_OR_CANCELLED), order.orderHash); - return 0; - } - - if (isRoundingError(filledTakerTokenAmount, order.takerTokenAmount, order.makerTokenAmount)) { - LogError(uint8(Errors.ROUNDING_ERROR_TOO_LARGE), order.orderHash); - return 0; - } - - if (!shouldThrowOnInsufficientBalanceOrAllowance && !isTransferable(order, filledTakerTokenAmount)) { - LogError(uint8(Errors.INSUFFICIENT_BALANCE_OR_ALLOWANCE), order.orderHash); - return 0; - } - - uint filledMakerTokenAmount = getPartialAmount(filledTakerTokenAmount, order.takerTokenAmount, order.makerTokenAmount); - uint paidMakerFee; - uint paidTakerFee; - filled[order.orderHash] = safeAdd(filled[order.orderHash], filledTakerTokenAmount); - require(transferViaTokenTransferProxy( - order.makerToken, - order.maker, - msg.sender, - filledMakerTokenAmount - )); - require(transferViaTokenTransferProxy( - order.takerToken, - msg.sender, - order.maker, - filledTakerTokenAmount - )); - if (order.feeRecipient != address(0)) { - if (order.makerFee > 0) { - paidMakerFee = getPartialAmount(filledTakerTokenAmount, order.takerTokenAmount, order.makerFee); - require(transferViaTokenTransferProxy( - ZRX_TOKEN_CONTRACT, - order.maker, - order.feeRecipient, - paidMakerFee - )); - } - if (order.takerFee > 0) { - paidTakerFee = getPartialAmount(filledTakerTokenAmount, order.takerTokenAmount, order.takerFee); - require(transferViaTokenTransferProxy( - ZRX_TOKEN_CONTRACT, - msg.sender, - order.feeRecipient, - paidTakerFee - )); - } - } - - LogFill( - order.maker, - msg.sender, - order.feeRecipient, - order.makerToken, - order.takerToken, - filledMakerTokenAmount, - filledTakerTokenAmount, - paidMakerFee, - paidTakerFee, - keccak256(order.makerToken, order.takerToken), - order.orderHash - ); - return filledTakerTokenAmount; - } - - /// @dev Cancels the input order. - /// @param orderAddresses Array of order's maker, taker, makerToken, takerToken, and feeRecipient. - /// @param orderValues Array of order's makerTokenAmount, takerTokenAmount, makerFee, takerFee, expirationTimestampInSec, and salt. - /// @param cancelTakerTokenAmount Desired amount of takerToken to cancel in order. - /// @return Amount of takerToken cancelled. - function cancelOrder( - address[5] orderAddresses, - uint[6] orderValues, - uint cancelTakerTokenAmount) - public - returns (uint) - { - Order memory order = Order({ - maker: orderAddresses[0], - taker: orderAddresses[1], - makerToken: orderAddresses[2], - takerToken: orderAddresses[3], - feeRecipient: orderAddresses[4], - makerTokenAmount: orderValues[0], - takerTokenAmount: orderValues[1], - makerFee: orderValues[2], - takerFee: orderValues[3], - expirationTimestampInSec: orderValues[4], - orderHash: getOrderHash(orderAddresses, orderValues) - }); - - require(order.maker == msg.sender); - require(order.makerTokenAmount > 0 && order.takerTokenAmount > 0 && cancelTakerTokenAmount > 0); - - if (block.timestamp >= order.expirationTimestampInSec) { - LogError(uint8(Errors.ORDER_EXPIRED), order.orderHash); - return 0; - } - - uint remainingTakerTokenAmount = safeSub(order.takerTokenAmount, getUnavailableTakerTokenAmount(order.orderHash)); - uint cancelledTakerTokenAmount = min256(cancelTakerTokenAmount, remainingTakerTokenAmount); - if (cancelledTakerTokenAmount == 0) { - LogError(uint8(Errors.ORDER_FULLY_FILLED_OR_CANCELLED), order.orderHash); - return 0; - } - - cancelled[order.orderHash] = safeAdd(cancelled[order.orderHash], cancelledTakerTokenAmount); - - LogCancel( - order.maker, - order.feeRecipient, - order.makerToken, - order.takerToken, - getPartialAmount(cancelledTakerTokenAmount, order.takerTokenAmount, order.makerTokenAmount), - cancelledTakerTokenAmount, - keccak256(order.makerToken, order.takerToken), - order.orderHash - ); - return cancelledTakerTokenAmount; - } - - /* - * Wrapper functions - */ - - /// @dev Fills an order with specified parameters and ECDSA signature, throws if specified amount not filled entirely. - /// @param orderAddresses Array of order's maker, taker, makerToken, takerToken, and feeRecipient. - /// @param orderValues Array of order's makerTokenAmount, takerTokenAmount, makerFee, takerFee, expirationTimestampInSec, and salt. - /// @param fillTakerTokenAmount Desired amount of takerToken to fill. - /// @param v ECDSA signature parameter v. - /// @param r ECDSA signature parameters r. - /// @param s ECDSA signature parameters s. - function fillOrKillOrder( - address[5] orderAddresses, - uint[6] orderValues, - uint fillTakerTokenAmount, - uint8 v, - bytes32 r, - bytes32 s) - public - { - require(fillOrder( - orderAddresses, - orderValues, - fillTakerTokenAmount, - false, - v, - r, - s - ) == fillTakerTokenAmount); - } - - /// @dev Synchronously executes multiple fill orders in a single transaction. - /// @param orderAddresses Array of address arrays containing individual order addresses. - /// @param orderValues Array of uint arrays containing individual order values. - /// @param fillTakerTokenAmounts Array of desired amounts of takerToken to fill in orders. - /// @param shouldThrowOnInsufficientBalanceOrAllowance Test if transfers will fail before attempting. - /// @param v Array ECDSA signature v parameters. - /// @param r Array of ECDSA signature r parameters. - /// @param s Array of ECDSA signature s parameters. - function batchFillOrders( - address[5][] orderAddresses, - uint[6][] orderValues, - uint[] fillTakerTokenAmounts, - bool shouldThrowOnInsufficientBalanceOrAllowance, - uint8[] v, - bytes32[] r, - bytes32[] s) - public - { - for (uint i = 0; i < orderAddresses.length; i++) { - fillOrder( - orderAddresses[i], - orderValues[i], - fillTakerTokenAmounts[i], - shouldThrowOnInsufficientBalanceOrAllowance, - v[i], - r[i], - s[i] - ); - } - } - - /// @dev Synchronously executes multiple fillOrKill orders in a single transaction. - /// @param orderAddresses Array of address arrays containing individual order addresses. - /// @param orderValues Array of uint arrays containing individual order values. - /// @param fillTakerTokenAmounts Array of desired amounts of takerToken to fill in orders. - /// @param v Array ECDSA signature v parameters. - /// @param r Array of ECDSA signature r parameters. - /// @param s Array of ECDSA signature s parameters. - function batchFillOrKillOrders( - address[5][] orderAddresses, - uint[6][] orderValues, - uint[] fillTakerTokenAmounts, - uint8[] v, - bytes32[] r, - bytes32[] s) - public - { - for (uint i = 0; i < orderAddresses.length; i++) { - fillOrKillOrder( - orderAddresses[i], - orderValues[i], - fillTakerTokenAmounts[i], - v[i], - r[i], - s[i] - ); - } - } - - /// @dev Synchronously executes multiple fill orders in a single transaction until total fillTakerTokenAmount filled. - /// @param orderAddresses Array of address arrays containing individual order addresses. - /// @param orderValues Array of uint arrays containing individual order values. - /// @param fillTakerTokenAmount Desired total amount of takerToken to fill in orders. - /// @param shouldThrowOnInsufficientBalanceOrAllowance Test if transfers will fail before attempting. - /// @param v Array ECDSA signature v parameters. - /// @param r Array of ECDSA signature r parameters. - /// @param s Array of ECDSA signature s parameters. - /// @return Total amount of fillTakerTokenAmount filled in orders. - function fillOrdersUpTo( - address[5][] orderAddresses, - uint[6][] orderValues, - uint fillTakerTokenAmount, - bool shouldThrowOnInsufficientBalanceOrAllowance, - uint8[] v, - bytes32[] r, - bytes32[] s) - public - returns (uint) - { - uint filledTakerTokenAmount = 0; - for (uint i = 0; i < orderAddresses.length; i++) { - require(orderAddresses[i][3] == orderAddresses[0][3]); // takerToken must be the same for each order - filledTakerTokenAmount = safeAdd(filledTakerTokenAmount, fillOrder( - orderAddresses[i], - orderValues[i], - safeSub(fillTakerTokenAmount, filledTakerTokenAmount), - shouldThrowOnInsufficientBalanceOrAllowance, - v[i], - r[i], - s[i] - )); - if (filledTakerTokenAmount == fillTakerTokenAmount) break; - } - return filledTakerTokenAmount; - } - - /// @dev Synchronously cancels multiple orders in a single transaction. - /// @param orderAddresses Array of address arrays containing individual order addresses. - /// @param orderValues Array of uint arrays containing individual order values. - /// @param cancelTakerTokenAmounts Array of desired amounts of takerToken to cancel in orders. - function batchCancelOrders( - address[5][] orderAddresses, - uint[6][] orderValues, - uint[] cancelTakerTokenAmounts) - public - { - for (uint i = 0; i < orderAddresses.length; i++) { - cancelOrder( - orderAddresses[i], - orderValues[i], - cancelTakerTokenAmounts[i] - ); - } - } - - /* - * Constant public functions - */ - - /// @dev Calculates Keccak-256 hash of order with specified parameters. - /// @param orderAddresses Array of order's maker, taker, makerToken, takerToken, and feeRecipient. - /// @param orderValues Array of order's makerTokenAmount, takerTokenAmount, makerFee, takerFee, expirationTimestampInSec, and salt. - /// @return Keccak-256 hash of order. - function getOrderHash(address[5] orderAddresses, uint[6] orderValues) - public - constant - returns (bytes32) - { - return keccak256( - address(this), - orderAddresses[0], // maker - orderAddresses[1], // taker - orderAddresses[2], // makerToken - orderAddresses[3], // takerToken - orderAddresses[4], // feeRecipient - orderValues[0], // makerTokenAmount - orderValues[1], // takerTokenAmount - orderValues[2], // makerFee - orderValues[3], // takerFee - orderValues[4], // expirationTimestampInSec - orderValues[5] // salt - ); - } - - /// @dev Verifies that an order signature is valid. - /// @param signer address of signer. - /// @param hash Signed Keccak-256 hash. - /// @param v ECDSA signature parameter v. - /// @param r ECDSA signature parameters r. - /// @param s ECDSA signature parameters s. - /// @return Validity of order signature. - function isValidSignature( - address signer, - bytes32 hash, - uint8 v, - bytes32 r, - bytes32 s) - public - constant - returns (bool) - { - return signer == ecrecover( - keccak256("\x19Ethereum Signed Message:\n32", hash), - v, - r, - s - ); - } - - /// @dev Checks if rounding error > 0.1%. - /// @param numerator Numerator. - /// @param denominator Denominator. - /// @param target Value to multiply with numerator/denominator. - /// @return Rounding error is present. - function isRoundingError(uint numerator, uint denominator, uint target) - public - constant - returns (bool) - { - uint remainder = mulmod(target, numerator, denominator); - if (remainder == 0) return false; // No rounding error. - - uint errPercentageTimes1000000 = safeDiv( - safeMul(remainder, 1000000), - safeMul(numerator, target) - ); - return errPercentageTimes1000000 > 1000; - } - - /// @dev Calculates partial value given a numerator and denominator. - /// @param numerator Numerator. - /// @param denominator Denominator. - /// @param target Value to calculate partial of. - /// @return Partial value of target. - function getPartialAmount(uint numerator, uint denominator, uint target) - public - constant - returns (uint) - { - return safeDiv(safeMul(numerator, target), denominator); - } - - /// @dev Calculates the sum of values already filled and cancelled for a given order. - /// @param orderHash The Keccak-256 hash of the given order. - /// @return Sum of values already filled and cancelled. - function getUnavailableTakerTokenAmount(bytes32 orderHash) - public - constant - returns (uint) - { - return safeAdd(filled[orderHash], cancelled[orderHash]); - } - - - /* - * Internal functions - */ - - /// @dev Transfers a token using TokenTransferProxy transferFrom function. - /// @param token Address of token to transferFrom. - /// @param from Address transfering token. - /// @param to Address receiving token. - /// @param value Amount of token to transfer. - /// @return Success of token transfer. - function transferViaTokenTransferProxy( - address token, - address from, - address to, - uint value) - internal - returns (bool) - { - return TokenTransferProxy(TOKEN_TRANSFER_PROXY_CONTRACT).transferFrom(token, from, to, value); - } - - /// @dev Checks if any order transfers will fail. - /// @param order Order struct of params that will be checked. - /// @param fillTakerTokenAmount Desired amount of takerToken to fill. - /// @return Predicted result of transfers. - function isTransferable(Order order, uint fillTakerTokenAmount) - internal - constant // The called token contracts may attempt to change state, but will not be able to due to gas limits on getBalance and getAllowance. - returns (bool) - { - address taker = msg.sender; - uint fillMakerTokenAmount = getPartialAmount(fillTakerTokenAmount, order.takerTokenAmount, order.makerTokenAmount); - - if (order.feeRecipient != address(0)) { - bool isMakerTokenZRX = order.makerToken == ZRX_TOKEN_CONTRACT; - bool isTakerTokenZRX = order.takerToken == ZRX_TOKEN_CONTRACT; - uint paidMakerFee = getPartialAmount(fillTakerTokenAmount, order.takerTokenAmount, order.makerFee); - uint paidTakerFee = getPartialAmount(fillTakerTokenAmount, order.takerTokenAmount, order.takerFee); - uint requiredMakerZRX = isMakerTokenZRX ? safeAdd(fillMakerTokenAmount, paidMakerFee) : paidMakerFee; - uint requiredTakerZRX = isTakerTokenZRX ? safeAdd(fillTakerTokenAmount, paidTakerFee) : paidTakerFee; - - if ( getBalance(ZRX_TOKEN_CONTRACT, order.maker) < requiredMakerZRX - || getAllowance(ZRX_TOKEN_CONTRACT, order.maker) < requiredMakerZRX - || getBalance(ZRX_TOKEN_CONTRACT, taker) < requiredTakerZRX - || getAllowance(ZRX_TOKEN_CONTRACT, taker) < requiredTakerZRX - ) return false; - - if (!isMakerTokenZRX && ( getBalance(order.makerToken, order.maker) < fillMakerTokenAmount // Don't double check makerToken if ZRX - || getAllowance(order.makerToken, order.maker) < fillMakerTokenAmount) - ) return false; - if (!isTakerTokenZRX && ( getBalance(order.takerToken, taker) < fillTakerTokenAmount // Don't double check takerToken if ZRX - || getAllowance(order.takerToken, taker) < fillTakerTokenAmount) - ) return false; - } else if ( getBalance(order.makerToken, order.maker) < fillMakerTokenAmount - || getAllowance(order.makerToken, order.maker) < fillMakerTokenAmount - || getBalance(order.takerToken, taker) < fillTakerTokenAmount - || getAllowance(order.takerToken, taker) < fillTakerTokenAmount - ) return false; - - return true; - } - - /// @dev Get token balance of an address. - /// @param token Address of token. - /// @param owner Address of owner. - /// @return Token balance of owner. - function getBalance(address token, address owner) - internal - constant // The called token contract may attempt to change state, but will not be able to due to an added gas limit. - returns (uint) - { - return Token(token).balanceOf.gas(EXTERNAL_QUERY_GAS_LIMIT)(owner); // Limit gas to prevent reentrancy - } - - /// @dev Get allowance of token given to TokenTransferProxy by an address. - /// @param token Address of token. - /// @param owner Address of owner. - /// @return Allowance of token given to TokenTransferProxy by owner. - function getAllowance(address token, address owner) - internal - constant // The called token contract may attempt to change state, but will not be able to due to an added gas limit. - returns (uint) - { - return Token(token).allowance.gas(EXTERNAL_QUERY_GAS_LIMIT)(owner, TOKEN_TRANSFER_PROXY_CONTRACT); // Limit gas to prevent reentrancy - } -} diff --git a/packages/contracts/src/1.0.0/Exchange/IExchange_v1.sol b/packages/contracts/src/1.0.0/Exchange/IExchange_v1.sol deleted file mode 100644 index ec4bce7b0..000000000 --- a/packages/contracts/src/1.0.0/Exchange/IExchange_v1.sol +++ /dev/null @@ -1,226 +0,0 @@ -pragma solidity ^0.4.19; - -contract IExchange_v1 { - - // Error Codes - enum Errors { - ORDER_EXPIRED, // Order has already expired - ORDER_FULLY_FILLED_OR_CANCELLED, // Order has already been fully filled or cancelled - ROUNDING_ERROR_TOO_LARGE, // Rounding error too large - INSUFFICIENT_BALANCE_OR_ALLOWANCE // Insufficient balance or allowance for token transfer - } - - event LogError(uint8 indexed errorId, bytes32 indexed orderHash); - - event LogFill( - address indexed maker, - address taker, - address indexed feeRecipient, - address makerToken, - address takerToken, - uint filledMakerTokenAmount, - uint filledTakerTokenAmount, - uint paidMakerFee, - uint paidTakerFee, - bytes32 indexed tokens, // keccak256(makerToken, takerToken), allows subscribing to a token pair - bytes32 orderHash - ); - - event LogCancel( - address indexed maker, - address indexed feeRecipient, - address makerToken, - address takerToken, - uint cancelledMakerTokenAmount, - uint cancelledTakerTokenAmount, - bytes32 indexed tokens, - bytes32 orderHash - ); - - function ZRX_TOKEN_CONTRACT() - public view - returns (address); - - function TOKEN_TRANSFER_PROXY_CONTRACT() - public view - returns (address); - - function EXTERNAL_QUERY_GAS_LIMIT() - public view - returns (uint16); - - function VERSION() - public view - returns (string); - - function filled(bytes32) - public view - returns (uint256); - - function cancelled(bytes32) - public view - returns (uint256); - - /// @dev Calculates the sum of values already filled and cancelled for a given order. - /// @param orderHash The Keccak-256 hash of the given order. - /// @return Sum of values already filled and cancelled. - function getUnavailableTakerTokenAmount(bytes32 orderHash) - public constant - returns (uint); - - /// @dev Calculates partial value given a numerator and denominator. - /// @param numerator Numerator. - /// @param denominator Denominator. - /// @param target Value to calculate partial of. - /// @return Partial value of target. - function getPartialAmount(uint numerator, uint denominator, uint target) - public constant - returns (uint); - - /// @dev Checks if rounding error > 0.1%. - /// @param numerator Numerator. - /// @param denominator Denominator. - /// @param target Value to multiply with numerator/denominator. - /// @return Rounding error is present. - function isRoundingError(uint numerator, uint denominator, uint target) - public constant - returns (bool); - - /// @dev Calculates Keccak-256 hash of order with specified parameters. - /// @param orderAddresses Array of order's maker, taker, makerToken, takerToken, and feeRecipient. - /// @param orderValues Array of order's makerTokenAmount, takerTokenAmount, makerFee, takerFee, expirationTimestampInSec, and salt. - /// @return Keccak-256 hash of order. - function getOrderHash(address[5] orderAddresses, uint[6] orderValues) - public - constant - returns (bytes32); - - /// @dev Verifies that an order signature is valid. - /// @param signer address of signer. - /// @param hash Signed Keccak-256 hash. - /// @param v ECDSA signature parameter v. - /// @param r ECDSA signature parameters r. - /// @param s ECDSA signature parameters s. - /// @return Validity of order signature. - function isValidSignature( - address signer, - bytes32 hash, - uint8 v, - bytes32 r, - bytes32 s) - public constant - returns (bool); - - /// @dev Fills the input order. - /// @param orderAddresses Array of order's maker, taker, makerToken, takerToken, and feeRecipient. - /// @param orderValues Array of order's makerTokenAmount, takerTokenAmount, makerFee, takerFee, expirationTimestampInSec, and salt. - /// @param fillTakerTokenAmount Desired amount of takerToken to fill. - /// @param shouldThrowOnInsufficientBalanceOrAllowance Test if transfer will fail before attempting. - /// @param v ECDSA signature parameter v. - /// @param r ECDSA signature parameters r. - /// @param s ECDSA signature parameters s. - /// @return Total amount of takerToken filled in trade. - function fillOrder( - address[5] orderAddresses, - uint[6] orderValues, - uint fillTakerTokenAmount, - bool shouldThrowOnInsufficientBalanceOrAllowance, - uint8 v, - bytes32 r, - bytes32 s) - public - returns (uint filledTakerTokenAmount); - - /// @dev Cancels the input order. - /// @param orderAddresses Array of order's maker, taker, makerToken, takerToken, and feeRecipient. - /// @param orderValues Array of order's makerTokenAmount, takerTokenAmount, makerFee, takerFee, expirationTimestampInSec, and salt. - /// @param cancelTakerTokenAmount Desired amount of takerToken to cancel in order. - /// @return Amount of takerToken cancelled. - function cancelOrder( - address[5] orderAddresses, - uint[6] orderValues, - uint cancelTakerTokenAmount) - public - returns (uint); - - - /// @dev Fills an order with specified parameters and ECDSA signature, throws if specified amount not filled entirely. - /// @param orderAddresses Array of order's maker, taker, makerToken, takerToken, and feeRecipient. - /// @param orderValues Array of order's makerTokenAmount, takerTokenAmount, makerFee, takerFee, expirationTimestampInSec, and salt. - /// @param fillTakerTokenAmount Desired amount of takerToken to fill. - /// @param v ECDSA signature parameter v. - /// @param r ECDSA signature parameters r. - /// @param s ECDSA signature parameters s. - function fillOrKillOrder( - address[5] orderAddresses, - uint[6] orderValues, - uint fillTakerTokenAmount, - uint8 v, - bytes32 r, - bytes32 s) - public; - - /// @dev Synchronously executes multiple fill orders in a single transaction. - /// @param orderAddresses Array of address arrays containing individual order addresses. - /// @param orderValues Array of uint arrays containing individual order values. - /// @param fillTakerTokenAmounts Array of desired amounts of takerToken to fill in orders. - /// @param shouldThrowOnInsufficientBalanceOrAllowance Test if transfers will fail before attempting. - /// @param v Array ECDSA signature v parameters. - /// @param r Array of ECDSA signature r parameters. - /// @param s Array of ECDSA signature s parameters. - function batchFillOrders( - address[5][] orderAddresses, - uint[6][] orderValues, - uint[] fillTakerTokenAmounts, - bool shouldThrowOnInsufficientBalanceOrAllowance, - uint8[] v, - bytes32[] r, - bytes32[] s) - public; - - /// @dev Synchronously executes multiple fillOrKill orders in a single transaction. - /// @param orderAddresses Array of address arrays containing individual order addresses. - /// @param orderValues Array of uint arrays containing individual order values. - /// @param fillTakerTokenAmounts Array of desired amounts of takerToken to fill in orders. - /// @param v Array ECDSA signature v parameters. - /// @param r Array of ECDSA signature r parameters. - /// @param s Array of ECDSA signature s parameters. - function batchFillOrKillOrders( - address[5][] orderAddresses, - uint[6][] orderValues, - uint[] fillTakerTokenAmounts, - uint8[] v, - bytes32[] r, - bytes32[] s) - public; - - /// @dev Synchronously executes multiple fill orders in a single transaction until total fillTakerTokenAmount filled. - /// @param orderAddresses Array of address arrays containing individual order addresses. - /// @param orderValues Array of uint arrays containing individual order values. - /// @param fillTakerTokenAmount Desired total amount of takerToken to fill in orders. - /// @param shouldThrowOnInsufficientBalanceOrAllowance Test if transfers will fail before attempting. - /// @param v Array ECDSA signature v parameters. - /// @param r Array of ECDSA signature r parameters. - /// @param s Array of ECDSA signature s parameters. - /// @return Total amount of fillTakerTokenAmount filled in orders. - function fillOrdersUpTo( - address[5][] orderAddresses, - uint[6][] orderValues, - uint fillTakerTokenAmount, - bool shouldThrowOnInsufficientBalanceOrAllowance, - uint8[] v, - bytes32[] r, - bytes32[] s) - public - returns (uint); - - /// @dev Synchronously cancels multiple orders in a single transaction. - /// @param orderAddresses Array of address arrays containing individual order addresses. - /// @param orderValues Array of uint arrays containing individual order values. - /// @param cancelTakerTokenAmounts Array of desired amounts of takerToken to cancel in orders. - function batchCancelOrders( - address[5][] orderAddresses, - uint[6][] orderValues, - uint[] cancelTakerTokenAmounts) - public; -} diff --git a/packages/contracts/src/1.0.0/MultiSigWalletWithTImeLockExceptRemoveAuthorizedAddress/MultiSigWalletWithTimeLockExceptRemoveAuthorizedAddress.sol b/packages/contracts/src/1.0.0/MultiSigWalletWithTImeLockExceptRemoveAuthorizedAddress/MultiSigWalletWithTimeLockExceptRemoveAuthorizedAddress.sol deleted file mode 100644 index aee722c53..000000000 --- a/packages/contracts/src/1.0.0/MultiSigWalletWithTImeLockExceptRemoveAuthorizedAddress/MultiSigWalletWithTimeLockExceptRemoveAuthorizedAddress.sol +++ /dev/null @@ -1,82 +0,0 @@ -/* - - Copyright 2018 ZeroEx Intl. - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - -*/ - -pragma solidity ^0.4.10; - -import "../../2.0.0/multisig/MultiSigWalletWithTimeLock.sol"; - -contract MultiSigWalletWithTimeLockExceptRemoveAuthorizedAddress is MultiSigWalletWithTimeLock { - - address public TOKEN_TRANSFER_PROXY_CONTRACT; - - modifier validRemoveAuthorizedAddressTx(uint transactionId) { - Transaction storage tx = transactions[transactionId]; - require(tx.destination == TOKEN_TRANSFER_PROXY_CONTRACT); - require(isFunctionRemoveAuthorizedAddress(tx.data)); - _; - } - - /// @dev Contract constructor sets initial owners, required number of confirmations, time lock, and tokenTransferProxy address. - /// @param _owners List of initial owners. - /// @param _required Number of required confirmations. - /// @param _secondsTimeLocked Duration needed after a transaction is confirmed and before it becomes executable, in seconds. - /// @param _tokenTransferProxy Address of TokenTransferProxy contract. - function MultiSigWalletWithTimeLockExceptRemoveAuthorizedAddress( - address[] _owners, - uint _required, - uint _secondsTimeLocked, - address _tokenTransferProxy) - public - MultiSigWalletWithTimeLock(_owners, _required, _secondsTimeLocked) - { - TOKEN_TRANSFER_PROXY_CONTRACT = _tokenTransferProxy; - } - - /// @dev Allows execution of removeAuthorizedAddress without time lock. - /// @param transactionId Transaction ID. - function executeRemoveAuthorizedAddress(uint transactionId) - public - notExecuted(transactionId) - fullyConfirmed(transactionId) - validRemoveAuthorizedAddressTx(transactionId) - { - Transaction storage tx = transactions[transactionId]; - tx.executed = true; - if (tx.destination.call.value(tx.value)(tx.data)) - Execution(transactionId); - else { - ExecutionFailure(transactionId); - tx.executed = false; - } - } - - /// @dev Compares first 4 bytes of byte array to removeAuthorizedAddress function signature. - /// @param data Transaction data. - /// @return Successful if data is a call to removeAuthorizedAddress. - function isFunctionRemoveAuthorizedAddress(bytes data) - public - constant - returns (bool) - { - bytes4 removeAuthorizedAddressSignature = bytes4(sha3("removeAuthorizedAddress(address)")); - for (uint i = 0; i < 4; i++) { - require(data[i] == removeAuthorizedAddressSignature[i]); - } - return true; - } -} diff --git a/packages/contracts/src/1.0.0/Ownable/IOwnable_v1.sol b/packages/contracts/src/1.0.0/Ownable/IOwnable_v1.sol deleted file mode 100644 index 7e22d544d..000000000 --- a/packages/contracts/src/1.0.0/Ownable/IOwnable_v1.sol +++ /dev/null @@ -1,18 +0,0 @@ -pragma solidity ^0.4.19; - -/* - * Ownable - * - * Base contract with an owner. - * Provides onlyOwner modifier, which prevents function from running if it is called by anyone other than the owner. - */ - -contract IOwnable_v1 { - - function owner() - public view - returns (address); - - function transferOwnership(address newOwner) - public; -} diff --git a/packages/contracts/src/1.0.0/Ownable/Ownable_v1.sol b/packages/contracts/src/1.0.0/Ownable/Ownable_v1.sol deleted file mode 100644 index c87438fa4..000000000 --- a/packages/contracts/src/1.0.0/Ownable/Ownable_v1.sol +++ /dev/null @@ -1,27 +0,0 @@ -pragma solidity ^0.4.11; - -/* - * Ownable - * - * Base contract with an owner. - * Provides onlyOwner modifier, which prevents function from running if it is called by anyone other than the owner. - */ - -contract Ownable_v1 { - address public owner; - - function Ownable_v1() { - owner = msg.sender; - } - - modifier onlyOwner() { - require(msg.sender == owner); - _; - } - - function transferOwnership(address newOwner) onlyOwner { - if (newOwner != address(0)) { - owner = newOwner; - } - } -} diff --git a/packages/contracts/src/1.0.0/SafeMath/SafeMath_v1.sol b/packages/contracts/src/1.0.0/SafeMath/SafeMath_v1.sol deleted file mode 100644 index 341d611ec..000000000 --- a/packages/contracts/src/1.0.0/SafeMath/SafeMath_v1.sol +++ /dev/null @@ -1,73 +0,0 @@ -pragma solidity ^0.4.11; - -contract SafeMath_v1 { - function safeMul(uint a, uint b) - internal - constant - returns (uint256) - { - uint c = a * b; - assert(a == 0 || c / a == b); - return c; - } - - function safeDiv(uint a, uint b) - internal - constant - returns (uint256) - { - uint c = a / b; - return c; - } - - function safeSub(uint a, uint b) - internal - constant - returns (uint256) - { - assert(b <= a); - return a - b; - } - - function safeAdd(uint a, uint b) - internal - constant - returns (uint256) - { - uint c = a + b; - assert(c >= a); - return c; - } - - function max64(uint64 a, uint64 b) - internal - constant - returns (uint64) - { - return a >= b ? a : b; - } - - function min64(uint64 a, uint64 b) - internal - constant - returns (uint64) - { - return a < b ? a : b; - } - - function max256(uint256 a, uint256 b) - internal - constant - returns (uint256) - { - return a >= b ? a : b; - } - - function min256(uint256 a, uint256 b) - internal - constant - returns (uint256) - { - return a < b ? a : b; - } -} diff --git a/packages/contracts/src/1.0.0/TokenRegistry/ITokenRegistery.sol b/packages/contracts/src/1.0.0/TokenRegistry/ITokenRegistery.sol deleted file mode 100644 index b8bdaf3b9..000000000 --- a/packages/contracts/src/1.0.0/TokenRegistry/ITokenRegistery.sol +++ /dev/null @@ -1,195 +0,0 @@ -/* - - Copyright 2018 ZeroEx Intl. - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - -*/ - -pragma solidity ^0.4.21; - -import { IOwnable_v1 as IOwnable } from "../Ownable/IOwnable_v1.sol"; - -/// @title Token Registry - Stores metadata associated with ERC20 tokens. See ERC22 https://github.com/ethereum/EIPs/issues/22 -/// @author Amir Bandeali - <amir@0xProject.com>, Will Warren - <will@0xProject.com> -contract ITokenRegistery is IOwnable { - - event LogAddToken( - address indexed token, - string name, - string symbol, - uint8 decimals, - bytes ipfsHash, - bytes swarmHash - ); - - event LogRemoveToken( - address indexed token, - string name, - string symbol, - uint8 decimals, - bytes ipfsHash, - bytes swarmHash - ); - - event LogTokenNameChange( - address indexed token, - string oldName, - string newName - ); - - event LogTokenSymbolChange( - address indexed token, - string oldSymbol, - string newSymbol - ); - - event LogTokenIpfsHashChange( - address indexed token, - bytes oldIpfsHash, - bytes newIpfsHash - ); - - event LogTokenSwarmHashChange( - address indexed token, - bytes oldSwarmHash, - bytes newSwarmHash - ); - - function tokens(address tokenAddress) - public view - returns ( - address token, - string name, - string symbol, - uint8 decimals, - bytes ipfsHash, - bytes swarmHash - ); - - function tokenAddresses(uint256 index) - public view - returns (address); - - - /// @dev Allows owner to add a new token to the registry. - /// @param _token Address of new token. - /// @param _name Name of new token. - /// @param _symbol Symbol for new token. - /// @param _decimals Number of decimals, divisibility of new token. - /// @param _ipfsHash IPFS hash of token icon. - /// @param _swarmHash Swarm hash of token icon. - function addToken( - address _token, - string _name, - string _symbol, - uint8 _decimals, - bytes _ipfsHash, - bytes _swarmHash) - public; - - /// @dev Allows owner to remove an existing token from the registry. - /// @param _token Address of existing token. - function removeToken(address _token, uint _index) - public; - - /// @dev Allows owner to modify an existing token's name. - /// @param _token Address of existing token. - /// @param _name New name. - function setTokenName(address _token, string _name) - public; - - /// @dev Allows owner to modify an existing token's symbol. - /// @param _token Address of existing token. - /// @param _symbol New symbol. - function setTokenSymbol(address _token, string _symbol) - public; - - /// @dev Allows owner to modify an existing token's IPFS hash. - /// @param _token Address of existing token. - /// @param _ipfsHash New IPFS hash. - function setTokenIpfsHash(address _token, bytes _ipfsHash) - public; - - /// @dev Allows owner to modify an existing token's Swarm hash. - /// @param _token Address of existing token. - /// @param _swarmHash New Swarm hash. - function setTokenSwarmHash(address _token, bytes _swarmHash) - public; - - /* - * Web3 call functions - */ - - /// @dev Provides a registered token's address when given the token symbol. - /// @param _symbol Symbol of registered token. - /// @return Token's address. - function getTokenAddressBySymbol(string _symbol) - public constant - returns (address); - - /// @dev Provides a registered token's address when given the token name. - /// @param _name Name of registered token. - /// @return Token's address. - function getTokenAddressByName(string _name) - public constant - returns (address); - - /// @dev Provides a registered token's metadata, looked up by address. - /// @param _token Address of registered token. - /// @return Token metadata. - function getTokenMetaData(address _token) - public constant - returns ( - address, //tokenAddress - string, //name - string, //symbol - uint8, //decimals - bytes, //ipfsHash - bytes //swarmHash - ); - - /// @dev Provides a registered token's metadata, looked up by name. - /// @param _name Name of registered token. - /// @return Token metadata. - function getTokenByName(string _name) - public constant - returns ( - address, //tokenAddress - string, //name - string, //symbol - uint8, //decimals - bytes, //ipfsHash - bytes //swarmHash - ); - - /// @dev Provides a registered token's metadata, looked up by symbol. - /// @param _symbol Symbol of registered token. - /// @return Token metadata. - function getTokenBySymbol(string _symbol) - public constant - returns ( - address, //tokenAddress - string, //name - string, //symbol - uint8, //decimals - bytes, //ipfsHash - bytes //swarmHash - ); - - /// @dev Returns an array containing all token addresses. - /// @return Array of token addresses. - function getTokenAddresses() - public constant - returns (address[]); -} diff --git a/packages/contracts/src/1.0.0/TokenRegistry/TokenRegistry.sol b/packages/contracts/src/1.0.0/TokenRegistry/TokenRegistry.sol deleted file mode 100644 index 7417a10a3..000000000 --- a/packages/contracts/src/1.0.0/TokenRegistry/TokenRegistry.sol +++ /dev/null @@ -1,308 +0,0 @@ -/* - - Copyright 2018 ZeroEx Intl. - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - -*/ - -pragma solidity ^0.4.11; - -import { Ownable_v1 as Ownable } from "../Ownable/Ownable_v1.sol"; - -/// @title Token Registry - Stores metadata associated with ERC20 tokens. See ERC22 https://github.com/ethereum/EIPs/issues/22 -/// @author Amir Bandeali - <amir@0xProject.com>, Will Warren - <will@0xProject.com> -contract TokenRegistry is Ownable { - - event LogAddToken( - address indexed token, - string name, - string symbol, - uint8 decimals, - bytes ipfsHash, - bytes swarmHash - ); - - event LogRemoveToken( - address indexed token, - string name, - string symbol, - uint8 decimals, - bytes ipfsHash, - bytes swarmHash - ); - - event LogTokenNameChange(address indexed token, string oldName, string newName); - event LogTokenSymbolChange(address indexed token, string oldSymbol, string newSymbol); - event LogTokenIpfsHashChange(address indexed token, bytes oldIpfsHash, bytes newIpfsHash); - event LogTokenSwarmHashChange(address indexed token, bytes oldSwarmHash, bytes newSwarmHash); - - mapping (address => TokenMetadata) public tokens; - mapping (string => address) tokenBySymbol; - mapping (string => address) tokenByName; - - address[] public tokenAddresses; - - struct TokenMetadata { - address token; - string name; - string symbol; - uint8 decimals; - bytes ipfsHash; - bytes swarmHash; - } - - modifier tokenExists(address _token) { - require(tokens[_token].token != address(0)); - _; - } - - modifier tokenDoesNotExist(address _token) { - require(tokens[_token].token == address(0)); - _; - } - - modifier nameDoesNotExist(string _name) { - require(tokenByName[_name] == address(0)); - _; - } - - modifier symbolDoesNotExist(string _symbol) { - require(tokenBySymbol[_symbol] == address(0)); - _; - } - - modifier addressNotNull(address _address) { - require(_address != address(0)); - _; - } - - - /// @dev Allows owner to add a new token to the registry. - /// @param _token Address of new token. - /// @param _name Name of new token. - /// @param _symbol Symbol for new token. - /// @param _decimals Number of decimals, divisibility of new token. - /// @param _ipfsHash IPFS hash of token icon. - /// @param _swarmHash Swarm hash of token icon. - function addToken( - address _token, - string _name, - string _symbol, - uint8 _decimals, - bytes _ipfsHash, - bytes _swarmHash) - public - onlyOwner - tokenDoesNotExist(_token) - addressNotNull(_token) - symbolDoesNotExist(_symbol) - nameDoesNotExist(_name) - { - tokens[_token] = TokenMetadata({ - token: _token, - name: _name, - symbol: _symbol, - decimals: _decimals, - ipfsHash: _ipfsHash, - swarmHash: _swarmHash - }); - tokenAddresses.push(_token); - tokenBySymbol[_symbol] = _token; - tokenByName[_name] = _token; - LogAddToken( - _token, - _name, - _symbol, - _decimals, - _ipfsHash, - _swarmHash - ); - } - - /// @dev Allows owner to remove an existing token from the registry. - /// @param _token Address of existing token. - function removeToken(address _token, uint _index) - public - onlyOwner - tokenExists(_token) - { - require(tokenAddresses[_index] == _token); - - tokenAddresses[_index] = tokenAddresses[tokenAddresses.length - 1]; - tokenAddresses.length -= 1; - - TokenMetadata storage token = tokens[_token]; - LogRemoveToken( - token.token, - token.name, - token.symbol, - token.decimals, - token.ipfsHash, - token.swarmHash - ); - delete tokenBySymbol[token.symbol]; - delete tokenByName[token.name]; - delete tokens[_token]; - } - - /// @dev Allows owner to modify an existing token's name. - /// @param _token Address of existing token. - /// @param _name New name. - function setTokenName(address _token, string _name) - public - onlyOwner - tokenExists(_token) - nameDoesNotExist(_name) - { - TokenMetadata storage token = tokens[_token]; - LogTokenNameChange(_token, token.name, _name); - delete tokenByName[token.name]; - tokenByName[_name] = _token; - token.name = _name; - } - - /// @dev Allows owner to modify an existing token's symbol. - /// @param _token Address of existing token. - /// @param _symbol New symbol. - function setTokenSymbol(address _token, string _symbol) - public - onlyOwner - tokenExists(_token) - symbolDoesNotExist(_symbol) - { - TokenMetadata storage token = tokens[_token]; - LogTokenSymbolChange(_token, token.symbol, _symbol); - delete tokenBySymbol[token.symbol]; - tokenBySymbol[_symbol] = _token; - token.symbol = _symbol; - } - - /// @dev Allows owner to modify an existing token's IPFS hash. - /// @param _token Address of existing token. - /// @param _ipfsHash New IPFS hash. - function setTokenIpfsHash(address _token, bytes _ipfsHash) - public - onlyOwner - tokenExists(_token) - { - TokenMetadata storage token = tokens[_token]; - LogTokenIpfsHashChange(_token, token.ipfsHash, _ipfsHash); - token.ipfsHash = _ipfsHash; - } - - /// @dev Allows owner to modify an existing token's Swarm hash. - /// @param _token Address of existing token. - /// @param _swarmHash New Swarm hash. - function setTokenSwarmHash(address _token, bytes _swarmHash) - public - onlyOwner - tokenExists(_token) - { - TokenMetadata storage token = tokens[_token]; - LogTokenSwarmHashChange(_token, token.swarmHash, _swarmHash); - token.swarmHash = _swarmHash; - } - - /* - * Web3 call functions - */ - - /// @dev Provides a registered token's address when given the token symbol. - /// @param _symbol Symbol of registered token. - /// @return Token's address. - function getTokenAddressBySymbol(string _symbol) constant returns (address) { - return tokenBySymbol[_symbol]; - } - - /// @dev Provides a registered token's address when given the token name. - /// @param _name Name of registered token. - /// @return Token's address. - function getTokenAddressByName(string _name) constant returns (address) { - return tokenByName[_name]; - } - - /// @dev Provides a registered token's metadata, looked up by address. - /// @param _token Address of registered token. - /// @return Token metadata. - function getTokenMetaData(address _token) - public - constant - returns ( - address, //tokenAddress - string, //name - string, //symbol - uint8, //decimals - bytes, //ipfsHash - bytes //swarmHash - ) - { - TokenMetadata memory token = tokens[_token]; - return ( - token.token, - token.name, - token.symbol, - token.decimals, - token.ipfsHash, - token.swarmHash - ); - } - - /// @dev Provides a registered token's metadata, looked up by name. - /// @param _name Name of registered token. - /// @return Token metadata. - function getTokenByName(string _name) - public - constant - returns ( - address, //tokenAddress - string, //name - string, //symbol - uint8, //decimals - bytes, //ipfsHash - bytes //swarmHash - ) - { - address _token = tokenByName[_name]; - return getTokenMetaData(_token); - } - - /// @dev Provides a registered token's metadata, looked up by symbol. - /// @param _symbol Symbol of registered token. - /// @return Token metadata. - function getTokenBySymbol(string _symbol) - public - constant - returns ( - address, //tokenAddress - string, //name - string, //symbol - uint8, //decimals - bytes, //ipfsHash - bytes //swarmHash - ) - { - address _token = tokenBySymbol[_symbol]; - return getTokenMetaData(_token); - } - - /// @dev Returns an array containing all token addresses. - /// @return Array of token addresses. - function getTokenAddresses() - public - constant - returns (address[]) - { - return tokenAddresses; - } -} diff --git a/packages/contracts/src/1.0.0/TokenTransferProxy/TokenTransferProxy_v1.sol b/packages/contracts/src/1.0.0/TokenTransferProxy/TokenTransferProxy_v1.sol deleted file mode 100644 index e3659d8ba..000000000 --- a/packages/contracts/src/1.0.0/TokenTransferProxy/TokenTransferProxy_v1.sol +++ /dev/null @@ -1,115 +0,0 @@ -/* - - Copyright 2018 ZeroEx Intl. - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - -*/ - -pragma solidity ^0.4.11; - -import { Token_v1 as Token } from "../Token/Token_v1.sol"; -import { Ownable_v1 as Ownable } from "../Ownable/Ownable_v1.sol"; - -/// @title TokenTransferProxy - Transfers tokens on behalf of contracts that have been approved via decentralized governance. -/// @author Amir Bandeali - <amir@0xProject.com>, Will Warren - <will@0xProject.com> -contract TokenTransferProxy_v1 is Ownable { - - /// @dev Only authorized addresses can invoke functions with this modifier. - modifier onlyAuthorized { - require(authorized[msg.sender]); - _; - } - - modifier targetAuthorized(address target) { - require(authorized[target]); - _; - } - - modifier targetNotAuthorized(address target) { - require(!authorized[target]); - _; - } - - mapping (address => bool) public authorized; - address[] public authorities; - - event LogAuthorizedAddressAdded(address indexed target, address indexed caller); - event LogAuthorizedAddressRemoved(address indexed target, address indexed caller); - - /* - * Public functions - */ - - /// @dev Authorizes an address. - /// @param target Address to authorize. - function addAuthorizedAddress(address target) - public - onlyOwner - targetNotAuthorized(target) - { - authorized[target] = true; - authorities.push(target); - LogAuthorizedAddressAdded(target, msg.sender); - } - - /// @dev Removes authorizion of an address. - /// @param target Address to remove authorization from. - function removeAuthorizedAddress(address target) - public - onlyOwner - targetAuthorized(target) - { - delete authorized[target]; - for (uint i = 0; i < authorities.length; i++) { - if (authorities[i] == target) { - authorities[i] = authorities[authorities.length - 1]; - authorities.length -= 1; - break; - } - } - LogAuthorizedAddressRemoved(target, msg.sender); - } - - /// @dev Calls into ERC20 Token contract, invoking transferFrom. - /// @param token Address of token to transfer. - /// @param from Address to transfer token from. - /// @param to Address to transfer token to. - /// @param value Amount of token to transfer. - /// @return Success of transfer. - function transferFrom( - address token, - address from, - address to, - uint value) - public - onlyAuthorized - returns (bool) - { - return Token(token).transferFrom(from, to, value); - } - - /* - * Public constant functions - */ - - /// @dev Gets all authorized addresses. - /// @return Array of authorized addresses. - function getAuthorizedAddresses() - public - constant - returns (address[]) - { - return authorities; - } -} diff --git a/packages/contracts/src/artifacts/index.ts b/packages/contracts/src/artifacts/index.ts new file mode 100644 index 000000000..c30972a91 --- /dev/null +++ b/packages/contracts/src/artifacts/index.ts @@ -0,0 +1,79 @@ +import { ContractArtifact } from 'ethereum-types'; + +import * as AssetProxyOwner from '../../generated-artifacts/AssetProxyOwner.json'; +import * as DummyERC20Token from '../../generated-artifacts/DummyERC20Token.json'; +import * as DummyERC721Receiver from '../../generated-artifacts/DummyERC721Receiver.json'; +import * as DummyERC721Token from '../../generated-artifacts/DummyERC721Token.json'; +import * as DummyMultipleReturnERC20Token from '../../generated-artifacts/DummyMultipleReturnERC20Token.json'; +import * as DummyNoReturnERC20Token from '../../generated-artifacts/DummyNoReturnERC20Token.json'; +import * as ERC20Proxy from '../../generated-artifacts/ERC20Proxy.json'; +import * as ERC20Token from '../../generated-artifacts/ERC20Token.json'; +import * as ERC721Proxy from '../../generated-artifacts/ERC721Proxy.json'; +import * as ERC721Token from '../../generated-artifacts/ERC721Token.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 IAssetData from '../../generated-artifacts/IAssetData.json'; +import * as IAssetProxy from '../../generated-artifacts/IAssetProxy.json'; +import * as InvalidERC721Receiver from '../../generated-artifacts/InvalidERC721Receiver.json'; +import * as IValidator from '../../generated-artifacts/IValidator.json'; +import * as IWallet from '../../generated-artifacts/IWallet.json'; +import * as MixinAuthorizable from '../../generated-artifacts/MixinAuthorizable.json'; +import * as MultiSigWallet from '../../generated-artifacts/MultiSigWallet.json'; +import * as MultiSigWalletWithTimeLock from '../../generated-artifacts/MultiSigWalletWithTimeLock.json'; +import * as OrderValidator from '../../generated-artifacts/OrderValidator.json'; +import * as ReentrantERC20Token from '../../generated-artifacts/ReentrantERC20Token.json'; +import * as TestAssetProxyDispatcher from '../../generated-artifacts/TestAssetProxyDispatcher.json'; +import * as TestAssetProxyOwner from '../../generated-artifacts/TestAssetProxyOwner.json'; +import * as TestConstants from '../../generated-artifacts/TestConstants.json'; +import * as TestExchangeInternals from '../../generated-artifacts/TestExchangeInternals.json'; +import * as TestLibBytes from '../../generated-artifacts/TestLibBytes.json'; +import * as TestLibs from '../../generated-artifacts/TestLibs.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 WETH9 from '../../generated-artifacts/WETH9.json'; +import * as Whitelist from '../../generated-artifacts/Whitelist.json'; +import * as ZRXToken from '../../generated-artifacts/ZRXToken.json'; + +export const artifacts = { + AssetProxyOwner: AssetProxyOwner as ContractArtifact, + DummyERC20Token: DummyERC20Token as ContractArtifact, + DummyERC721Receiver: DummyERC721Receiver as ContractArtifact, + DummyERC721Token: DummyERC721Token as ContractArtifact, + DummyMultipleReturnERC20Token: DummyMultipleReturnERC20Token as ContractArtifact, + DummyNoReturnERC20Token: DummyNoReturnERC20Token as ContractArtifact, + ERC20Proxy: ERC20Proxy as ContractArtifact, + ERC20Token: ERC20Token as ContractArtifact, + ERC721Proxy: ERC721Proxy as ContractArtifact, + ERC721Token: ERC721Token as ContractArtifact, + Exchange: Exchange as ContractArtifact, + ExchangeWrapper: ExchangeWrapper as ContractArtifact, + Forwarder: Forwarder as ContractArtifact, + IAssetData: IAssetData as ContractArtifact, + IAssetProxy: IAssetProxy as ContractArtifact, + IValidator: IValidator as ContractArtifact, + IWallet: IWallet as ContractArtifact, + InvalidERC721Receiver: InvalidERC721Receiver as ContractArtifact, + MixinAuthorizable: MixinAuthorizable as ContractArtifact, + MultiSigWallet: MultiSigWallet as ContractArtifact, + MultiSigWalletWithTimeLock: MultiSigWalletWithTimeLock as ContractArtifact, + OrderValidator: OrderValidator as ContractArtifact, + ReentrantERC20Token: ReentrantERC20Token as ContractArtifact, + TestAssetProxyDispatcher: TestAssetProxyDispatcher as ContractArtifact, + TestAssetProxyOwner: TestAssetProxyOwner as ContractArtifact, + TestConstants: TestConstants as ContractArtifact, + TestExchangeInternals: TestExchangeInternals as ContractArtifact, + TestLibBytes: TestLibBytes as ContractArtifact, + TestLibs: TestLibs as ContractArtifact, + TestSignatureValidator: TestSignatureValidator as ContractArtifact, + TestStaticCallReceiver: TestStaticCallReceiver as ContractArtifact, + Validator: Validator as ContractArtifact, + WETH9: WETH9 as ContractArtifact, + Wallet: Wallet as ContractArtifact, + Whitelist: Whitelist as ContractArtifact, + // Note(albrow): "as any" hack still required here because ZRXToken does not + // conform to the v2 artifact type. + ZRXToken: (ZRXToken as any) as ContractArtifact, +}; diff --git a/packages/contracts/src/wrappers/index.ts b/packages/contracts/src/wrappers/index.ts new file mode 100644 index 000000000..9ca676b56 --- /dev/null +++ b/packages/contracts/src/wrappers/index.ts @@ -0,0 +1,34 @@ +export * from '../../generated-wrappers/asset_proxy_owner'; +export * from '../../generated-wrappers/dummy_erc20_token'; +export * from '../../generated-wrappers/dummy_erc721_receiver'; +export * from '../../generated-wrappers/dummy_erc721_token'; +export * from '../../generated-wrappers/dummy_multiple_return_erc20_token'; +export * from '../../generated-wrappers/dummy_no_return_erc20_token'; +export * from '../../generated-wrappers/erc20_proxy'; +export * from '../../generated-wrappers/erc721_proxy'; +export * from '../../generated-wrappers/erc20_token'; +export * from '../../generated-wrappers/erc721_token'; +export * from '../../generated-wrappers/exchange'; +export * from '../../generated-wrappers/exchange_wrapper'; +export * from '../../generated-wrappers/forwarder'; +export * from '../../generated-wrappers/i_asset_data'; +export * from '../../generated-wrappers/i_asset_proxy'; +export * from '../../generated-wrappers/invalid_erc721_receiver'; +export * from '../../generated-wrappers/mixin_authorizable'; +export * from '../../generated-wrappers/multi_sig_wallet'; +export * from '../../generated-wrappers/multi_sig_wallet_with_time_lock'; +export * from '../../generated-wrappers/order_validator'; +export * from '../../generated-wrappers/reentrant_erc20_token'; +export * from '../../generated-wrappers/test_asset_proxy_dispatcher'; +export * from '../../generated-wrappers/test_asset_proxy_owner'; +export * from '../../generated-wrappers/test_constants'; +export * from '../../generated-wrappers/test_exchange_internals'; +export * from '../../generated-wrappers/test_lib_bytes'; +export * from '../../generated-wrappers/test_libs'; +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/weth9'; +export * from '../../generated-wrappers/whitelist'; +export * from '../../generated-wrappers/zrx_token'; diff --git a/packages/contracts/test/asset_proxy/authorizable.ts b/packages/contracts/test/asset_proxy/authorizable.ts index 0c0da46b3..a37a865fe 100644 --- a/packages/contracts/test/asset_proxy/authorizable.ts +++ b/packages/contracts/test/asset_proxy/authorizable.ts @@ -4,8 +4,8 @@ import { BigNumber } from '@0xproject/utils'; import * as chai from 'chai'; import * as _ from 'lodash'; -import { MixinAuthorizableContract } from '../../generated_contract_wrappers/mixin_authorizable'; -import { artifacts } from '../utils/artifacts'; +import { MixinAuthorizableContract } from '../../generated-wrappers/mixin_authorizable'; +import { artifacts } from '../../src/artifacts'; import { expectTransactionFailedAsync } from '../utils/assertions'; import { chaiSetup } from '../utils/chai_setup'; import { constants } from '../utils/constants'; diff --git a/packages/contracts/test/asset_proxy/proxies.ts b/packages/contracts/test/asset_proxy/proxies.ts index 4d70031d1..a46a580d1 100644 --- a/packages/contracts/test/asset_proxy/proxies.ts +++ b/packages/contracts/test/asset_proxy/proxies.ts @@ -5,15 +5,15 @@ import { BigNumber } from '@0xproject/utils'; import * as chai from 'chai'; import * as _ from 'lodash'; -import { DummyERC20TokenContract } from '../../generated_contract_wrappers/dummy_erc20_token'; -import { DummyERC721ReceiverContract } from '../../generated_contract_wrappers/dummy_erc721_receiver'; -import { DummyERC721TokenContract } from '../../generated_contract_wrappers/dummy_erc721_token'; -import { DummyMultipleReturnERC20TokenContract } from '../../generated_contract_wrappers/dummy_multiple_return_erc20_token'; -import { DummyNoReturnERC20TokenContract } from '../../generated_contract_wrappers/dummy_no_return_erc20_token'; -import { ERC20ProxyContract } from '../../generated_contract_wrappers/erc20_proxy'; -import { ERC721ProxyContract } from '../../generated_contract_wrappers/erc721_proxy'; -import { IAssetProxyContract } from '../../generated_contract_wrappers/i_asset_proxy'; -import { artifacts } from '../utils/artifacts'; +import { DummyERC20TokenContract } from '../../generated-wrappers/dummy_erc20_token'; +import { DummyERC721ReceiverContract } from '../../generated-wrappers/dummy_erc721_receiver'; +import { DummyERC721TokenContract } from '../../generated-wrappers/dummy_erc721_token'; +import { DummyMultipleReturnERC20TokenContract } from '../../generated-wrappers/dummy_multiple_return_erc20_token'; +import { DummyNoReturnERC20TokenContract } from '../../generated-wrappers/dummy_no_return_erc20_token'; +import { ERC20ProxyContract } from '../../generated-wrappers/erc20_proxy'; +import { ERC721ProxyContract } from '../../generated-wrappers/erc721_proxy'; +import { IAssetProxyContract } from '../../generated-wrappers/i_asset_proxy'; +import { artifacts } from '../../src/artifacts'; import { expectTransactionFailedAsync, expectTransactionFailedWithoutReasonAsync } from '../utils/assertions'; import { chaiSetup } from '../utils/chai_setup'; import { constants } from '../utils/constants'; diff --git a/packages/contracts/test/exchange/core.ts b/packages/contracts/test/exchange/core.ts index acb99eed1..a47240efc 100644 --- a/packages/contracts/test/exchange/core.ts +++ b/packages/contracts/test/exchange/core.ts @@ -8,18 +8,15 @@ import { LogWithDecodedArgs } from 'ethereum-types'; import ethUtil = require('ethereumjs-util'); import * as _ from 'lodash'; -import { - DummyERC20TokenContract, - DummyERC20TokenTransferEventArgs, -} from '../../generated_contract_wrappers/dummy_erc20_token'; -import { DummyERC721TokenContract } from '../../generated_contract_wrappers/dummy_erc721_token'; -import { DummyNoReturnERC20TokenContract } from '../../generated_contract_wrappers/dummy_no_return_erc20_token'; -import { ERC20ProxyContract } from '../../generated_contract_wrappers/erc20_proxy'; -import { ERC721ProxyContract } from '../../generated_contract_wrappers/erc721_proxy'; -import { ExchangeCancelEventArgs, ExchangeContract } from '../../generated_contract_wrappers/exchange'; -import { ReentrantERC20TokenContract } from '../../generated_contract_wrappers/reentrant_erc20_token'; -import { TestStaticCallReceiverContract } from '../../generated_contract_wrappers/test_static_call_receiver'; -import { artifacts } from '../utils/artifacts'; +import { DummyERC20TokenContract, DummyERC20TokenTransferEventArgs } from '../../generated-wrappers/dummy_erc20_token'; +import { DummyERC721TokenContract } from '../../generated-wrappers/dummy_erc721_token'; +import { DummyNoReturnERC20TokenContract } from '../../generated-wrappers/dummy_no_return_erc20_token'; +import { ERC20ProxyContract } from '../../generated-wrappers/erc20_proxy'; +import { ERC721ProxyContract } from '../../generated-wrappers/erc721_proxy'; +import { ExchangeCancelEventArgs, ExchangeContract } from '../../generated-wrappers/exchange'; +import { ReentrantERC20TokenContract } from '../../generated-wrappers/reentrant_erc20_token'; +import { TestStaticCallReceiverContract } from '../../generated-wrappers/test_static_call_receiver'; +import { artifacts } from '../../src/artifacts'; import { expectTransactionFailedAsync } from '../utils/assertions'; import { getLatestBlockTimestampAsync, increaseTimeAndMineBlockAsync } from '../utils/block_timestamp'; import { chaiSetup } from '../utils/chai_setup'; diff --git a/packages/contracts/test/exchange/dispatcher.ts b/packages/contracts/test/exchange/dispatcher.ts index a8ae897a8..2967ed4e8 100644 --- a/packages/contracts/test/exchange/dispatcher.ts +++ b/packages/contracts/test/exchange/dispatcher.ts @@ -6,14 +6,14 @@ import * as chai from 'chai'; import { LogWithDecodedArgs } from 'ethereum-types'; import * as _ from 'lodash'; -import { DummyERC20TokenContract } from '../../generated_contract_wrappers/dummy_erc20_token'; -import { ERC20ProxyContract } from '../../generated_contract_wrappers/erc20_proxy'; -import { ERC721ProxyContract } from '../../generated_contract_wrappers/erc721_proxy'; +import { DummyERC20TokenContract } from '../../generated-wrappers/dummy_erc20_token'; +import { ERC20ProxyContract } from '../../generated-wrappers/erc20_proxy'; +import { ERC721ProxyContract } from '../../generated-wrappers/erc721_proxy'; import { TestAssetProxyDispatcherAssetProxyRegisteredEventArgs, TestAssetProxyDispatcherContract, -} from '../../generated_contract_wrappers/test_asset_proxy_dispatcher'; -import { artifacts } from '../utils/artifacts'; +} from '../../generated-wrappers/test_asset_proxy_dispatcher'; +import { artifacts } from '../../src/artifacts'; import { expectTransactionFailedAsync } from '../utils/assertions'; import { chaiSetup } from '../utils/chai_setup'; import { constants } from '../utils/constants'; diff --git a/packages/contracts/test/exchange/internal.ts b/packages/contracts/test/exchange/internal.ts index 156e086af..a1a14d56c 100644 --- a/packages/contracts/test/exchange/internal.ts +++ b/packages/contracts/test/exchange/internal.ts @@ -4,8 +4,8 @@ import { BigNumber } from '@0xproject/utils'; import * as chai from 'chai'; import * as _ from 'lodash'; -import { TestExchangeInternalsContract } from '../../generated_contract_wrappers/test_exchange_internals'; -import { artifacts } from '../utils/artifacts'; +import { TestExchangeInternalsContract } from '../../generated-wrappers/test_exchange_internals'; +import { artifacts } from '../../src/artifacts'; import { getRevertReasonOrErrorMessageForSendTransactionAsync } from '../utils/assertions'; import { chaiSetup } from '../utils/chai_setup'; import { bytes32Values, testCombinatoriallyWithReferenceFuncAsync, uint256Values } from '../utils/combinatorial_utils'; diff --git a/packages/contracts/test/exchange/libs.ts b/packages/contracts/test/exchange/libs.ts index 049b7f37a..9d5aebcd2 100644 --- a/packages/contracts/test/exchange/libs.ts +++ b/packages/contracts/test/exchange/libs.ts @@ -4,10 +4,10 @@ import { SignedOrder } from '@0xproject/types'; import { BigNumber } from '@0xproject/utils'; import * as chai from 'chai'; -import { TestConstantsContract } from '../../generated_contract_wrappers/test_constants'; -import { TestLibsContract } from '../../generated_contract_wrappers/test_libs'; +import { TestConstantsContract } from '../../generated-wrappers/test_constants'; +import { TestLibsContract } from '../../generated-wrappers/test_libs'; +import { artifacts } from '../../src/artifacts'; import { addressUtils } from '../utils/address_utils'; -import { artifacts } from '../utils/artifacts'; import { chaiSetup } from '../utils/chai_setup'; import { constants } from '../utils/constants'; import { OrderFactory } from '../utils/order_factory'; diff --git a/packages/contracts/test/exchange/match_orders.ts b/packages/contracts/test/exchange/match_orders.ts index c6e7b494f..d20b6227f 100644 --- a/packages/contracts/test/exchange/match_orders.ts +++ b/packages/contracts/test/exchange/match_orders.ts @@ -6,14 +6,14 @@ import { Web3Wrapper } from '@0xproject/web3-wrapper'; import * as chai from 'chai'; import * as _ from 'lodash'; -import { DummyERC20TokenContract } from '../../generated_contract_wrappers/dummy_erc20_token'; -import { DummyERC721TokenContract } from '../../generated_contract_wrappers/dummy_erc721_token'; -import { ERC20ProxyContract } from '../../generated_contract_wrappers/erc20_proxy'; -import { ERC721ProxyContract } from '../../generated_contract_wrappers/erc721_proxy'; -import { ExchangeContract } from '../../generated_contract_wrappers/exchange'; -import { ReentrantERC20TokenContract } from '../../generated_contract_wrappers/reentrant_erc20_token'; -import { TestExchangeInternalsContract } from '../../generated_contract_wrappers/test_exchange_internals'; -import { artifacts } from '../utils/artifacts'; +import { DummyERC20TokenContract } from '../../generated-wrappers/dummy_erc20_token'; +import { DummyERC721TokenContract } from '../../generated-wrappers/dummy_erc721_token'; +import { ERC20ProxyContract } from '../../generated-wrappers/erc20_proxy'; +import { ERC721ProxyContract } from '../../generated-wrappers/erc721_proxy'; +import { ExchangeContract } from '../../generated-wrappers/exchange'; +import { ReentrantERC20TokenContract } from '../../generated-wrappers/reentrant_erc20_token'; +import { TestExchangeInternalsContract } from '../../generated-wrappers/test_exchange_internals'; +import { artifacts } from '../../src/artifacts'; import { expectTransactionFailedAsync } from '../utils/assertions'; import { chaiSetup } from '../utils/chai_setup'; import { constants } from '../utils/constants'; diff --git a/packages/contracts/test/exchange/signature_validator.ts b/packages/contracts/test/exchange/signature_validator.ts index 192ed3ca9..6b9cc87f4 100644 --- a/packages/contracts/test/exchange/signature_validator.ts +++ b/packages/contracts/test/exchange/signature_validator.ts @@ -8,12 +8,12 @@ import ethUtil = require('ethereumjs-util'); import { TestSignatureValidatorContract, TestSignatureValidatorSignatureValidatorApprovalEventArgs, -} from '../../generated_contract_wrappers/test_signature_validator'; -import { TestStaticCallReceiverContract } from '../../generated_contract_wrappers/test_static_call_receiver'; -import { ValidatorContract } from '../../generated_contract_wrappers/validator'; -import { WalletContract } from '../../generated_contract_wrappers/wallet'; +} from '../../generated-wrappers/test_signature_validator'; +import { TestStaticCallReceiverContract } from '../../generated-wrappers/test_static_call_receiver'; +import { ValidatorContract } from '../../generated-wrappers/validator'; +import { WalletContract } from '../../generated-wrappers/wallet'; +import { artifacts } from '../../src/artifacts'; import { addressUtils } from '../utils/address_utils'; -import { artifacts } from '../utils/artifacts'; import { expectContractCallFailedAsync } from '../utils/assertions'; import { chaiSetup } from '../utils/chai_setup'; import { constants } from '../utils/constants'; diff --git a/packages/contracts/test/exchange/transactions.ts b/packages/contracts/test/exchange/transactions.ts index 2bdd96b16..c440770c1 100644 --- a/packages/contracts/test/exchange/transactions.ts +++ b/packages/contracts/test/exchange/transactions.ts @@ -5,12 +5,12 @@ import { BigNumber } from '@0xproject/utils'; import * as chai from 'chai'; import * as _ from 'lodash'; -import { DummyERC20TokenContract } from '../../generated_contract_wrappers/dummy_erc20_token'; -import { ERC20ProxyContract } from '../../generated_contract_wrappers/erc20_proxy'; -import { ExchangeContract } from '../../generated_contract_wrappers/exchange'; -import { ExchangeWrapperContract } from '../../generated_contract_wrappers/exchange_wrapper'; -import { WhitelistContract } from '../../generated_contract_wrappers/whitelist'; -import { artifacts } from '../utils/artifacts'; +import { DummyERC20TokenContract } from '../../generated-wrappers/dummy_erc20_token'; +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 { expectTransactionFailedAsync } from '../utils/assertions'; import { chaiSetup } from '../utils/chai_setup'; import { constants } from '../utils/constants'; diff --git a/packages/contracts/test/exchange/wrapper.ts b/packages/contracts/test/exchange/wrapper.ts index aadb5ab59..1ddb018ba 100644 --- a/packages/contracts/test/exchange/wrapper.ts +++ b/packages/contracts/test/exchange/wrapper.ts @@ -6,13 +6,13 @@ import { Web3Wrapper } from '@0xproject/web3-wrapper'; import * as chai from 'chai'; import * as _ from 'lodash'; -import { DummyERC20TokenContract } from '../../generated_contract_wrappers/dummy_erc20_token'; -import { DummyERC721TokenContract } from '../../generated_contract_wrappers/dummy_erc721_token'; -import { ERC20ProxyContract } from '../../generated_contract_wrappers/erc20_proxy'; -import { ERC721ProxyContract } from '../../generated_contract_wrappers/erc721_proxy'; -import { ExchangeContract } from '../../generated_contract_wrappers/exchange'; -import { ReentrantERC20TokenContract } from '../../generated_contract_wrappers/reentrant_erc20_token'; -import { artifacts } from '../utils/artifacts'; +import { DummyERC20TokenContract } from '../../generated-wrappers/dummy_erc20_token'; +import { DummyERC721TokenContract } from '../../generated-wrappers/dummy_erc721_token'; +import { ERC20ProxyContract } from '../../generated-wrappers/erc20_proxy'; +import { ERC721ProxyContract } from '../../generated-wrappers/erc721_proxy'; +import { ExchangeContract } from '../../generated-wrappers/exchange'; +import { ReentrantERC20TokenContract } from '../../generated-wrappers/reentrant_erc20_token'; +import { artifacts } from '../../src/artifacts'; import { expectTransactionFailedAsync } from '../utils/assertions'; import { getLatestBlockTimestampAsync, increaseTimeAndMineBlockAsync } from '../utils/block_timestamp'; import { chaiSetup } from '../utils/chai_setup'; diff --git a/packages/contracts/test/extensions/forwarder.ts b/packages/contracts/test/extensions/forwarder.ts index 8424d01fd..f6d1303b0 100644 --- a/packages/contracts/test/extensions/forwarder.ts +++ b/packages/contracts/test/extensions/forwarder.ts @@ -6,12 +6,12 @@ import { Web3Wrapper } from '@0xproject/web3-wrapper'; import * as chai from 'chai'; import { TransactionReceiptWithDecodedLogs } from 'ethereum-types'; -import { DummyERC20TokenContract } from '../../generated_contract_wrappers/dummy_erc20_token'; -import { DummyERC721TokenContract } from '../../generated_contract_wrappers/dummy_erc721_token'; -import { ExchangeContract } from '../../generated_contract_wrappers/exchange'; -import { ForwarderContract } from '../../generated_contract_wrappers/forwarder'; -import { WETH9Contract } from '../../generated_contract_wrappers/weth9'; -import { artifacts } from '../utils/artifacts'; +import { DummyERC20TokenContract } from '../../generated-wrappers/dummy_erc20_token'; +import { DummyERC721TokenContract } from '../../generated-wrappers/dummy_erc721_token'; +import { ExchangeContract } from '../../generated-wrappers/exchange'; +import { ForwarderContract } from '../../generated-wrappers/forwarder'; +import { WETH9Contract } from '../../generated-wrappers/weth9'; +import { artifacts } from '../../src/artifacts'; import { expectContractCreationFailedAsync, expectTransactionFailedAsync, @@ -91,7 +91,7 @@ describe(ContractName.Forwarder, () => { const erc721Balances = await erc721Wrapper.getBalancesAsync(); erc721MakerAssetIds = erc721Balances[makerAddress][erc721Token.address]; - wethContract = await WETH9Contract.deployFrom0xArtifactAsync(artifacts.EtherToken, provider, txDefaults); + wethContract = await WETH9Contract.deployFrom0xArtifactAsync(artifacts.WETH9, provider, txDefaults); weth = new DummyERC20TokenContract(wethContract.abi, wethContract.address, provider); erc20Wrapper.addDummyTokenContract(weth); diff --git a/packages/contracts/test/extensions/order_validator.ts b/packages/contracts/test/extensions/order_validator.ts index 3a57cfc37..5c01de020 100644 --- a/packages/contracts/test/extensions/order_validator.ts +++ b/packages/contracts/test/extensions/order_validator.ts @@ -5,13 +5,13 @@ import { BigNumber } from '@0xproject/utils'; import * as chai from 'chai'; import * as _ from 'lodash'; -import { DummyERC20TokenContract } from '../../generated_contract_wrappers/dummy_erc20_token'; -import { DummyERC721TokenContract } from '../../generated_contract_wrappers/dummy_erc721_token'; -import { ERC20ProxyContract } from '../../generated_contract_wrappers/erc20_proxy'; -import { ERC721ProxyContract } from '../../generated_contract_wrappers/erc721_proxy'; -import { ExchangeContract } from '../../generated_contract_wrappers/exchange'; -import { OrderValidatorContract } from '../../generated_contract_wrappers/order_validator'; -import { artifacts } from '../utils/artifacts'; +import { DummyERC20TokenContract } from '../../generated-wrappers/dummy_erc20_token'; +import { DummyERC721TokenContract } from '../../generated-wrappers/dummy_erc721_token'; +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 { chaiSetup } from '../utils/chai_setup'; import { constants } from '../utils/constants'; import { ERC20Wrapper } from '../utils/erc20_wrapper'; diff --git a/packages/contracts/test/libraries/lib_bytes.ts b/packages/contracts/test/libraries/lib_bytes.ts index 13640a761..8e8ed7ede 100644 --- a/packages/contracts/test/libraries/lib_bytes.ts +++ b/packages/contracts/test/libraries/lib_bytes.ts @@ -7,8 +7,8 @@ import * as chai from 'chai'; import ethUtil = require('ethereumjs-util'); import * as _ from 'lodash'; -import { TestLibBytesContract } from '../../generated_contract_wrappers/test_lib_bytes'; -import { artifacts } from '../utils/artifacts'; +import { TestLibBytesContract } from '../../generated-wrappers/test_lib_bytes'; +import { artifacts } from '../../src/artifacts'; import { expectContractCallFailedAsync } from '../utils/assertions'; import { chaiSetup } from '../utils/chai_setup'; import { constants } from '../utils/constants'; diff --git a/packages/contracts/test/multisig/asset_proxy_owner.ts b/packages/contracts/test/multisig/asset_proxy_owner.ts index 299707512..d866b392e 100644 --- a/packages/contracts/test/multisig/asset_proxy_owner.ts +++ b/packages/contracts/test/multisig/asset_proxy_owner.ts @@ -10,10 +10,10 @@ import { AssetProxyOwnerExecutionEventArgs, AssetProxyOwnerExecutionFailureEventArgs, AssetProxyOwnerSubmissionEventArgs, -} from '../../generated_contract_wrappers/asset_proxy_owner'; -import { MixinAuthorizableContract } from '../../generated_contract_wrappers/mixin_authorizable'; -import { TestAssetProxyOwnerContract } from '../../generated_contract_wrappers/test_asset_proxy_owner'; -import { artifacts } from '../utils/artifacts'; +} from '../../generated-wrappers/asset_proxy_owner'; +import { MixinAuthorizableContract } from '../../generated-wrappers/mixin_authorizable'; +import { TestAssetProxyOwnerContract } from '../../generated-wrappers/test_asset_proxy_owner'; +import { artifacts } from '../../src/artifacts'; import { expectContractCallFailedAsync, expectContractCreationFailedAsync, diff --git a/packages/contracts/test/multisig/multi_sig_with_time_lock.ts b/packages/contracts/test/multisig/multi_sig_with_time_lock.ts index 0b17c298b..60787ac50 100644 --- a/packages/contracts/test/multisig/multi_sig_with_time_lock.ts +++ b/packages/contracts/test/multisig/multi_sig_with_time_lock.ts @@ -5,7 +5,7 @@ import * as chai from 'chai'; import { LogWithDecodedArgs } from 'ethereum-types'; import * as _ from 'lodash'; -import { DummyERC20TokenContract } from '../../generated_contract_wrappers/dummy_erc20_token'; +import { DummyERC20TokenContract } from '../../generated-wrappers/dummy_erc20_token'; import { MultiSigWalletWithTimeLockConfirmationEventArgs, MultiSigWalletWithTimeLockConfirmationTimeSetEventArgs, @@ -13,8 +13,8 @@ import { MultiSigWalletWithTimeLockExecutionEventArgs, MultiSigWalletWithTimeLockExecutionFailureEventArgs, MultiSigWalletWithTimeLockSubmissionEventArgs, -} from '../../generated_contract_wrappers/multi_sig_wallet_with_time_lock'; -import { artifacts } from '../utils/artifacts'; +} from '../../generated-wrappers/multi_sig_wallet_with_time_lock'; +import { artifacts } from '../../src/artifacts'; import { expectTransactionFailedAsync, expectTransactionFailedWithoutReasonAsync } from '../utils/assertions'; import { increaseTimeAndMineBlockAsync } from '../utils/block_timestamp'; import { chaiSetup } from '../utils/chai_setup'; diff --git a/packages/contracts/test/token_registry.ts b/packages/contracts/test/token_registry.ts deleted file mode 100644 index 7cc43be9b..000000000 --- a/packages/contracts/test/token_registry.ts +++ /dev/null @@ -1,255 +0,0 @@ -import { BlockchainLifecycle } from '@0xproject/dev-utils'; -import { BigNumber, NULL_BYTES } from '@0xproject/utils'; -import * as chai from 'chai'; -import ethUtil = require('ethereumjs-util'); -import * as _ from 'lodash'; - -import { TokenRegistryContract } from '../generated_contract_wrappers/token_registry'; - -import { artifacts } from './utils/artifacts'; -import { expectTransactionFailedWithoutReasonAsync } from './utils/assertions'; -import { chaiSetup } from './utils/chai_setup'; -import { constants } from './utils/constants'; -import { TokenRegWrapper } from './utils/token_registry_wrapper'; -import { provider, txDefaults, web3Wrapper } from './utils/web3_wrapper'; - -chaiSetup.configure(); -const expect = chai.expect; -const blockchainLifecycle = new BlockchainLifecycle(web3Wrapper); - -describe('TokenRegistry', () => { - let owner: string; - let notOwner: string; - let tokenReg: TokenRegistryContract; - let tokenRegWrapper: TokenRegWrapper; - - before(async () => { - await blockchainLifecycle.startAsync(); - }); - after(async () => { - await blockchainLifecycle.revertAsync(); - }); - before(async () => { - const accounts = await web3Wrapper.getAvailableAddressesAsync(); - owner = accounts[0]; - notOwner = accounts[1]; - tokenReg = await TokenRegistryContract.deployFrom0xArtifactAsync(artifacts.TokenRegistry, provider, txDefaults); - tokenRegWrapper = new TokenRegWrapper(tokenReg, provider); - }); - beforeEach(async () => { - await blockchainLifecycle.startAsync(); - }); - afterEach(async () => { - await blockchainLifecycle.revertAsync(); - }); - - const tokenAddress1 = `0x${ethUtil.setLength(ethUtil.toBuffer('0x1'), 20, false).toString('hex')}`; - const tokenAddress2 = `0x${ethUtil.setLength(ethUtil.toBuffer('0x2'), 20, false).toString('hex')}`; - - const token1 = { - address: tokenAddress1, - name: 'testToken1', - symbol: 'TT1', - decimals: 18, - ipfsHash: `0x${ethUtil.sha3('ipfs1').toString('hex')}`, - swarmHash: `0x${ethUtil.sha3('swarm1').toString('hex')}`, - }; - - const token2 = { - address: tokenAddress2, - name: 'testToken2', - symbol: 'TT2', - decimals: 18, - ipfsHash: `0x${ethUtil.sha3('ipfs2').toString('hex')}`, - swarmHash: `0x${ethUtil.sha3('swarm2').toString('hex')}`, - }; - - const nullToken = { - address: constants.NULL_ADDRESS, - name: '', - symbol: '', - decimals: 0, - ipfsHash: NULL_BYTES, - swarmHash: NULL_BYTES, - }; - - describe('addToken', () => { - it('should throw when not called by owner', async () => { - return expectTransactionFailedWithoutReasonAsync(tokenRegWrapper.addTokenAsync(token1, notOwner)); - }); - - it('should add token metadata when called by owner', async () => { - await tokenRegWrapper.addTokenAsync(token1, owner); - const tokenData = await tokenRegWrapper.getTokenMetaDataAsync(token1.address); - expect(tokenData).to.be.deep.equal(token1); - }); - - it('should throw if token already exists', async () => { - await tokenRegWrapper.addTokenAsync(token1, owner); - - return expectTransactionFailedWithoutReasonAsync(tokenRegWrapper.addTokenAsync(token1, owner)); - }); - - it('should throw if token address is null', async () => { - return expectTransactionFailedWithoutReasonAsync(tokenRegWrapper.addTokenAsync(nullToken, owner)); - }); - - it('should throw if name already exists', async () => { - await tokenRegWrapper.addTokenAsync(token1, owner); - const duplicateNameToken = _.assign({}, token2, { name: token1.name }); - - return expectTransactionFailedWithoutReasonAsync(tokenRegWrapper.addTokenAsync(duplicateNameToken, owner)); - }); - - it('should throw if symbol already exists', async () => { - await tokenRegWrapper.addTokenAsync(token1, owner); - const duplicateSymbolToken = _.assign({}, token2, { - symbol: token1.symbol, - }); - - return expectTransactionFailedWithoutReasonAsync( - tokenRegWrapper.addTokenAsync(duplicateSymbolToken, owner), - ); - }); - }); - - describe('after addToken', () => { - beforeEach(async () => { - await tokenRegWrapper.addTokenAsync(token1, owner); - }); - - describe('getTokenByName', () => { - it('should return token metadata when given the token name', async () => { - const tokenData = await tokenRegWrapper.getTokenByNameAsync(token1.name); - expect(tokenData).to.be.deep.equal(token1); - }); - }); - - describe('getTokenBySymbol', () => { - it('should return token metadata when given the token symbol', async () => { - const tokenData = await tokenRegWrapper.getTokenBySymbolAsync(token1.symbol); - expect(tokenData).to.be.deep.equal(token1); - }); - }); - - describe('setTokenName', () => { - it('should throw when not called by owner', async () => { - return expectTransactionFailedWithoutReasonAsync( - tokenReg.setTokenName.sendTransactionAsync(token1.address, token2.name, { from: notOwner }), - ); - }); - - it('should change the token name when called by owner', async () => { - await web3Wrapper.awaitTransactionSuccessAsync( - await tokenReg.setTokenName.sendTransactionAsync(token1.address, token2.name, { - from: owner, - }), - constants.AWAIT_TRANSACTION_MINED_MS, - ); - const [newData, oldData] = await Promise.all([ - tokenRegWrapper.getTokenByNameAsync(token2.name), - tokenRegWrapper.getTokenByNameAsync(token1.name), - ]); - - const expectedNewData = _.assign({}, token1, { name: token2.name }); - const expectedOldData = nullToken; - expect(newData).to.be.deep.equal(expectedNewData); - expect(oldData).to.be.deep.equal(expectedOldData); - }); - - it('should throw if the name already exists', async () => { - await tokenRegWrapper.addTokenAsync(token2, owner); - - return expectTransactionFailedWithoutReasonAsync( - tokenReg.setTokenName.sendTransactionAsync(token1.address, token2.name, { from: owner }), - ); - }); - - it('should throw if token does not exist', async () => { - return expectTransactionFailedWithoutReasonAsync( - tokenReg.setTokenName.sendTransactionAsync(nullToken.address, token2.name, { from: owner }), - ); - }); - }); - - describe('setTokenSymbol', () => { - it('should throw when not called by owner', async () => { - return expectTransactionFailedWithoutReasonAsync( - tokenReg.setTokenSymbol.sendTransactionAsync(token1.address, token2.symbol, { - from: notOwner, - }), - ); - }); - - it('should change the token symbol when called by owner', async () => { - await web3Wrapper.awaitTransactionSuccessAsync( - await tokenReg.setTokenSymbol.sendTransactionAsync(token1.address, token2.symbol, { from: owner }), - constants.AWAIT_TRANSACTION_MINED_MS, - ); - const [newData, oldData] = await Promise.all([ - tokenRegWrapper.getTokenBySymbolAsync(token2.symbol), - tokenRegWrapper.getTokenBySymbolAsync(token1.symbol), - ]); - - const expectedNewData = _.assign({}, token1, { symbol: token2.symbol }); - const expectedOldData = nullToken; - expect(newData).to.be.deep.equal(expectedNewData); - expect(oldData).to.be.deep.equal(expectedOldData); - }); - - it('should throw if the symbol already exists', async () => { - await tokenRegWrapper.addTokenAsync(token2, owner); - - return expectTransactionFailedWithoutReasonAsync( - tokenReg.setTokenSymbol.sendTransactionAsync(token1.address, token2.symbol, { - from: owner, - }), - ); - }); - - it('should throw if token does not exist', async () => { - return expectTransactionFailedWithoutReasonAsync( - tokenReg.setTokenSymbol.sendTransactionAsync(nullToken.address, token2.symbol, { - from: owner, - }), - ); - }); - }); - - describe('removeToken', () => { - it('should throw if not called by owner', async () => { - const index = new BigNumber(0); - return expectTransactionFailedWithoutReasonAsync( - tokenReg.removeToken.sendTransactionAsync(token1.address, index, { from: notOwner }), - ); - }); - - it('should remove token metadata when called by owner', async () => { - const index = new BigNumber(0); - await web3Wrapper.awaitTransactionSuccessAsync( - await tokenReg.removeToken.sendTransactionAsync(token1.address, index, { - from: owner, - }), - constants.AWAIT_TRANSACTION_MINED_MS, - ); - const tokenData = await tokenRegWrapper.getTokenMetaDataAsync(token1.address); - expect(tokenData).to.be.deep.equal(nullToken); - }); - - it('should throw if token does not exist', async () => { - const index = new BigNumber(0); - return expectTransactionFailedWithoutReasonAsync( - tokenReg.removeToken.sendTransactionAsync(nullToken.address, index, { from: owner }), - ); - }); - - it('should throw if token at given index does not match address', async () => { - await tokenRegWrapper.addTokenAsync(token2, owner); - const incorrectIndex = new BigNumber(0); - return expectTransactionFailedWithoutReasonAsync( - tokenReg.removeToken.sendTransactionAsync(token2.address, incorrectIndex, { from: owner }), - ); - }); - }); - }); -}); diff --git a/packages/contracts/test/tokens/erc721_token.ts b/packages/contracts/test/tokens/erc721_token.ts index e61fd7d51..fe10e060a 100644 --- a/packages/contracts/test/tokens/erc721_token.ts +++ b/packages/contracts/test/tokens/erc721_token.ts @@ -7,13 +7,13 @@ import { LogWithDecodedArgs } from 'ethereum-types'; import { DummyERC721ReceiverContract, DummyERC721ReceiverTokenReceivedEventArgs, -} from '../../generated_contract_wrappers/dummy_erc721_receiver'; +} from '../../generated-wrappers/dummy_erc721_receiver'; import { DummyERC721TokenContract, DummyERC721TokenTransferEventArgs, -} from '../../generated_contract_wrappers/dummy_erc721_token'; -import { InvalidERC721ReceiverContract } from '../../generated_contract_wrappers/invalid_erc721_receiver'; -import { artifacts } from '../utils/artifacts'; +} from '../../generated-wrappers/dummy_erc721_token'; +import { InvalidERC721ReceiverContract } from '../../generated-wrappers/invalid_erc721_receiver'; +import { artifacts } from '../../src/artifacts'; import { expectTransactionFailedAsync, expectTransactionFailedWithoutReasonAsync } from '../utils/assertions'; import { chaiSetup } from '../utils/chai_setup'; import { constants } from '../utils/constants'; diff --git a/packages/contracts/test/tokens/unlimited_allowance_token.ts b/packages/contracts/test/tokens/unlimited_allowance_token.ts index 63680fe9b..ec00e43ab 100644 --- a/packages/contracts/test/tokens/unlimited_allowance_token.ts +++ b/packages/contracts/test/tokens/unlimited_allowance_token.ts @@ -3,8 +3,8 @@ import { RevertReason } from '@0xproject/types'; import { BigNumber } from '@0xproject/utils'; import * as chai from 'chai'; -import { DummyERC20TokenContract } from '../../generated_contract_wrappers/dummy_erc20_token'; -import { artifacts } from '../utils/artifacts'; +import { DummyERC20TokenContract } from '../../generated-wrappers/dummy_erc20_token'; +import { artifacts } from '../../src/artifacts'; import { expectContractCallFailedAsync } from '../utils/assertions'; import { chaiSetup } from '../utils/chai_setup'; import { constants } from '../utils/constants'; diff --git a/packages/contracts/test/tokens/ether_token.ts b/packages/contracts/test/tokens/weth9.ts index a104fc915..25463ac62 100644 --- a/packages/contracts/test/tokens/ether_token.ts +++ b/packages/contracts/test/tokens/weth9.ts @@ -3,8 +3,8 @@ import { BigNumber } from '@0xproject/utils'; import { Web3Wrapper } from '@0xproject/web3-wrapper'; import * as chai from 'chai'; -import { WETH9Contract } from '../../generated_contract_wrappers/weth9'; -import { artifacts } from '../utils/artifacts'; +import { WETH9Contract } from '../../generated-wrappers/weth9'; +import { artifacts } from '../../src/artifacts'; import { expectInsufficientFundsAsync, expectTransactionFailedWithoutReasonAsync } from '../utils/assertions'; import { chaiSetup } from '../utils/chai_setup'; import { constants } from '../utils/constants'; @@ -29,7 +29,7 @@ describe('EtherToken', () => { const accounts = await web3Wrapper.getAvailableAddressesAsync(); account = accounts[0]; - etherToken = await WETH9Contract.deployFrom0xArtifactAsync(artifacts.EtherToken, provider, { + etherToken = await WETH9Contract.deployFrom0xArtifactAsync(artifacts.WETH9, provider, { gasPrice, ...txDefaults, }); diff --git a/packages/contracts/test/tokens/zrx_token.ts b/packages/contracts/test/tokens/zrx_token.ts index a0d77c924..8881aca77 100644 --- a/packages/contracts/test/tokens/zrx_token.ts +++ b/packages/contracts/test/tokens/zrx_token.ts @@ -3,8 +3,8 @@ import { BigNumber } from '@0xproject/utils'; import { Web3Wrapper } from '@0xproject/web3-wrapper'; import * as chai from 'chai'; -import { ZRXTokenContract } from '../../generated_contract_wrappers/zrx_token'; -import { artifacts } from '../utils/artifacts'; +import { ZRXTokenContract } from '../../generated-wrappers/zrx_token'; +import { artifacts } from '../../src/artifacts'; import { chaiSetup } from '../utils/chai_setup'; import { constants } from '../utils/constants'; import { provider, txDefaults, web3Wrapper } from '../utils/web3_wrapper'; @@ -29,7 +29,7 @@ describe('ZRXToken', () => { const accounts = await web3Wrapper.getAvailableAddressesAsync(); owner = accounts[0]; spender = accounts[1]; - zrxToken = await ZRXTokenContract.deployFrom0xArtifactAsync(artifacts.ZRX, provider, txDefaults); + zrxToken = await ZRXTokenContract.deployFrom0xArtifactAsync(artifacts.ZRXToken, provider, txDefaults); MAX_UINT = constants.UNLIMITED_ALLOWANCE_IN_BASE_UNITS; }); beforeEach(async () => { diff --git a/packages/contracts/test/utils/artifacts.ts b/packages/contracts/test/utils/artifacts.ts deleted file mode 100644 index 53f2a4e4e..000000000 --- a/packages/contracts/test/utils/artifacts.ts +++ /dev/null @@ -1,69 +0,0 @@ -import { ContractArtifact } from 'ethereum-types'; - -import * as AssetProxyOwner from '../../artifacts/AssetProxyOwner.json'; -import * as DummyERC20Token from '../../artifacts/DummyERC20Token.json'; -import * as DummyERC721Receiver from '../../artifacts/DummyERC721Receiver.json'; -import * as DummyERC721Token from '../../artifacts/DummyERC721Token.json'; -import * as DummyMultipleReturnERC20Token from '../../artifacts/DummyMultipleReturnERC20Token.json'; -import * as DummyNoReturnERC20Token from '../../artifacts/DummyNoReturnERC20Token.json'; -import * as ERC20Proxy from '../../artifacts/ERC20Proxy.json'; -import * as ERC721Proxy from '../../artifacts/ERC721Proxy.json'; -import * as Exchange from '../../artifacts/Exchange.json'; -import * as ExchangeWrapper from '../../artifacts/ExchangeWrapper.json'; -import * as Forwarder from '../../artifacts/Forwarder.json'; -import * as IAssetProxy from '../../artifacts/IAssetProxy.json'; -import * as InvalidERC721Receiver from '../../artifacts/InvalidERC721Receiver.json'; -import * as MixinAuthorizable from '../../artifacts/MixinAuthorizable.json'; -import * as MultiSigWallet from '../../artifacts/MultiSigWallet.json'; -import * as MultiSigWalletWithTimeLock from '../../artifacts/MultiSigWalletWithTimeLock.json'; -import * as OrderValidator from '../../artifacts/OrderValidator.json'; -import * as ReentrantERC20Token from '../../artifacts/ReentrantERC20Token.json'; -import * as TestAssetProxyDispatcher from '../../artifacts/TestAssetProxyDispatcher.json'; -import * as TestAssetProxyOwner from '../../artifacts/TestAssetProxyOwner.json'; -import * as TestConstants from '../../artifacts/TestConstants.json'; -import * as TestExchangeInternals from '../../artifacts/TestExchangeInternals.json'; -import * as TestLibBytes from '../../artifacts/TestLibBytes.json'; -import * as TestLibs from '../../artifacts/TestLibs.json'; -import * as TestSignatureValidator from '../../artifacts/TestSignatureValidator.json'; -import * as TestStaticCallReceiver from '../../artifacts/TestStaticCallReceiver.json'; -import * as TokenRegistry from '../../artifacts/TokenRegistry.json'; -import * as Validator from '../../artifacts/Validator.json'; -import * as Wallet from '../../artifacts/Wallet.json'; -import * as EtherToken from '../../artifacts/WETH9.json'; -import * as Whitelist from '../../artifacts/Whitelist.json'; -import * as ZRX from '../../artifacts/ZRXToken.json'; - -export const artifacts = { - AssetProxyOwner: (AssetProxyOwner as any) as ContractArtifact, - DummyERC20Token: (DummyERC20Token as any) as ContractArtifact, - DummyERC721Receiver: (DummyERC721Receiver as any) as ContractArtifact, - DummyERC721Token: (DummyERC721Token as any) as ContractArtifact, - DummyMultipleReturnERC20Token: (DummyMultipleReturnERC20Token as any) as ContractArtifact, - DummyNoReturnERC20Token: (DummyNoReturnERC20Token as any) as ContractArtifact, - ERC20Proxy: (ERC20Proxy as any) as ContractArtifact, - ERC721Proxy: (ERC721Proxy as any) as ContractArtifact, - Exchange: (Exchange as any) as ContractArtifact, - ExchangeWrapper: (ExchangeWrapper as any) as ContractArtifact, - EtherToken: (EtherToken as any) as ContractArtifact, - Forwarder: (Forwarder as any) as ContractArtifact, - IAssetProxy: (IAssetProxy as any) as ContractArtifact, - InvalidERC721Receiver: (InvalidERC721Receiver as any) as ContractArtifact, - MixinAuthorizable: (MixinAuthorizable as any) as ContractArtifact, - MultiSigWallet: (MultiSigWallet as any) as ContractArtifact, - MultiSigWalletWithTimeLock: (MultiSigWalletWithTimeLock as any) as ContractArtifact, - OrderValidator: (OrderValidator as any) as ContractArtifact, - ReentrantERC20Token: (ReentrantERC20Token as any) as ContractArtifact, - TestAssetProxyOwner: (TestAssetProxyOwner as any) as ContractArtifact, - TestAssetProxyDispatcher: (TestAssetProxyDispatcher as any) as ContractArtifact, - TestConstants: (TestConstants as any) as ContractArtifact, - TestLibBytes: (TestLibBytes as any) as ContractArtifact, - TestLibs: (TestLibs as any) as ContractArtifact, - TestExchangeInternals: (TestExchangeInternals as any) as ContractArtifact, - TestSignatureValidator: (TestSignatureValidator as any) as ContractArtifact, - TestStaticCallReceiver: (TestStaticCallReceiver as any) as ContractArtifact, - Validator: (Validator as any) as ContractArtifact, - Wallet: (Wallet as any) as ContractArtifact, - TokenRegistry: (TokenRegistry as any) as ContractArtifact, - Whitelist: (Whitelist as any) as ContractArtifact, - ZRX: (ZRX as any) as ContractArtifact, -}; diff --git a/packages/contracts/test/utils/erc20_wrapper.ts b/packages/contracts/test/utils/erc20_wrapper.ts index 526ffe9f8..05eaed52b 100644 --- a/packages/contracts/test/utils/erc20_wrapper.ts +++ b/packages/contracts/test/utils/erc20_wrapper.ts @@ -4,10 +4,10 @@ import { Web3Wrapper } from '@0xproject/web3-wrapper'; import { Provider } from 'ethereum-types'; import * as _ from 'lodash'; -import { DummyERC20TokenContract } from '../../generated_contract_wrappers/dummy_erc20_token'; -import { ERC20ProxyContract } from '../../generated_contract_wrappers/erc20_proxy'; +import { DummyERC20TokenContract } from '../../generated-wrappers/dummy_erc20_token'; +import { ERC20ProxyContract } from '../../generated-wrappers/erc20_proxy'; +import { artifacts } from '../../src/artifacts'; -import { artifacts } from './artifacts'; import { constants } from './constants'; import { ERC20BalancesByOwner } from './types'; import { txDefaults } from './web3_wrapper'; diff --git a/packages/contracts/test/utils/erc721_wrapper.ts b/packages/contracts/test/utils/erc721_wrapper.ts index 743d10706..cdc8f4af6 100644 --- a/packages/contracts/test/utils/erc721_wrapper.ts +++ b/packages/contracts/test/utils/erc721_wrapper.ts @@ -4,10 +4,10 @@ import { Web3Wrapper } from '@0xproject/web3-wrapper'; import { Provider } from 'ethereum-types'; import * as _ from 'lodash'; -import { DummyERC721TokenContract } from '../../generated_contract_wrappers/dummy_erc721_token'; -import { ERC721ProxyContract } from '../../generated_contract_wrappers/erc721_proxy'; +import { DummyERC721TokenContract } from '../../generated-wrappers/dummy_erc721_token'; +import { ERC721ProxyContract } from '../../generated-wrappers/erc721_proxy'; +import { artifacts } from '../../src/artifacts'; -import { artifacts } from './artifacts'; import { constants } from './constants'; import { ERC721TokenIdsByOwner } from './types'; import { txDefaults } from './web3_wrapper'; diff --git a/packages/contracts/test/utils/exchange_wrapper.ts b/packages/contracts/test/utils/exchange_wrapper.ts index 619d43994..00014f660 100644 --- a/packages/contracts/test/utils/exchange_wrapper.ts +++ b/packages/contracts/test/utils/exchange_wrapper.ts @@ -3,7 +3,7 @@ import { BigNumber } from '@0xproject/utils'; import { Web3Wrapper } from '@0xproject/web3-wrapper'; import { Provider, TransactionReceiptWithDecodedLogs } from 'ethereum-types'; -import { ExchangeContract } from '../../generated_contract_wrappers/exchange'; +import { ExchangeContract } from '../../generated-wrappers/exchange'; import { formatters } from './formatters'; import { LogDecoder } from './log_decoder'; diff --git a/packages/contracts/test/utils/fill_order_combinatorial_utils.ts b/packages/contracts/test/utils/fill_order_combinatorial_utils.ts index 92d0f4003..f7c35c469 100644 --- a/packages/contracts/test/utils/fill_order_combinatorial_utils.ts +++ b/packages/contracts/test/utils/fill_order_combinatorial_utils.ts @@ -14,10 +14,10 @@ import { LogWithDecodedArgs, Provider, TxData } from 'ethereum-types'; import * as _ from 'lodash'; import 'make-promises-safe'; -import { ExchangeContract, ExchangeFillEventArgs } from '../../generated_contract_wrappers/exchange'; -import { TestLibsContract } from '../../generated_contract_wrappers/test_libs'; +import { ExchangeContract, ExchangeFillEventArgs } from '../../generated-wrappers/exchange'; +import { TestLibsContract } from '../../generated-wrappers/test_libs'; +import { artifacts } from '../../src/artifacts'; -import { artifacts } from './artifacts'; import { expectTransactionFailedAsync } from './assertions'; import { AssetWrapper } from './asset_wrapper'; import { chaiSetup } from './chai_setup'; diff --git a/packages/contracts/test/utils/forwarder_wrapper.ts b/packages/contracts/test/utils/forwarder_wrapper.ts index de247a878..07527bc2e 100644 --- a/packages/contracts/test/utils/forwarder_wrapper.ts +++ b/packages/contracts/test/utils/forwarder_wrapper.ts @@ -4,7 +4,7 @@ import { Web3Wrapper } from '@0xproject/web3-wrapper'; import { Provider, TransactionReceiptWithDecodedLogs, TxDataPayable } from 'ethereum-types'; import * as _ from 'lodash'; -import { ForwarderContract } from '../../generated_contract_wrappers/forwarder'; +import { ForwarderContract } from '../../generated-wrappers/forwarder'; import { constants } from './constants'; import { formatters } from './formatters'; diff --git a/packages/contracts/test/utils/log_decoder.ts b/packages/contracts/test/utils/log_decoder.ts index 144a18dd1..10ddbdcba 100644 --- a/packages/contracts/test/utils/log_decoder.ts +++ b/packages/contracts/test/utils/log_decoder.ts @@ -11,7 +11,8 @@ import { } from 'ethereum-types'; import * as _ from 'lodash'; -import { artifacts } from './artifacts'; +import { artifacts } from '../../src/artifacts'; + import { constants } from './constants'; export class LogDecoder { diff --git a/packages/contracts/test/utils/multi_sig_wrapper.ts b/packages/contracts/test/utils/multi_sig_wrapper.ts index e12a58695..953d1004e 100644 --- a/packages/contracts/test/utils/multi_sig_wrapper.ts +++ b/packages/contracts/test/utils/multi_sig_wrapper.ts @@ -3,8 +3,8 @@ import { Web3Wrapper } from '@0xproject/web3-wrapper'; import { Provider, TransactionReceiptWithDecodedLogs } from 'ethereum-types'; import * as _ from 'lodash'; -import { AssetProxyOwnerContract } from '../../generated_contract_wrappers/asset_proxy_owner'; -import { MultiSigWalletContract } from '../../generated_contract_wrappers/multi_sig_wallet'; +import { AssetProxyOwnerContract } from '../../generated-wrappers/asset_proxy_owner'; +import { MultiSigWalletContract } from '../../generated-wrappers/multi_sig_wallet'; import { LogDecoder } from './log_decoder'; diff --git a/packages/contracts/test/utils/order_factory_from_scenario.ts b/packages/contracts/test/utils/order_factory_from_scenario.ts index 8e04db588..2ffb2d620 100644 --- a/packages/contracts/test/utils/order_factory_from_scenario.ts +++ b/packages/contracts/test/utils/order_factory_from_scenario.ts @@ -2,7 +2,7 @@ import { assetDataUtils, generatePseudoRandomSalt } from '@0xproject/order-utils import { Order } from '@0xproject/types'; import { BigNumber, errorUtils } from '@0xproject/utils'; -import { DummyERC721TokenContract } from '../../generated_contract_wrappers/dummy_erc721_token'; +import { DummyERC721TokenContract } from '../../generated-wrappers/dummy_erc721_token'; import { constants } from './constants'; import { diff --git a/packages/contracts/test/utils/token_registry_wrapper.ts b/packages/contracts/test/utils/token_registry_wrapper.ts deleted file mode 100644 index f1c40e8ff..000000000 --- a/packages/contracts/test/utils/token_registry_wrapper.ts +++ /dev/null @@ -1,66 +0,0 @@ -import { Web3Wrapper } from '@0xproject/web3-wrapper'; -import { Provider } from 'ethereum-types'; - -import { TokenRegistryContract } from '../../generated_contract_wrappers/token_registry'; - -import { Token } from './types'; - -import { constants } from './constants'; - -export class TokenRegWrapper { - private readonly _tokenReg: TokenRegistryContract; - private readonly _web3Wrapper: Web3Wrapper; - constructor(tokenRegContract: TokenRegistryContract, provider: Provider) { - this._tokenReg = tokenRegContract; - this._web3Wrapper = new Web3Wrapper(provider); - } - public async addTokenAsync(token: Token, from: string): Promise<string> { - const txHash = await this._tokenReg.addToken.sendTransactionAsync( - token.address as string, - token.name, - token.symbol, - token.decimals, - token.ipfsHash, - token.swarmHash, - { from }, - ); - await this._web3Wrapper.awaitTransactionSuccessAsync(txHash, constants.AWAIT_TRANSACTION_MINED_MS); - return txHash; - } - public async getTokenMetaDataAsync(tokenAddress: string): Promise<Token> { - const data = await this._tokenReg.getTokenMetaData.callAsync(tokenAddress); - const token: Token = { - address: data[0], - name: data[1], - symbol: data[2], - decimals: data[3], - ipfsHash: data[4], - swarmHash: data[5], - }; - return token; - } - public async getTokenByNameAsync(tokenName: string): Promise<Token> { - const data = await this._tokenReg.getTokenByName.callAsync(tokenName); - const token: Token = { - address: data[0], - name: data[1], - symbol: data[2], - decimals: data[3], - ipfsHash: data[4], - swarmHash: data[5], - }; - return token; - } - public async getTokenBySymbolAsync(tokenSymbol: string): Promise<Token> { - const data = await this._tokenReg.getTokenBySymbol.callAsync(tokenSymbol); - const token: Token = { - address: data[0], - name: data[1], - symbol: data[2], - decimals: data[3], - ipfsHash: data[4], - swarmHash: data[5], - }; - return token; - } -} diff --git a/packages/contracts/tsconfig.json b/packages/contracts/tsconfig.json index 5fd4c5331..8b29365cc 100644 --- a/packages/contracts/tsconfig.json +++ b/packages/contracts/tsconfig.json @@ -2,15 +2,47 @@ "extends": "../../tsconfig", "compilerOptions": { "outDir": "lib", - "rootDir": "." + "rootDir": ".", + "resolveJsonModule": true }, - "include": [ - "./globals.d.ts", - "./generated_contract_wrappers", - "./src/**/*", - "./utils/**/*", - "./test/**/*", - "./migrations/**/*" + "include": ["./src/**/*", "./test/**/*", "./generated-wrappers/**/*"], + "files": [ + "./generated-artifacts/AssetProxyOwner.json", + "./generated-artifacts/DummyERC20Token.json", + "./generated-artifacts/DummyERC721Receiver.json", + "./generated-artifacts/DummyERC721Token.json", + "./generated-artifacts/DummyMultipleReturnERC20Token.json", + "./generated-artifacts/DummyNoReturnERC20Token.json", + "./generated-artifacts/ERC20Proxy.json", + "./generated-artifacts/ERC20Token.json", + "./generated-artifacts/ERC721Proxy.json", + "./generated-artifacts/ERC721Token.json", + "./generated-artifacts/Exchange.json", + "./generated-artifacts/ExchangeWrapper.json", + "./generated-artifacts/Forwarder.json", + "./generated-artifacts/IAssetData.json", + "./generated-artifacts/IAssetProxy.json", + "./generated-artifacts/IValidator.json", + "./generated-artifacts/IWallet.json", + "./generated-artifacts/InvalidERC721Receiver.json", + "./generated-artifacts/MixinAuthorizable.json", + "./generated-artifacts/MultiSigWallet.json", + "./generated-artifacts/MultiSigWalletWithTimeLock.json", + "./generated-artifacts/OrderValidator.json", + "./generated-artifacts/ReentrantERC20Token.json", + "./generated-artifacts/TestAssetProxyDispatcher.json", + "./generated-artifacts/TestAssetProxyOwner.json", + "./generated-artifacts/TestConstants.json", + "./generated-artifacts/TestExchangeInternals.json", + "./generated-artifacts/TestLibBytes.json", + "./generated-artifacts/TestLibs.json", + "./generated-artifacts/TestSignatureValidator.json", + "./generated-artifacts/TestStaticCallReceiver.json", + "./generated-artifacts/Validator.json", + "./generated-artifacts/WETH9.json", + "./generated-artifacts/Wallet.json", + "./generated-artifacts/Whitelist.json", + "./generated-artifacts/ZRXToken.json" ], "exclude": ["./deploy/solc/solc_bin"] } |