aboutsummaryrefslogtreecommitdiffstats
path: root/lang/fpc
ModeNameSize
-rw-r--r--Makefile3334logstatsplainblame
-rw-r--r--Makefile.units5706logstatsplainblame
-rw-r--r--distinfo464logstatsplainblame
d---------files42logstatsplain
-rw-r--r--pkg-descr252logstatsplainblame
-rw-r--r--pkg-plist11448logstatsplainblame
d=dbf5be6c217b49c4b768a9ea9969d44d70fb3dcc'>packages/abi-gen-wrappers/package.json41
-rw-r--r--packages/abi-gen-wrappers/src/generated-wrappers/asset_proxy_owner.ts1876
-rw-r--r--packages/abi-gen-wrappers/src/generated-wrappers/dummy_erc20_token.ts1044
-rw-r--r--packages/abi-gen-wrappers/src/generated-wrappers/dummy_erc721_token.ts1326
-rw-r--r--packages/abi-gen-wrappers/src/generated-wrappers/erc20_proxy.ts649
-rw-r--r--packages/abi-gen-wrappers/src/generated-wrappers/erc20_token.ts556
-rw-r--r--packages/abi-gen-wrappers/src/generated-wrappers/erc721_proxy.ts649
-rw-r--r--packages/abi-gen-wrappers/src/generated-wrappers/erc721_token.ts893
-rw-r--r--packages/abi-gen-wrappers/src/generated-wrappers/exchange.ts3072
-rw-r--r--packages/abi-gen-wrappers/src/generated-wrappers/forwarder.ts730
-rw-r--r--packages/abi-gen-wrappers/src/generated-wrappers/i_validator.ts108
-rw-r--r--packages/abi-gen-wrappers/src/generated-wrappers/i_wallet.ts103
-rw-r--r--packages/abi-gen-wrappers/src/generated-wrappers/order_validator.ts357
-rw-r--r--packages/abi-gen-wrappers/src/generated-wrappers/weth9.ts835
-rw-r--r--packages/abi-gen-wrappers/src/generated-wrappers/zrx_token.ts646
-rw-r--r--packages/abi-gen-wrappers/src/index.ts14
-rw-r--r--packages/abi-gen-wrappers/tsconfig.json8
-rw-r--r--packages/abi-gen/package.json1
-rw-r--r--packages/assert/package.json1
-rw-r--r--packages/asset-buyer/CHANGELOG.json5
-rw-r--r--packages/asset-buyer/package.json9
-rw-r--r--packages/asset-buyer/src/asset_buyer.ts4
-rw-r--r--packages/asset-buyer/src/utils/asset_data_utils.ts20
-rw-r--r--packages/base-contract/package.json1
-rw-r--r--packages/contract-addresses/CHANGELOG.json11
-rw-r--r--packages/contract-addresses/README.md69
-rw-r--r--packages/contract-addresses/package.json37
-rw-r--r--packages/contract-addresses/src/index.ts66
-rw-r--r--packages/contract-addresses/tsconfig.json8
-rw-r--r--packages/contract-addresses/tslint.json3
-rw-r--r--packages/contract-artifacts/CHANGELOG.json11
-rw-r--r--packages/contract-artifacts/README.md67
-rw-r--r--packages/contract-artifacts/artifacts/AssetProxyOwner.json (renamed from packages/migrations/artifacts/2.0.0-trimmed/AssetProxyOwner.json)27
-rw-r--r--packages/contract-artifacts/artifacts/DummyERC20Token.json (renamed from packages/migrations/artifacts/2.0.0-trimmed/DummyERC20Token.json)19
-rw-r--r--packages/contract-artifacts/artifacts/DummyERC721Token.json (renamed from packages/migrations/artifacts/2.0.0-trimmed/DummyERC721Token.json)0
-rw-r--r--packages/contract-artifacts/artifacts/ERC20Proxy.json (renamed from packages/migrations/artifacts/2.0.0-trimmed/ERC20Proxy.json)23
-rw-r--r--packages/contract-artifacts/artifacts/ERC20Token.json (renamed from packages/migrations/artifacts/2.0.0-trimmed/ERC20Token.json)0
-rw-r--r--packages/contract-artifacts/artifacts/ERC721Proxy.json (renamed from packages/migrations/artifacts/2.0.0-trimmed/ERC721Proxy.json)23
-rw-r--r--packages/contract-artifacts/artifacts/ERC721Token.json (renamed from packages/migrations/artifacts/2.0.0-trimmed/ERC721Token.json)0
-rw-r--r--packages/contract-artifacts/artifacts/Exchange.json (renamed from packages/migrations/artifacts/2.0.0-trimmed/Exchange.json)23
-rw-r--r--packages/contract-artifacts/artifacts/Forwarder.json (renamed from packages/migrations/artifacts/2.0.0-trimmed/Forwarder.json)27
-rw-r--r--packages/contract-artifacts/artifacts/IValidator.json (renamed from packages/migrations/artifacts/2.0.0-trimmed/IValidator.json)0
-rw-r--r--packages/contract-artifacts/artifacts/IWallet.json (renamed from packages/migrations/artifacts/2.0.0-trimmed/IWallet.json)0
-rw-r--r--packages/contract-artifacts/artifacts/OrderValidator.json (renamed from packages/migrations/artifacts/2.0.0-trimmed/OrderValidator.json)27
-rw-r--r--packages/contract-artifacts/artifacts/WETH9.json (renamed from packages/migrations/artifacts/2.0.0-trimmed/WETH9.json)23
-rw-r--r--packages/contract-artifacts/artifacts/ZRXToken.json (renamed from packages/migrations/artifacts/2.0.0-trimmed/ZRXToken.json)23
-rw-r--r--packages/contract-artifacts/package.json33
-rw-r--r--packages/contract-artifacts/src/index.ts31
-rw-r--r--packages/contract-artifacts/tsconfig.json25
-rw-r--r--packages/contract-artifacts/tslint.json3
-rw-r--r--packages/contract-wrappers/CHANGELOG.json35
-rw-r--r--packages/contract-wrappers/package.json15
-rw-r--r--packages/contract-wrappers/src/artifacts.ts27
-rw-r--r--packages/contract-wrappers/src/contract_wrappers.ts89
-rw-r--r--packages/contract-wrappers/src/contract_wrappers/contract_wrapper.ts57
-rw-r--r--packages/contract-wrappers/src/contract_wrappers/erc20_proxy_wrapper.ts48
-rw-r--r--packages/contract-wrappers/src/contract_wrappers/erc20_token_wrapper.ts29
-rw-r--r--packages/contract-wrappers/src/contract_wrappers/erc721_proxy_wrapper.ts48
-rw-r--r--packages/contract-wrappers/src/contract_wrappers/erc721_token_wrapper.ts33
-rw-r--r--packages/contract-wrappers/src/contract_wrappers/ether_token_wrapper.ts36
-rw-r--r--packages/contract-wrappers/src/contract_wrappers/exchange_wrapper.ts82
-rw-r--r--packages/contract-wrappers/src/contract_wrappers/forwarder_wrapper.ts95
-rw-r--r--packages/contract-wrappers/src/contract_wrappers/order_validator_wrapper.ts28
-rw-r--r--packages/contract-wrappers/src/globals.d.ts6
-rw-r--r--packages/contract-wrappers/src/index.ts61
-rw-r--r--packages/contract-wrappers/src/schemas/contract_wrappers_config_schema.ts22
-rw-r--r--packages/contract-wrappers/src/schemas/contract_wrappers_private_network_config_schema.ts36
-rw-r--r--packages/contract-wrappers/src/schemas/contract_wrappers_public_network_config_schema.ts44
-rw-r--r--packages/contract-wrappers/src/types.ts38
-rw-r--r--packages/contract-wrappers/src/utils/contract_addresses.ts15
-rw-r--r--packages/contract-wrappers/src/utils/transaction_encoder.ts4
-rw-r--r--packages/contract-wrappers/test/artifacts_test.ts43
-rw-r--r--packages/contract-wrappers/test/erc20_proxy_wrapper_test.ts10
-rw-r--r--packages/contract-wrappers/test/erc20_wrapper_test.ts59
-rw-r--r--packages/contract-wrappers/test/erc721_proxy_wrapper_test.ts10
-rw-r--r--packages/contract-wrappers/test/erc721_wrapper_test.ts32
-rw-r--r--packages/contract-wrappers/test/ether_token_wrapper_test.ts32
-rw-r--r--packages/contract-wrappers/test/exchange_wrapper_test.ts39
-rw-r--r--packages/contract-wrappers/test/forwarder_wrapper_test.ts28
-rw-r--r--packages/contract-wrappers/test/global_hooks.ts13
-rw-r--r--packages/contract-wrappers/test/order_validator_wrapper_test.ts26
-rw-r--r--packages/contract-wrappers/test/revert_validation_test.ts39
-rw-r--r--packages/contract-wrappers/test/subscription_test.ts20
-rw-r--r--packages/contract-wrappers/test/transaction_encoder_test.ts20
-rw-r--r--packages/contract-wrappers/test/utils/migrate.ts18
-rw-r--r--packages/contract-wrappers/test/utils/token_utils.ts20
-rw-r--r--packages/contracts/.solhintignore3
-rw-r--r--packages/contracts/compiler.json5
-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.ts6
-rw-r--r--packages/contracts/package.json21
-rw-r--r--packages/contracts/src/1.0.0/Arbitrage/Arbitrage.sol114
-rw-r--r--packages/contracts/src/1.0.0/EtherDelta/AccountLevels.sol11
-rw-r--r--packages/contracts/src/1.0.0/EtherDelta/EtherDelta.sol168
-rw-r--r--packages/contracts/src/1.0.0/Exchange/Exchange_v1.sol602
-rw-r--r--packages/contracts/src/1.0.0/Exchange/IExchange_v1.sol226
-rw-r--r--packages/contracts/src/1.0.0/MultiSigWalletWithTImeLockExceptRemoveAuthorizedAddress/MultiSigWalletWithTimeLockExceptRemoveAuthorizedAddress.sol82
-rw-r--r--packages/contracts/src/1.0.0/Ownable/IOwnable_v1.sol18
-rw-r--r--packages/contracts/src/1.0.0/Ownable/Ownable_v1.sol27
-rw-r--r--packages/contracts/src/1.0.0/SafeMath/SafeMath_v1.sol73
-rw-r--r--packages/contracts/src/1.0.0/TokenRegistry/ITokenRegistery.sol195
-rw-r--r--packages/contracts/src/1.0.0/TokenRegistry/TokenRegistry.sol308
-rw-r--r--packages/contracts/src/1.0.0/TokenTransferProxy/TokenTransferProxy_v1.sol115
-rw-r--r--packages/contracts/src/artifacts/index.ts79
-rw-r--r--packages/contracts/src/wrappers/index.ts34
-rw-r--r--packages/contracts/test/asset_proxy/authorizable.ts4
-rw-r--r--packages/contracts/test/asset_proxy/proxies.ts18
-rw-r--r--packages/contracts/test/exchange/core.ts21
-rw-r--r--packages/contracts/test/exchange/dispatcher.ts10
-rw-r--r--packages/contracts/test/exchange/internal.ts4
-rw-r--r--packages/contracts/test/exchange/libs.ts6
-rw-r--r--packages/contracts/test/exchange/match_orders.ts16
-rw-r--r--packages/contracts/test/exchange/signature_validator.ts10
-rw-r--r--packages/contracts/test/exchange/transactions.ts12
-rw-r--r--packages/contracts/test/exchange/wrapper.ts14
-rw-r--r--packages/contracts/test/extensions/forwarder.ts14
-rw-r--r--packages/contracts/test/extensions/order_validator.ts14
-rw-r--r--packages/contracts/test/libraries/lib_bytes.ts4
-rw-r--r--packages/contracts/test/multisig/asset_proxy_owner.ts8
-rw-r--r--packages/contracts/test/multisig/multi_sig_with_time_lock.ts6
-rw-r--r--packages/contracts/test/token_registry.ts255
-rw-r--r--packages/contracts/test/tokens/erc721_token.ts8
-rw-r--r--packages/contracts/test/tokens/unlimited_allowance_token.ts4
-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.ts6
-rw-r--r--packages/contracts/test/utils/artifacts.ts69
-rw-r--r--packages/contracts/test/utils/erc20_wrapper.ts6
-rw-r--r--packages/contracts/test/utils/erc721_wrapper.ts6
-rw-r--r--packages/contracts/test/utils/exchange_wrapper.ts2
-rw-r--r--packages/contracts/test/utils/fill_order_combinatorial_utils.ts6
-rw-r--r--packages/contracts/test/utils/forwarder_wrapper.ts2
-rw-r--r--packages/contracts/test/utils/log_decoder.ts3
-rw-r--r--packages/contracts/test/utils/multi_sig_wrapper.ts4
-rw-r--r--packages/contracts/test/utils/order_factory_from_scenario.ts2
-rw-r--r--packages/contracts/test/utils/token_registry_wrapper.ts66
-rw-r--r--packages/contracts/tsconfig.json48
-rw-r--r--packages/dev-utils/CHANGELOG.json9
-rw-r--r--packages/dev-utils/package.json4
-rw-r--r--packages/ethereum-types/package.json1
-rw-r--r--packages/fill-scenarios/CHANGELOG.json9
-rw-r--r--packages/fill-scenarios/package.json16
-rw-r--r--packages/fill-scenarios/src/artifacts.ts11
-rw-r--r--packages/fill-scenarios/src/fill_scenarios.ts6
-rw-r--r--packages/fill-scenarios/src/globals.d.ts6
-rw-r--r--packages/instant/package.json1
-rw-r--r--packages/json-schemas/package.json1
-rw-r--r--packages/migrations/.gitignore1
-rw-r--r--packages/migrations/CHANGELOG.json10
-rw-r--r--packages/migrations/artifacts/1.0.0/DummyERC20Token.json375
-rw-r--r--packages/migrations/artifacts/1.0.0/Exchange_v1.json678
-rw-r--r--packages/migrations/artifacts/1.0.0/MultiSigWallet.json580
-rw-r--r--packages/migrations/artifacts/1.0.0/MultiSigWalletWithTimeLock.json664
-rw-r--r--packages/migrations/artifacts/1.0.0/MultiSigWalletWithTimeLockExceptRemoveAuthorizedAddress.json725
-rw-r--r--packages/migrations/artifacts/1.0.0/TokenRegistry.json600
-rw-r--r--packages/migrations/artifacts/1.0.0/TokenTransferProxy_v1.json236
-rw-r--r--packages/migrations/artifacts/1.0.0/WETH9.json332
-rw-r--r--packages/migrations/artifacts/1.0.0/ZRXToken.json288
-rw-r--r--packages/migrations/artifacts/2.0.0-testnet/AssetProxyOwner.json1012
-rw-r--r--packages/migrations/artifacts/2.0.0-testnet/DummyERC20Token.json641
-rw-r--r--packages/migrations/artifacts/2.0.0-testnet/DummyERC721Token.json672
-rw-r--r--packages/migrations/artifacts/2.0.0-testnet/ERC20Proxy.json508
-rw-r--r--packages/migrations/artifacts/2.0.0-testnet/ERC20Token.json486
-rw-r--r--packages/migrations/artifacts/2.0.0-testnet/ERC721Proxy.json508
-rw-r--r--packages/migrations/artifacts/2.0.0-testnet/ERC721Token.json565
-rw-r--r--packages/migrations/artifacts/2.0.0-testnet/Exchange.json2294
-rw-r--r--packages/migrations/artifacts/2.0.0-testnet/Forwarder.json761
-rw-r--r--packages/migrations/artifacts/2.0.0-testnet/IValidator.json320
-rw-r--r--packages/migrations/artifacts/2.0.0-testnet/IWallet.json316
-rw-r--r--packages/migrations/artifacts/2.0.0-testnet/OrderValidator.json885
-rw-r--r--packages/migrations/artifacts/2.0.0-testnet/WETH9.json346
-rw-r--r--packages/migrations/artifacts/2.0.0-testnet/ZRXToken.json10041
-rw-r--r--packages/migrations/artifacts/2.0.0/AssetProxyOwner.json985
-rw-r--r--packages/migrations/artifacts/2.0.0/DummyERC20Token.json641
-rw-r--r--packages/migrations/artifacts/2.0.0/DummyERC721Token.json672
-rw-r--r--packages/migrations/artifacts/2.0.0/ERC20Proxy.json481
-rw-r--r--packages/migrations/artifacts/2.0.0/ERC20Token.json486
-rw-r--r--packages/migrations/artifacts/2.0.0/ERC721Proxy.json481
-rw-r--r--packages/migrations/artifacts/2.0.0/ERC721Token.json565
-rw-r--r--packages/migrations/artifacts/2.0.0/Exchange.json2262
-rw-r--r--packages/migrations/artifacts/2.0.0/Forwarder.json734
-rw-r--r--packages/migrations/artifacts/2.0.0/IValidator.json320
-rw-r--r--packages/migrations/artifacts/2.0.0/IWallet.json316
-rw-r--r--packages/migrations/artifacts/2.0.0/OrderValidator.json858
-rw-r--r--packages/migrations/artifacts/2.0.0/WETH9.json351
-rw-r--r--packages/migrations/artifacts/2.0.0/ZRXToken.json10046
-rw-r--r--packages/migrations/compiler.json20
-rw-r--r--packages/migrations/package.json27
-rw-r--r--packages/migrations/src/1.0.0/artifacts.ts21
-rw-r--r--packages/migrations/src/1.0.0/migration.ts142
-rw-r--r--packages/migrations/src/2.0.0/artifacts.ts25
-rw-r--r--packages/migrations/src/2.0.0/migration.ts150
-rw-r--r--packages/migrations/src/globals.d.ts6
-rw-r--r--packages/migrations/src/index.ts3
-rw-r--r--packages/migrations/src/migrate.ts39
-rw-r--r--packages/migrations/src/migration.ts175
-rw-r--r--packages/migrations/src/utils/artifact_writer.ts26
-rw-r--r--packages/monorepo-scripts/src/test_installation.ts12
-rw-r--r--packages/monorepo-scripts/src/utils/doc_generate_and_upload_utils.ts11
-rw-r--r--packages/order-utils/package.json13
-rw-r--r--packages/order-utils/src/artifacts.ts14
-rw-r--r--packages/order-utils/src/globals.d.ts6
-rw-r--r--packages/order-utils/src/signature_utils.ts6
-rw-r--r--packages/order-utils/test/exchange_transfer_simulator_test.ts6
-rw-r--r--packages/order-utils/test/utils/simple_erc20_balance_and_proxy_allowance_fetcher.ts3
-rw-r--r--packages/order-watcher/.npmignore1
-rw-r--r--packages/order-watcher/CHANGELOG.json7
-rw-r--r--packages/order-watcher/package.json21
-rw-r--r--packages/order-watcher/src/artifacts.ts13
-rw-r--r--packages/order-watcher/src/globals.d.ts6
-rw-r--r--packages/order-watcher/src/index.ts1
-rw-r--r--packages/order-watcher/src/order_watcher/order_watcher.ts15
-rw-r--r--packages/order-watcher/test/expiration_watcher_test.ts19
-rw-r--r--packages/order-watcher/test/global_hooks.ts13
-rw-r--r--packages/order-watcher/test/order_watcher_test.ts24
-rw-r--r--packages/order-watcher/test/utils/migrate.ts18
-rw-r--r--packages/order-watcher/test/utils/token_utils.ts34
-rw-r--r--packages/react-docs/package.json1
-rw-r--r--packages/react-shared/package.json1
-rw-r--r--packages/sol-cov/CHANGELOG.json9
-rw-r--r--packages/sol-cov/package.json2
-rw-r--r--packages/sol-resolver/package.json1
-rw-r--r--packages/sra-spec/CHANGELOG.json9
-rw-r--r--packages/sra-spec/package.json4
-rw-r--r--packages/subproviders/CHANGELOG.json4
-rw-r--r--packages/subproviders/package.json3
-rw-r--r--packages/testnet-faucets/src/ts/handler.ts7
-rw-r--r--packages/tslint-config/package.json1
-rw-r--r--packages/types/package.json1
-rw-r--r--packages/typescript-typings/package.json1
-rw-r--r--packages/utils/package.json1
-rw-r--r--packages/web3-wrapper/package.json1
-rw-r--r--packages/website/package.json1
-rw-r--r--packages/website/ts/blockchain.ts10
-rw-r--r--packages/website/ts/utils/utils.ts7
-rw-r--r--tsconfig.json3
-rw-r--r--yarn.lock15
338 files changed, 14530 insertions, 47248 deletions
diff --git a/.gitattributes b/.gitattributes
index 52031de51..b786d1f1d 100644
--- a/.gitattributes
+++ b/.gitattributes
@@ -1 +1,5 @@
*.sol linguist-language=Solidity
+
+# Automatically collapse generated files in GitHub.
+packages/contract-artifacts/artifacts/*json linguist-generated
+packages/abi-gen-wrappers/wrappers/*.ts liguist-generated
diff --git a/.gitignore b/.gitignore
index 6143dedb0..3276e848a 100644
--- a/.gitignore
+++ b/.gitignore
@@ -79,30 +79,14 @@ packages/react-docs/example/public/bundle*
packages/testnet-faucets/server/
# generated contract artifacts/
+packages/contracts/generated-artifacts/
packages/sol-cov/test/fixtures/artifacts/
packages/metacoin/artifacts/
-packages/order-watcher/test/artifacts/
-packages/contract-wrappers/test/artifacts/
-packages/contract-wrappers/src/artifacts/
-packages/order-watcher/src/artifacts/
-packages/0x.js/src/artifacts/
-packages/order-utils/src/artifacts/
-
-# unstable generated contract artifacts:
-packages/migrations/artifacts/development/
-
-# generated contract watcher
-packages/0x.js/src/generated_contract_wrappers/
-packages/contracts/generated_contract_wrappers/
-packages/contract-wrappers/src/contract_wrappers/generated/
+
+# generated contract wrappers
+packages/abi-gen-wrappers/wrappers
+packages/contracts/generated-wrappers/
packages/metacoin/src/contract_wrappers
-packages/fill-scenarios/src/generated_contract_wrappers/
-packages/order-watcher/src/generated_contract_wrappers/
-packages/order-utils/src/generated_contract_wrappers/
-packages/migrations/src/1.0.0/contract_wrappers
-packages/migrations/src/2.0.0-testnet/contract_wrappers
-packages/migrations/src/2.0.0/contract_wrappers
-packages/migrations/src/development/contract_wrappers
# solc-bin in sol-compiler
packages/sol-compiler/solc_bin/
diff --git a/.prettierignore b/.prettierignore
index 5d3e33770..8d302a275 100644
--- a/.prettierignore
+++ b/.prettierignore
@@ -1,27 +1,12 @@
lib
.nyc_output
-/packages/contract-wrappers/src/contract_wrappers/generated/
+/packages/contracts/generated-wrappers
+/packages/contracts/generated-artifacts
+/packages/abi-gen-wrappers/src/generated-wrappers
+/packages/contract-artifacts/artifacts
/packages/metacoin/src/contract_wrappers
-/packages/0x.js/src/generated_contract_wrappers/
-/packages/contracts/generated_contract_wrappers/
-/packages/fill-scenarios/src/generated_contract_wrappers/
-/packages/order-watcher/src/generated_contract_wrappers/
-/packages/order-utils/src/generated_contract_wrappers/
-/packages/migrations/src/1.0.0/contract_wrappers
-/packages/migrations/src/2.0.0-testnet/contract_wrappers
-/packages/migrations/src/2.0.0/contract_wrappers
-/packages/0x.js/src/artifacts
-/packages/contracts/src/artifacts
-/packages/contract-wrappers/src/artifacts
-/packages/order-watcher/src/artifacts
/packages/metacoin/artifacts
/packages/sra-spec/public/
-/packages/contract-wrappers/test/artifacts
-/packages/order-watcher/test/artifacts
-/packages/migrations/artifacts/1.0.0
-/packages/migrations/artifacts/2.0.0-testnet
-/packages/migrations/artifacts/2.0.0
-/packages/migrations/artifacts/development
package.json
scripts/postpublish_utils.js
packages/sol-cov/test/fixtures/artifacts
diff --git a/package.json b/package.json
index e6ae0ebde..031f73ba8 100644
--- a/package.json
+++ b/package.json
@@ -14,7 +14,6 @@
"report_coverage": "lcov-result-merger './{packages/*/coverage/lcov.info,python-packages/*/.coverage}' | coveralls",
"test:installation": "node ./packages/monorepo-scripts/lib/test_installation.js",
"test:installation:local": "IS_LOCAL_PUBLISH=true node ./packages/monorepo-scripts/lib/test_installation.js",
- "test:publish:circleci:comment": "HACK(albrow) We need an automated way to login to npm and echo+sleep piped to stdin was the only way I could find to do it.",
"test:publish:circleci": "yarn npm-cli-login -u test -p test -e test@example.com -r http://localhost:4873 && IS_LOCAL_PUBLISH=true run-s script:publish test:installation:local",
"run:publish": "run-s install:all build:monorepo_scripts script:prepublish_checks rebuild:no_website script:publish",
"run:publish:local": "IS_LOCAL_PUBLISH=true yarn run:publish",
diff --git a/packages/0x.js/CHANGELOG.json b/packages/0x.js/CHANGELOG.json
index 6dfcc3d33..4efd8f035 100644
--- a/packages/0x.js/CHANGELOG.json
+++ b/packages/0x.js/CHANGELOG.json
@@ -15,6 +15,15 @@
"note":
"Removed `SignerType` (including `SignerType.Metamask`). Please use the `MetamaskSubprovider` to wrap `web3.currentProvider`.",
"pr": 1102
+ },
+ {
+ "note":
+ "Updated to use new modularized artifacts and the latest version of @0xproject/contract-wrappers",
+ "pr": 1105
+ },
+ {
+ "note": "Make web3-provider-engine types a 'dependency' so it's available to users of the library",
+ "pr": 1105
}
]
},
diff --git a/packages/0x.js/package.json b/packages/0x.js/package.json
index 1a57edd45..a78457e22 100644
--- a/packages/0x.js/package.json
+++ b/packages/0x.js/package.json
@@ -42,7 +42,9 @@
},
"license": "Apache-2.0",
"devDependencies": {
+ "@0xproject/contract-addresses": "^1.0.0",
"@0xproject/abi-gen": "^1.0.13",
+ "@0xproject/abi-gen-wrappers": "^1.0.0",
"@0xproject/dev-utils": "^1.0.12",
"@0xproject/migrations": "^1.0.14",
"@0xproject/monorepo-scripts": "^1.0.11",
@@ -51,7 +53,6 @@
"@types/mocha": "^2.2.42",
"@types/node": "*",
"@types/sinon": "^2.2.2",
- "@types/web3-provider-engine": "^14.0.0",
"awesome-typescript-loader": "^5.2.1",
"chai": "^4.0.1",
"chai-as-promised": "^7.1.0",
@@ -83,6 +84,7 @@
"@0xproject/typescript-typings": "^3.0.2",
"@0xproject/utils": "^2.0.2",
"@0xproject/web3-wrapper": "^3.0.3",
+ "@types/web3-provider-engine": "^14.0.0",
"ethereum-types": "^1.0.11",
"ethers": "~4.0.4",
"lodash": "^4.17.5",
diff --git a/packages/0x.js/src/globals.d.ts b/packages/0x.js/src/globals.d.ts
deleted file mode 100644
index 94e63a32d..000000000
--- a/packages/0x.js/src/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/0x.js/src/index.ts b/packages/0x.js/src/index.ts
index ce3f616aa..7fd48da37 100644
--- a/packages/0x.js/src/index.ts
+++ b/packages/0x.js/src/index.ts
@@ -1,3 +1,5 @@
+export { ContractAddresses } from '@0xproject/contract-addresses';
+
export { assetDataUtils, signatureUtils, generatePseudoRandomSalt, orderHashUtils } from '@0xproject/order-utils';
export {
@@ -18,6 +20,16 @@ export {
TransactionOpts,
OrderStatus,
OrderInfo,
+ EventCallback,
+ DecodedLogEvent,
+ TransactionEncoder,
+ BalanceAndAllowance,
+ OrderAndTraderInfo,
+ TraderInfo,
+ ValidateOrderFillableOpts,
+} from '@0xproject/contract-wrappers';
+
+export {
WETH9Events,
WETH9WithdrawalEventArgs,
WETH9ApprovalEventArgs,
@@ -38,16 +50,9 @@ export {
ExchangeSignatureValidatorApprovalEventArgs,
ExchangeFillEventArgs,
ExchangeCancelEventArgs,
- ExchangeEvents,
- EventCallback,
- DecodedLogEvent,
ExchangeEventArgs,
- TransactionEncoder,
- BalanceAndAllowance,
- OrderAndTraderInfo,
- TraderInfo,
- ValidateOrderFillableOpts,
-} from '@0xproject/contract-wrappers';
+ ExchangeEvents,
+} from '@0xproject/abi-gen-wrappers';
export { OrderWatcher, OnOrderStateChangeCallback, OrderWatcherConfig } from '@0xproject/order-watcher';
diff --git a/packages/0x.js/typedoc-tsconfig.json b/packages/0x.js/typedoc-tsconfig.json
index c9b0af1ae..a4c669cb6 100644
--- a/packages/0x.js/typedoc-tsconfig.json
+++ b/packages/0x.js/typedoc-tsconfig.json
@@ -3,5 +3,5 @@
"compilerOptions": {
"outDir": "lib"
},
- "include": ["./src/**/*", "./test/**/*"]
+ "include": ["./src/**/*"]
}
diff --git a/packages/abi-gen-wrappers/CHANGELOG.json b/packages/abi-gen-wrappers/CHANGELOG.json
new file mode 100644
index 000000000..d91ad0b36
--- /dev/null
+++ b/packages/abi-gen-wrappers/CHANGELOG.json
@@ -0,0 +1,11 @@
+[
+ {
+ "version": "1.0.0",
+ "changes": [
+ {
+ "pr": 1105,
+ "note": "Initial release"
+ }
+ ]
+ }
+]
diff --git a/packages/abi-gen-wrappers/README.md b/packages/abi-gen-wrappers/README.md
new file mode 100644
index 000000000..f904f9af8
--- /dev/null
+++ b/packages/abi-gen-wrappers/README.md
@@ -0,0 +1,73 @@
+## @0xproject/abi-gen-wrappers
+
+Low-level 0x smart contract wrappers generated using @0xproject/abi-gen. These
+low-level wrappers are imported by other packages in the 0x monorepo and
+application developers are not expected to import this package directly.
+
+You may also be interested in the
+[@0xproject/contract-wrappers](../contract-wrappers/README.md) package which
+includes some higher-level features.
+
+## Installation
+
+```bash
+yarn add @0xproject/abi-gen-wrappers
+```
+
+**Import**
+
+```typescript
+import * as wrappers from '@0xproject/abi-gen-wrappers';
+```
+
+or
+
+```javascript
+var wrappers = require('@0xproject/abi-gen-wrappers');
+```
+
+## Contributing
+
+We welcome improvements and fixes from the wider community! To report bugs within this package, please create an issue in this repository.
+
+Please read our [contribution guidelines](../../CONTRIBUTING.md) before getting started.
+
+### Install dependencies
+
+If you don't have yarn workspaces enabled (Yarn < v1.0) - enable them:
+
+```bash
+yarn config set workspaces-experimental true
+```
+
+Then install dependencies
+
+```bash
+yarn install
+```
+
+### Build
+
+To build this package and all other monorepo packages that it depends on, run the following from the monorepo root directory:
+
+```bash
+PKG=@0xproject/abi-gen-wrappers yarn build
+```
+
+### Clean
+
+```bash
+yarn clean
+```
+
+### Lint
+
+```bash
+yarn lint
+```
+
+### Run Tests
+
+```bash
+yarn test
+```
diff --git a/packages/abi-gen-wrappers/package.json b/packages/abi-gen-wrappers/package.json
new file mode 100644
index 000000000..a660d3015
--- /dev/null
+++ b/packages/abi-gen-wrappers/package.json
@@ -0,0 +1,41 @@
+{
+ "name": "@0xproject/abi-gen-wrappers",
+ "version": "1.0.0",
+ "engines": {
+ "node": ">=6.12"
+ },
+ "description": "Low-level 0x smart contract wrappers generated using @0xproject/abi-gen",
+ "main": "lib/src/index.js",
+ "directories": {
+ "test": "test"
+ },
+ "scripts": {
+ "build": "yarn pre_build && tsc -b",
+ "build:ci": "yarn build",
+ "pre_build": "yarn generate_contract_wrappers",
+ "clean": "shx rm -rf lib wrappers",
+ "generate_contract_wrappers": "abi-gen --abis ${npm_package_config_abis} --template ../contract_templates/contract.handlebars --partials '../contract_templates/partials/**/*.handlebars' --output src/generated-wrappers --backend ethers"
+ },
+ "config": {
+ "abis": "../contract-artifacts/artifacts/@(AssetProxyOwner|DummyERC20Token|DummyERC721Token|ERC20Proxy|ERC20Token|ERC721Proxy|ERC721Token|Exchange|Forwarder|IValidator|IWallet|OrderValidator|WETH9|ZRXToken).json"
+ },
+ "repository": {
+ "type": "git",
+ "url": "https://github.com/0xProject/0x-monorepo.git"
+ },
+ "license": "Apache-2.0",
+ "bugs": {
+ "url": "https://github.com/0xProject/0x-monorepo/issues"
+ },
+ "homepage": "https://github.com/0xProject/0x-monorepo/packages/abi-gen-wrappers/README.md",
+ "devDependencies": {
+ "@0xproject/abi-gen": "^1.0.12",
+ "shx": "^0.2.2"
+ },
+ "dependencies": {
+ "@0xproject/base-contract": "^3.0.1"
+ },
+ "publishConfig": {
+ "access": "public"
+ }
+}
diff --git a/packages/abi-gen-wrappers/src/generated-wrappers/asset_proxy_owner.ts b/packages/abi-gen-wrappers/src/generated-wrappers/asset_proxy_owner.ts
new file mode 100644
index 000000000..464f80305
--- /dev/null
+++ b/packages/abi-gen-wrappers/src/generated-wrappers/asset_proxy_owner.ts
@@ -0,0 +1,1876 @@
+// tslint:disable:no-consecutive-blank-lines ordered-imports align trailing-comma whitespace class-name
+// tslint:disable:no-unused-variable
+// tslint:disable:no-unbound-method
+import { BaseContract } from '@0xproject/base-contract';
+import { BlockParam, BlockParamLiteral, CallData, ContractAbi, ContractArtifact, DecodedLogArgs, MethodAbi, Provider, TxData, TxDataPayable } from 'ethereum-types';
+import { BigNumber, classUtils, logUtils } from '@0xproject/utils';
+import { Web3Wrapper } from '@0xproject/web3-wrapper';
+import * as ethers from 'ethers';
+import * as _ from 'lodash';
+// tslint:enable:no-unused-variable
+
+export type AssetProxyOwnerEventArgs =
+ | AssetProxyOwnerAssetProxyRegistrationEventArgs
+ | AssetProxyOwnerConfirmationTimeSetEventArgs
+ | AssetProxyOwnerTimeLockChangeEventArgs
+ | AssetProxyOwnerConfirmationEventArgs
+ | AssetProxyOwnerRevocationEventArgs
+ | AssetProxyOwnerSubmissionEventArgs
+ | AssetProxyOwnerExecutionEventArgs
+ | AssetProxyOwnerExecutionFailureEventArgs
+ | AssetProxyOwnerDepositEventArgs
+ | AssetProxyOwnerOwnerAdditionEventArgs
+ | AssetProxyOwnerOwnerRemovalEventArgs
+ | AssetProxyOwnerRequirementChangeEventArgs;
+
+export enum AssetProxyOwnerEvents {
+ AssetProxyRegistration = 'AssetProxyRegistration',
+ ConfirmationTimeSet = 'ConfirmationTimeSet',
+ TimeLockChange = 'TimeLockChange',
+ Confirmation = 'Confirmation',
+ Revocation = 'Revocation',
+ Submission = 'Submission',
+ Execution = 'Execution',
+ ExecutionFailure = 'ExecutionFailure',
+ Deposit = 'Deposit',
+ OwnerAddition = 'OwnerAddition',
+ OwnerRemoval = 'OwnerRemoval',
+ RequirementChange = 'RequirementChange',
+}
+
+export interface AssetProxyOwnerAssetProxyRegistrationEventArgs extends DecodedLogArgs {
+ assetProxyContract: string;
+ isRegistered: boolean;
+}
+
+export interface AssetProxyOwnerConfirmationTimeSetEventArgs extends DecodedLogArgs {
+ transactionId: BigNumber;
+ confirmationTime: BigNumber;
+}
+
+export interface AssetProxyOwnerTimeLockChangeEventArgs extends DecodedLogArgs {
+ secondsTimeLocked: BigNumber;
+}
+
+export interface AssetProxyOwnerConfirmationEventArgs extends DecodedLogArgs {
+ sender: string;
+ transactionId: BigNumber;
+}
+
+export interface AssetProxyOwnerRevocationEventArgs extends DecodedLogArgs {
+ sender: string;
+ transactionId: BigNumber;
+}
+
+export interface AssetProxyOwnerSubmissionEventArgs extends DecodedLogArgs {
+ transactionId: BigNumber;
+}
+
+export interface AssetProxyOwnerExecutionEventArgs extends DecodedLogArgs {
+ transactionId: BigNumber;
+}
+
+export interface AssetProxyOwnerExecutionFailureEventArgs extends DecodedLogArgs {
+ transactionId: BigNumber;
+}
+
+export interface AssetProxyOwnerDepositEventArgs extends DecodedLogArgs {
+ sender: string;
+ value: BigNumber;
+}
+
+export interface AssetProxyOwnerOwnerAdditionEventArgs extends DecodedLogArgs {
+ owner: string;
+}
+
+export interface AssetProxyOwnerOwnerRemovalEventArgs extends DecodedLogArgs {
+ owner: string;
+}
+
+export interface AssetProxyOwnerRequirementChangeEventArgs extends DecodedLogArgs {
+ required: BigNumber;
+}
+
+
+/* istanbul ignore next */
+// tslint:disable:no-parameter-reassignment
+// tslint:disable-next-line:class-name
+export class AssetProxyOwnerContract extends BaseContract {
+ public owners = {
+ async callAsync(
+ index_0: BigNumber,
+ callData: Partial<CallData> = {},
+ defaultBlock?: BlockParam,
+ ): Promise<string
+ > {
+ const self = this as any as AssetProxyOwnerContract;
+ const functionSignature = 'owners(uint256)';
+ const inputAbi = self._lookupAbi(functionSignature).inputs;
+ [index_0
+ ] = BaseContract._formatABIDataItemList(inputAbi, [index_0
+ ], BaseContract._bigNumberToString.bind(self));
+ BaseContract.strictArgumentEncodingCheck(inputAbi, [index_0
+ ]);
+ const ethersFunction = self._lookupEthersInterface(functionSignature).functions.owners;
+ const encodedData = ethersFunction.encode([index_0
+ ]);
+ const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
+ {
+ to: self.address,
+ ...callData,
+ data: encodedData,
+ },
+ self._web3Wrapper.getContractDefaults(),
+ );
+ const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
+ BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
+ let resultArray = ethersFunction.decode(rawCallResult);
+ const outputAbi = (_.find(self.abi, {name: 'owners'}) as MethodAbi).outputs;
+ resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this));
+ resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this));
+ return resultArray[0];
+ },
+ };
+ public removeOwner = {
+ async sendTransactionAsync(
+ owner: string,
+ txData: Partial<TxData> = {},
+ ): Promise<string> {
+ const self = this as any as AssetProxyOwnerContract;
+ const inputAbi = self._lookupAbi('removeOwner(address)').inputs;
+ [owner
+ ] = BaseContract._formatABIDataItemList(inputAbi, [owner
+ ], BaseContract._bigNumberToString.bind(self));
+ BaseContract.strictArgumentEncodingCheck(inputAbi, [owner
+ ]);
+ const encodedData = self._lookupEthersInterface('removeOwner(address)').functions.removeOwner.encode([owner
+ ]);
+ const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
+ {
+ to: self.address,
+ ...txData,
+ data: encodedData,
+ },
+ self._web3Wrapper.getContractDefaults(),
+ self.removeOwner.estimateGasAsync.bind(
+ self,
+ owner
+ ),
+ );
+ const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults);
+ return txHash;
+ },
+ async estimateGasAsync(
+ owner: string,
+ txData: Partial<TxData> = {},
+ ): Promise<number> {
+ const self = this as any as AssetProxyOwnerContract;
+ const inputAbi = self._lookupAbi('removeOwner(address)').inputs;
+ [owner
+ ] = BaseContract._formatABIDataItemList(inputAbi, [owner
+ ], BaseContract._bigNumberToString);
+ const encodedData = self._lookupEthersInterface('removeOwner(address)').functions.removeOwner.encode([owner
+ ]);
+ const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
+ {
+ to: self.address,
+ ...txData,
+ data: encodedData,
+ },
+ self._web3Wrapper.getContractDefaults(),
+ );
+ const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults);
+ return gas;
+ },
+ getABIEncodedTransactionData(
+ owner: string,
+ ): string {
+ const self = this as any as AssetProxyOwnerContract;
+ const inputAbi = self._lookupAbi('removeOwner(address)').inputs;
+ [owner
+ ] = BaseContract._formatABIDataItemList(inputAbi, [owner
+ ], BaseContract._bigNumberToString);
+ const abiEncodedTransactionData = self._lookupEthersInterface('removeOwner(address)').functions.removeOwner.encode([owner
+ ]);
+ return abiEncodedTransactionData;
+ },
+ async callAsync(
+ owner: string,
+ callData: Partial<CallData> = {},
+ defaultBlock?: BlockParam,
+ ): Promise<void
+ > {
+ const self = this as any as AssetProxyOwnerContract;
+ const functionSignature = 'removeOwner(address)';
+ const inputAbi = self._lookupAbi(functionSignature).inputs;
+ [owner
+ ] = BaseContract._formatABIDataItemList(inputAbi, [owner
+ ], BaseContract._bigNumberToString.bind(self));
+ BaseContract.strictArgumentEncodingCheck(inputAbi, [owner
+ ]);
+ const ethersFunction = self._lookupEthersInterface(functionSignature).functions.removeOwner;
+ const encodedData = ethersFunction.encode([owner
+ ]);
+ const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
+ {
+ to: self.address,
+ ...callData,
+ data: encodedData,
+ },
+ self._web3Wrapper.getContractDefaults(),
+ );
+ const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
+ BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
+ let resultArray = ethersFunction.decode(rawCallResult);
+ const outputAbi = (_.find(self.abi, {name: 'removeOwner'}) as MethodAbi).outputs;
+ resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this));
+ resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this));
+ return resultArray;
+ },
+ };
+ public revokeConfirmation = {
+ async sendTransactionAsync(
+ transactionId: BigNumber,
+ txData: Partial<TxData> = {},
+ ): Promise<string> {
+ const self = this as any as AssetProxyOwnerContract;
+ const inputAbi = self._lookupAbi('revokeConfirmation(uint256)').inputs;
+ [transactionId
+ ] = BaseContract._formatABIDataItemList(inputAbi, [transactionId
+ ], BaseContract._bigNumberToString.bind(self));
+ BaseContract.strictArgumentEncodingCheck(inputAbi, [transactionId
+ ]);
+ const encodedData = self._lookupEthersInterface('revokeConfirmation(uint256)').functions.revokeConfirmation.encode([transactionId
+ ]);
+ const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
+ {
+ to: self.address,
+ ...txData,
+ data: encodedData,
+ },
+ self._web3Wrapper.getContractDefaults(),
+ self.revokeConfirmation.estimateGasAsync.bind(
+ self,
+ transactionId
+ ),
+ );
+ const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults);
+ return txHash;
+ },
+ async estimateGasAsync(
+ transactionId: BigNumber,
+ txData: Partial<TxData> = {},
+ ): Promise<number> {
+ const self = this as any as AssetProxyOwnerContract;
+ const inputAbi = self._lookupAbi('revokeConfirmation(uint256)').inputs;
+ [transactionId
+ ] = BaseContract._formatABIDataItemList(inputAbi, [transactionId
+ ], BaseContract._bigNumberToString);
+ const encodedData = self._lookupEthersInterface('revokeConfirmation(uint256)').functions.revokeConfirmation.encode([transactionId
+ ]);
+ const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
+ {
+ to: self.address,
+ ...txData,
+ data: encodedData,
+ },
+ self._web3Wrapper.getContractDefaults(),
+ );
+ const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults);
+ return gas;
+ },
+ getABIEncodedTransactionData(
+ transactionId: BigNumber,
+ ): string {
+ const self = this as any as AssetProxyOwnerContract;
+ const inputAbi = self._lookupAbi('revokeConfirmation(uint256)').inputs;
+ [transactionId
+ ] = BaseContract._formatABIDataItemList(inputAbi, [transactionId
+ ], BaseContract._bigNumberToString);
+ const abiEncodedTransactionData = self._lookupEthersInterface('revokeConfirmation(uint256)').functions.revokeConfirmation.encode([transactionId
+ ]);
+ return abiEncodedTransactionData;
+ },
+ async callAsync(
+ transactionId: BigNumber,
+ callData: Partial<CallData> = {},
+ defaultBlock?: BlockParam,
+ ): Promise<void
+ > {
+ const self = this as any as AssetProxyOwnerContract;
+ const functionSignature = 'revokeConfirmation(uint256)';
+ const inputAbi = self._lookupAbi(functionSignature).inputs;
+ [transactionId
+ ] = BaseContract._formatABIDataItemList(inputAbi, [transactionId
+ ], BaseContract._bigNumberToString.bind(self));
+ BaseContract.strictArgumentEncodingCheck(inputAbi, [transactionId
+ ]);
+ const ethersFunction = self._lookupEthersInterface(functionSignature).functions.revokeConfirmation;
+ const encodedData = ethersFunction.encode([transactionId
+ ]);
+ const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
+ {
+ to: self.address,
+ ...callData,
+ data: encodedData,
+ },
+ self._web3Wrapper.getContractDefaults(),
+ );
+ const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
+ BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
+ let resultArray = ethersFunction.decode(rawCallResult);
+ const outputAbi = (_.find(self.abi, {name: 'revokeConfirmation'}) as MethodAbi).outputs;
+ resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this));
+ resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this));
+ return resultArray;
+ },
+ };
+ public isOwner = {
+ async callAsync(
+ index_0: string,
+ callData: Partial<CallData> = {},
+ defaultBlock?: BlockParam,
+ ): Promise<boolean
+ > {
+ const self = this as any as AssetProxyOwnerContract;
+ const functionSignature = 'isOwner(address)';
+ const inputAbi = self._lookupAbi(functionSignature).inputs;
+ [index_0
+ ] = BaseContract._formatABIDataItemList(inputAbi, [index_0
+ ], BaseContract._bigNumberToString.bind(self));
+ BaseContract.strictArgumentEncodingCheck(inputAbi, [index_0
+ ]);
+ const ethersFunction = self._lookupEthersInterface(functionSignature).functions.isOwner;
+ const encodedData = ethersFunction.encode([index_0
+ ]);
+ const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
+ {
+ to: self.address,
+ ...callData,
+ data: encodedData,
+ },
+ self._web3Wrapper.getContractDefaults(),
+ );
+ const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
+ BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
+ let resultArray = ethersFunction.decode(rawCallResult);
+ const outputAbi = (_.find(self.abi, {name: 'isOwner'}) as MethodAbi).outputs;
+ resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this));
+ resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this));
+ return resultArray[0];
+ },
+ };
+ public confirmations = {
+ async callAsync(
+ index_0: BigNumber,
+ index_1: string,
+ callData: Partial<CallData> = {},
+ defaultBlock?: BlockParam,
+ ): Promise<boolean
+ > {
+ const self = this as any as AssetProxyOwnerContract;
+ const functionSignature = 'confirmations(uint256,address)';
+ const inputAbi = self._lookupAbi(functionSignature).inputs;
+ [index_0,
+ index_1
+ ] = BaseContract._formatABIDataItemList(inputAbi, [index_0,
+ index_1
+ ], BaseContract._bigNumberToString.bind(self));
+ BaseContract.strictArgumentEncodingCheck(inputAbi, [index_0,
+ index_1
+ ]);
+ const ethersFunction = self._lookupEthersInterface(functionSignature).functions.confirmations;
+ const encodedData = ethersFunction.encode([index_0,
+ index_1
+ ]);
+ const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
+ {
+ to: self.address,
+ ...callData,
+ data: encodedData,
+ },
+ self._web3Wrapper.getContractDefaults(),
+ );
+ const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
+ BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
+ let resultArray = ethersFunction.decode(rawCallResult);
+ const outputAbi = (_.find(self.abi, {name: 'confirmations'}) as MethodAbi).outputs;
+ resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this));
+ resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this));
+ return resultArray[0];
+ },
+ };
+ public executeRemoveAuthorizedAddressAtIndex = {
+ async sendTransactionAsync(
+ transactionId: BigNumber,
+ txData: Partial<TxData> = {},
+ ): Promise<string> {
+ const self = this as any as AssetProxyOwnerContract;
+ const inputAbi = self._lookupAbi('executeRemoveAuthorizedAddressAtIndex(uint256)').inputs;
+ [transactionId
+ ] = BaseContract._formatABIDataItemList(inputAbi, [transactionId
+ ], BaseContract._bigNumberToString.bind(self));
+ BaseContract.strictArgumentEncodingCheck(inputAbi, [transactionId
+ ]);
+ const encodedData = self._lookupEthersInterface('executeRemoveAuthorizedAddressAtIndex(uint256)').functions.executeRemoveAuthorizedAddressAtIndex.encode([transactionId
+ ]);
+ const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
+ {
+ to: self.address,
+ ...txData,
+ data: encodedData,
+ },
+ self._web3Wrapper.getContractDefaults(),
+ self.executeRemoveAuthorizedAddressAtIndex.estimateGasAsync.bind(
+ self,
+ transactionId
+ ),
+ );
+ const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults);
+ return txHash;
+ },
+ async estimateGasAsync(
+ transactionId: BigNumber,
+ txData: Partial<TxData> = {},
+ ): Promise<number> {
+ const self = this as any as AssetProxyOwnerContract;
+ const inputAbi = self._lookupAbi('executeRemoveAuthorizedAddressAtIndex(uint256)').inputs;
+ [transactionId
+ ] = BaseContract._formatABIDataItemList(inputAbi, [transactionId
+ ], BaseContract._bigNumberToString);
+ const encodedData = self._lookupEthersInterface('executeRemoveAuthorizedAddressAtIndex(uint256)').functions.executeRemoveAuthorizedAddressAtIndex.encode([transactionId
+ ]);
+ const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
+ {
+ to: self.address,
+ ...txData,
+ data: encodedData,
+ },
+ self._web3Wrapper.getContractDefaults(),
+ );
+ const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults);
+ return gas;
+ },
+ getABIEncodedTransactionData(
+ transactionId: BigNumber,
+ ): string {
+ const self = this as any as AssetProxyOwnerContract;
+ const inputAbi = self._lookupAbi('executeRemoveAuthorizedAddressAtIndex(uint256)').inputs;
+ [transactionId
+ ] = BaseContract._formatABIDataItemList(inputAbi, [transactionId
+ ], BaseContract._bigNumberToString);
+ const abiEncodedTransactionData = self._lookupEthersInterface('executeRemoveAuthorizedAddressAtIndex(uint256)').functions.executeRemoveAuthorizedAddressAtIndex.encode([transactionId
+ ]);
+ return abiEncodedTransactionData;
+ },
+ async callAsync(
+ transactionId: BigNumber,
+ callData: Partial<CallData> = {},
+ defaultBlock?: BlockParam,
+ ): Promise<void
+ > {
+ const self = this as any as AssetProxyOwnerContract;
+ const functionSignature = 'executeRemoveAuthorizedAddressAtIndex(uint256)';
+ const inputAbi = self._lookupAbi(functionSignature).inputs;
+ [transactionId
+ ] = BaseContract._formatABIDataItemList(inputAbi, [transactionId
+ ], BaseContract._bigNumberToString.bind(self));
+ BaseContract.strictArgumentEncodingCheck(inputAbi, [transactionId
+ ]);
+ const ethersFunction = self._lookupEthersInterface(functionSignature).functions.executeRemoveAuthorizedAddressAtIndex;
+ const encodedData = ethersFunction.encode([transactionId
+ ]);
+ const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
+ {
+ to: self.address,
+ ...callData,
+ data: encodedData,
+ },
+ self._web3Wrapper.getContractDefaults(),
+ );
+ const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
+ BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
+ let resultArray = ethersFunction.decode(rawCallResult);
+ const outputAbi = (_.find(self.abi, {name: 'executeRemoveAuthorizedAddressAtIndex'}) as MethodAbi).outputs;
+ resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this));
+ resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this));
+ return resultArray;
+ },
+ };
+ public secondsTimeLocked = {
+ async callAsync(
+ callData: Partial<CallData> = {},
+ defaultBlock?: BlockParam,
+ ): Promise<BigNumber
+ > {
+ const self = this as any as AssetProxyOwnerContract;
+ const functionSignature = 'secondsTimeLocked()';
+ const inputAbi = self._lookupAbi(functionSignature).inputs;
+ [] = BaseContract._formatABIDataItemList(inputAbi, [], BaseContract._bigNumberToString.bind(self));
+ BaseContract.strictArgumentEncodingCheck(inputAbi, []);
+ const ethersFunction = self._lookupEthersInterface(functionSignature).functions.secondsTimeLocked;
+ const encodedData = ethersFunction.encode([]);
+ const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
+ {
+ to: self.address,
+ ...callData,
+ data: encodedData,
+ },
+ self._web3Wrapper.getContractDefaults(),
+ );
+ const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
+ BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
+ let resultArray = ethersFunction.decode(rawCallResult);
+ const outputAbi = (_.find(self.abi, {name: 'secondsTimeLocked'}) as MethodAbi).outputs;
+ resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this));
+ resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this));
+ return resultArray[0];
+ },
+ };
+ public getTransactionCount = {
+ async callAsync(
+ pending: boolean,
+ executed: boolean,
+ callData: Partial<CallData> = {},
+ defaultBlock?: BlockParam,
+ ): Promise<BigNumber
+ > {
+ const self = this as any as AssetProxyOwnerContract;
+ const functionSignature = 'getTransactionCount(bool,bool)';
+ const inputAbi = self._lookupAbi(functionSignature).inputs;
+ [pending,
+ executed
+ ] = BaseContract._formatABIDataItemList(inputAbi, [pending,
+ executed
+ ], BaseContract._bigNumberToString.bind(self));
+ BaseContract.strictArgumentEncodingCheck(inputAbi, [pending,
+ executed
+ ]);
+ const ethersFunction = self._lookupEthersInterface(functionSignature).functions.getTransactionCount;
+ const encodedData = ethersFunction.encode([pending,
+ executed
+ ]);
+ const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
+ {
+ to: self.address,
+ ...callData,
+ data: encodedData,
+ },
+ self._web3Wrapper.getContractDefaults(),
+ );
+ const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
+ BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
+ let resultArray = ethersFunction.decode(rawCallResult);
+ const outputAbi = (_.find(self.abi, {name: 'getTransactionCount'}) as MethodAbi).outputs;
+ resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this));
+ resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this));
+ return resultArray[0];
+ },
+ };
+ public registerAssetProxy = {
+ async sendTransactionAsync(
+ assetProxyContract: string,
+ isRegistered: boolean,
+ txData: Partial<TxData> = {},
+ ): Promise<string> {
+ const self = this as any as AssetProxyOwnerContract;
+ const inputAbi = self._lookupAbi('registerAssetProxy(address,bool)').inputs;
+ [assetProxyContract,
+ isRegistered
+ ] = BaseContract._formatABIDataItemList(inputAbi, [assetProxyContract,
+ isRegistered
+ ], BaseContract._bigNumberToString.bind(self));
+ BaseContract.strictArgumentEncodingCheck(inputAbi, [assetProxyContract,
+ isRegistered
+ ]);
+ const encodedData = self._lookupEthersInterface('registerAssetProxy(address,bool)').functions.registerAssetProxy.encode([assetProxyContract,
+ isRegistered
+ ]);
+ const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
+ {
+ to: self.address,
+ ...txData,
+ data: encodedData,
+ },
+ self._web3Wrapper.getContractDefaults(),
+ self.registerAssetProxy.estimateGasAsync.bind(
+ self,
+ assetProxyContract,
+ isRegistered
+ ),
+ );
+ const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults);
+ return txHash;
+ },
+ async estimateGasAsync(
+ assetProxyContract: string,
+ isRegistered: boolean,
+ txData: Partial<TxData> = {},
+ ): Promise<number> {
+ const self = this as any as AssetProxyOwnerContract;
+ const inputAbi = self._lookupAbi('registerAssetProxy(address,bool)').inputs;
+ [assetProxyContract,
+ isRegistered
+ ] = BaseContract._formatABIDataItemList(inputAbi, [assetProxyContract,
+ isRegistered
+ ], BaseContract._bigNumberToString);
+ const encodedData = self._lookupEthersInterface('registerAssetProxy(address,bool)').functions.registerAssetProxy.encode([assetProxyContract,
+ isRegistered
+ ]);
+ const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
+ {
+ to: self.address,
+ ...txData,
+ data: encodedData,
+ },
+ self._web3Wrapper.getContractDefaults(),
+ );
+ const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults);
+ return gas;
+ },
+ getABIEncodedTransactionData(
+ assetProxyContract: string,
+ isRegistered: boolean,
+ ): string {
+ const self = this as any as AssetProxyOwnerContract;
+ const inputAbi = self._lookupAbi('registerAssetProxy(address,bool)').inputs;
+ [assetProxyContract,
+ isRegistered
+ ] = BaseContract._formatABIDataItemList(inputAbi, [assetProxyContract,
+ isRegistered
+ ], BaseContract._bigNumberToString);
+ const abiEncodedTransactionData = self._lookupEthersInterface('registerAssetProxy(address,bool)').functions.registerAssetProxy.encode([assetProxyContract,
+ isRegistered
+ ]);
+ return abiEncodedTransactionData;
+ },
+ async callAsync(
+ assetProxyContract: string,
+ isRegistered: boolean,
+ callData: Partial<CallData> = {},
+ defaultBlock?: BlockParam,
+ ): Promise<void
+ > {
+ const self = this as any as AssetProxyOwnerContract;
+ const functionSignature = 'registerAssetProxy(address,bool)';
+ const inputAbi = self._lookupAbi(functionSignature).inputs;
+ [assetProxyContract,
+ isRegistered
+ ] = BaseContract._formatABIDataItemList(inputAbi, [assetProxyContract,
+ isRegistered
+ ], BaseContract._bigNumberToString.bind(self));
+ BaseContract.strictArgumentEncodingCheck(inputAbi, [assetProxyContract,
+ isRegistered
+ ]);
+ const ethersFunction = self._lookupEthersInterface(functionSignature).functions.registerAssetProxy;
+ const encodedData = ethersFunction.encode([assetProxyContract,
+ isRegistered
+ ]);
+ const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
+ {
+ to: self.address,
+ ...callData,
+ data: encodedData,
+ },
+ self._web3Wrapper.getContractDefaults(),
+ );
+ const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
+ BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
+ let resultArray = ethersFunction.decode(rawCallResult);
+ const outputAbi = (_.find(self.abi, {name: 'registerAssetProxy'}) as MethodAbi).outputs;
+ resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this));
+ resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this));
+ return resultArray;
+ },
+ };
+ public addOwner = {
+ async sendTransactionAsync(
+ owner: string,
+ txData: Partial<TxData> = {},
+ ): Promise<string> {
+ const self = this as any as AssetProxyOwnerContract;
+ const inputAbi = self._lookupAbi('addOwner(address)').inputs;
+ [owner
+ ] = BaseContract._formatABIDataItemList(inputAbi, [owner
+ ], BaseContract._bigNumberToString.bind(self));
+ BaseContract.strictArgumentEncodingCheck(inputAbi, [owner
+ ]);
+ const encodedData = self._lookupEthersInterface('addOwner(address)').functions.addOwner.encode([owner
+ ]);
+ const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
+ {
+ to: self.address,
+ ...txData,
+ data: encodedData,
+ },
+ self._web3Wrapper.getContractDefaults(),
+ self.addOwner.estimateGasAsync.bind(
+ self,
+ owner
+ ),
+ );
+ const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults);
+ return txHash;
+ },
+ async estimateGasAsync(
+ owner: string,
+ txData: Partial<TxData> = {},
+ ): Promise<number> {
+ const self = this as any as AssetProxyOwnerContract;
+ const inputAbi = self._lookupAbi('addOwner(address)').inputs;
+ [owner
+ ] = BaseContract._formatABIDataItemList(inputAbi, [owner
+ ], BaseContract._bigNumberToString);
+ const encodedData = self._lookupEthersInterface('addOwner(address)').functions.addOwner.encode([owner
+ ]);
+ const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
+ {
+ to: self.address,
+ ...txData,
+ data: encodedData,
+ },
+ self._web3Wrapper.getContractDefaults(),
+ );
+ const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults);
+ return gas;
+ },
+ getABIEncodedTransactionData(
+ owner: string,
+ ): string {
+ const self = this as any as AssetProxyOwnerContract;
+ const inputAbi = self._lookupAbi('addOwner(address)').inputs;
+ [owner
+ ] = BaseContract._formatABIDataItemList(inputAbi, [owner
+ ], BaseContract._bigNumberToString);
+ const abiEncodedTransactionData = self._lookupEthersInterface('addOwner(address)').functions.addOwner.encode([owner
+ ]);
+ return abiEncodedTransactionData;
+ },
+ async callAsync(
+ owner: string,
+ callData: Partial<CallData> = {},
+ defaultBlock?: BlockParam,
+ ): Promise<void
+ > {
+ const self = this as any as AssetProxyOwnerContract;
+ const functionSignature = 'addOwner(address)';
+ const inputAbi = self._lookupAbi(functionSignature).inputs;
+ [owner
+ ] = BaseContract._formatABIDataItemList(inputAbi, [owner
+ ], BaseContract._bigNumberToString.bind(self));
+ BaseContract.strictArgumentEncodingCheck(inputAbi, [owner
+ ]);
+ const ethersFunction = self._lookupEthersInterface(functionSignature).functions.addOwner;
+ const encodedData = ethersFunction.encode([owner
+ ]);
+ const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
+ {
+ to: self.address,
+ ...callData,
+ data: encodedData,
+ },
+ self._web3Wrapper.getContractDefaults(),
+ );
+ const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
+ BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
+ let resultArray = ethersFunction.decode(rawCallResult);
+ const outputAbi = (_.find(self.abi, {name: 'addOwner'}) as MethodAbi).outputs;
+ resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this));
+ resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this));
+ return resultArray;
+ },
+ };
+ public isConfirmed = {
+ async callAsync(
+ transactionId: BigNumber,
+ callData: Partial<CallData> = {},
+ defaultBlock?: BlockParam,
+ ): Promise<boolean
+ > {
+ const self = this as any as AssetProxyOwnerContract;
+ const functionSignature = 'isConfirmed(uint256)';
+ const inputAbi = self._lookupAbi(functionSignature).inputs;
+ [transactionId
+ ] = BaseContract._formatABIDataItemList(inputAbi, [transactionId
+ ], BaseContract._bigNumberToString.bind(self));
+ BaseContract.strictArgumentEncodingCheck(inputAbi, [transactionId
+ ]);
+ const ethersFunction = self._lookupEthersInterface(functionSignature).functions.isConfirmed;
+ const encodedData = ethersFunction.encode([transactionId
+ ]);
+ const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
+ {
+ to: self.address,
+ ...callData,
+ data: encodedData,
+ },
+ self._web3Wrapper.getContractDefaults(),
+ );
+ const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
+ BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
+ let resultArray = ethersFunction.decode(rawCallResult);
+ const outputAbi = (_.find(self.abi, {name: 'isConfirmed'}) as MethodAbi).outputs;
+ resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this));
+ resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this));
+ return resultArray[0];
+ },
+ };
+ public changeTimeLock = {
+ async sendTransactionAsync(
+ _secondsTimeLocked: BigNumber,
+ txData: Partial<TxData> = {},
+ ): Promise<string> {
+ const self = this as any as AssetProxyOwnerContract;
+ const inputAbi = self._lookupAbi('changeTimeLock(uint256)').inputs;
+ [_secondsTimeLocked
+ ] = BaseContract._formatABIDataItemList(inputAbi, [_secondsTimeLocked
+ ], BaseContract._bigNumberToString.bind(self));
+ BaseContract.strictArgumentEncodingCheck(inputAbi, [_secondsTimeLocked
+ ]);
+ const encodedData = self._lookupEthersInterface('changeTimeLock(uint256)').functions.changeTimeLock.encode([_secondsTimeLocked
+ ]);
+ const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
+ {
+ to: self.address,
+ ...txData,
+ data: encodedData,
+ },
+ self._web3Wrapper.getContractDefaults(),
+ self.changeTimeLock.estimateGasAsync.bind(
+ self,
+ _secondsTimeLocked
+ ),
+ );
+ const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults);
+ return txHash;
+ },
+ async estimateGasAsync(
+ _secondsTimeLocked: BigNumber,
+ txData: Partial<TxData> = {},
+ ): Promise<number> {
+ const self = this as any as AssetProxyOwnerContract;
+ const inputAbi = self._lookupAbi('changeTimeLock(uint256)').inputs;
+ [_secondsTimeLocked
+ ] = BaseContract._formatABIDataItemList(inputAbi, [_secondsTimeLocked
+ ], BaseContract._bigNumberToString);
+ const encodedData = self._lookupEthersInterface('changeTimeLock(uint256)').functions.changeTimeLock.encode([_secondsTimeLocked
+ ]);
+ const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
+ {
+ to: self.address,
+ ...txData,
+ data: encodedData,
+ },
+ self._web3Wrapper.getContractDefaults(),
+ );
+ const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults);
+ return gas;
+ },
+ getABIEncodedTransactionData(
+ _secondsTimeLocked: BigNumber,
+ ): string {
+ const self = this as any as AssetProxyOwnerContract;
+ const inputAbi = self._lookupAbi('changeTimeLock(uint256)').inputs;
+ [_secondsTimeLocked
+ ] = BaseContract._formatABIDataItemList(inputAbi, [_secondsTimeLocked
+ ], BaseContract._bigNumberToString);
+ const abiEncodedTransactionData = self._lookupEthersInterface('changeTimeLock(uint256)').functions.changeTimeLock.encode([_secondsTimeLocked
+ ]);
+ return abiEncodedTransactionData;
+ },
+ async callAsync(
+ _secondsTimeLocked: BigNumber,
+ callData: Partial<CallData> = {},
+ defaultBlock?: BlockParam,
+ ): Promise<void
+ > {
+ const self = this as any as AssetProxyOwnerContract;
+ const functionSignature = 'changeTimeLock(uint256)';
+ const inputAbi = self._lookupAbi(functionSignature).inputs;
+ [_secondsTimeLocked
+ ] = BaseContract._formatABIDataItemList(inputAbi, [_secondsTimeLocked
+ ], BaseContract._bigNumberToString.bind(self));
+ BaseContract.strictArgumentEncodingCheck(inputAbi, [_secondsTimeLocked
+ ]);
+ const ethersFunction = self._lookupEthersInterface(functionSignature).functions.changeTimeLock;
+ const encodedData = ethersFunction.encode([_secondsTimeLocked
+ ]);
+ const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
+ {
+ to: self.address,
+ ...callData,
+ data: encodedData,
+ },
+ self._web3Wrapper.getContractDefaults(),
+ );
+ const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
+ BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
+ let resultArray = ethersFunction.decode(rawCallResult);
+ const outputAbi = (_.find(self.abi, {name: 'changeTimeLock'}) as MethodAbi).outputs;
+ resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this));
+ resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this));
+ return resultArray;
+ },
+ };
+ public isAssetProxyRegistered = {
+ async callAsync(
+ index_0: string,
+ callData: Partial<CallData> = {},
+ defaultBlock?: BlockParam,
+ ): Promise<boolean
+ > {
+ const self = this as any as AssetProxyOwnerContract;
+ const functionSignature = 'isAssetProxyRegistered(address)';
+ const inputAbi = self._lookupAbi(functionSignature).inputs;
+ [index_0
+ ] = BaseContract._formatABIDataItemList(inputAbi, [index_0
+ ], BaseContract._bigNumberToString.bind(self));
+ BaseContract.strictArgumentEncodingCheck(inputAbi, [index_0
+ ]);
+ const ethersFunction = self._lookupEthersInterface(functionSignature).functions.isAssetProxyRegistered;
+ const encodedData = ethersFunction.encode([index_0
+ ]);
+ const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
+ {
+ to: self.address,
+ ...callData,
+ data: encodedData,
+ },
+ self._web3Wrapper.getContractDefaults(),
+ );
+ const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
+ BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
+ let resultArray = ethersFunction.decode(rawCallResult);
+ const outputAbi = (_.find(self.abi, {name: 'isAssetProxyRegistered'}) as MethodAbi).outputs;
+ resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this));
+ resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this));
+ return resultArray[0];
+ },
+ };
+ public getConfirmationCount = {
+ async callAsync(
+ transactionId: BigNumber,
+ callData: Partial<CallData> = {},
+ defaultBlock?: BlockParam,
+ ): Promise<BigNumber
+ > {
+ const self = this as any as AssetProxyOwnerContract;
+ const functionSignature = 'getConfirmationCount(uint256)';
+ const inputAbi = self._lookupAbi(functionSignature).inputs;
+ [transactionId
+ ] = BaseContract._formatABIDataItemList(inputAbi, [transactionId
+ ], BaseContract._bigNumberToString.bind(self));
+ BaseContract.strictArgumentEncodingCheck(inputAbi, [transactionId
+ ]);
+ const ethersFunction = self._lookupEthersInterface(functionSignature).functions.getConfirmationCount;
+ const encodedData = ethersFunction.encode([transactionId
+ ]);
+ const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
+ {
+ to: self.address,
+ ...callData,
+ data: encodedData,
+ },
+ self._web3Wrapper.getContractDefaults(),
+ );
+ const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
+ BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
+ let resultArray = ethersFunction.decode(rawCallResult);
+ const outputAbi = (_.find(self.abi, {name: 'getConfirmationCount'}) as MethodAbi).outputs;
+ resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this));
+ resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this));
+ return resultArray[0];
+ },
+ };
+ public transactions = {
+ async callAsync(
+ index_0: BigNumber,
+ callData: Partial<CallData> = {},
+ defaultBlock?: BlockParam,
+ ): Promise<[string, BigNumber, string, boolean]
+ > {
+ const self = this as any as AssetProxyOwnerContract;
+ const functionSignature = 'transactions(uint256)';
+ const inputAbi = self._lookupAbi(functionSignature).inputs;
+ [index_0
+ ] = BaseContract._formatABIDataItemList(inputAbi, [index_0
+ ], BaseContract._bigNumberToString.bind(self));
+ BaseContract.strictArgumentEncodingCheck(inputAbi, [index_0
+ ]);
+ const ethersFunction = self._lookupEthersInterface(functionSignature).functions.transactions;
+ const encodedData = ethersFunction.encode([index_0
+ ]);
+ const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
+ {
+ to: self.address,
+ ...callData,
+ data: encodedData,
+ },
+ self._web3Wrapper.getContractDefaults(),
+ );
+ const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
+ BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
+ let resultArray = ethersFunction.decode(rawCallResult);
+ const outputAbi = (_.find(self.abi, {name: 'transactions'}) as MethodAbi).outputs;
+ resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this));
+ resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this));
+ return resultArray;
+ },
+ };
+ public getOwners = {
+ async callAsync(
+ callData: Partial<CallData> = {},
+ defaultBlock?: BlockParam,
+ ): Promise<string[]
+ > {
+ const self = this as any as AssetProxyOwnerContract;
+ const functionSignature = 'getOwners()';
+ const inputAbi = self._lookupAbi(functionSignature).inputs;
+ [] = BaseContract._formatABIDataItemList(inputAbi, [], BaseContract._bigNumberToString.bind(self));
+ BaseContract.strictArgumentEncodingCheck(inputAbi, []);
+ const ethersFunction = self._lookupEthersInterface(functionSignature).functions.getOwners;
+ const encodedData = ethersFunction.encode([]);
+ const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
+ {
+ to: self.address,
+ ...callData,
+ data: encodedData,
+ },
+ self._web3Wrapper.getContractDefaults(),
+ );
+ const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
+ BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
+ let resultArray = ethersFunction.decode(rawCallResult);
+ const outputAbi = (_.find(self.abi, {name: 'getOwners'}) as MethodAbi).outputs;
+ resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this));
+ resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this));
+ return resultArray[0];
+ },
+ };
+ public getTransactionIds = {
+ async callAsync(
+ from: BigNumber,
+ to: BigNumber,
+ pending: boolean,
+ executed: boolean,
+ callData: Partial<CallData> = {},
+ defaultBlock?: BlockParam,
+ ): Promise<BigNumber[]
+ > {
+ const self = this as any as AssetProxyOwnerContract;
+ const functionSignature = 'getTransactionIds(uint256,uint256,bool,bool)';
+ const inputAbi = self._lookupAbi(functionSignature).inputs;
+ [from,
+ to,
+ pending,
+ executed
+ ] = BaseContract._formatABIDataItemList(inputAbi, [from,
+ to,
+ pending,
+ executed
+ ], BaseContract._bigNumberToString.bind(self));
+ BaseContract.strictArgumentEncodingCheck(inputAbi, [from,
+ to,
+ pending,
+ executed
+ ]);
+ const ethersFunction = self._lookupEthersInterface(functionSignature).functions.getTransactionIds;
+ const encodedData = ethersFunction.encode([from,
+ to,
+ pending,
+ executed
+ ]);
+ const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
+ {
+ to: self.address,
+ ...callData,
+ data: encodedData,
+ },
+ self._web3Wrapper.getContractDefaults(),
+ );
+ const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
+ BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
+ let resultArray = ethersFunction.decode(rawCallResult);
+ const outputAbi = (_.find(self.abi, {name: 'getTransactionIds'}) as MethodAbi).outputs;
+ resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this));
+ resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this));
+ return resultArray[0];
+ },
+ };
+ public getConfirmations = {
+ async callAsync(
+ transactionId: BigNumber,
+ callData: Partial<CallData> = {},
+ defaultBlock?: BlockParam,
+ ): Promise<string[]
+ > {
+ const self = this as any as AssetProxyOwnerContract;
+ const functionSignature = 'getConfirmations(uint256)';
+ const inputAbi = self._lookupAbi(functionSignature).inputs;
+ [transactionId
+ ] = BaseContract._formatABIDataItemList(inputAbi, [transactionId
+ ], BaseContract._bigNumberToString.bind(self));
+ BaseContract.strictArgumentEncodingCheck(inputAbi, [transactionId
+ ]);
+ const ethersFunction = self._lookupEthersInterface(functionSignature).functions.getConfirmations;
+ const encodedData = ethersFunction.encode([transactionId
+ ]);
+ const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
+ {
+ to: self.address,
+ ...callData,
+ data: encodedData,
+ },
+ self._web3Wrapper.getContractDefaults(),
+ );
+ const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
+ BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
+ let resultArray = ethersFunction.decode(rawCallResult);
+ const outputAbi = (_.find(self.abi, {name: 'getConfirmations'}) as MethodAbi).outputs;
+ resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this));
+ resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this));
+ return resultArray[0];
+ },
+ };
+ public transactionCount = {
+ async callAsync(
+ callData: Partial<CallData> = {},
+ defaultBlock?: BlockParam,
+ ): Promise<BigNumber
+ > {
+ const self = this as any as AssetProxyOwnerContract;
+ const functionSignature = 'transactionCount()';
+ const inputAbi = self._lookupAbi(functionSignature).inputs;
+ [] = BaseContract._formatABIDataItemList(inputAbi, [], BaseContract._bigNumberToString.bind(self));
+ BaseContract.strictArgumentEncodingCheck(inputAbi, []);
+ const ethersFunction = self._lookupEthersInterface(functionSignature).functions.transactionCount;
+ const encodedData = ethersFunction.encode([]);
+ const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
+ {
+ to: self.address,
+ ...callData,
+ data: encodedData,
+ },
+ self._web3Wrapper.getContractDefaults(),
+ );
+ const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
+ BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
+ let resultArray = ethersFunction.decode(rawCallResult);
+ const outputAbi = (_.find(self.abi, {name: 'transactionCount'}) as MethodAbi).outputs;
+ resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this));
+ resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this));
+ return resultArray[0];
+ },
+ };
+ public changeRequirement = {
+ async sendTransactionAsync(
+ _required: BigNumber,
+ txData: Partial<TxData> = {},
+ ): Promise<string> {
+ const self = this as any as AssetProxyOwnerContract;
+ const inputAbi = self._lookupAbi('changeRequirement(uint256)').inputs;
+ [_required
+ ] = BaseContract._formatABIDataItemList(inputAbi, [_required
+ ], BaseContract._bigNumberToString.bind(self));
+ BaseContract.strictArgumentEncodingCheck(inputAbi, [_required
+ ]);
+ const encodedData = self._lookupEthersInterface('changeRequirement(uint256)').functions.changeRequirement.encode([_required
+ ]);
+ const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
+ {
+ to: self.address,
+ ...txData,
+ data: encodedData,
+ },
+ self._web3Wrapper.getContractDefaults(),
+ self.changeRequirement.estimateGasAsync.bind(
+ self,
+ _required
+ ),
+ );
+ const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults);
+ return txHash;
+ },
+ async estimateGasAsync(
+ _required: BigNumber,
+ txData: Partial<TxData> = {},
+ ): Promise<number> {
+ const self = this as any as AssetProxyOwnerContract;
+ const inputAbi = self._lookupAbi('changeRequirement(uint256)').inputs;
+ [_required
+ ] = BaseContract._formatABIDataItemList(inputAbi, [_required
+ ], BaseContract._bigNumberToString);
+ const encodedData = self._lookupEthersInterface('changeRequirement(uint256)').functions.changeRequirement.encode([_required
+ ]);
+ const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
+ {
+ to: self.address,
+ ...txData,
+ data: encodedData,
+ },
+ self._web3Wrapper.getContractDefaults(),
+ );
+ const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults);
+ return gas;
+ },
+ getABIEncodedTransactionData(
+ _required: BigNumber,
+ ): string {
+ const self = this as any as AssetProxyOwnerContract;
+ const inputAbi = self._lookupAbi('changeRequirement(uint256)').inputs;
+ [_required
+ ] = BaseContract._formatABIDataItemList(inputAbi, [_required
+ ], BaseContract._bigNumberToString);
+ const abiEncodedTransactionData = self._lookupEthersInterface('changeRequirement(uint256)').functions.changeRequirement.encode([_required
+ ]);
+ return abiEncodedTransactionData;
+ },
+ async callAsync(
+ _required: BigNumber,
+ callData: Partial<CallData> = {},
+ defaultBlock?: BlockParam,
+ ): Promise<void
+ > {
+ const self = this as any as AssetProxyOwnerContract;
+ const functionSignature = 'changeRequirement(uint256)';
+ const inputAbi = self._lookupAbi(functionSignature).inputs;
+ [_required
+ ] = BaseContract._formatABIDataItemList(inputAbi, [_required
+ ], BaseContract._bigNumberToString.bind(self));
+ BaseContract.strictArgumentEncodingCheck(inputAbi, [_required
+ ]);
+ const ethersFunction = self._lookupEthersInterface(functionSignature).functions.changeRequirement;
+ const encodedData = ethersFunction.encode([_required
+ ]);
+ const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
+ {
+ to: self.address,
+ ...callData,
+ data: encodedData,
+ },
+ self._web3Wrapper.getContractDefaults(),
+ );
+ const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
+ BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
+ let resultArray = ethersFunction.decode(rawCallResult);
+ const outputAbi = (_.find(self.abi, {name: 'changeRequirement'}) as MethodAbi).outputs;
+ resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this));
+ resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this));
+ return resultArray;
+ },
+ };
+ public confirmTransaction = {
+ async sendTransactionAsync(
+ transactionId: BigNumber,
+ txData: Partial<TxData> = {},
+ ): Promise<string> {
+ const self = this as any as AssetProxyOwnerContract;
+ const inputAbi = self._lookupAbi('confirmTransaction(uint256)').inputs;
+ [transactionId
+ ] = BaseContract._formatABIDataItemList(inputAbi, [transactionId
+ ], BaseContract._bigNumberToString.bind(self));
+ BaseContract.strictArgumentEncodingCheck(inputAbi, [transactionId
+ ]);
+ const encodedData = self._lookupEthersInterface('confirmTransaction(uint256)').functions.confirmTransaction.encode([transactionId
+ ]);
+ const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
+ {
+ to: self.address,
+ ...txData,
+ data: encodedData,
+ },
+ self._web3Wrapper.getContractDefaults(),
+ self.confirmTransaction.estimateGasAsync.bind(
+ self,
+ transactionId
+ ),
+ );
+ const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults);
+ return txHash;
+ },
+ async estimateGasAsync(
+ transactionId: BigNumber,
+ txData: Partial<TxData> = {},
+ ): Promise<number> {
+ const self = this as any as AssetProxyOwnerContract;
+ const inputAbi = self._lookupAbi('confirmTransaction(uint256)').inputs;
+ [transactionId
+ ] = BaseContract._formatABIDataItemList(inputAbi, [transactionId
+ ], BaseContract._bigNumberToString);
+ const encodedData = self._lookupEthersInterface('confirmTransaction(uint256)').functions.confirmTransaction.encode([transactionId
+ ]);
+ const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
+ {
+ to: self.address,
+ ...txData,
+ data: encodedData,
+ },
+ self._web3Wrapper.getContractDefaults(),
+ );
+ const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults);
+ return gas;
+ },
+ getABIEncodedTransactionData(
+ transactionId: BigNumber,
+ ): string {
+ const self = this as any as AssetProxyOwnerContract;
+ const inputAbi = self._lookupAbi('confirmTransaction(uint256)').inputs;
+ [transactionId
+ ] = BaseContract._formatABIDataItemList(inputAbi, [transactionId
+ ], BaseContract._bigNumberToString);
+ const abiEncodedTransactionData = self._lookupEthersInterface('confirmTransaction(uint256)').functions.confirmTransaction.encode([transactionId
+ ]);
+ return abiEncodedTransactionData;
+ },
+ async callAsync(
+ transactionId: BigNumber,
+ callData: Partial<CallData> = {},
+ defaultBlock?: BlockParam,
+ ): Promise<void
+ > {
+ const self = this as any as AssetProxyOwnerContract;
+ const functionSignature = 'confirmTransaction(uint256)';
+ const inputAbi = self._lookupAbi(functionSignature).inputs;
+ [transactionId
+ ] = BaseContract._formatABIDataItemList(inputAbi, [transactionId
+ ], BaseContract._bigNumberToString.bind(self));
+ BaseContract.strictArgumentEncodingCheck(inputAbi, [transactionId
+ ]);
+ const ethersFunction = self._lookupEthersInterface(functionSignature).functions.confirmTransaction;
+ const encodedData = ethersFunction.encode([transactionId
+ ]);
+ const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
+ {
+ to: self.address,
+ ...callData,
+ data: encodedData,
+ },
+ self._web3Wrapper.getContractDefaults(),
+ );
+ const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
+ BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
+ let resultArray = ethersFunction.decode(rawCallResult);
+ const outputAbi = (_.find(self.abi, {name: 'confirmTransaction'}) as MethodAbi).outputs;
+ resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this));
+ resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this));
+ return resultArray;
+ },
+ };
+ public submitTransaction = {
+ async sendTransactionAsync(
+ destination: string,
+ value: BigNumber,
+ data: string,
+ txData: Partial<TxData> = {},
+ ): Promise<string> {
+ const self = this as any as AssetProxyOwnerContract;
+ const inputAbi = self._lookupAbi('submitTransaction(address,uint256,bytes)').inputs;
+ [destination,
+ value,
+ data
+ ] = BaseContract._formatABIDataItemList(inputAbi, [destination,
+ value,
+ data
+ ], BaseContract._bigNumberToString.bind(self));
+ BaseContract.strictArgumentEncodingCheck(inputAbi, [destination,
+ value,
+ data
+ ]);
+ const encodedData = self._lookupEthersInterface('submitTransaction(address,uint256,bytes)').functions.submitTransaction.encode([destination,
+ value,
+ data
+ ]);
+ const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
+ {
+ to: self.address,
+ ...txData,
+ data: encodedData,
+ },
+ self._web3Wrapper.getContractDefaults(),
+ self.submitTransaction.estimateGasAsync.bind(
+ self,
+ destination,
+ value,
+ data
+ ),
+ );
+ const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults);
+ return txHash;
+ },
+ async estimateGasAsync(
+ destination: string,
+ value: BigNumber,
+ data: string,
+ txData: Partial<TxData> = {},
+ ): Promise<number> {
+ const self = this as any as AssetProxyOwnerContract;
+ const inputAbi = self._lookupAbi('submitTransaction(address,uint256,bytes)').inputs;
+ [destination,
+ value,
+ data
+ ] = BaseContract._formatABIDataItemList(inputAbi, [destination,
+ value,
+ data
+ ], BaseContract._bigNumberToString);
+ const encodedData = self._lookupEthersInterface('submitTransaction(address,uint256,bytes)').functions.submitTransaction.encode([destination,
+ value,
+ data
+ ]);
+ const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
+ {
+ to: self.address,
+ ...txData,
+ data: encodedData,
+ },
+ self._web3Wrapper.getContractDefaults(),
+ );
+ const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults);
+ return gas;
+ },
+ getABIEncodedTransactionData(
+ destination: string,
+ value: BigNumber,
+ data: string,
+ ): string {
+ const self = this as any as AssetProxyOwnerContract;
+ const inputAbi = self._lookupAbi('submitTransaction(address,uint256,bytes)').inputs;
+ [destination,
+ value,
+ data
+ ] = BaseContract._formatABIDataItemList(inputAbi, [destination,
+ value,
+ data
+ ], BaseContract._bigNumberToString);
+ const abiEncodedTransactionData = self._lookupEthersInterface('submitTransaction(address,uint256,bytes)').functions.submitTransaction.encode([destination,
+ value,
+ data
+ ]);
+ return abiEncodedTransactionData;
+ },
+ async callAsync(
+ destination: string,
+ value: BigNumber,
+ data: string,
+ callData: Partial<CallData> = {},
+ defaultBlock?: BlockParam,
+ ): Promise<BigNumber
+ > {
+ const self = this as any as AssetProxyOwnerContract;
+ const functionSignature = 'submitTransaction(address,uint256,bytes)';
+ const inputAbi = self._lookupAbi(functionSignature).inputs;
+ [destination,
+ value,
+ data
+ ] = BaseContract._formatABIDataItemList(inputAbi, [destination,
+ value,
+ data
+ ], BaseContract._bigNumberToString.bind(self));
+ BaseContract.strictArgumentEncodingCheck(inputAbi, [destination,
+ value,
+ data
+ ]);
+ const ethersFunction = self._lookupEthersInterface(functionSignature).functions.submitTransaction;
+ const encodedData = ethersFunction.encode([destination,
+ value,
+ data
+ ]);
+ const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
+ {
+ to: self.address,
+ ...callData,
+ data: encodedData,
+ },
+ self._web3Wrapper.getContractDefaults(),
+ );
+ const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
+ BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
+ let resultArray = ethersFunction.decode(rawCallResult);
+ const outputAbi = (_.find(self.abi, {name: 'submitTransaction'}) as MethodAbi).outputs;
+ resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this));
+ resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this));
+ return resultArray[0];
+ },
+ };
+ public confirmationTimes = {
+ async callAsync(
+ index_0: BigNumber,
+ callData: Partial<CallData> = {},
+ defaultBlock?: BlockParam,
+ ): Promise<BigNumber
+ > {
+ const self = this as any as AssetProxyOwnerContract;
+ const functionSignature = 'confirmationTimes(uint256)';
+ const inputAbi = self._lookupAbi(functionSignature).inputs;
+ [index_0
+ ] = BaseContract._formatABIDataItemList(inputAbi, [index_0
+ ], BaseContract._bigNumberToString.bind(self));
+ BaseContract.strictArgumentEncodingCheck(inputAbi, [index_0
+ ]);
+ const ethersFunction = self._lookupEthersInterface(functionSignature).functions.confirmationTimes;
+ const encodedData = ethersFunction.encode([index_0
+ ]);
+ const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
+ {
+ to: self.address,
+ ...callData,
+ data: encodedData,
+ },
+ self._web3Wrapper.getContractDefaults(),
+ );
+ const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
+ BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
+ let resultArray = ethersFunction.decode(rawCallResult);
+ const outputAbi = (_.find(self.abi, {name: 'confirmationTimes'}) as MethodAbi).outputs;
+ resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this));
+ resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this));
+ return resultArray[0];
+ },
+ };
+ public MAX_OWNER_COUNT = {
+ async callAsync(
+ callData: Partial<CallData> = {},
+ defaultBlock?: BlockParam,
+ ): Promise<BigNumber
+ > {
+ const self = this as any as AssetProxyOwnerContract;
+ const functionSignature = 'MAX_OWNER_COUNT()';
+ const inputAbi = self._lookupAbi(functionSignature).inputs;
+ [] = BaseContract._formatABIDataItemList(inputAbi, [], BaseContract._bigNumberToString.bind(self));
+ BaseContract.strictArgumentEncodingCheck(inputAbi, []);
+ const ethersFunction = self._lookupEthersInterface(functionSignature).functions.MAX_OWNER_COUNT;
+ const encodedData = ethersFunction.encode([]);
+ const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
+ {
+ to: self.address,
+ ...callData,
+ data: encodedData,
+ },
+ self._web3Wrapper.getContractDefaults(),
+ );
+ const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
+ BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
+ let resultArray = ethersFunction.decode(rawCallResult);
+ const outputAbi = (_.find(self.abi, {name: 'MAX_OWNER_COUNT'}) as MethodAbi).outputs;
+ resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this));
+ resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this));
+ return resultArray[0];
+ },
+ };
+ public required = {
+ async callAsync(
+ callData: Partial<CallData> = {},
+ defaultBlock?: BlockParam,
+ ): Promise<BigNumber
+ > {
+ const self = this as any as AssetProxyOwnerContract;
+ const functionSignature = 'required()';
+ const inputAbi = self._lookupAbi(functionSignature).inputs;
+ [] = BaseContract._formatABIDataItemList(inputAbi, [], BaseContract._bigNumberToString.bind(self));
+ BaseContract.strictArgumentEncodingCheck(inputAbi, []);
+ const ethersFunction = self._lookupEthersInterface(functionSignature).functions.required;
+ const encodedData = ethersFunction.encode([]);
+ const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
+ {
+ to: self.address,
+ ...callData,
+ data: encodedData,
+ },
+ self._web3Wrapper.getContractDefaults(),
+ );
+ const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
+ BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
+ let resultArray = ethersFunction.decode(rawCallResult);
+ const outputAbi = (_.find(self.abi, {name: 'required'}) as MethodAbi).outputs;
+ resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this));
+ resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this));
+ return resultArray[0];
+ },
+ };
+ public replaceOwner = {
+ async sendTransactionAsync(
+ owner: string,
+ newOwner: string,
+ txData: Partial<TxData> = {},
+ ): Promise<string> {
+ const self = this as any as AssetProxyOwnerContract;
+ const inputAbi = self._lookupAbi('replaceOwner(address,address)').inputs;
+ [owner,
+ newOwner
+ ] = BaseContract._formatABIDataItemList(inputAbi, [owner,
+ newOwner
+ ], BaseContract._bigNumberToString.bind(self));
+ BaseContract.strictArgumentEncodingCheck(inputAbi, [owner,
+ newOwner
+ ]);
+ const encodedData = self._lookupEthersInterface('replaceOwner(address,address)').functions.replaceOwner.encode([owner,
+ newOwner
+ ]);
+ const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
+ {
+ to: self.address,
+ ...txData,
+ data: encodedData,
+ },
+ self._web3Wrapper.getContractDefaults(),
+ self.replaceOwner.estimateGasAsync.bind(
+ self,
+ owner,
+ newOwner
+ ),
+ );
+ const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults);
+ return txHash;
+ },
+ async estimateGasAsync(
+ owner: string,
+ newOwner: string,
+ txData: Partial<TxData> = {},
+ ): Promise<number> {
+ const self = this as any as AssetProxyOwnerContract;
+ const inputAbi = self._lookupAbi('replaceOwner(address,address)').inputs;
+ [owner,
+ newOwner
+ ] = BaseContract._formatABIDataItemList(inputAbi, [owner,
+ newOwner
+ ], BaseContract._bigNumberToString);
+ const encodedData = self._lookupEthersInterface('replaceOwner(address,address)').functions.replaceOwner.encode([owner,
+ newOwner
+ ]);
+ const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
+ {
+ to: self.address,
+ ...txData,
+ data: encodedData,
+ },
+ self._web3Wrapper.getContractDefaults(),
+ );
+ const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults);
+ return gas;
+ },
+ getABIEncodedTransactionData(
+ owner: string,
+ newOwner: string,
+ ): string {
+ const self = this as any as AssetProxyOwnerContract;
+ const inputAbi = self._lookupAbi('replaceOwner(address,address)').inputs;
+ [owner,
+ newOwner
+ ] = BaseContract._formatABIDataItemList(inputAbi, [owner,
+ newOwner
+ ], BaseContract._bigNumberToString);
+ const abiEncodedTransactionData = self._lookupEthersInterface('replaceOwner(address,address)').functions.replaceOwner.encode([owner,
+ newOwner
+ ]);
+ return abiEncodedTransactionData;
+ },
+ async callAsync(
+ owner: string,
+ newOwner: string,
+ callData: Partial<CallData> = {},
+ defaultBlock?: BlockParam,
+ ): Promise<void
+ > {
+ const self = this as any as AssetProxyOwnerContract;
+ const functionSignature = 'replaceOwner(address,address)';
+ const inputAbi = self._lookupAbi(functionSignature).inputs;
+ [owner,
+ newOwner
+ ] = BaseContract._formatABIDataItemList(inputAbi, [owner,
+ newOwner
+ ], BaseContract._bigNumberToString.bind(self));
+ BaseContract.strictArgumentEncodingCheck(inputAbi, [owner,
+ newOwner
+ ]);
+ const ethersFunction = self._lookupEthersInterface(functionSignature).functions.replaceOwner;
+ const encodedData = ethersFunction.encode([owner,
+ newOwner
+ ]);
+ const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
+ {
+ to: self.address,
+ ...callData,
+ data: encodedData,
+ },
+ self._web3Wrapper.getContractDefaults(),
+ );
+ const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
+ BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
+ let resultArray = ethersFunction.decode(rawCallResult);
+ const outputAbi = (_.find(self.abi, {name: 'replaceOwner'}) as MethodAbi).outputs;
+ resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this));
+ resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this));
+ return resultArray;
+ },
+ };
+ public executeTransaction = {
+ async sendTransactionAsync(
+ transactionId: BigNumber,
+ txData: Partial<TxData> = {},
+ ): Promise<string> {
+ const self = this as any as AssetProxyOwnerContract;
+ const inputAbi = self._lookupAbi('executeTransaction(uint256)').inputs;
+ [transactionId
+ ] = BaseContract._formatABIDataItemList(inputAbi, [transactionId
+ ], BaseContract._bigNumberToString.bind(self));
+ BaseContract.strictArgumentEncodingCheck(inputAbi, [transactionId
+ ]);
+ const encodedData = self._lookupEthersInterface('executeTransaction(uint256)').functions.executeTransaction.encode([transactionId
+ ]);
+ const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
+ {
+ to: self.address,
+ ...txData,
+ data: encodedData,
+ },
+ self._web3Wrapper.getContractDefaults(),
+ self.executeTransaction.estimateGasAsync.bind(
+ self,
+ transactionId
+ ),
+ );
+ const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults);
+ return txHash;
+ },
+ async estimateGasAsync(
+ transactionId: BigNumber,
+ txData: Partial<TxData> = {},
+ ): Promise<number> {
+ const self = this as any as AssetProxyOwnerContract;
+ const inputAbi = self._lookupAbi('executeTransaction(uint256)').inputs;
+ [transactionId
+ ] = BaseContract._formatABIDataItemList(inputAbi, [transactionId
+ ], BaseContract._bigNumberToString);
+ const encodedData = self._lookupEthersInterface('executeTransaction(uint256)').functions.executeTransaction.encode([transactionId
+ ]);
+ const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
+ {
+ to: self.address,
+ ...txData,
+ data: encodedData,
+ },
+ self._web3Wrapper.getContractDefaults(),
+ );
+ const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults);
+ return gas;
+ },
+ getABIEncodedTransactionData(
+ transactionId: BigNumber,
+ ): string {
+ const self = this as any as AssetProxyOwnerContract;
+ const inputAbi = self._lookupAbi('executeTransaction(uint256)').inputs;
+ [transactionId
+ ] = BaseContract._formatABIDataItemList(inputAbi, [transactionId
+ ], BaseContract._bigNumberToString);
+ const abiEncodedTransactionData = self._lookupEthersInterface('executeTransaction(uint256)').functions.executeTransaction.encode([transactionId
+ ]);
+ return abiEncodedTransactionData;
+ },
+ async callAsync(
+ transactionId: BigNumber,
+ callData: Partial<CallData> = {},
+ defaultBlock?: BlockParam,
+ ): Promise<void
+ > {
+ const self = this as any as AssetProxyOwnerContract;
+ const functionSignature = 'executeTransaction(uint256)';
+ const inputAbi = self._lookupAbi(functionSignature).inputs;
+ [transactionId
+ ] = BaseContract._formatABIDataItemList(inputAbi, [transactionId
+ ], BaseContract._bigNumberToString.bind(self));
+ BaseContract.strictArgumentEncodingCheck(inputAbi, [transactionId
+ ]);
+ const ethersFunction = self._lookupEthersInterface(functionSignature).functions.executeTransaction;
+ const encodedData = ethersFunction.encode([transactionId
+ ]);
+ const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
+ {
+ to: self.address,
+ ...callData,
+ data: encodedData,
+ },
+ self._web3Wrapper.getContractDefaults(),
+ );
+ const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
+ BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
+ let resultArray = ethersFunction.decode(rawCallResult);
+ const outputAbi = (_.find(self.abi, {name: 'executeTransaction'}) as MethodAbi).outputs;
+ resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this));
+ resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this));
+ return resultArray;
+ },
+ };
+ public static async deployFrom0xArtifactAsync(
+ artifact: ContractArtifact,
+ provider: Provider,
+ txDefaults: Partial<TxData>,
+ _owners: string[],
+ _assetProxyContracts: string[],
+ _required: BigNumber,
+ _secondsTimeLocked: BigNumber,
+ ): Promise<AssetProxyOwnerContract> {
+ if (_.isUndefined(artifact.compilerOutput)) {
+ throw new Error('Compiler output not found in the artifact file');
+ }
+ const bytecode = artifact.compilerOutput.evm.bytecode.object;
+ const abi = artifact.compilerOutput.abi;
+ return AssetProxyOwnerContract.deployAsync(bytecode, abi, provider, txDefaults, _owners,
+_assetProxyContracts,
+_required,
+_secondsTimeLocked
+);
+ }
+ public static async deployAsync(
+ bytecode: string,
+ abi: ContractAbi,
+ provider: Provider,
+ txDefaults: Partial<TxData>,
+ _owners: string[],
+ _assetProxyContracts: string[],
+ _required: BigNumber,
+ _secondsTimeLocked: BigNumber,
+ ): Promise<AssetProxyOwnerContract> {
+ const constructorAbi = BaseContract._lookupConstructorAbi(abi);
+ [_owners,
+_assetProxyContracts,
+_required,
+_secondsTimeLocked
+] = BaseContract._formatABIDataItemList(
+ constructorAbi.inputs,
+ [_owners,
+_assetProxyContracts,
+_required,
+_secondsTimeLocked
+],
+ BaseContract._bigNumberToString,
+ );
+ const iface = new ethers.utils.Interface(abi);
+ const deployInfo = iface.deployFunction;
+ const txData = deployInfo.encode(bytecode, [_owners,
+_assetProxyContracts,
+_required,
+_secondsTimeLocked
+]);
+ const web3Wrapper = new Web3Wrapper(provider);
+ const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
+ {data: txData},
+ txDefaults,
+ web3Wrapper.estimateGasAsync.bind(web3Wrapper),
+ );
+ const txHash = await web3Wrapper.sendTransactionAsync(txDataWithDefaults);
+ logUtils.log(`transactionHash: ${txHash}`);
+ const txReceipt = await web3Wrapper.awaitTransactionSuccessAsync(txHash);
+ logUtils.log(`AssetProxyOwner successfully deployed at ${txReceipt.contractAddress}`);
+ const contractInstance = new AssetProxyOwnerContract(abi, txReceipt.contractAddress as string, provider, txDefaults);
+ contractInstance.constructorArgs = [_owners,
+_assetProxyContracts,
+_required,
+_secondsTimeLocked
+];
+ return contractInstance;
+ }
+ constructor(abi: ContractAbi, address: string, provider: Provider, txDefaults?: Partial<TxData>) {
+ super('AssetProxyOwner', abi, address, provider, txDefaults);
+ classUtils.bindAll(this, ['_ethersInterfacesByFunctionSignature', 'address', 'abi', '_web3Wrapper']);
+ }
+} // tslint:disable:max-file-line-count
+// tslint:enable:no-unbound-method
diff --git a/packages/abi-gen-wrappers/src/generated-wrappers/dummy_erc20_token.ts b/packages/abi-gen-wrappers/src/generated-wrappers/dummy_erc20_token.ts
new file mode 100644
index 000000000..f8ba30cb1
--- /dev/null
+++ b/packages/abi-gen-wrappers/src/generated-wrappers/dummy_erc20_token.ts
@@ -0,0 +1,1044 @@
+// tslint:disable:no-consecutive-blank-lines ordered-imports align trailing-comma whitespace class-name
+// tslint:disable:no-unused-variable
+// tslint:disable:no-unbound-method
+import { BaseContract } from '@0xproject/base-contract';
+import { BlockParam, BlockParamLiteral, CallData, ContractAbi, ContractArtifact, DecodedLogArgs, MethodAbi, Provider, TxData, TxDataPayable } from 'ethereum-types';
+import { BigNumber, classUtils, logUtils } from '@0xproject/utils';
+import { Web3Wrapper } from '@0xproject/web3-wrapper';
+import * as ethers from 'ethers';
+import * as _ from 'lodash';
+// tslint:enable:no-unused-variable
+
+export type DummyERC20TokenEventArgs =
+ | DummyERC20TokenTransferEventArgs
+ | DummyERC20TokenApprovalEventArgs;
+
+export enum DummyERC20TokenEvents {
+ Transfer = 'Transfer',
+ Approval = 'Approval',
+}
+
+export interface DummyERC20TokenTransferEventArgs extends DecodedLogArgs {
+ _from: string;
+ _to: string;
+ _value: BigNumber;
+}
+
+export interface DummyERC20TokenApprovalEventArgs extends DecodedLogArgs {
+ _owner: string;
+ _spender: string;
+ _value: BigNumber;
+}
+
+
+/* istanbul ignore next */
+// tslint:disable:no-parameter-reassignment
+// tslint:disable-next-line:class-name
+export class DummyERC20TokenContract extends BaseContract {
+ public name = {
+ async callAsync(
+ callData: Partial<CallData> = {},
+ defaultBlock?: BlockParam,
+ ): Promise<string
+ > {
+ const self = this as any as DummyERC20TokenContract;
+ const functionSignature = 'name()';
+ const inputAbi = self._lookupAbi(functionSignature).inputs;
+ [] = BaseContract._formatABIDataItemList(inputAbi, [], BaseContract._bigNumberToString.bind(self));
+ BaseContract.strictArgumentEncodingCheck(inputAbi, []);
+ const ethersFunction = self._lookupEthersInterface(functionSignature).functions.name;
+ const encodedData = ethersFunction.encode([]);
+ const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
+ {
+ to: self.address,
+ ...callData,
+ data: encodedData,
+ },
+ self._web3Wrapper.getContractDefaults(),
+ );
+ const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
+ BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
+ let resultArray = ethersFunction.decode(rawCallResult);
+ const outputAbi = (_.find(self.abi, {name: 'name'}) as MethodAbi).outputs;
+ resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this));
+ resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this));
+ return resultArray[0];
+ },
+ };
+ public approve = {
+ async sendTransactionAsync(
+ _spender: string,
+ _value: BigNumber,
+ txData: Partial<TxData> = {},
+ ): Promise<string> {
+ const self = this as any as DummyERC20TokenContract;
+ const inputAbi = self._lookupAbi('approve(address,uint256)').inputs;
+ [_spender,
+ _value
+ ] = BaseContract._formatABIDataItemList(inputAbi, [_spender,
+ _value
+ ], BaseContract._bigNumberToString.bind(self));
+ BaseContract.strictArgumentEncodingCheck(inputAbi, [_spender,
+ _value
+ ]);
+ const encodedData = self._lookupEthersInterface('approve(address,uint256)').functions.approve.encode([_spender,
+ _value
+ ]);
+ const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
+ {
+ to: self.address,
+ ...txData,
+ data: encodedData,
+ },
+ self._web3Wrapper.getContractDefaults(),
+ self.approve.estimateGasAsync.bind(
+ self,
+ _spender,
+ _value
+ ),
+ );
+ const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults);
+ return txHash;
+ },
+ async estimateGasAsync(
+ _spender: string,
+ _value: BigNumber,
+ txData: Partial<TxData> = {},
+ ): Promise<number> {
+ const self = this as any as DummyERC20TokenContract;
+ const inputAbi = self._lookupAbi('approve(address,uint256)').inputs;
+ [_spender,
+ _value
+ ] = BaseContract._formatABIDataItemList(inputAbi, [_spender,
+ _value
+ ], BaseContract._bigNumberToString);
+ const encodedData = self._lookupEthersInterface('approve(address,uint256)').functions.approve.encode([_spender,
+ _value
+ ]);
+ const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
+ {
+ to: self.address,
+ ...txData,
+ data: encodedData,
+ },
+ self._web3Wrapper.getContractDefaults(),
+ );
+ const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults);
+ return gas;
+ },
+ getABIEncodedTransactionData(
+ _spender: string,
+ _value: BigNumber,
+ ): string {
+ const self = this as any as DummyERC20TokenContract;
+ const inputAbi = self._lookupAbi('approve(address,uint256)').inputs;
+ [_spender,
+ _value
+ ] = BaseContract._formatABIDataItemList(inputAbi, [_spender,
+ _value
+ ], BaseContract._bigNumberToString);
+ const abiEncodedTransactionData = self._lookupEthersInterface('approve(address,uint256)').functions.approve.encode([_spender,
+ _value
+ ]);
+ return abiEncodedTransactionData;
+ },
+ async callAsync(
+ _spender: string,
+ _value: BigNumber,
+ callData: Partial<CallData> = {},
+ defaultBlock?: BlockParam,
+ ): Promise<boolean
+ > {
+ const self = this as any as DummyERC20TokenContract;
+ const functionSignature = 'approve(address,uint256)';
+ const inputAbi = self._lookupAbi(functionSignature).inputs;
+ [_spender,
+ _value
+ ] = BaseContract._formatABIDataItemList(inputAbi, [_spender,
+ _value
+ ], BaseContract._bigNumberToString.bind(self));
+ BaseContract.strictArgumentEncodingCheck(inputAbi, [_spender,
+ _value
+ ]);
+ const ethersFunction = self._lookupEthersInterface(functionSignature).functions.approve;
+ const encodedData = ethersFunction.encode([_spender,
+ _value
+ ]);
+ const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
+ {
+ to: self.address,
+ ...callData,
+ data: encodedData,
+ },
+ self._web3Wrapper.getContractDefaults(),
+ );
+ const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
+ BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
+ let resultArray = ethersFunction.decode(rawCallResult);
+ const outputAbi = (_.find(self.abi, {name: 'approve'}) as MethodAbi).outputs;
+ resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this));
+ resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this));
+ return resultArray[0];
+ },
+ };
+ public totalSupply = {
+ async callAsync(
+ callData: Partial<CallData> = {},
+ defaultBlock?: BlockParam,
+ ): Promise<BigNumber
+ > {
+ const self = this as any as DummyERC20TokenContract;
+ const functionSignature = 'totalSupply()';
+ const inputAbi = self._lookupAbi(functionSignature).inputs;
+ [] = BaseContract._formatABIDataItemList(inputAbi, [], BaseContract._bigNumberToString.bind(self));
+ BaseContract.strictArgumentEncodingCheck(inputAbi, []);
+ const ethersFunction = self._lookupEthersInterface(functionSignature).functions.totalSupply;
+ const encodedData = ethersFunction.encode([]);
+ const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
+ {
+ to: self.address,
+ ...callData,
+ data: encodedData,
+ },
+ self._web3Wrapper.getContractDefaults(),
+ );
+ const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
+ BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
+ let resultArray = ethersFunction.decode(rawCallResult);
+ const outputAbi = (_.find(self.abi, {name: 'totalSupply'}) as MethodAbi).outputs;
+ resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this));
+ resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this));
+ return resultArray[0];
+ },
+ };
+ public transferFrom = {
+ async sendTransactionAsync(
+ _from: string,
+ _to: string,
+ _value: BigNumber,
+ txData: Partial<TxData> = {},
+ ): Promise<string> {
+ const self = this as any as DummyERC20TokenContract;
+ const inputAbi = self._lookupAbi('transferFrom(address,address,uint256)').inputs;
+ [_from,
+ _to,
+ _value
+ ] = BaseContract._formatABIDataItemList(inputAbi, [_from,
+ _to,
+ _value
+ ], BaseContract._bigNumberToString.bind(self));
+ BaseContract.strictArgumentEncodingCheck(inputAbi, [_from,
+ _to,
+ _value
+ ]);
+ const encodedData = self._lookupEthersInterface('transferFrom(address,address,uint256)').functions.transferFrom.encode([_from,
+ _to,
+ _value
+ ]);
+ const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
+ {
+ to: self.address,
+ ...txData,
+ data: encodedData,
+ },
+ self._web3Wrapper.getContractDefaults(),
+ self.transferFrom.estimateGasAsync.bind(
+ self,
+ _from,
+ _to,
+ _value
+ ),
+ );
+ const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults);
+ return txHash;
+ },
+ async estimateGasAsync(
+ _from: string,
+ _to: string,
+ _value: BigNumber,
+ txData: Partial<TxData> = {},
+ ): Promise<number> {
+ const self = this as any as DummyERC20TokenContract;
+ const inputAbi = self._lookupAbi('transferFrom(address,address,uint256)').inputs;
+ [_from,
+ _to,
+ _value
+ ] = BaseContract._formatABIDataItemList(inputAbi, [_from,
+ _to,
+ _value
+ ], BaseContract._bigNumberToString);
+ const encodedData = self._lookupEthersInterface('transferFrom(address,address,uint256)').functions.transferFrom.encode([_from,
+ _to,
+ _value
+ ]);
+ const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
+ {
+ to: self.address,
+ ...txData,
+ data: encodedData,
+ },
+ self._web3Wrapper.getContractDefaults(),
+ );
+ const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults);
+ return gas;
+ },
+ getABIEncodedTransactionData(
+ _from: string,
+ _to: string,
+ _value: BigNumber,
+ ): string {
+ const self = this as any as DummyERC20TokenContract;
+ const inputAbi = self._lookupAbi('transferFrom(address,address,uint256)').inputs;
+ [_from,
+ _to,
+ _value
+ ] = BaseContract._formatABIDataItemList(inputAbi, [_from,
+ _to,
+ _value
+ ], BaseContract._bigNumberToString);
+ const abiEncodedTransactionData = self._lookupEthersInterface('transferFrom(address,address,uint256)').functions.transferFrom.encode([_from,
+ _to,
+ _value
+ ]);
+ return abiEncodedTransactionData;
+ },
+ async callAsync(
+ _from: string,
+ _to: string,
+ _value: BigNumber,
+ callData: Partial<CallData> = {},
+ defaultBlock?: BlockParam,
+ ): Promise<boolean
+ > {
+ const self = this as any as DummyERC20TokenContract;
+ const functionSignature = 'transferFrom(address,address,uint256)';
+ const inputAbi = self._lookupAbi(functionSignature).inputs;
+ [_from,
+ _to,
+ _value
+ ] = BaseContract._formatABIDataItemList(inputAbi, [_from,
+ _to,
+ _value
+ ], BaseContract._bigNumberToString.bind(self));
+ BaseContract.strictArgumentEncodingCheck(inputAbi, [_from,
+ _to,
+ _value
+ ]);
+ const ethersFunction = self._lookupEthersInterface(functionSignature).functions.transferFrom;
+ const encodedData = ethersFunction.encode([_from,
+ _to,
+ _value
+ ]);
+ const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
+ {
+ to: self.address,
+ ...callData,
+ data: encodedData,
+ },
+ self._web3Wrapper.getContractDefaults(),
+ );
+ const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
+ BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
+ let resultArray = ethersFunction.decode(rawCallResult);
+ const outputAbi = (_.find(self.abi, {name: 'transferFrom'}) as MethodAbi).outputs;
+ resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this));
+ resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this));
+ return resultArray[0];
+ },
+ };
+ public decimals = {
+ async callAsync(
+ callData: Partial<CallData> = {},
+ defaultBlock?: BlockParam,
+ ): Promise<BigNumber
+ > {
+ const self = this as any as DummyERC20TokenContract;
+ const functionSignature = 'decimals()';
+ const inputAbi = self._lookupAbi(functionSignature).inputs;
+ [] = BaseContract._formatABIDataItemList(inputAbi, [], BaseContract._bigNumberToString.bind(self));
+ BaseContract.strictArgumentEncodingCheck(inputAbi, []);
+ const ethersFunction = self._lookupEthersInterface(functionSignature).functions.decimals;
+ const encodedData = ethersFunction.encode([]);
+ const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
+ {
+ to: self.address,
+ ...callData,
+ data: encodedData,
+ },
+ self._web3Wrapper.getContractDefaults(),
+ );
+ const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
+ BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
+ let resultArray = ethersFunction.decode(rawCallResult);
+ const outputAbi = (_.find(self.abi, {name: 'decimals'}) as MethodAbi).outputs;
+ resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this));
+ resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this));
+ return resultArray[0];
+ },
+ };
+ public balanceOf = {
+ async callAsync(
+ _owner: string,
+ callData: Partial<CallData> = {},
+ defaultBlock?: BlockParam,
+ ): Promise<BigNumber
+ > {
+ const self = this as any as DummyERC20TokenContract;
+ const functionSignature = 'balanceOf(address)';
+ const inputAbi = self._lookupAbi(functionSignature).inputs;
+ [_owner
+ ] = BaseContract._formatABIDataItemList(inputAbi, [_owner
+ ], BaseContract._bigNumberToString.bind(self));
+ BaseContract.strictArgumentEncodingCheck(inputAbi, [_owner
+ ]);
+ const ethersFunction = self._lookupEthersInterface(functionSignature).functions.balanceOf;
+ const encodedData = ethersFunction.encode([_owner
+ ]);
+ const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
+ {
+ to: self.address,
+ ...callData,
+ data: encodedData,
+ },
+ self._web3Wrapper.getContractDefaults(),
+ );
+ const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
+ BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
+ let resultArray = ethersFunction.decode(rawCallResult);
+ const outputAbi = (_.find(self.abi, {name: 'balanceOf'}) as MethodAbi).outputs;
+ resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this));
+ resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this));
+ return resultArray[0];
+ },
+ };
+ public owner = {
+ async callAsync(
+ callData: Partial<CallData> = {},
+ defaultBlock?: BlockParam,
+ ): Promise<string
+ > {
+ const self = this as any as DummyERC20TokenContract;
+ const functionSignature = 'owner()';
+ const inputAbi = self._lookupAbi(functionSignature).inputs;
+ [] = BaseContract._formatABIDataItemList(inputAbi, [], BaseContract._bigNumberToString.bind(self));
+ BaseContract.strictArgumentEncodingCheck(inputAbi, []);
+ const ethersFunction = self._lookupEthersInterface(functionSignature).functions.owner;
+ const encodedData = ethersFunction.encode([]);
+ const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
+ {
+ to: self.address,
+ ...callData,
+ data: encodedData,
+ },
+ self._web3Wrapper.getContractDefaults(),
+ );
+ const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
+ BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
+ let resultArray = ethersFunction.decode(rawCallResult);
+ const outputAbi = (_.find(self.abi, {name: 'owner'}) as MethodAbi).outputs;
+ resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this));
+ resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this));
+ return resultArray[0];
+ },
+ };
+ public symbol = {
+ async callAsync(
+ callData: Partial<CallData> = {},
+ defaultBlock?: BlockParam,
+ ): Promise<string
+ > {
+ const self = this as any as DummyERC20TokenContract;
+ const functionSignature = 'symbol()';
+ const inputAbi = self._lookupAbi(functionSignature).inputs;
+ [] = BaseContract._formatABIDataItemList(inputAbi, [], BaseContract._bigNumberToString.bind(self));
+ BaseContract.strictArgumentEncodingCheck(inputAbi, []);
+ const ethersFunction = self._lookupEthersInterface(functionSignature).functions.symbol;
+ const encodedData = ethersFunction.encode([]);
+ const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
+ {
+ to: self.address,
+ ...callData,
+ data: encodedData,
+ },
+ self._web3Wrapper.getContractDefaults(),
+ );
+ const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
+ BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
+ let resultArray = ethersFunction.decode(rawCallResult);
+ const outputAbi = (_.find(self.abi, {name: 'symbol'}) as MethodAbi).outputs;
+ resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this));
+ resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this));
+ return resultArray[0];
+ },
+ };
+ public mint = {
+ async sendTransactionAsync(
+ _value: BigNumber,
+ txData: Partial<TxData> = {},
+ ): Promise<string> {
+ const self = this as any as DummyERC20TokenContract;
+ const inputAbi = self._lookupAbi('mint(uint256)').inputs;
+ [_value
+ ] = BaseContract._formatABIDataItemList(inputAbi, [_value
+ ], BaseContract._bigNumberToString.bind(self));
+ BaseContract.strictArgumentEncodingCheck(inputAbi, [_value
+ ]);
+ const encodedData = self._lookupEthersInterface('mint(uint256)').functions.mint.encode([_value
+ ]);
+ const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
+ {
+ to: self.address,
+ ...txData,
+ data: encodedData,
+ },
+ self._web3Wrapper.getContractDefaults(),
+ self.mint.estimateGasAsync.bind(
+ self,
+ _value
+ ),
+ );
+ const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults);
+ return txHash;
+ },
+ async estimateGasAsync(
+ _value: BigNumber,
+ txData: Partial<TxData> = {},
+ ): Promise<number> {
+ const self = this as any as DummyERC20TokenContract;
+ const inputAbi = self._lookupAbi('mint(uint256)').inputs;
+ [_value
+ ] = BaseContract._formatABIDataItemList(inputAbi, [_value
+ ], BaseContract._bigNumberToString);
+ const encodedData = self._lookupEthersInterface('mint(uint256)').functions.mint.encode([_value
+ ]);
+ const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
+ {
+ to: self.address,
+ ...txData,
+ data: encodedData,
+ },
+ self._web3Wrapper.getContractDefaults(),
+ );
+ const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults);
+ return gas;
+ },
+ getABIEncodedTransactionData(
+ _value: BigNumber,
+ ): string {
+ const self = this as any as DummyERC20TokenContract;
+ const inputAbi = self._lookupAbi('mint(uint256)').inputs;
+ [_value
+ ] = BaseContract._formatABIDataItemList(inputAbi, [_value
+ ], BaseContract._bigNumberToString);
+ const abiEncodedTransactionData = self._lookupEthersInterface('mint(uint256)').functions.mint.encode([_value
+ ]);
+ return abiEncodedTransactionData;
+ },
+ async callAsync(
+ _value: BigNumber,
+ callData: Partial<CallData> = {},
+ defaultBlock?: BlockParam,
+ ): Promise<void
+ > {
+ const self = this as any as DummyERC20TokenContract;
+ const functionSignature = 'mint(uint256)';
+ const inputAbi = self._lookupAbi(functionSignature).inputs;
+ [_value
+ ] = BaseContract._formatABIDataItemList(inputAbi, [_value
+ ], BaseContract._bigNumberToString.bind(self));
+ BaseContract.strictArgumentEncodingCheck(inputAbi, [_value
+ ]);
+ const ethersFunction = self._lookupEthersInterface(functionSignature).functions.mint;
+ const encodedData = ethersFunction.encode([_value
+ ]);
+ const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
+ {
+ to: self.address,
+ ...callData,
+ data: encodedData,
+ },
+ self._web3Wrapper.getContractDefaults(),
+ );
+ const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
+ BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
+ let resultArray = ethersFunction.decode(rawCallResult);
+ const outputAbi = (_.find(self.abi, {name: 'mint'}) as MethodAbi).outputs;
+ resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this));
+ resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this));
+ return resultArray;
+ },
+ };
+ public transfer = {
+ async sendTransactionAsync(
+ _to: string,
+ _value: BigNumber,
+ txData: Partial<TxData> = {},
+ ): Promise<string> {
+ const self = this as any as DummyERC20TokenContract;
+ const inputAbi = self._lookupAbi('transfer(address,uint256)').inputs;
+ [_to,
+ _value
+ ] = BaseContract._formatABIDataItemList(inputAbi, [_to,
+ _value
+ ], BaseContract._bigNumberToString.bind(self));
+ BaseContract.strictArgumentEncodingCheck(inputAbi, [_to,
+ _value
+ ]);
+ const encodedData = self._lookupEthersInterface('transfer(address,uint256)').functions.transfer.encode([_to,
+ _value
+ ]);
+ const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
+ {
+ to: self.address,
+ ...txData,
+ data: encodedData,
+ },
+ self._web3Wrapper.getContractDefaults(),
+ self.transfer.estimateGasAsync.bind(
+ self,
+ _to,
+ _value
+ ),
+ );
+ const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults);
+ return txHash;
+ },
+ async estimateGasAsync(
+ _to: string,
+ _value: BigNumber,
+ txData: Partial<TxData> = {},
+ ): Promise<number> {
+ const self = this as any as DummyERC20TokenContract;
+ const inputAbi = self._lookupAbi('transfer(address,uint256)').inputs;
+ [_to,
+ _value
+ ] = BaseContract._formatABIDataItemList(inputAbi, [_to,
+ _value
+ ], BaseContract._bigNumberToString);
+ const encodedData = self._lookupEthersInterface('transfer(address,uint256)').functions.transfer.encode([_to,
+ _value
+ ]);
+ const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
+ {
+ to: self.address,
+ ...txData,
+ data: encodedData,
+ },
+ self._web3Wrapper.getContractDefaults(),
+ );
+ const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults);
+ return gas;
+ },
+ getABIEncodedTransactionData(
+ _to: string,
+ _value: BigNumber,
+ ): string {
+ const self = this as any as DummyERC20TokenContract;
+ const inputAbi = self._lookupAbi('transfer(address,uint256)').inputs;
+ [_to,
+ _value
+ ] = BaseContract._formatABIDataItemList(inputAbi, [_to,
+ _value
+ ], BaseContract._bigNumberToString);
+ const abiEncodedTransactionData = self._lookupEthersInterface('transfer(address,uint256)').functions.transfer.encode([_to,
+ _value
+ ]);
+ return abiEncodedTransactionData;
+ },
+ async callAsync(
+ _to: string,
+ _value: BigNumber,
+ callData: Partial<CallData> = {},
+ defaultBlock?: BlockParam,
+ ): Promise<boolean
+ > {
+ const self = this as any as DummyERC20TokenContract;
+ const functionSignature = 'transfer(address,uint256)';
+ const inputAbi = self._lookupAbi(functionSignature).inputs;
+ [_to,
+ _value
+ ] = BaseContract._formatABIDataItemList(inputAbi, [_to,
+ _value
+ ], BaseContract._bigNumberToString.bind(self));
+ BaseContract.strictArgumentEncodingCheck(inputAbi, [_to,
+ _value
+ ]);
+ const ethersFunction = self._lookupEthersInterface(functionSignature).functions.transfer;
+ const encodedData = ethersFunction.encode([_to,
+ _value
+ ]);
+ const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
+ {
+ to: self.address,
+ ...callData,
+ data: encodedData,
+ },
+ self._web3Wrapper.getContractDefaults(),
+ );
+ const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
+ BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
+ let resultArray = ethersFunction.decode(rawCallResult);
+ const outputAbi = (_.find(self.abi, {name: 'transfer'}) as MethodAbi).outputs;
+ resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this));
+ resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this));
+ return resultArray[0];
+ },
+ };
+ public allowance = {
+ async callAsync(
+ _owner: string,
+ _spender: string,
+ callData: Partial<CallData> = {},
+ defaultBlock?: BlockParam,
+ ): Promise<BigNumber
+ > {
+ const self = this as any as DummyERC20TokenContract;
+ const functionSignature = 'allowance(address,address)';
+ const inputAbi = self._lookupAbi(functionSignature).inputs;
+ [_owner,
+ _spender
+ ] = BaseContract._formatABIDataItemList(inputAbi, [_owner,
+ _spender
+ ], BaseContract._bigNumberToString.bind(self));
+ BaseContract.strictArgumentEncodingCheck(inputAbi, [_owner,
+ _spender
+ ]);
+ const ethersFunction = self._lookupEthersInterface(functionSignature).functions.allowance;
+ const encodedData = ethersFunction.encode([_owner,
+ _spender
+ ]);
+ const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
+ {
+ to: self.address,
+ ...callData,
+ data: encodedData,
+ },
+ self._web3Wrapper.getContractDefaults(),
+ );
+ const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
+ BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
+ let resultArray = ethersFunction.decode(rawCallResult);
+ const outputAbi = (_.find(self.abi, {name: 'allowance'}) as MethodAbi).outputs;
+ resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this));
+ resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this));
+ return resultArray[0];
+ },
+ };
+ public setBalance = {
+ async sendTransactionAsync(
+ _target: string,
+ _value: BigNumber,
+ txData: Partial<TxData> = {},
+ ): Promise<string> {
+ const self = this as any as DummyERC20TokenContract;
+ const inputAbi = self._lookupAbi('setBalance(address,uint256)').inputs;
+ [_target,
+ _value
+ ] = BaseContract._formatABIDataItemList(inputAbi, [_target,
+ _value
+ ], BaseContract._bigNumberToString.bind(self));
+ BaseContract.strictArgumentEncodingCheck(inputAbi, [_target,
+ _value
+ ]);
+ const encodedData = self._lookupEthersInterface('setBalance(address,uint256)').functions.setBalance.encode([_target,
+ _value
+ ]);
+ const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
+ {
+ to: self.address,
+ ...txData,
+ data: encodedData,
+ },
+ self._web3Wrapper.getContractDefaults(),
+ self.setBalance.estimateGasAsync.bind(
+ self,
+ _target,
+ _value
+ ),
+ );
+ const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults);
+ return txHash;
+ },
+ async estimateGasAsync(
+ _target: string,
+ _value: BigNumber,
+ txData: Partial<TxData> = {},
+ ): Promise<number> {
+ const self = this as any as DummyERC20TokenContract;
+ const inputAbi = self._lookupAbi('setBalance(address,uint256)').inputs;
+ [_target,
+ _value
+ ] = BaseContract._formatABIDataItemList(inputAbi, [_target,
+ _value
+ ], BaseContract._bigNumberToString);
+ const encodedData = self._lookupEthersInterface('setBalance(address,uint256)').functions.setBalance.encode([_target,
+ _value
+ ]);
+ const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
+ {
+ to: self.address,
+ ...txData,
+ data: encodedData,
+ },
+ self._web3Wrapper.getContractDefaults(),
+ );
+ const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults);
+ return gas;
+ },
+ getABIEncodedTransactionData(
+ _target: string,
+ _value: BigNumber,
+ ): string {
+ const self = this as any as DummyERC20TokenContract;
+ const inputAbi = self._lookupAbi('setBalance(address,uint256)').inputs;
+ [_target,
+ _value
+ ] = BaseContract._formatABIDataItemList(inputAbi, [_target,
+ _value
+ ], BaseContract._bigNumberToString);
+ const abiEncodedTransactionData = self._lookupEthersInterface('setBalance(address,uint256)').functions.setBalance.encode([_target,
+ _value
+ ]);
+ return abiEncodedTransactionData;
+ },
+ async callAsync(
+ _target: string,
+ _value: BigNumber,
+ callData: Partial<CallData> = {},
+ defaultBlock?: BlockParam,
+ ): Promise<void
+ > {
+ const self = this as any as DummyERC20TokenContract;
+ const functionSignature = 'setBalance(address,uint256)';
+ const inputAbi = self._lookupAbi(functionSignature).inputs;
+ [_target,
+ _value
+ ] = BaseContract._formatABIDataItemList(inputAbi, [_target,
+ _value
+ ], BaseContract._bigNumberToString.bind(self));
+ BaseContract.strictArgumentEncodingCheck(inputAbi, [_target,
+ _value
+ ]);
+ const ethersFunction = self._lookupEthersInterface(functionSignature).functions.setBalance;
+ const encodedData = ethersFunction.encode([_target,
+ _value
+ ]);
+ const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
+ {
+ to: self.address,
+ ...callData,
+ data: encodedData,
+ },
+ self._web3Wrapper.getContractDefaults(),
+ );
+ const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
+ BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
+ let resultArray = ethersFunction.decode(rawCallResult);
+ const outputAbi = (_.find(self.abi, {name: 'setBalance'}) as MethodAbi).outputs;
+ resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this));
+ resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this));
+ return resultArray;
+ },
+ };
+ public transferOwnership = {
+ async sendTransactionAsync(
+ newOwner: string,
+ txData: Partial<TxData> = {},
+ ): Promise<string> {
+ const self = this as any as DummyERC20TokenContract;
+ const inputAbi = self._lookupAbi('transferOwnership(address)').inputs;
+ [newOwner
+ ] = BaseContract._formatABIDataItemList(inputAbi, [newOwner
+ ], BaseContract._bigNumberToString.bind(self));
+ BaseContract.strictArgumentEncodingCheck(inputAbi, [newOwner
+ ]);
+ const encodedData = self._lookupEthersInterface('transferOwnership(address)').functions.transferOwnership.encode([newOwner
+ ]);
+ const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
+ {
+ to: self.address,
+ ...txData,
+ data: encodedData,
+ },
+ self._web3Wrapper.getContractDefaults(),
+ self.transferOwnership.estimateGasAsync.bind(
+ self,
+ newOwner
+ ),
+ );
+ const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults);
+ return txHash;
+ },
+ async estimateGasAsync(
+ newOwner: string,
+ txData: Partial<TxData> = {},
+ ): Promise<number> {
+ const self = this as any as DummyERC20TokenContract;
+ const inputAbi = self._lookupAbi('transferOwnership(address)').inputs;
+ [newOwner
+ ] = BaseContract._formatABIDataItemList(inputAbi, [newOwner
+ ], BaseContract._bigNumberToString);
+ const encodedData = self._lookupEthersInterface('transferOwnership(address)').functions.transferOwnership.encode([newOwner
+ ]);
+ const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
+ {
+ to: self.address,
+ ...txData,
+ data: encodedData,
+ },
+ self._web3Wrapper.getContractDefaults(),
+ );
+ const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults);
+ return gas;
+ },
+ getABIEncodedTransactionData(
+ newOwner: string,
+ ): string {
+ const self = this as any as DummyERC20TokenContract;
+ const inputAbi = self._lookupAbi('transferOwnership(address)').inputs;
+ [newOwner
+ ] = BaseContract._formatABIDataItemList(inputAbi, [newOwner
+ ], BaseContract._bigNumberToString);
+ const abiEncodedTransactionData = self._lookupEthersInterface('transferOwnership(address)').functions.transferOwnership.encode([newOwner
+ ]);
+ return abiEncodedTransactionData;
+ },
+ async callAsync(
+ newOwner: string,
+ callData: Partial<CallData> = {},
+ defaultBlock?: BlockParam,
+ ): Promise<void
+ > {
+ const self = this as any as DummyERC20TokenContract;
+ const functionSignature = 'transferOwnership(address)';
+ const inputAbi = self._lookupAbi(functionSignature).inputs;
+ [newOwner
+ ] = BaseContract._formatABIDataItemList(inputAbi, [newOwner
+ ], BaseContract._bigNumberToString.bind(self));
+ BaseContract.strictArgumentEncodingCheck(inputAbi, [newOwner
+ ]);
+ const ethersFunction = self._lookupEthersInterface(functionSignature).functions.transferOwnership;
+ const encodedData = ethersFunction.encode([newOwner
+ ]);
+ const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
+ {
+ to: self.address,
+ ...callData,
+ data: encodedData,
+ },
+ self._web3Wrapper.getContractDefaults(),
+ );
+ const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
+ BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
+ let resultArray = ethersFunction.decode(rawCallResult);
+ const outputAbi = (_.find(self.abi, {name: 'transferOwnership'}) as MethodAbi).outputs;
+ resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this));
+ resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this));
+ return resultArray;
+ },
+ };
+ public MAX_MINT_AMOUNT = {
+ async callAsync(
+ callData: Partial<CallData> = {},
+ defaultBlock?: BlockParam,
+ ): Promise<BigNumber
+ > {
+ const self = this as any as DummyERC20TokenContract;
+ const functionSignature = 'MAX_MINT_AMOUNT()';
+ const inputAbi = self._lookupAbi(functionSignature).inputs;
+ [] = BaseContract._formatABIDataItemList(inputAbi, [], BaseContract._bigNumberToString.bind(self));
+ BaseContract.strictArgumentEncodingCheck(inputAbi, []);
+ const ethersFunction = self._lookupEthersInterface(functionSignature).functions.MAX_MINT_AMOUNT;
+ const encodedData = ethersFunction.encode([]);
+ const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
+ {
+ to: self.address,
+ ...callData,
+ data: encodedData,
+ },
+ self._web3Wrapper.getContractDefaults(),
+ );
+ const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
+ BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
+ let resultArray = ethersFunction.decode(rawCallResult);
+ const outputAbi = (_.find(self.abi, {name: 'MAX_MINT_AMOUNT'}) as MethodAbi).outputs;
+ resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this));
+ resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this));
+ return resultArray[0];
+ },
+ };
+ public static async deployFrom0xArtifactAsync(
+ artifact: ContractArtifact,
+ provider: Provider,
+ txDefaults: Partial<TxData>,
+ _name: string,
+ _symbol: string,
+ _decimals: BigNumber,
+ _totalSupply: BigNumber,
+ ): Promise<DummyERC20TokenContract> {
+ if (_.isUndefined(artifact.compilerOutput)) {
+ throw new Error('Compiler output not found in the artifact file');
+ }
+ const bytecode = artifact.compilerOutput.evm.bytecode.object;
+ const abi = artifact.compilerOutput.abi;
+ return DummyERC20TokenContract.deployAsync(bytecode, abi, provider, txDefaults, _name,
+_symbol,
+_decimals,
+_totalSupply
+);
+ }
+ public static async deployAsync(
+ bytecode: string,
+ abi: ContractAbi,
+ provider: Provider,
+ txDefaults: Partial<TxData>,
+ _name: string,
+ _symbol: string,
+ _decimals: BigNumber,
+ _totalSupply: BigNumber,
+ ): Promise<DummyERC20TokenContract> {
+ const constructorAbi = BaseContract._lookupConstructorAbi(abi);
+ [_name,
+_symbol,
+_decimals,
+_totalSupply
+] = BaseContract._formatABIDataItemList(
+ constructorAbi.inputs,
+ [_name,
+_symbol,
+_decimals,
+_totalSupply
+],
+ BaseContract._bigNumberToString,
+ );
+ const iface = new ethers.utils.Interface(abi);
+ const deployInfo = iface.deployFunction;
+ const txData = deployInfo.encode(bytecode, [_name,
+_symbol,
+_decimals,
+_totalSupply
+]);
+ const web3Wrapper = new Web3Wrapper(provider);
+ const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
+ {data: txData},
+ txDefaults,
+ web3Wrapper.estimateGasAsync.bind(web3Wrapper),
+ );
+ const txHash = await web3Wrapper.sendTransactionAsync(txDataWithDefaults);
+ logUtils.log(`transactionHash: ${txHash}`);
+ const txReceipt = await web3Wrapper.awaitTransactionSuccessAsync(txHash);
+ logUtils.log(`DummyERC20Token successfully deployed at ${txReceipt.contractAddress}`);
+ const contractInstance = new DummyERC20TokenContract(abi, txReceipt.contractAddress as string, provider, txDefaults);
+ contractInstance.constructorArgs = [_name,
+_symbol,
+_decimals,
+_totalSupply
+];
+ return contractInstance;
+ }
+ constructor(abi: ContractAbi, address: string, provider: Provider, txDefaults?: Partial<TxData>) {
+ super('DummyERC20Token', abi, address, provider, txDefaults);
+ classUtils.bindAll(this, ['_ethersInterfacesByFunctionSignature', 'address', 'abi', '_web3Wrapper']);
+ }
+} // tslint:disable:max-file-line-count
+// tslint:enable:no-unbound-method
diff --git a/packages/abi-gen-wrappers/src/generated-wrappers/dummy_erc721_token.ts b/packages/abi-gen-wrappers/src/generated-wrappers/dummy_erc721_token.ts
new file mode 100644
index 000000000..ec56448fc
--- /dev/null
+++ b/packages/abi-gen-wrappers/src/generated-wrappers/dummy_erc721_token.ts
@@ -0,0 +1,1326 @@
+// tslint:disable:no-consecutive-blank-lines ordered-imports align trailing-comma whitespace class-name
+// tslint:disable:no-unused-variable
+// tslint:disable:no-unbound-method
+import { BaseContract } from '@0xproject/base-contract';
+import { BlockParam, BlockParamLiteral, CallData, ContractAbi, ContractArtifact, DecodedLogArgs, MethodAbi, Provider, TxData, TxDataPayable } from 'ethereum-types';
+import { BigNumber, classUtils, logUtils } from '@0xproject/utils';
+import { Web3Wrapper } from '@0xproject/web3-wrapper';
+import * as ethers from 'ethers';
+import * as _ from 'lodash';
+// tslint:enable:no-unused-variable
+
+export type DummyERC721TokenEventArgs =
+ | DummyERC721TokenTransferEventArgs
+ | DummyERC721TokenApprovalEventArgs
+ | DummyERC721TokenApprovalForAllEventArgs;
+
+export enum DummyERC721TokenEvents {
+ Transfer = 'Transfer',
+ Approval = 'Approval',
+ ApprovalForAll = 'ApprovalForAll',
+}
+
+export interface DummyERC721TokenTransferEventArgs extends DecodedLogArgs {
+ _from: string;
+ _to: string;
+ _tokenId: BigNumber;
+}
+
+export interface DummyERC721TokenApprovalEventArgs extends DecodedLogArgs {
+ _owner: string;
+ _approved: string;
+ _tokenId: BigNumber;
+}
+
+export interface DummyERC721TokenApprovalForAllEventArgs extends DecodedLogArgs {
+ _owner: string;
+ _operator: string;
+ _approved: boolean;
+}
+
+
+/* istanbul ignore next */
+// tslint:disable:no-parameter-reassignment
+// tslint:disable-next-line:class-name
+export class DummyERC721TokenContract extends BaseContract {
+ public name = {
+ async callAsync(
+ callData: Partial<CallData> = {},
+ defaultBlock?: BlockParam,
+ ): Promise<string
+ > {
+ const self = this as any as DummyERC721TokenContract;
+ const functionSignature = 'name()';
+ const inputAbi = self._lookupAbi(functionSignature).inputs;
+ [] = BaseContract._formatABIDataItemList(inputAbi, [], BaseContract._bigNumberToString.bind(self));
+ BaseContract.strictArgumentEncodingCheck(inputAbi, []);
+ const ethersFunction = self._lookupEthersInterface(functionSignature).functions.name;
+ const encodedData = ethersFunction.encode([]);
+ const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
+ {
+ to: self.address,
+ ...callData,
+ data: encodedData,
+ },
+ self._web3Wrapper.getContractDefaults(),
+ );
+ const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
+ BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
+ let resultArray = ethersFunction.decode(rawCallResult);
+ const outputAbi = (_.find(self.abi, {name: 'name'}) as MethodAbi).outputs;
+ resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this));
+ resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this));
+ return resultArray[0];
+ },
+ };
+ public getApproved = {
+ async callAsync(
+ _tokenId: BigNumber,
+ callData: Partial<CallData> = {},
+ defaultBlock?: BlockParam,
+ ): Promise<string
+ > {
+ const self = this as any as DummyERC721TokenContract;
+ const functionSignature = 'getApproved(uint256)';
+ const inputAbi = self._lookupAbi(functionSignature).inputs;
+ [_tokenId
+ ] = BaseContract._formatABIDataItemList(inputAbi, [_tokenId
+ ], BaseContract._bigNumberToString.bind(self));
+ BaseContract.strictArgumentEncodingCheck(inputAbi, [_tokenId
+ ]);
+ const ethersFunction = self._lookupEthersInterface(functionSignature).functions.getApproved;
+ const encodedData = ethersFunction.encode([_tokenId
+ ]);
+ const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
+ {
+ to: self.address,
+ ...callData,
+ data: encodedData,
+ },
+ self._web3Wrapper.getContractDefaults(),
+ );
+ const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
+ BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
+ let resultArray = ethersFunction.decode(rawCallResult);
+ const outputAbi = (_.find(self.abi, {name: 'getApproved'}) as MethodAbi).outputs;
+ resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this));
+ resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this));
+ return resultArray[0];
+ },
+ };
+ public approve = {
+ async sendTransactionAsync(
+ _approved: string,
+ _tokenId: BigNumber,
+ txData: Partial<TxData> = {},
+ ): Promise<string> {
+ const self = this as any as DummyERC721TokenContract;
+ const inputAbi = self._lookupAbi('approve(address,uint256)').inputs;
+ [_approved,
+ _tokenId
+ ] = BaseContract._formatABIDataItemList(inputAbi, [_approved,
+ _tokenId
+ ], BaseContract._bigNumberToString.bind(self));
+ BaseContract.strictArgumentEncodingCheck(inputAbi, [_approved,
+ _tokenId
+ ]);
+ const encodedData = self._lookupEthersInterface('approve(address,uint256)').functions.approve.encode([_approved,
+ _tokenId
+ ]);
+ const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
+ {
+ to: self.address,
+ ...txData,
+ data: encodedData,
+ },
+ self._web3Wrapper.getContractDefaults(),
+ self.approve.estimateGasAsync.bind(
+ self,
+ _approved,
+ _tokenId
+ ),
+ );
+ const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults);
+ return txHash;
+ },
+ async estimateGasAsync(
+ _approved: string,
+ _tokenId: BigNumber,
+ txData: Partial<TxData> = {},
+ ): Promise<number> {
+ const self = this as any as DummyERC721TokenContract;
+ const inputAbi = self._lookupAbi('approve(address,uint256)').inputs;
+ [_approved,
+ _tokenId
+ ] = BaseContract._formatABIDataItemList(inputAbi, [_approved,
+ _tokenId
+ ], BaseContract._bigNumberToString);
+ const encodedData = self._lookupEthersInterface('approve(address,uint256)').functions.approve.encode([_approved,
+ _tokenId
+ ]);
+ const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
+ {
+ to: self.address,
+ ...txData,
+ data: encodedData,
+ },
+ self._web3Wrapper.getContractDefaults(),
+ );
+ const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults);
+ return gas;
+ },
+ getABIEncodedTransactionData(
+ _approved: string,
+ _tokenId: BigNumber,
+ ): string {
+ const self = this as any as DummyERC721TokenContract;
+ const inputAbi = self._lookupAbi('approve(address,uint256)').inputs;
+ [_approved,
+ _tokenId
+ ] = BaseContract._formatABIDataItemList(inputAbi, [_approved,
+ _tokenId
+ ], BaseContract._bigNumberToString);
+ const abiEncodedTransactionData = self._lookupEthersInterface('approve(address,uint256)').functions.approve.encode([_approved,
+ _tokenId
+ ]);
+ return abiEncodedTransactionData;
+ },
+ async callAsync(
+ _approved: string,
+ _tokenId: BigNumber,
+ callData: Partial<CallData> = {},
+ defaultBlock?: BlockParam,
+ ): Promise<void
+ > {
+ const self = this as any as DummyERC721TokenContract;
+ const functionSignature = 'approve(address,uint256)';
+ const inputAbi = self._lookupAbi(functionSignature).inputs;
+ [_approved,
+ _tokenId
+ ] = BaseContract._formatABIDataItemList(inputAbi, [_approved,
+ _tokenId
+ ], BaseContract._bigNumberToString.bind(self));
+ BaseContract.strictArgumentEncodingCheck(inputAbi, [_approved,
+ _tokenId
+ ]);
+ const ethersFunction = self._lookupEthersInterface(functionSignature).functions.approve;
+ const encodedData = ethersFunction.encode([_approved,
+ _tokenId
+ ]);
+ const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
+ {
+ to: self.address,
+ ...callData,
+ data: encodedData,
+ },
+ self._web3Wrapper.getContractDefaults(),
+ );
+ const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
+ BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
+ let resultArray = ethersFunction.decode(rawCallResult);
+ const outputAbi = (_.find(self.abi, {name: 'approve'}) as MethodAbi).outputs;
+ resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this));
+ resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this));
+ return resultArray;
+ },
+ };
+ public transferFrom = {
+ async sendTransactionAsync(
+ _from: string,
+ _to: string,
+ _tokenId: BigNumber,
+ txData: Partial<TxData> = {},
+ ): Promise<string> {
+ const self = this as any as DummyERC721TokenContract;
+ const inputAbi = self._lookupAbi('transferFrom(address,address,uint256)').inputs;
+ [_from,
+ _to,
+ _tokenId
+ ] = BaseContract._formatABIDataItemList(inputAbi, [_from,
+ _to,
+ _tokenId
+ ], BaseContract._bigNumberToString.bind(self));
+ BaseContract.strictArgumentEncodingCheck(inputAbi, [_from,
+ _to,
+ _tokenId
+ ]);
+ const encodedData = self._lookupEthersInterface('transferFrom(address,address,uint256)').functions.transferFrom.encode([_from,
+ _to,
+ _tokenId
+ ]);
+ const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
+ {
+ to: self.address,
+ ...txData,
+ data: encodedData,
+ },
+ self._web3Wrapper.getContractDefaults(),
+ self.transferFrom.estimateGasAsync.bind(
+ self,
+ _from,
+ _to,
+ _tokenId
+ ),
+ );
+ const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults);
+ return txHash;
+ },
+ async estimateGasAsync(
+ _from: string,
+ _to: string,
+ _tokenId: BigNumber,
+ txData: Partial<TxData> = {},
+ ): Promise<number> {
+ const self = this as any as DummyERC721TokenContract;
+ const inputAbi = self._lookupAbi('transferFrom(address,address,uint256)').inputs;
+ [_from,
+ _to,
+ _tokenId
+ ] = BaseContract._formatABIDataItemList(inputAbi, [_from,
+ _to,
+ _tokenId
+ ], BaseContract._bigNumberToString);
+ const encodedData = self._lookupEthersInterface('transferFrom(address,address,uint256)').functions.transferFrom.encode([_from,
+ _to,
+ _tokenId
+ ]);
+ const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
+ {
+ to: self.address,
+ ...txData,
+ data: encodedData,
+ },
+ self._web3Wrapper.getContractDefaults(),
+ );
+ const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults);
+ return gas;
+ },
+ getABIEncodedTransactionData(
+ _from: string,
+ _to: string,
+ _tokenId: BigNumber,
+ ): string {
+ const self = this as any as DummyERC721TokenContract;
+ const inputAbi = self._lookupAbi('transferFrom(address,address,uint256)').inputs;
+ [_from,
+ _to,
+ _tokenId
+ ] = BaseContract._formatABIDataItemList(inputAbi, [_from,
+ _to,
+ _tokenId
+ ], BaseContract._bigNumberToString);
+ const abiEncodedTransactionData = self._lookupEthersInterface('transferFrom(address,address,uint256)').functions.transferFrom.encode([_from,
+ _to,
+ _tokenId
+ ]);
+ return abiEncodedTransactionData;
+ },
+ async callAsync(
+ _from: string,
+ _to: string,
+ _tokenId: BigNumber,
+ callData: Partial<CallData> = {},
+ defaultBlock?: BlockParam,
+ ): Promise<void
+ > {
+ const self = this as any as DummyERC721TokenContract;
+ const functionSignature = 'transferFrom(address,address,uint256)';
+ const inputAbi = self._lookupAbi(functionSignature).inputs;
+ [_from,
+ _to,
+ _tokenId
+ ] = BaseContract._formatABIDataItemList(inputAbi, [_from,
+ _to,
+ _tokenId
+ ], BaseContract._bigNumberToString.bind(self));
+ BaseContract.strictArgumentEncodingCheck(inputAbi, [_from,
+ _to,
+ _tokenId
+ ]);
+ const ethersFunction = self._lookupEthersInterface(functionSignature).functions.transferFrom;
+ const encodedData = ethersFunction.encode([_from,
+ _to,
+ _tokenId
+ ]);
+ const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
+ {
+ to: self.address,
+ ...callData,
+ data: encodedData,
+ },
+ self._web3Wrapper.getContractDefaults(),
+ );
+ const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
+ BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
+ let resultArray = ethersFunction.decode(rawCallResult);
+ const outputAbi = (_.find(self.abi, {name: 'transferFrom'}) as MethodAbi).outputs;
+ resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this));
+ resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this));
+ return resultArray;
+ },
+ };
+ public mint = {
+ async sendTransactionAsync(
+ _to: string,
+ _tokenId: BigNumber,
+ txData: Partial<TxData> = {},
+ ): Promise<string> {
+ const self = this as any as DummyERC721TokenContract;
+ const inputAbi = self._lookupAbi('mint(address,uint256)').inputs;
+ [_to,
+ _tokenId
+ ] = BaseContract._formatABIDataItemList(inputAbi, [_to,
+ _tokenId
+ ], BaseContract._bigNumberToString.bind(self));
+ BaseContract.strictArgumentEncodingCheck(inputAbi, [_to,
+ _tokenId
+ ]);
+ const encodedData = self._lookupEthersInterface('mint(address,uint256)').functions.mint.encode([_to,
+ _tokenId
+ ]);
+ const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
+ {
+ to: self.address,
+ ...txData,
+ data: encodedData,
+ },
+ self._web3Wrapper.getContractDefaults(),
+ self.mint.estimateGasAsync.bind(
+ self,
+ _to,
+ _tokenId
+ ),
+ );
+ const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults);
+ return txHash;
+ },
+ async estimateGasAsync(
+ _to: string,
+ _tokenId: BigNumber,
+ txData: Partial<TxData> = {},
+ ): Promise<number> {
+ const self = this as any as DummyERC721TokenContract;
+ const inputAbi = self._lookupAbi('mint(address,uint256)').inputs;
+ [_to,
+ _tokenId
+ ] = BaseContract._formatABIDataItemList(inputAbi, [_to,
+ _tokenId
+ ], BaseContract._bigNumberToString);
+ const encodedData = self._lookupEthersInterface('mint(address,uint256)').functions.mint.encode([_to,
+ _tokenId
+ ]);
+ const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
+ {
+ to: self.address,
+ ...txData,
+ data: encodedData,
+ },
+ self._web3Wrapper.getContractDefaults(),
+ );
+ const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults);
+ return gas;
+ },
+ getABIEncodedTransactionData(
+ _to: string,
+ _tokenId: BigNumber,
+ ): string {
+ const self = this as any as DummyERC721TokenContract;
+ const inputAbi = self._lookupAbi('mint(address,uint256)').inputs;
+ [_to,
+ _tokenId
+ ] = BaseContract._formatABIDataItemList(inputAbi, [_to,
+ _tokenId
+ ], BaseContract._bigNumberToString);
+ const abiEncodedTransactionData = self._lookupEthersInterface('mint(address,uint256)').functions.mint.encode([_to,
+ _tokenId
+ ]);
+ return abiEncodedTransactionData;
+ },
+ async callAsync(
+ _to: string,
+ _tokenId: BigNumber,
+ callData: Partial<CallData> = {},
+ defaultBlock?: BlockParam,
+ ): Promise<void
+ > {
+ const self = this as any as DummyERC721TokenContract;
+ const functionSignature = 'mint(address,uint256)';
+ const inputAbi = self._lookupAbi(functionSignature).inputs;
+ [_to,
+ _tokenId
+ ] = BaseContract._formatABIDataItemList(inputAbi, [_to,
+ _tokenId
+ ], BaseContract._bigNumberToString.bind(self));
+ BaseContract.strictArgumentEncodingCheck(inputAbi, [_to,
+ _tokenId
+ ]);
+ const ethersFunction = self._lookupEthersInterface(functionSignature).functions.mint;
+ const encodedData = ethersFunction.encode([_to,
+ _tokenId
+ ]);
+ const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
+ {
+ to: self.address,
+ ...callData,
+ data: encodedData,
+ },
+ self._web3Wrapper.getContractDefaults(),
+ );
+ const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
+ BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
+ let resultArray = ethersFunction.decode(rawCallResult);
+ const outputAbi = (_.find(self.abi, {name: 'mint'}) as MethodAbi).outputs;
+ resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this));
+ resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this));
+ return resultArray;
+ },
+ };
+ public safeTransferFrom1 = {
+ async sendTransactionAsync(
+ _from: string,
+ _to: string,
+ _tokenId: BigNumber,
+ txData: Partial<TxData> = {},
+ ): Promise<string> {
+ const self = this as any as DummyERC721TokenContract;
+ const inputAbi = self._lookupAbi('safeTransferFrom(address,address,uint256)').inputs;
+ [_from,
+ _to,
+ _tokenId
+ ] = BaseContract._formatABIDataItemList(inputAbi, [_from,
+ _to,
+ _tokenId
+ ], BaseContract._bigNumberToString.bind(self));
+ BaseContract.strictArgumentEncodingCheck(inputAbi, [_from,
+ _to,
+ _tokenId
+ ]);
+ const encodedData = self._lookupEthersInterface('safeTransferFrom(address,address,uint256)').functions.safeTransferFrom.encode([_from,
+ _to,
+ _tokenId
+ ]);
+ const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
+ {
+ to: self.address,
+ ...txData,
+ data: encodedData,
+ },
+ self._web3Wrapper.getContractDefaults(),
+ self.safeTransferFrom1.estimateGasAsync.bind(
+ self,
+ _from,
+ _to,
+ _tokenId
+ ),
+ );
+ const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults);
+ return txHash;
+ },
+ async estimateGasAsync(
+ _from: string,
+ _to: string,
+ _tokenId: BigNumber,
+ txData: Partial<TxData> = {},
+ ): Promise<number> {
+ const self = this as any as DummyERC721TokenContract;
+ const inputAbi = self._lookupAbi('safeTransferFrom(address,address,uint256)').inputs;
+ [_from,
+ _to,
+ _tokenId
+ ] = BaseContract._formatABIDataItemList(inputAbi, [_from,
+ _to,
+ _tokenId
+ ], BaseContract._bigNumberToString);
+ const encodedData = self._lookupEthersInterface('safeTransferFrom(address,address,uint256)').functions.safeTransferFrom.encode([_from,
+ _to,
+ _tokenId
+ ]);
+ const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
+ {
+ to: self.address,
+ ...txData,
+ data: encodedData,
+ },
+ self._web3Wrapper.getContractDefaults(),
+ );
+ const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults);
+ return gas;
+ },
+ getABIEncodedTransactionData(
+ _from: string,
+ _to: string,
+ _tokenId: BigNumber,
+ ): string {
+ const self = this as any as DummyERC721TokenContract;
+ const inputAbi = self._lookupAbi('safeTransferFrom(address,address,uint256)').inputs;
+ [_from,
+ _to,
+ _tokenId
+ ] = BaseContract._formatABIDataItemList(inputAbi, [_from,
+ _to,
+ _tokenId
+ ], BaseContract._bigNumberToString);
+ const abiEncodedTransactionData = self._lookupEthersInterface('safeTransferFrom(address,address,uint256)').functions.safeTransferFrom.encode([_from,
+ _to,
+ _tokenId
+ ]);
+ return abiEncodedTransactionData;
+ },
+ async callAsync(
+ _from: string,
+ _to: string,
+ _tokenId: BigNumber,
+ callData: Partial<CallData> = {},
+ defaultBlock?: BlockParam,
+ ): Promise<void
+ > {
+ const self = this as any as DummyERC721TokenContract;
+ const functionSignature = 'safeTransferFrom(address,address,uint256)';
+ const inputAbi = self._lookupAbi(functionSignature).inputs;
+ [_from,
+ _to,
+ _tokenId
+ ] = BaseContract._formatABIDataItemList(inputAbi, [_from,
+ _to,
+ _tokenId
+ ], BaseContract._bigNumberToString.bind(self));
+ BaseContract.strictArgumentEncodingCheck(inputAbi, [_from,
+ _to,
+ _tokenId
+ ]);
+ const ethersFunction = self._lookupEthersInterface(functionSignature).functions.safeTransferFrom;
+ const encodedData = ethersFunction.encode([_from,
+ _to,
+ _tokenId
+ ]);
+ const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
+ {
+ to: self.address,
+ ...callData,
+ data: encodedData,
+ },
+ self._web3Wrapper.getContractDefaults(),
+ );
+ const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
+ BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
+ let resultArray = ethersFunction.decode(rawCallResult);
+ const outputAbi = (_.find(self.abi, {name: 'safeTransferFrom'}) as MethodAbi).outputs;
+ resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this));
+ resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this));
+ return resultArray;
+ },
+ };
+ public ownerOf = {
+ async callAsync(
+ _tokenId: BigNumber,
+ callData: Partial<CallData> = {},
+ defaultBlock?: BlockParam,
+ ): Promise<string
+ > {
+ const self = this as any as DummyERC721TokenContract;
+ const functionSignature = 'ownerOf(uint256)';
+ const inputAbi = self._lookupAbi(functionSignature).inputs;
+ [_tokenId
+ ] = BaseContract._formatABIDataItemList(inputAbi, [_tokenId
+ ], BaseContract._bigNumberToString.bind(self));
+ BaseContract.strictArgumentEncodingCheck(inputAbi, [_tokenId
+ ]);
+ const ethersFunction = self._lookupEthersInterface(functionSignature).functions.ownerOf;
+ const encodedData = ethersFunction.encode([_tokenId
+ ]);
+ const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
+ {
+ to: self.address,
+ ...callData,
+ data: encodedData,
+ },
+ self._web3Wrapper.getContractDefaults(),
+ );
+ const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
+ BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
+ let resultArray = ethersFunction.decode(rawCallResult);
+ const outputAbi = (_.find(self.abi, {name: 'ownerOf'}) as MethodAbi).outputs;
+ resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this));
+ resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this));
+ return resultArray[0];
+ },
+ };
+ public balanceOf = {
+ async callAsync(
+ _owner: string,
+ callData: Partial<CallData> = {},
+ defaultBlock?: BlockParam,
+ ): Promise<BigNumber
+ > {
+ const self = this as any as DummyERC721TokenContract;
+ const functionSignature = 'balanceOf(address)';
+ const inputAbi = self._lookupAbi(functionSignature).inputs;
+ [_owner
+ ] = BaseContract._formatABIDataItemList(inputAbi, [_owner
+ ], BaseContract._bigNumberToString.bind(self));
+ BaseContract.strictArgumentEncodingCheck(inputAbi, [_owner
+ ]);
+ const ethersFunction = self._lookupEthersInterface(functionSignature).functions.balanceOf;
+ const encodedData = ethersFunction.encode([_owner
+ ]);
+ const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
+ {
+ to: self.address,
+ ...callData,
+ data: encodedData,
+ },
+ self._web3Wrapper.getContractDefaults(),
+ );
+ const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
+ BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
+ let resultArray = ethersFunction.decode(rawCallResult);
+ const outputAbi = (_.find(self.abi, {name: 'balanceOf'}) as MethodAbi).outputs;
+ resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this));
+ resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this));
+ return resultArray[0];
+ },
+ };
+ public owner = {
+ async callAsync(
+ callData: Partial<CallData> = {},
+ defaultBlock?: BlockParam,
+ ): Promise<string
+ > {
+ const self = this as any as DummyERC721TokenContract;
+ const functionSignature = 'owner()';
+ const inputAbi = self._lookupAbi(functionSignature).inputs;
+ [] = BaseContract._formatABIDataItemList(inputAbi, [], BaseContract._bigNumberToString.bind(self));
+ BaseContract.strictArgumentEncodingCheck(inputAbi, []);
+ const ethersFunction = self._lookupEthersInterface(functionSignature).functions.owner;
+ const encodedData = ethersFunction.encode([]);
+ const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
+ {
+ to: self.address,
+ ...callData,
+ data: encodedData,
+ },
+ self._web3Wrapper.getContractDefaults(),
+ );
+ const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
+ BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
+ let resultArray = ethersFunction.decode(rawCallResult);
+ const outputAbi = (_.find(self.abi, {name: 'owner'}) as MethodAbi).outputs;
+ resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this));
+ resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this));
+ return resultArray[0];
+ },
+ };
+ public symbol = {
+ async callAsync(
+ callData: Partial<CallData> = {},
+ defaultBlock?: BlockParam,
+ ): Promise<string
+ > {
+ const self = this as any as DummyERC721TokenContract;
+ const functionSignature = 'symbol()';
+ const inputAbi = self._lookupAbi(functionSignature).inputs;
+ [] = BaseContract._formatABIDataItemList(inputAbi, [], BaseContract._bigNumberToString.bind(self));
+ BaseContract.strictArgumentEncodingCheck(inputAbi, []);
+ const ethersFunction = self._lookupEthersInterface(functionSignature).functions.symbol;
+ const encodedData = ethersFunction.encode([]);
+ const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
+ {
+ to: self.address,
+ ...callData,
+ data: encodedData,
+ },
+ self._web3Wrapper.getContractDefaults(),
+ );
+ const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
+ BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
+ let resultArray = ethersFunction.decode(rawCallResult);
+ const outputAbi = (_.find(self.abi, {name: 'symbol'}) as MethodAbi).outputs;
+ resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this));
+ resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this));
+ return resultArray[0];
+ },
+ };
+ public burn = {
+ async sendTransactionAsync(
+ _owner: string,
+ _tokenId: BigNumber,
+ txData: Partial<TxData> = {},
+ ): Promise<string> {
+ const self = this as any as DummyERC721TokenContract;
+ const inputAbi = self._lookupAbi('burn(address,uint256)').inputs;
+ [_owner,
+ _tokenId
+ ] = BaseContract._formatABIDataItemList(inputAbi, [_owner,
+ _tokenId
+ ], BaseContract._bigNumberToString.bind(self));
+ BaseContract.strictArgumentEncodingCheck(inputAbi, [_owner,
+ _tokenId
+ ]);
+ const encodedData = self._lookupEthersInterface('burn(address,uint256)').functions.burn.encode([_owner,
+ _tokenId
+ ]);
+ const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
+ {
+ to: self.address,
+ ...txData,
+ data: encodedData,
+ },
+ self._web3Wrapper.getContractDefaults(),
+ self.burn.estimateGasAsync.bind(
+ self,
+ _owner,
+ _tokenId
+ ),
+ );
+ const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults);
+ return txHash;
+ },
+ async estimateGasAsync(
+ _owner: string,
+ _tokenId: BigNumber,
+ txData: Partial<TxData> = {},
+ ): Promise<number> {
+ const self = this as any as DummyERC721TokenContract;
+ const inputAbi = self._lookupAbi('burn(address,uint256)').inputs;
+ [_owner,
+ _tokenId
+ ] = BaseContract._formatABIDataItemList(inputAbi, [_owner,
+ _tokenId
+ ], BaseContract._bigNumberToString);
+ const encodedData = self._lookupEthersInterface('burn(address,uint256)').functions.burn.encode([_owner,
+ _tokenId
+ ]);
+ const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
+ {
+ to: self.address,
+ ...txData,
+ data: encodedData,
+ },
+ self._web3Wrapper.getContractDefaults(),
+ );
+ const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults);
+ return gas;
+ },
+ getABIEncodedTransactionData(
+ _owner: string,
+ _tokenId: BigNumber,
+ ): string {
+ const self = this as any as DummyERC721TokenContract;
+ const inputAbi = self._lookupAbi('burn(address,uint256)').inputs;
+ [_owner,
+ _tokenId
+ ] = BaseContract._formatABIDataItemList(inputAbi, [_owner,
+ _tokenId
+ ], BaseContract._bigNumberToString);
+ const abiEncodedTransactionData = self._lookupEthersInterface('burn(address,uint256)').functions.burn.encode([_owner,
+ _tokenId
+ ]);
+ return abiEncodedTransactionData;
+ },
+ async callAsync(
+ _owner: string,
+ _tokenId: BigNumber,
+ callData: Partial<CallData> = {},
+ defaultBlock?: BlockParam,
+ ): Promise<void
+ > {
+ const self = this as any as DummyERC721TokenContract;
+ const functionSignature = 'burn(address,uint256)';
+ const inputAbi = self._lookupAbi(functionSignature).inputs;
+ [_owner,
+ _tokenId
+ ] = BaseContract._formatABIDataItemList(inputAbi, [_owner,
+ _tokenId
+ ], BaseContract._bigNumberToString.bind(self));
+ BaseContract.strictArgumentEncodingCheck(inputAbi, [_owner,
+ _tokenId
+ ]);
+ const ethersFunction = self._lookupEthersInterface(functionSignature).functions.burn;
+ const encodedData = ethersFunction.encode([_owner,
+ _tokenId
+ ]);
+ const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
+ {
+ to: self.address,
+ ...callData,
+ data: encodedData,
+ },
+ self._web3Wrapper.getContractDefaults(),
+ );
+ const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
+ BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
+ let resultArray = ethersFunction.decode(rawCallResult);
+ const outputAbi = (_.find(self.abi, {name: 'burn'}) as MethodAbi).outputs;
+ resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this));
+ resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this));
+ return resultArray;
+ },
+ };
+ public setApprovalForAll = {
+ async sendTransactionAsync(
+ _operator: string,
+ _approved: boolean,
+ txData: Partial<TxData> = {},
+ ): Promise<string> {
+ const self = this as any as DummyERC721TokenContract;
+ const inputAbi = self._lookupAbi('setApprovalForAll(address,bool)').inputs;
+ [_operator,
+ _approved
+ ] = BaseContract._formatABIDataItemList(inputAbi, [_operator,
+ _approved
+ ], BaseContract._bigNumberToString.bind(self));
+ BaseContract.strictArgumentEncodingCheck(inputAbi, [_operator,
+ _approved
+ ]);
+ const encodedData = self._lookupEthersInterface('setApprovalForAll(address,bool)').functions.setApprovalForAll.encode([_operator,
+ _approved
+ ]);
+ const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
+ {
+ to: self.address,
+ ...txData,
+ data: encodedData,
+ },
+ self._web3Wrapper.getContractDefaults(),
+ self.setApprovalForAll.estimateGasAsync.bind(
+ self,
+ _operator,
+ _approved
+ ),
+ );
+ const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults);
+ return txHash;
+ },
+ async estimateGasAsync(
+ _operator: string,
+ _approved: boolean,
+ txData: Partial<TxData> = {},
+ ): Promise<number> {
+ const self = this as any as DummyERC721TokenContract;
+ const inputAbi = self._lookupAbi('setApprovalForAll(address,bool)').inputs;
+ [_operator,
+ _approved
+ ] = BaseContract._formatABIDataItemList(inputAbi, [_operator,
+ _approved
+ ], BaseContract._bigNumberToString);
+ const encodedData = self._lookupEthersInterface('setApprovalForAll(address,bool)').functions.setApprovalForAll.encode([_operator,
+ _approved
+ ]);
+ const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
+ {
+ to: self.address,
+ ...txData,
+ data: encodedData,
+ },
+ self._web3Wrapper.getContractDefaults(),
+ );
+ const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults);
+ return gas;
+ },
+ getABIEncodedTransactionData(
+ _operator: string,
+ _approved: boolean,
+ ): string {
+ const self = this as any as DummyERC721TokenContract;
+ const inputAbi = self._lookupAbi('setApprovalForAll(address,bool)').inputs;
+ [_operator,
+ _approved
+ ] = BaseContract._formatABIDataItemList(inputAbi, [_operator,
+ _approved
+ ], BaseContract._bigNumberToString);
+ const abiEncodedTransactionData = self._lookupEthersInterface('setApprovalForAll(address,bool)').functions.setApprovalForAll.encode([_operator,
+ _approved
+ ]);
+ return abiEncodedTransactionData;
+ },
+ async callAsync(
+ _operator: string,
+ _approved: boolean,
+ callData: Partial<CallData> = {},
+ defaultBlock?: BlockParam,
+ ): Promise<void
+ > {
+ const self = this as any as DummyERC721TokenContract;
+ const functionSignature = 'setApprovalForAll(address,bool)';
+ const inputAbi = self._lookupAbi(functionSignature).inputs;
+ [_operator,
+ _approved
+ ] = BaseContract._formatABIDataItemList(inputAbi, [_operator,
+ _approved
+ ], BaseContract._bigNumberToString.bind(self));
+ BaseContract.strictArgumentEncodingCheck(inputAbi, [_operator,
+ _approved
+ ]);
+ const ethersFunction = self._lookupEthersInterface(functionSignature).functions.setApprovalForAll;
+ const encodedData = ethersFunction.encode([_operator,
+ _approved
+ ]);
+ const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
+ {
+ to: self.address,
+ ...callData,
+ data: encodedData,
+ },
+ self._web3Wrapper.getContractDefaults(),
+ );
+ const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
+ BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
+ let resultArray = ethersFunction.decode(rawCallResult);
+ const outputAbi = (_.find(self.abi, {name: 'setApprovalForAll'}) as MethodAbi).outputs;
+ resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this));
+ resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this));
+ return resultArray;
+ },
+ };
+ public safeTransferFrom2 = {
+ async sendTransactionAsync(
+ _from: string,
+ _to: string,
+ _tokenId: BigNumber,
+ _data: string,
+ txData: Partial<TxData> = {},
+ ): Promise<string> {
+ const self = this as any as DummyERC721TokenContract;
+ const inputAbi = self._lookupAbi('safeTransferFrom(address,address,uint256,bytes)').inputs;
+ [_from,
+ _to,
+ _tokenId,
+ _data
+ ] = BaseContract._formatABIDataItemList(inputAbi, [_from,
+ _to,
+ _tokenId,
+ _data
+ ], BaseContract._bigNumberToString.bind(self));
+ BaseContract.strictArgumentEncodingCheck(inputAbi, [_from,
+ _to,
+ _tokenId,
+ _data
+ ]);
+ const encodedData = self._lookupEthersInterface('safeTransferFrom(address,address,uint256,bytes)').functions.safeTransferFrom.encode([_from,
+ _to,
+ _tokenId,
+ _data
+ ]);
+ const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
+ {
+ to: self.address,
+ ...txData,
+ data: encodedData,
+ },
+ self._web3Wrapper.getContractDefaults(),
+ self.safeTransferFrom2.estimateGasAsync.bind(
+ self,
+ _from,
+ _to,
+ _tokenId,
+ _data
+ ),
+ );
+ const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults);
+ return txHash;
+ },
+ async estimateGasAsync(
+ _from: string,
+ _to: string,
+ _tokenId: BigNumber,
+ _data: string,
+ txData: Partial<TxData> = {},
+ ): Promise<number> {
+ const self = this as any as DummyERC721TokenContract;
+ const inputAbi = self._lookupAbi('safeTransferFrom(address,address,uint256,bytes)').inputs;
+ [_from,
+ _to,
+ _tokenId,
+ _data
+ ] = BaseContract._formatABIDataItemList(inputAbi, [_from,
+ _to,
+ _tokenId,
+ _data
+ ], BaseContract._bigNumberToString);
+ const encodedData = self._lookupEthersInterface('safeTransferFrom(address,address,uint256,bytes)').functions.safeTransferFrom.encode([_from,
+ _to,
+ _tokenId,
+ _data
+ ]);
+ const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
+ {
+ to: self.address,
+ ...txData,
+ data: encodedData,
+ },
+ self._web3Wrapper.getContractDefaults(),
+ );
+ const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults);
+ return gas;
+ },
+ getABIEncodedTransactionData(
+ _from: string,
+ _to: string,
+ _tokenId: BigNumber,
+ _data: string,
+ ): string {
+ const self = this as any as DummyERC721TokenContract;
+ const inputAbi = self._lookupAbi('safeTransferFrom(address,address,uint256,bytes)').inputs;
+ [_from,
+ _to,
+ _tokenId,
+ _data
+ ] = BaseContract._formatABIDataItemList(inputAbi, [_from,
+ _to,
+ _tokenId,
+ _data
+ ], BaseContract._bigNumberToString);
+ const abiEncodedTransactionData = self._lookupEthersInterface('safeTransferFrom(address,address,uint256,bytes)').functions.safeTransferFrom.encode([_from,
+ _to,
+ _tokenId,
+ _data
+ ]);
+ return abiEncodedTransactionData;
+ },
+ async callAsync(
+ _from: string,
+ _to: string,
+ _tokenId: BigNumber,
+ _data: string,
+ callData: Partial<CallData> = {},
+ defaultBlock?: BlockParam,
+ ): Promise<void
+ > {
+ const self = this as any as DummyERC721TokenContract;
+ const functionSignature = 'safeTransferFrom(address,address,uint256,bytes)';
+ const inputAbi = self._lookupAbi(functionSignature).inputs;
+ [_from,
+ _to,
+ _tokenId,
+ _data
+ ] = BaseContract._formatABIDataItemList(inputAbi, [_from,
+ _to,
+ _tokenId,
+ _data
+ ], BaseContract._bigNumberToString.bind(self));
+ BaseContract.strictArgumentEncodingCheck(inputAbi, [_from,
+ _to,
+ _tokenId,
+ _data
+ ]);
+ const ethersFunction = self._lookupEthersInterface(functionSignature).functions.safeTransferFrom;
+ const encodedData = ethersFunction.encode([_from,
+ _to,
+ _tokenId,
+ _data
+ ]);
+ const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
+ {
+ to: self.address,
+ ...callData,
+ data: encodedData,
+ },
+ self._web3Wrapper.getContractDefaults(),
+ );
+ const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
+ BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
+ let resultArray = ethersFunction.decode(rawCallResult);
+ const outputAbi = (_.find(self.abi, {name: 'safeTransferFrom'}) as MethodAbi).outputs;
+ resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this));
+ resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this));
+ return resultArray;
+ },
+ };
+ public isApprovedForAll = {
+ async callAsync(
+ _owner: string,
+ _operator: string,
+ callData: Partial<CallData> = {},
+ defaultBlock?: BlockParam,
+ ): Promise<boolean
+ > {
+ const self = this as any as DummyERC721TokenContract;
+ const functionSignature = 'isApprovedForAll(address,address)';
+ const inputAbi = self._lookupAbi(functionSignature).inputs;
+ [_owner,
+ _operator
+ ] = BaseContract._formatABIDataItemList(inputAbi, [_owner,
+ _operator
+ ], BaseContract._bigNumberToString.bind(self));
+ BaseContract.strictArgumentEncodingCheck(inputAbi, [_owner,
+ _operator
+ ]);
+ const ethersFunction = self._lookupEthersInterface(functionSignature).functions.isApprovedForAll;
+ const encodedData = ethersFunction.encode([_owner,
+ _operator
+ ]);
+ const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
+ {
+ to: self.address,
+ ...callData,
+ data: encodedData,
+ },
+ self._web3Wrapper.getContractDefaults(),
+ );
+ const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
+ BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
+ let resultArray = ethersFunction.decode(rawCallResult);
+ const outputAbi = (_.find(self.abi, {name: 'isApprovedForAll'}) as MethodAbi).outputs;
+ resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this));
+ resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this));
+ return resultArray[0];
+ },
+ };
+ public transferOwnership = {
+ async sendTransactionAsync(
+ newOwner: string,
+ txData: Partial<TxData> = {},
+ ): Promise<string> {
+ const self = this as any as DummyERC721TokenContract;
+ const inputAbi = self._lookupAbi('transferOwnership(address)').inputs;
+ [newOwner
+ ] = BaseContract._formatABIDataItemList(inputAbi, [newOwner
+ ], BaseContract._bigNumberToString.bind(self));
+ BaseContract.strictArgumentEncodingCheck(inputAbi, [newOwner
+ ]);
+ const encodedData = self._lookupEthersInterface('transferOwnership(address)').functions.transferOwnership.encode([newOwner
+ ]);
+ const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
+ {
+ to: self.address,
+ ...txData,
+ data: encodedData,
+ },
+ self._web3Wrapper.getContractDefaults(),
+ self.transferOwnership.estimateGasAsync.bind(
+ self,
+ newOwner
+ ),
+ );
+ const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults);
+ return txHash;
+ },
+ async estimateGasAsync(
+ newOwner: string,
+ txData: Partial<TxData> = {},
+ ): Promise<number> {
+ const self = this as any as DummyERC721TokenContract;
+ const inputAbi = self._lookupAbi('transferOwnership(address)').inputs;
+ [newOwner
+ ] = BaseContract._formatABIDataItemList(inputAbi, [newOwner
+ ], BaseContract._bigNumberToString);
+ const encodedData = self._lookupEthersInterface('transferOwnership(address)').functions.transferOwnership.encode([newOwner
+ ]);
+ const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
+ {
+ to: self.address,
+ ...txData,
+ data: encodedData,
+ },
+ self._web3Wrapper.getContractDefaults(),
+ );
+ const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults);
+ return gas;
+ },
+ getABIEncodedTransactionData(
+ newOwner: string,
+ ): string {
+ const self = this as any as DummyERC721TokenContract;
+ const inputAbi = self._lookupAbi('transferOwnership(address)').inputs;
+ [newOwner
+ ] = BaseContract._formatABIDataItemList(inputAbi, [newOwner
+ ], BaseContract._bigNumberToString);
+ const abiEncodedTransactionData = self._lookupEthersInterface('transferOwnership(address)').functions.transferOwnership.encode([newOwner
+ ]);
+ return abiEncodedTransactionData;
+ },
+ async callAsync(
+ newOwner: string,
+ callData: Partial<CallData> = {},
+ defaultBlock?: BlockParam,
+ ): Promise<void
+ > {
+ const self = this as any as DummyERC721TokenContract;
+ const functionSignature = 'transferOwnership(address)';
+ const inputAbi = self._lookupAbi(functionSignature).inputs;
+ [newOwner
+ ] = BaseContract._formatABIDataItemList(inputAbi, [newOwner
+ ], BaseContract._bigNumberToString.bind(self));
+ BaseContract.strictArgumentEncodingCheck(inputAbi, [newOwner
+ ]);
+ const ethersFunction = self._lookupEthersInterface(functionSignature).functions.transferOwnership;
+ const encodedData = ethersFunction.encode([newOwner
+ ]);
+ const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
+ {
+ to: self.address,
+ ...callData,
+ data: encodedData,
+ },
+ self._web3Wrapper.getContractDefaults(),
+ );
+ const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
+ BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
+ let resultArray = ethersFunction.decode(rawCallResult);
+ const outputAbi = (_.find(self.abi, {name: 'transferOwnership'}) as MethodAbi).outputs;
+ resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this));
+ resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this));
+ return resultArray;
+ },
+ };
+ public static async deployFrom0xArtifactAsync(
+ artifact: ContractArtifact,
+ provider: Provider,
+ txDefaults: Partial<TxData>,
+ _name: string,
+ _symbol: string,
+ ): Promise<DummyERC721TokenContract> {
+ if (_.isUndefined(artifact.compilerOutput)) {
+ throw new Error('Compiler output not found in the artifact file');
+ }
+ const bytecode = artifact.compilerOutput.evm.bytecode.object;
+ const abi = artifact.compilerOutput.abi;
+ return DummyERC721TokenContract.deployAsync(bytecode, abi, provider, txDefaults, _name,
+_symbol
+);
+ }
+ public static async deployAsync(
+ bytecode: string,
+ abi: ContractAbi,
+ provider: Provider,
+ txDefaults: Partial<TxData>,
+ _name: string,
+ _symbol: string,
+ ): Promise<DummyERC721TokenContract> {
+ const constructorAbi = BaseContract._lookupConstructorAbi(abi);
+ [_name,
+_symbol
+] = BaseContract._formatABIDataItemList(
+ constructorAbi.inputs,
+ [_name,
+_symbol
+],
+ BaseContract._bigNumberToString,
+ );
+ const iface = new ethers.utils.Interface(abi);
+ const deployInfo = iface.deployFunction;
+ const txData = deployInfo.encode(bytecode, [_name,
+_symbol
+]);
+ const web3Wrapper = new Web3Wrapper(provider);
+ const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
+ {data: txData},
+ txDefaults,
+ web3Wrapper.estimateGasAsync.bind(web3Wrapper),
+ );
+ const txHash = await web3Wrapper.sendTransactionAsync(txDataWithDefaults);
+ logUtils.log(`transactionHash: ${txHash}`);
+ const txReceipt = await web3Wrapper.awaitTransactionSuccessAsync(txHash);
+ logUtils.log(`DummyERC721Token successfully deployed at ${txReceipt.contractAddress}`);
+ const contractInstance = new DummyERC721TokenContract(abi, txReceipt.contractAddress as string, provider, txDefaults);
+ contractInstance.constructorArgs = [_name,
+_symbol
+];
+ return contractInstance;
+ }
+ constructor(abi: ContractAbi, address: string, provider: Provider, txDefaults?: Partial<TxData>) {
+ super('DummyERC721Token', abi, address, provider, txDefaults);
+ classUtils.bindAll(this, ['_ethersInterfacesByFunctionSignature', 'address', 'abi', '_web3Wrapper']);
+ }
+} // tslint:disable:max-file-line-count
+// tslint:enable:no-unbound-method
diff --git a/packages/abi-gen-wrappers/src/generated-wrappers/erc20_proxy.ts b/packages/abi-gen-wrappers/src/generated-wrappers/erc20_proxy.ts
new file mode 100644
index 000000000..0130faec5
--- /dev/null
+++ b/packages/abi-gen-wrappers/src/generated-wrappers/erc20_proxy.ts
@@ -0,0 +1,649 @@
+// tslint:disable:no-consecutive-blank-lines ordered-imports align trailing-comma whitespace class-name
+// tslint:disable:no-unused-variable
+// tslint:disable:no-unbound-method
+import { BaseContract } from '@0xproject/base-contract';
+import { BlockParam, BlockParamLiteral, CallData, ContractAbi, ContractArtifact, DecodedLogArgs, MethodAbi, Provider, TxData, TxDataPayable } from 'ethereum-types';
+import { BigNumber, classUtils, logUtils } from '@0xproject/utils';
+import { Web3Wrapper } from '@0xproject/web3-wrapper';
+import * as ethers from 'ethers';
+import * as _ from 'lodash';
+// tslint:enable:no-unused-variable
+
+export type ERC20ProxyEventArgs =
+ | ERC20ProxyAuthorizedAddressAddedEventArgs
+ | ERC20ProxyAuthorizedAddressRemovedEventArgs;
+
+export enum ERC20ProxyEvents {
+ AuthorizedAddressAdded = 'AuthorizedAddressAdded',
+ AuthorizedAddressRemoved = 'AuthorizedAddressRemoved',
+}
+
+export interface ERC20ProxyAuthorizedAddressAddedEventArgs extends DecodedLogArgs {
+ target: string;
+ caller: string;
+}
+
+export interface ERC20ProxyAuthorizedAddressRemovedEventArgs extends DecodedLogArgs {
+ target: string;
+ caller: string;
+}
+
+
+/* istanbul ignore next */
+// tslint:disable:no-parameter-reassignment
+// tslint:disable-next-line:class-name
+export class ERC20ProxyContract extends BaseContract {
+ public addAuthorizedAddress = {
+ async sendTransactionAsync(
+ target: string,
+ txData: Partial<TxData> = {},
+ ): Promise<string> {
+ const self = this as any as ERC20ProxyContract;
+ const inputAbi = self._lookupAbi('addAuthorizedAddress(address)').inputs;
+ [target
+ ] = BaseContract._formatABIDataItemList(inputAbi, [target
+ ], BaseContract._bigNumberToString.bind(self));
+ BaseContract.strictArgumentEncodingCheck(inputAbi, [target
+ ]);
+ const encodedData = self._lookupEthersInterface('addAuthorizedAddress(address)').functions.addAuthorizedAddress.encode([target
+ ]);
+ const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
+ {
+ to: self.address,
+ ...txData,
+ data: encodedData,
+ },
+ self._web3Wrapper.getContractDefaults(),
+ self.addAuthorizedAddress.estimateGasAsync.bind(
+ self,
+ target
+ ),
+ );
+ const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults);
+ return txHash;
+ },
+ async estimateGasAsync(
+ target: string,
+ txData: Partial<TxData> = {},
+ ): Promise<number> {
+ const self = this as any as ERC20ProxyContract;
+ const inputAbi = self._lookupAbi('addAuthorizedAddress(address)').inputs;
+ [target
+ ] = BaseContract._formatABIDataItemList(inputAbi, [target
+ ], BaseContract._bigNumberToString);
+ const encodedData = self._lookupEthersInterface('addAuthorizedAddress(address)').functions.addAuthorizedAddress.encode([target
+ ]);
+ const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
+ {
+ to: self.address,
+ ...txData,
+ data: encodedData,
+ },
+ self._web3Wrapper.getContractDefaults(),
+ );
+ const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults);
+ return gas;
+ },
+ getABIEncodedTransactionData(
+ target: string,
+ ): string {
+ const self = this as any as ERC20ProxyContract;
+ const inputAbi = self._lookupAbi('addAuthorizedAddress(address)').inputs;
+ [target
+ ] = BaseContract._formatABIDataItemList(inputAbi, [target
+ ], BaseContract._bigNumberToString);
+ const abiEncodedTransactionData = self._lookupEthersInterface('addAuthorizedAddress(address)').functions.addAuthorizedAddress.encode([target
+ ]);
+ return abiEncodedTransactionData;
+ },
+ async callAsync(
+ target: string,
+ callData: Partial<CallData> = {},
+ defaultBlock?: BlockParam,
+ ): Promise<void
+ > {
+ const self = this as any as ERC20ProxyContract;
+ const functionSignature = 'addAuthorizedAddress(address)';
+ const inputAbi = self._lookupAbi(functionSignature).inputs;
+ [target
+ ] = BaseContract._formatABIDataItemList(inputAbi, [target
+ ], BaseContract._bigNumberToString.bind(self));
+ BaseContract.strictArgumentEncodingCheck(inputAbi, [target
+ ]);
+ const ethersFunction = self._lookupEthersInterface(functionSignature).functions.addAuthorizedAddress;
+ const encodedData = ethersFunction.encode([target
+ ]);
+ const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
+ {
+ to: self.address,
+ ...callData,
+ data: encodedData,
+ },
+ self._web3Wrapper.getContractDefaults(),
+ );
+ const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
+ BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
+ let resultArray = ethersFunction.decode(rawCallResult);
+ const outputAbi = (_.find(self.abi, {name: 'addAuthorizedAddress'}) as MethodAbi).outputs;
+ resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this));
+ resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this));
+ return resultArray;
+ },
+ };
+ public authorities = {
+ async callAsync(
+ index_0: BigNumber,
+ callData: Partial<CallData> = {},
+ defaultBlock?: BlockParam,
+ ): Promise<string
+ > {
+ const self = this as any as ERC20ProxyContract;
+ const functionSignature = 'authorities(uint256)';
+ const inputAbi = self._lookupAbi(functionSignature).inputs;
+ [index_0
+ ] = BaseContract._formatABIDataItemList(inputAbi, [index_0
+ ], BaseContract._bigNumberToString.bind(self));
+ BaseContract.strictArgumentEncodingCheck(inputAbi, [index_0
+ ]);
+ const ethersFunction = self._lookupEthersInterface(functionSignature).functions.authorities;
+ const encodedData = ethersFunction.encode([index_0
+ ]);
+ const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
+ {
+ to: self.address,
+ ...callData,
+ data: encodedData,
+ },
+ self._web3Wrapper.getContractDefaults(),
+ );
+ const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
+ BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
+ let resultArray = ethersFunction.decode(rawCallResult);
+ const outputAbi = (_.find(self.abi, {name: 'authorities'}) as MethodAbi).outputs;
+ resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this));
+ resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this));
+ return resultArray[0];
+ },
+ };
+ public removeAuthorizedAddress = {
+ async sendTransactionAsync(
+ target: string,
+ txData: Partial<TxData> = {},
+ ): Promise<string> {
+ const self = this as any as ERC20ProxyContract;
+ const inputAbi = self._lookupAbi('removeAuthorizedAddress(address)').inputs;
+ [target
+ ] = BaseContract._formatABIDataItemList(inputAbi, [target
+ ], BaseContract._bigNumberToString.bind(self));
+ BaseContract.strictArgumentEncodingCheck(inputAbi, [target
+ ]);
+ const encodedData = self._lookupEthersInterface('removeAuthorizedAddress(address)').functions.removeAuthorizedAddress.encode([target
+ ]);
+ const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
+ {
+ to: self.address,
+ ...txData,
+ data: encodedData,
+ },
+ self._web3Wrapper.getContractDefaults(),
+ self.removeAuthorizedAddress.estimateGasAsync.bind(
+ self,
+ target
+ ),
+ );
+ const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults);
+ return txHash;
+ },
+ async estimateGasAsync(
+ target: string,
+ txData: Partial<TxData> = {},
+ ): Promise<number> {
+ const self = this as any as ERC20ProxyContract;
+ const inputAbi = self._lookupAbi('removeAuthorizedAddress(address)').inputs;
+ [target
+ ] = BaseContract._formatABIDataItemList(inputAbi, [target
+ ], BaseContract._bigNumberToString);
+ const encodedData = self._lookupEthersInterface('removeAuthorizedAddress(address)').functions.removeAuthorizedAddress.encode([target
+ ]);
+ const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
+ {
+ to: self.address,
+ ...txData,
+ data: encodedData,
+ },
+ self._web3Wrapper.getContractDefaults(),
+ );
+ const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults);
+ return gas;
+ },
+ getABIEncodedTransactionData(
+ target: string,
+ ): string {
+ const self = this as any as ERC20ProxyContract;
+ const inputAbi = self._lookupAbi('removeAuthorizedAddress(address)').inputs;
+ [target
+ ] = BaseContract._formatABIDataItemList(inputAbi, [target
+ ], BaseContract._bigNumberToString);
+ const abiEncodedTransactionData = self._lookupEthersInterface('removeAuthorizedAddress(address)').functions.removeAuthorizedAddress.encode([target
+ ]);
+ return abiEncodedTransactionData;
+ },
+ async callAsync(
+ target: string,
+ callData: Partial<CallData> = {},
+ defaultBlock?: BlockParam,
+ ): Promise<void
+ > {
+ const self = this as any as ERC20ProxyContract;
+ const functionSignature = 'removeAuthorizedAddress(address)';
+ const inputAbi = self._lookupAbi(functionSignature).inputs;
+ [target
+ ] = BaseContract._formatABIDataItemList(inputAbi, [target
+ ], BaseContract._bigNumberToString.bind(self));
+ BaseContract.strictArgumentEncodingCheck(inputAbi, [target
+ ]);
+ const ethersFunction = self._lookupEthersInterface(functionSignature).functions.removeAuthorizedAddress;
+ const encodedData = ethersFunction.encode([target
+ ]);
+ const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
+ {
+ to: self.address,
+ ...callData,
+ data: encodedData,
+ },
+ self._web3Wrapper.getContractDefaults(),
+ );
+ const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
+ BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
+ let resultArray = ethersFunction.decode(rawCallResult);
+ const outputAbi = (_.find(self.abi, {name: 'removeAuthorizedAddress'}) as MethodAbi).outputs;
+ resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this));
+ resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this));
+ return resultArray;
+ },
+ };
+ public owner = {
+ async callAsync(
+ callData: Partial<CallData> = {},
+ defaultBlock?: BlockParam,
+ ): Promise<string
+ > {
+ const self = this as any as ERC20ProxyContract;
+ const functionSignature = 'owner()';
+ const inputAbi = self._lookupAbi(functionSignature).inputs;
+ [] = BaseContract._formatABIDataItemList(inputAbi, [], BaseContract._bigNumberToString.bind(self));
+ BaseContract.strictArgumentEncodingCheck(inputAbi, []);
+ const ethersFunction = self._lookupEthersInterface(functionSignature).functions.owner;
+ const encodedData = ethersFunction.encode([]);
+ const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
+ {
+ to: self.address,
+ ...callData,
+ data: encodedData,
+ },
+ self._web3Wrapper.getContractDefaults(),
+ );
+ const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
+ BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
+ let resultArray = ethersFunction.decode(rawCallResult);
+ const outputAbi = (_.find(self.abi, {name: 'owner'}) as MethodAbi).outputs;
+ resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this));
+ resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this));
+ return resultArray[0];
+ },
+ };
+ public removeAuthorizedAddressAtIndex = {
+ async sendTransactionAsync(
+ target: string,
+ index: BigNumber,
+ txData: Partial<TxData> = {},
+ ): Promise<string> {
+ const self = this as any as ERC20ProxyContract;
+ const inputAbi = self._lookupAbi('removeAuthorizedAddressAtIndex(address,uint256)').inputs;
+ [target,
+ index
+ ] = BaseContract._formatABIDataItemList(inputAbi, [target,
+ index
+ ], BaseContract._bigNumberToString.bind(self));
+ BaseContract.strictArgumentEncodingCheck(inputAbi, [target,
+ index
+ ]);
+ const encodedData = self._lookupEthersInterface('removeAuthorizedAddressAtIndex(address,uint256)').functions.removeAuthorizedAddressAtIndex.encode([target,
+ index
+ ]);
+ const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
+ {
+ to: self.address,
+ ...txData,
+ data: encodedData,
+ },
+ self._web3Wrapper.getContractDefaults(),
+ self.removeAuthorizedAddressAtIndex.estimateGasAsync.bind(
+ self,
+ target,
+ index
+ ),
+ );
+ const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults);
+ return txHash;
+ },
+ async estimateGasAsync(
+ target: string,
+ index: BigNumber,
+ txData: Partial<TxData> = {},
+ ): Promise<number> {
+ const self = this as any as ERC20ProxyContract;
+ const inputAbi = self._lookupAbi('removeAuthorizedAddressAtIndex(address,uint256)').inputs;
+ [target,
+ index
+ ] = BaseContract._formatABIDataItemList(inputAbi, [target,
+ index
+ ], BaseContract._bigNumberToString);
+ const encodedData = self._lookupEthersInterface('removeAuthorizedAddressAtIndex(address,uint256)').functions.removeAuthorizedAddressAtIndex.encode([target,
+ index
+ ]);
+ const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
+ {
+ to: self.address,
+ ...txData,
+ data: encodedData,
+ },
+ self._web3Wrapper.getContractDefaults(),
+ );
+ const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults);
+ return gas;
+ },
+ getABIEncodedTransactionData(
+ target: string,
+ index: BigNumber,
+ ): string {
+ const self = this as any as ERC20ProxyContract;
+ const inputAbi = self._lookupAbi('removeAuthorizedAddressAtIndex(address,uint256)').inputs;
+ [target,
+ index
+ ] = BaseContract._formatABIDataItemList(inputAbi, [target,
+ index
+ ], BaseContract._bigNumberToString);
+ const abiEncodedTransactionData = self._lookupEthersInterface('removeAuthorizedAddressAtIndex(address,uint256)').functions.removeAuthorizedAddressAtIndex.encode([target,
+ index
+ ]);
+ return abiEncodedTransactionData;
+ },
+ async callAsync(
+ target: string,
+ index: BigNumber,
+ callData: Partial<CallData> = {},
+ defaultBlock?: BlockParam,
+ ): Promise<void
+ > {
+ const self = this as any as ERC20ProxyContract;
+ const functionSignature = 'removeAuthorizedAddressAtIndex(address,uint256)';
+ const inputAbi = self._lookupAbi(functionSignature).inputs;
+ [target,
+ index
+ ] = BaseContract._formatABIDataItemList(inputAbi, [target,
+ index
+ ], BaseContract._bigNumberToString.bind(self));
+ BaseContract.strictArgumentEncodingCheck(inputAbi, [target,
+ index
+ ]);
+ const ethersFunction = self._lookupEthersInterface(functionSignature).functions.removeAuthorizedAddressAtIndex;
+ const encodedData = ethersFunction.encode([target,
+ index
+ ]);
+ const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
+ {
+ to: self.address,
+ ...callData,
+ data: encodedData,
+ },
+ self._web3Wrapper.getContractDefaults(),
+ );
+ const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
+ BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
+ let resultArray = ethersFunction.decode(rawCallResult);
+ const outputAbi = (_.find(self.abi, {name: 'removeAuthorizedAddressAtIndex'}) as MethodAbi).outputs;
+ resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this));
+ resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this));
+ return resultArray;
+ },
+ };
+ public getProxyId = {
+ async callAsync(
+ callData: Partial<CallData> = {},
+ defaultBlock?: BlockParam,
+ ): Promise<string
+ > {
+ const self = this as any as ERC20ProxyContract;
+ const functionSignature = 'getProxyId()';
+ const inputAbi = self._lookupAbi(functionSignature).inputs;
+ [] = BaseContract._formatABIDataItemList(inputAbi, [], BaseContract._bigNumberToString.bind(self));
+ BaseContract.strictArgumentEncodingCheck(inputAbi, []);
+ const ethersFunction = self._lookupEthersInterface(functionSignature).functions.getProxyId;
+ const encodedData = ethersFunction.encode([]);
+ const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
+ {
+ to: self.address,
+ ...callData,
+ data: encodedData,
+ },
+ self._web3Wrapper.getContractDefaults(),
+ );
+ const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
+ BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
+ let resultArray = ethersFunction.decode(rawCallResult);
+ const outputAbi = (_.find(self.abi, {name: 'getProxyId'}) as MethodAbi).outputs;
+ resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this));
+ resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this));
+ return resultArray[0];
+ },
+ };
+ public authorized = {
+ async callAsync(
+ index_0: string,
+ callData: Partial<CallData> = {},
+ defaultBlock?: BlockParam,
+ ): Promise<boolean
+ > {
+ const self = this as any as ERC20ProxyContract;
+ const functionSignature = 'authorized(address)';
+ const inputAbi = self._lookupAbi(functionSignature).inputs;
+ [index_0
+ ] = BaseContract._formatABIDataItemList(inputAbi, [index_0
+ ], BaseContract._bigNumberToString.bind(self));
+ BaseContract.strictArgumentEncodingCheck(inputAbi, [index_0
+ ]);
+ const ethersFunction = self._lookupEthersInterface(functionSignature).functions.authorized;
+ const encodedData = ethersFunction.encode([index_0
+ ]);
+ const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
+ {
+ to: self.address,
+ ...callData,
+ data: encodedData,
+ },
+ self._web3Wrapper.getContractDefaults(),
+ );
+ const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
+ BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
+ let resultArray = ethersFunction.decode(rawCallResult);
+ const outputAbi = (_.find(self.abi, {name: 'authorized'}) as MethodAbi).outputs;
+ resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this));
+ resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this));
+ return resultArray[0];
+ },
+ };
+ public getAuthorizedAddresses = {
+ async callAsync(
+ callData: Partial<CallData> = {},
+ defaultBlock?: BlockParam,
+ ): Promise<string[]
+ > {
+ const self = this as any as ERC20ProxyContract;
+ const functionSignature = 'getAuthorizedAddresses()';
+ const inputAbi = self._lookupAbi(functionSignature).inputs;
+ [] = BaseContract._formatABIDataItemList(inputAbi, [], BaseContract._bigNumberToString.bind(self));
+ BaseContract.strictArgumentEncodingCheck(inputAbi, []);
+ const ethersFunction = self._lookupEthersInterface(functionSignature).functions.getAuthorizedAddresses;
+ const encodedData = ethersFunction.encode([]);
+ const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
+ {
+ to: self.address,
+ ...callData,
+ data: encodedData,
+ },
+ self._web3Wrapper.getContractDefaults(),
+ );
+ const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
+ BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
+ let resultArray = ethersFunction.decode(rawCallResult);
+ const outputAbi = (_.find(self.abi, {name: 'getAuthorizedAddresses'}) as MethodAbi).outputs;
+ resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this));
+ resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this));
+ return resultArray[0];
+ },
+ };
+ public transferOwnership = {
+ async sendTransactionAsync(
+ newOwner: string,
+ txData: Partial<TxData> = {},
+ ): Promise<string> {
+ const self = this as any as ERC20ProxyContract;
+ const inputAbi = self._lookupAbi('transferOwnership(address)').inputs;
+ [newOwner
+ ] = BaseContract._formatABIDataItemList(inputAbi, [newOwner
+ ], BaseContract._bigNumberToString.bind(self));
+ BaseContract.strictArgumentEncodingCheck(inputAbi, [newOwner
+ ]);
+ const encodedData = self._lookupEthersInterface('transferOwnership(address)').functions.transferOwnership.encode([newOwner
+ ]);
+ const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
+ {
+ to: self.address,
+ ...txData,
+ data: encodedData,
+ },
+ self._web3Wrapper.getContractDefaults(),
+ self.transferOwnership.estimateGasAsync.bind(
+ self,
+ newOwner
+ ),
+ );
+ const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults);
+ return txHash;
+ },
+ async estimateGasAsync(
+ newOwner: string,
+ txData: Partial<TxData> = {},
+ ): Promise<number> {
+ const self = this as any as ERC20ProxyContract;
+ const inputAbi = self._lookupAbi('transferOwnership(address)').inputs;
+ [newOwner
+ ] = BaseContract._formatABIDataItemList(inputAbi, [newOwner
+ ], BaseContract._bigNumberToString);
+ const encodedData = self._lookupEthersInterface('transferOwnership(address)').functions.transferOwnership.encode([newOwner
+ ]);
+ const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
+ {
+ to: self.address,
+ ...txData,
+ data: encodedData,
+ },
+ self._web3Wrapper.getContractDefaults(),
+ );
+ const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults);
+ return gas;
+ },
+ getABIEncodedTransactionData(
+ newOwner: string,
+ ): string {
+ const self = this as any as ERC20ProxyContract;
+ const inputAbi = self._lookupAbi('transferOwnership(address)').inputs;
+ [newOwner
+ ] = BaseContract._formatABIDataItemList(inputAbi, [newOwner
+ ], BaseContract._bigNumberToString);
+ const abiEncodedTransactionData = self._lookupEthersInterface('transferOwnership(address)').functions.transferOwnership.encode([newOwner
+ ]);
+ return abiEncodedTransactionData;
+ },
+ async callAsync(
+ newOwner: string,
+ callData: Partial<CallData> = {},
+ defaultBlock?: BlockParam,
+ ): Promise<void
+ > {
+ const self = this as any as ERC20ProxyContract;
+ const functionSignature = 'transferOwnership(address)';
+ const inputAbi = self._lookupAbi(functionSignature).inputs;
+ [newOwner
+ ] = BaseContract._formatABIDataItemList(inputAbi, [newOwner
+ ], BaseContract._bigNumberToString.bind(self));
+ BaseContract.strictArgumentEncodingCheck(inputAbi, [newOwner
+ ]);
+ const ethersFunction = self._lookupEthersInterface(functionSignature).functions.transferOwnership;
+ const encodedData = ethersFunction.encode([newOwner
+ ]);
+ const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
+ {
+ to: self.address,
+ ...callData,
+ data: encodedData,
+ },
+ self._web3Wrapper.getContractDefaults(),
+ );
+ const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
+ BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
+ let resultArray = ethersFunction.decode(rawCallResult);
+ const outputAbi = (_.find(self.abi, {name: 'transferOwnership'}) as MethodAbi).outputs;
+ resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this));
+ resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this));
+ return resultArray;
+ },
+ };
+ public static async deployFrom0xArtifactAsync(
+ artifact: ContractArtifact,
+ provider: Provider,
+ txDefaults: Partial<TxData>,
+ ): Promise<ERC20ProxyContract> {
+ if (_.isUndefined(artifact.compilerOutput)) {
+ throw new Error('Compiler output not found in the artifact file');
+ }
+ const bytecode = artifact.compilerOutput.evm.bytecode.object;
+ const abi = artifact.compilerOutput.abi;
+ return ERC20ProxyContract.deployAsync(bytecode, abi, provider, txDefaults, );
+ }
+ public static async deployAsync(
+ bytecode: string,
+ abi: ContractAbi,
+ provider: Provider,
+ txDefaults: Partial<TxData>,
+ ): Promise<ERC20ProxyContract> {
+ const constructorAbi = BaseContract._lookupConstructorAbi(abi);
+ [] = BaseContract._formatABIDataItemList(
+ constructorAbi.inputs,
+ [],
+ BaseContract._bigNumberToString,
+ );
+ const iface = new ethers.utils.Interface(abi);
+ const deployInfo = iface.deployFunction;
+ const txData = deployInfo.encode(bytecode, []);
+ const web3Wrapper = new Web3Wrapper(provider);
+ const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
+ {data: txData},
+ txDefaults,
+ web3Wrapper.estimateGasAsync.bind(web3Wrapper),
+ );
+ const txHash = await web3Wrapper.sendTransactionAsync(txDataWithDefaults);
+ logUtils.log(`transactionHash: ${txHash}`);
+ const txReceipt = await web3Wrapper.awaitTransactionSuccessAsync(txHash);
+ logUtils.log(`ERC20Proxy successfully deployed at ${txReceipt.contractAddress}`);
+ const contractInstance = new ERC20ProxyContract(abi, txReceipt.contractAddress as string, provider, txDefaults);
+ contractInstance.constructorArgs = [];
+ return contractInstance;
+ }
+ constructor(abi: ContractAbi, address: string, provider: Provider, txDefaults?: Partial<TxData>) {
+ super('ERC20Proxy', abi, address, provider, txDefaults);
+ classUtils.bindAll(this, ['_ethersInterfacesByFunctionSignature', 'address', 'abi', '_web3Wrapper']);
+ }
+} // tslint:disable:max-file-line-count
+// tslint:enable:no-unbound-method
diff --git a/packages/abi-gen-wrappers/src/generated-wrappers/erc20_token.ts b/packages/abi-gen-wrappers/src/generated-wrappers/erc20_token.ts
new file mode 100644
index 000000000..5a51561d7
--- /dev/null
+++ b/packages/abi-gen-wrappers/src/generated-wrappers/erc20_token.ts
@@ -0,0 +1,556 @@
+// tslint:disable:no-consecutive-blank-lines ordered-imports align trailing-comma whitespace class-name
+// tslint:disable:no-unused-variable
+// tslint:disable:no-unbound-method
+import { BaseContract } from '@0xproject/base-contract';
+import { BlockParam, BlockParamLiteral, CallData, ContractAbi, ContractArtifact, DecodedLogArgs, MethodAbi, Provider, TxData, TxDataPayable } from 'ethereum-types';
+import { BigNumber, classUtils, logUtils } from '@0xproject/utils';
+import { Web3Wrapper } from '@0xproject/web3-wrapper';
+import * as ethers from 'ethers';
+import * as _ from 'lodash';
+// tslint:enable:no-unused-variable
+
+export type ERC20TokenEventArgs =
+ | ERC20TokenTransferEventArgs
+ | ERC20TokenApprovalEventArgs;
+
+export enum ERC20TokenEvents {
+ Transfer = 'Transfer',
+ Approval = 'Approval',
+}
+
+export interface ERC20TokenTransferEventArgs extends DecodedLogArgs {
+ _from: string;
+ _to: string;
+ _value: BigNumber;
+}
+
+export interface ERC20TokenApprovalEventArgs extends DecodedLogArgs {
+ _owner: string;
+ _spender: string;
+ _value: BigNumber;
+}
+
+
+/* istanbul ignore next */
+// tslint:disable:no-parameter-reassignment
+// tslint:disable-next-line:class-name
+export class ERC20TokenContract extends BaseContract {
+ public approve = {
+ async sendTransactionAsync(
+ _spender: string,
+ _value: BigNumber,
+ txData: Partial<TxData> = {},
+ ): Promise<string> {
+ const self = this as any as ERC20TokenContract;
+ const inputAbi = self._lookupAbi('approve(address,uint256)').inputs;
+ [_spender,
+ _value
+ ] = BaseContract._formatABIDataItemList(inputAbi, [_spender,
+ _value
+ ], BaseContract._bigNumberToString.bind(self));
+ BaseContract.strictArgumentEncodingCheck(inputAbi, [_spender,
+ _value
+ ]);
+ const encodedData = self._lookupEthersInterface('approve(address,uint256)').functions.approve.encode([_spender,
+ _value
+ ]);
+ const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
+ {
+ to: self.address,
+ ...txData,
+ data: encodedData,
+ },
+ self._web3Wrapper.getContractDefaults(),
+ self.approve.estimateGasAsync.bind(
+ self,
+ _spender,
+ _value
+ ),
+ );
+ const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults);
+ return txHash;
+ },
+ async estimateGasAsync(
+ _spender: string,
+ _value: BigNumber,
+ txData: Partial<TxData> = {},
+ ): Promise<number> {
+ const self = this as any as ERC20TokenContract;
+ const inputAbi = self._lookupAbi('approve(address,uint256)').inputs;
+ [_spender,
+ _value
+ ] = BaseContract._formatABIDataItemList(inputAbi, [_spender,
+ _value
+ ], BaseContract._bigNumberToString);
+ const encodedData = self._lookupEthersInterface('approve(address,uint256)').functions.approve.encode([_spender,
+ _value
+ ]);
+ const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
+ {
+ to: self.address,
+ ...txData,
+ data: encodedData,
+ },
+ self._web3Wrapper.getContractDefaults(),
+ );
+ const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults);
+ return gas;
+ },
+ getABIEncodedTransactionData(
+ _spender: string,
+ _value: BigNumber,
+ ): string {
+ const self = this as any as ERC20TokenContract;
+ const inputAbi = self._lookupAbi('approve(address,uint256)').inputs;
+ [_spender,
+ _value
+ ] = BaseContract._formatABIDataItemList(inputAbi, [_spender,
+ _value
+ ], BaseContract._bigNumberToString);
+ const abiEncodedTransactionData = self._lookupEthersInterface('approve(address,uint256)').functions.approve.encode([_spender,
+ _value
+ ]);
+ return abiEncodedTransactionData;
+ },
+ async callAsync(
+ _spender: string,
+ _value: BigNumber,
+ callData: Partial<CallData> = {},
+ defaultBlock?: BlockParam,
+ ): Promise<boolean
+ > {
+ const self = this as any as ERC20TokenContract;
+ const functionSignature = 'approve(address,uint256)';
+ const inputAbi = self._lookupAbi(functionSignature).inputs;
+ [_spender,
+ _value
+ ] = BaseContract._formatABIDataItemList(inputAbi, [_spender,
+ _value
+ ], BaseContract._bigNumberToString.bind(self));
+ BaseContract.strictArgumentEncodingCheck(inputAbi, [_spender,
+ _value
+ ]);
+ const ethersFunction = self._lookupEthersInterface(functionSignature).functions.approve;
+ const encodedData = ethersFunction.encode([_spender,
+ _value
+ ]);
+ const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
+ {
+ to: self.address,
+ ...callData,
+ data: encodedData,
+ },
+ self._web3Wrapper.getContractDefaults(),
+ );
+ const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
+ BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
+ let resultArray = ethersFunction.decode(rawCallResult);
+ const outputAbi = (_.find(self.abi, {name: 'approve'}) as MethodAbi).outputs;
+ resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this));
+ resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this));
+ return resultArray[0];
+ },
+ };
+ public totalSupply = {
+ async callAsync(
+ callData: Partial<CallData> = {},
+ defaultBlock?: BlockParam,
+ ): Promise<BigNumber
+ > {
+ const self = this as any as ERC20TokenContract;
+ const functionSignature = 'totalSupply()';
+ const inputAbi = self._lookupAbi(functionSignature).inputs;
+ [] = BaseContract._formatABIDataItemList(inputAbi, [], BaseContract._bigNumberToString.bind(self));
+ BaseContract.strictArgumentEncodingCheck(inputAbi, []);
+ const ethersFunction = self._lookupEthersInterface(functionSignature).functions.totalSupply;
+ const encodedData = ethersFunction.encode([]);
+ const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
+ {
+ to: self.address,
+ ...callData,
+ data: encodedData,
+ },
+ self._web3Wrapper.getContractDefaults(),
+ );
+ const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
+ BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
+ let resultArray = ethersFunction.decode(rawCallResult);
+ const outputAbi = (_.find(self.abi, {name: 'totalSupply'}) as MethodAbi).outputs;
+ resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this));
+ resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this));
+ return resultArray[0];
+ },
+ };
+ public transferFrom = {
+ async sendTransactionAsync(
+ _from: string,
+ _to: string,
+ _value: BigNumber,
+ txData: Partial<TxData> = {},
+ ): Promise<string> {
+ const self = this as any as ERC20TokenContract;
+ const inputAbi = self._lookupAbi('transferFrom(address,address,uint256)').inputs;
+ [_from,
+ _to,
+ _value
+ ] = BaseContract._formatABIDataItemList(inputAbi, [_from,
+ _to,
+ _value
+ ], BaseContract._bigNumberToString.bind(self));
+ BaseContract.strictArgumentEncodingCheck(inputAbi, [_from,
+ _to,
+ _value
+ ]);
+ const encodedData = self._lookupEthersInterface('transferFrom(address,address,uint256)').functions.transferFrom.encode([_from,
+ _to,
+ _value
+ ]);
+ const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
+ {
+ to: self.address,
+ ...txData,
+ data: encodedData,
+ },
+ self._web3Wrapper.getContractDefaults(),
+ self.transferFrom.estimateGasAsync.bind(
+ self,
+ _from,
+ _to,
+ _value
+ ),
+ );
+ const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults);
+ return txHash;
+ },
+ async estimateGasAsync(
+ _from: string,
+ _to: string,
+ _value: BigNumber,
+ txData: Partial<TxData> = {},
+ ): Promise<number> {
+ const self = this as any as ERC20TokenContract;
+ const inputAbi = self._lookupAbi('transferFrom(address,address,uint256)').inputs;
+ [_from,
+ _to,
+ _value
+ ] = BaseContract._formatABIDataItemList(inputAbi, [_from,
+ _to,
+ _value
+ ], BaseContract._bigNumberToString);
+ const encodedData = self._lookupEthersInterface('transferFrom(address,address,uint256)').functions.transferFrom.encode([_from,
+ _to,
+ _value
+ ]);
+ const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
+ {
+ to: self.address,
+ ...txData,
+ data: encodedData,
+ },
+ self._web3Wrapper.getContractDefaults(),
+ );
+ const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults);
+ return gas;
+ },
+ getABIEncodedTransactionData(
+ _from: string,
+ _to: string,
+ _value: BigNumber,
+ ): string {
+ const self = this as any as ERC20TokenContract;
+ const inputAbi = self._lookupAbi('transferFrom(address,address,uint256)').inputs;
+ [_from,
+ _to,
+ _value
+ ] = BaseContract._formatABIDataItemList(inputAbi, [_from,
+ _to,
+ _value
+ ], BaseContract._bigNumberToString);
+ const abiEncodedTransactionData = self._lookupEthersInterface('transferFrom(address,address,uint256)').functions.transferFrom.encode([_from,
+ _to,
+ _value
+ ]);
+ return abiEncodedTransactionData;
+ },
+ async callAsync(
+ _from: string,
+ _to: string,
+ _value: BigNumber,
+ callData: Partial<CallData> = {},
+ defaultBlock?: BlockParam,
+ ): Promise<boolean
+ > {
+ const self = this as any as ERC20TokenContract;
+ const functionSignature = 'transferFrom(address,address,uint256)';
+ const inputAbi = self._lookupAbi(functionSignature).inputs;
+ [_from,
+ _to,
+ _value
+ ] = BaseContract._formatABIDataItemList(inputAbi, [_from,
+ _to,
+ _value
+ ], BaseContract._bigNumberToString.bind(self));
+ BaseContract.strictArgumentEncodingCheck(inputAbi, [_from,
+ _to,
+ _value
+ ]);
+ const ethersFunction = self._lookupEthersInterface(functionSignature).functions.transferFrom;
+ const encodedData = ethersFunction.encode([_from,
+ _to,
+ _value
+ ]);
+ const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
+ {
+ to: self.address,
+ ...callData,
+ data: encodedData,
+ },
+ self._web3Wrapper.getContractDefaults(),
+ );
+ const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
+ BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
+ let resultArray = ethersFunction.decode(rawCallResult);
+ const outputAbi = (_.find(self.abi, {name: 'transferFrom'}) as MethodAbi).outputs;
+ resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this));
+ resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this));
+ return resultArray[0];
+ },
+ };
+ public balanceOf = {
+ async callAsync(
+ _owner: string,
+ callData: Partial<CallData> = {},
+ defaultBlock?: BlockParam,
+ ): Promise<BigNumber
+ > {
+ const self = this as any as ERC20TokenContract;
+ const functionSignature = 'balanceOf(address)';
+ const inputAbi = self._lookupAbi(functionSignature).inputs;
+ [_owner
+ ] = BaseContract._formatABIDataItemList(inputAbi, [_owner
+ ], BaseContract._bigNumberToString.bind(self));
+ BaseContract.strictArgumentEncodingCheck(inputAbi, [_owner
+ ]);
+ const ethersFunction = self._lookupEthersInterface(functionSignature).functions.balanceOf;
+ const encodedData = ethersFunction.encode([_owner
+ ]);
+ const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
+ {
+ to: self.address,
+ ...callData,
+ data: encodedData,
+ },
+ self._web3Wrapper.getContractDefaults(),
+ );
+ const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
+ BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
+ let resultArray = ethersFunction.decode(rawCallResult);
+ const outputAbi = (_.find(self.abi, {name: 'balanceOf'}) as MethodAbi).outputs;
+ resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this));
+ resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this));
+ return resultArray[0];
+ },
+ };
+ public transfer = {
+ async sendTransactionAsync(
+ _to: string,
+ _value: BigNumber,
+ txData: Partial<TxData> = {},
+ ): Promise<string> {
+ const self = this as any as ERC20TokenContract;
+ const inputAbi = self._lookupAbi('transfer(address,uint256)').inputs;
+ [_to,
+ _value
+ ] = BaseContract._formatABIDataItemList(inputAbi, [_to,
+ _value
+ ], BaseContract._bigNumberToString.bind(self));
+ BaseContract.strictArgumentEncodingCheck(inputAbi, [_to,
+ _value
+ ]);
+ const encodedData = self._lookupEthersInterface('transfer(address,uint256)').functions.transfer.encode([_to,
+ _value
+ ]);
+ const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
+ {
+ to: self.address,
+ ...txData,
+ data: encodedData,
+ },
+ self._web3Wrapper.getContractDefaults(),
+ self.transfer.estimateGasAsync.bind(
+ self,
+ _to,
+ _value
+ ),
+ );
+ const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults);
+ return txHash;
+ },
+ async estimateGasAsync(
+ _to: string,
+ _value: BigNumber,
+ txData: Partial<TxData> = {},
+ ): Promise<number> {
+ const self = this as any as ERC20TokenContract;
+ const inputAbi = self._lookupAbi('transfer(address,uint256)').inputs;
+ [_to,
+ _value
+ ] = BaseContract._formatABIDataItemList(inputAbi, [_to,
+ _value
+ ], BaseContract._bigNumberToString);
+ const encodedData = self._lookupEthersInterface('transfer(address,uint256)').functions.transfer.encode([_to,
+ _value
+ ]);
+ const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
+ {
+ to: self.address,
+ ...txData,
+ data: encodedData,
+ },
+ self._web3Wrapper.getContractDefaults(),
+ );
+ const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults);
+ return gas;
+ },
+ getABIEncodedTransactionData(
+ _to: string,
+ _value: BigNumber,
+ ): string {
+ const self = this as any as ERC20TokenContract;
+ const inputAbi = self._lookupAbi('transfer(address,uint256)').inputs;
+ [_to,
+ _value
+ ] = BaseContract._formatABIDataItemList(inputAbi, [_to,
+ _value
+ ], BaseContract._bigNumberToString);
+ const abiEncodedTransactionData = self._lookupEthersInterface('transfer(address,uint256)').functions.transfer.encode([_to,
+ _value
+ ]);
+ return abiEncodedTransactionData;
+ },
+ async callAsync(
+ _to: string,
+ _value: BigNumber,
+ callData: Partial<CallData> = {},
+ defaultBlock?: BlockParam,
+ ): Promise<boolean
+ > {
+ const self = this as any as ERC20TokenContract;
+ const functionSignature = 'transfer(address,uint256)';
+ const inputAbi = self._lookupAbi(functionSignature).inputs;
+ [_to,
+ _value
+ ] = BaseContract._formatABIDataItemList(inputAbi, [_to,
+ _value
+ ], BaseContract._bigNumberToString.bind(self));
+ BaseContract.strictArgumentEncodingCheck(inputAbi, [_to,
+ _value
+ ]);
+ const ethersFunction = self._lookupEthersInterface(functionSignature).functions.transfer;
+ const encodedData = ethersFunction.encode([_to,
+ _value
+ ]);
+ const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
+ {
+ to: self.address,
+ ...callData,
+ data: encodedData,
+ },
+ self._web3Wrapper.getContractDefaults(),
+ );
+ const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
+ BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
+ let resultArray = ethersFunction.decode(rawCallResult);
+ const outputAbi = (_.find(self.abi, {name: 'transfer'}) as MethodAbi).outputs;
+ resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this));
+ resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this));
+ return resultArray[0];
+ },
+ };
+ public allowance = {
+ async callAsync(
+ _owner: string,
+ _spender: string,
+ callData: Partial<CallData> = {},
+ defaultBlock?: BlockParam,
+ ): Promise<BigNumber
+ > {
+ const self = this as any as ERC20TokenContract;
+ const functionSignature = 'allowance(address,address)';
+ const inputAbi = self._lookupAbi(functionSignature).inputs;
+ [_owner,
+ _spender
+ ] = BaseContract._formatABIDataItemList(inputAbi, [_owner,
+ _spender
+ ], BaseContract._bigNumberToString.bind(self));
+ BaseContract.strictArgumentEncodingCheck(inputAbi, [_owner,
+ _spender
+ ]);
+ const ethersFunction = self._lookupEthersInterface(functionSignature).functions.allowance;
+ const encodedData = ethersFunction.encode([_owner,
+ _spender
+ ]);
+ const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
+ {
+ to: self.address,
+ ...callData,
+ data: encodedData,
+ },
+ self._web3Wrapper.getContractDefaults(),
+ );
+ const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
+ BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
+ let resultArray = ethersFunction.decode(rawCallResult);
+ const outputAbi = (_.find(self.abi, {name: 'allowance'}) as MethodAbi).outputs;
+ resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this));
+ resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this));
+ return resultArray[0];
+ },
+ };
+ public static async deployFrom0xArtifactAsync(
+ artifact: ContractArtifact,
+ provider: Provider,
+ txDefaults: Partial<TxData>,
+ ): Promise<ERC20TokenContract> {
+ if (_.isUndefined(artifact.compilerOutput)) {
+ throw new Error('Compiler output not found in the artifact file');
+ }
+ const bytecode = artifact.compilerOutput.evm.bytecode.object;
+ const abi = artifact.compilerOutput.abi;
+ return ERC20TokenContract.deployAsync(bytecode, abi, provider, txDefaults, );
+ }
+ public static async deployAsync(
+ bytecode: string,
+ abi: ContractAbi,
+ provider: Provider,
+ txDefaults: Partial<TxData>,
+ ): Promise<ERC20TokenContract> {
+ const constructorAbi = BaseContract._lookupConstructorAbi(abi);
+ [] = BaseContract._formatABIDataItemList(
+ constructorAbi.inputs,
+ [],
+ BaseContract._bigNumberToString,
+ );
+ const iface = new ethers.utils.Interface(abi);
+ const deployInfo = iface.deployFunction;
+ const txData = deployInfo.encode(bytecode, []);
+ const web3Wrapper = new Web3Wrapper(provider);
+ const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
+ {data: txData},
+ txDefaults,
+ web3Wrapper.estimateGasAsync.bind(web3Wrapper),
+ );
+ const txHash = await web3Wrapper.sendTransactionAsync(txDataWithDefaults);
+ logUtils.log(`transactionHash: ${txHash}`);
+ const txReceipt = await web3Wrapper.awaitTransactionSuccessAsync(txHash);
+ logUtils.log(`ERC20Token successfully deployed at ${txReceipt.contractAddress}`);
+ const contractInstance = new ERC20TokenContract(abi, txReceipt.contractAddress as string, provider, txDefaults);
+ contractInstance.constructorArgs = [];
+ return contractInstance;
+ }
+ constructor(abi: ContractAbi, address: string, provider: Provider, txDefaults?: Partial<TxData>) {
+ super('ERC20Token', abi, address, provider, txDefaults);
+ classUtils.bindAll(this, ['_ethersInterfacesByFunctionSignature', 'address', 'abi', '_web3Wrapper']);
+ }
+} // tslint:disable:max-file-line-count
+// tslint:enable:no-unbound-method
diff --git a/packages/abi-gen-wrappers/src/generated-wrappers/erc721_proxy.ts b/packages/abi-gen-wrappers/src/generated-wrappers/erc721_proxy.ts
new file mode 100644
index 000000000..97c9ed0bc
--- /dev/null
+++ b/packages/abi-gen-wrappers/src/generated-wrappers/erc721_proxy.ts
@@ -0,0 +1,649 @@
+// tslint:disable:no-consecutive-blank-lines ordered-imports align trailing-comma whitespace class-name
+// tslint:disable:no-unused-variable
+// tslint:disable:no-unbound-method
+import { BaseContract } from '@0xproject/base-contract';
+import { BlockParam, BlockParamLiteral, CallData, ContractAbi, ContractArtifact, DecodedLogArgs, MethodAbi, Provider, TxData, TxDataPayable } from 'ethereum-types';
+import { BigNumber, classUtils, logUtils } from '@0xproject/utils';
+import { Web3Wrapper } from '@0xproject/web3-wrapper';
+import * as ethers from 'ethers';
+import * as _ from 'lodash';
+// tslint:enable:no-unused-variable
+
+export type ERC721ProxyEventArgs =
+ | ERC721ProxyAuthorizedAddressAddedEventArgs
+ | ERC721ProxyAuthorizedAddressRemovedEventArgs;
+
+export enum ERC721ProxyEvents {
+ AuthorizedAddressAdded = 'AuthorizedAddressAdded',
+ AuthorizedAddressRemoved = 'AuthorizedAddressRemoved',
+}
+
+export interface ERC721ProxyAuthorizedAddressAddedEventArgs extends DecodedLogArgs {
+ target: string;
+ caller: string;
+}
+
+export interface ERC721ProxyAuthorizedAddressRemovedEventArgs extends DecodedLogArgs {
+ target: string;
+ caller: string;
+}
+
+
+/* istanbul ignore next */
+// tslint:disable:no-parameter-reassignment
+// tslint:disable-next-line:class-name
+export class ERC721ProxyContract extends BaseContract {
+ public addAuthorizedAddress = {
+ async sendTransactionAsync(
+ target: string,
+ txData: Partial<TxData> = {},
+ ): Promise<string> {
+ const self = this as any as ERC721ProxyContract;
+ const inputAbi = self._lookupAbi('addAuthorizedAddress(address)').inputs;
+ [target
+ ] = BaseContract._formatABIDataItemList(inputAbi, [target
+ ], BaseContract._bigNumberToString.bind(self));
+ BaseContract.strictArgumentEncodingCheck(inputAbi, [target
+ ]);
+ const encodedData = self._lookupEthersInterface('addAuthorizedAddress(address)').functions.addAuthorizedAddress.encode([target
+ ]);
+ const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
+ {
+ to: self.address,
+ ...txData,
+ data: encodedData,
+ },
+ self._web3Wrapper.getContractDefaults(),
+ self.addAuthorizedAddress.estimateGasAsync.bind(
+ self,
+ target
+ ),
+ );
+ const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults);
+ return txHash;
+ },
+ async estimateGasAsync(
+ target: string,
+ txData: Partial<TxData> = {},
+ ): Promise<number> {
+ const self = this as any as ERC721ProxyContract;
+ const inputAbi = self._lookupAbi('addAuthorizedAddress(address)').inputs;
+ [target
+ ] = BaseContract._formatABIDataItemList(inputAbi, [target
+ ], BaseContract._bigNumberToString);
+ const encodedData = self._lookupEthersInterface('addAuthorizedAddress(address)').functions.addAuthorizedAddress.encode([target
+ ]);
+ const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
+ {
+ to: self.address,
+ ...txData,
+ data: encodedData,
+ },
+ self._web3Wrapper.getContractDefaults(),
+ );
+ const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults);
+ return gas;
+ },
+ getABIEncodedTransactionData(
+ target: string,
+ ): string {
+ const self = this as any as ERC721ProxyContract;
+ const inputAbi = self._lookupAbi('addAuthorizedAddress(address)').inputs;
+ [target
+ ] = BaseContract._formatABIDataItemList(inputAbi, [target
+ ], BaseContract._bigNumberToString);
+ const abiEncodedTransactionData = self._lookupEthersInterface('addAuthorizedAddress(address)').functions.addAuthorizedAddress.encode([target
+ ]);
+ return abiEncodedTransactionData;
+ },
+ async callAsync(
+ target: string,
+ callData: Partial<CallData> = {},
+ defaultBlock?: BlockParam,
+ ): Promise<void
+ > {
+ const self = this as any as ERC721ProxyContract;
+ const functionSignature = 'addAuthorizedAddress(address)';
+ const inputAbi = self._lookupAbi(functionSignature).inputs;
+ [target
+ ] = BaseContract._formatABIDataItemList(inputAbi, [target
+ ], BaseContract._bigNumberToString.bind(self));
+ BaseContract.strictArgumentEncodingCheck(inputAbi, [target
+ ]);
+ const ethersFunction = self._lookupEthersInterface(functionSignature).functions.addAuthorizedAddress;
+ const encodedData = ethersFunction.encode([target
+ ]);
+ const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
+ {
+ to: self.address,
+ ...callData,
+ data: encodedData,
+ },
+ self._web3Wrapper.getContractDefaults(),
+ );
+ const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
+ BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
+ let resultArray = ethersFunction.decode(rawCallResult);
+ const outputAbi = (_.find(self.abi, {name: 'addAuthorizedAddress'}) as MethodAbi).outputs;
+ resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this));
+ resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this));
+ return resultArray;
+ },
+ };
+ public authorities = {
+ async callAsync(
+ index_0: BigNumber,
+ callData: Partial<CallData> = {},
+ defaultBlock?: BlockParam,
+ ): Promise<string
+ > {
+ const self = this as any as ERC721ProxyContract;
+ const functionSignature = 'authorities(uint256)';
+ const inputAbi = self._lookupAbi(functionSignature).inputs;
+ [index_0
+ ] = BaseContract._formatABIDataItemList(inputAbi, [index_0
+ ], BaseContract._bigNumberToString.bind(self));
+ BaseContract.strictArgumentEncodingCheck(inputAbi, [index_0
+ ]);
+ const ethersFunction = self._lookupEthersInterface(functionSignature).functions.authorities;
+ const encodedData = ethersFunction.encode([index_0
+ ]);
+ const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
+ {
+ to: self.address,
+ ...callData,
+ data: encodedData,
+ },
+ self._web3Wrapper.getContractDefaults(),
+ );
+ const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
+ BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
+ let resultArray = ethersFunction.decode(rawCallResult);
+ const outputAbi = (_.find(self.abi, {name: 'authorities'}) as MethodAbi).outputs;
+ resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this));
+ resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this));
+ return resultArray[0];
+ },
+ };
+ public removeAuthorizedAddress = {
+ async sendTransactionAsync(
+ target: string,
+ txData: Partial<TxData> = {},
+ ): Promise<string> {
+ const self = this as any as ERC721ProxyContract;
+ const inputAbi = self._lookupAbi('removeAuthorizedAddress(address)').inputs;
+ [target
+ ] = BaseContract._formatABIDataItemList(inputAbi, [target
+ ], BaseContract._bigNumberToString.bind(self));
+ BaseContract.strictArgumentEncodingCheck(inputAbi, [target
+ ]);
+ const encodedData = self._lookupEthersInterface('removeAuthorizedAddress(address)').functions.removeAuthorizedAddress.encode([target
+ ]);
+ const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
+ {
+ to: self.address,
+ ...txData,
+ data: encodedData,
+ },
+ self._web3Wrapper.getContractDefaults(),
+ self.removeAuthorizedAddress.estimateGasAsync.bind(
+ self,
+ target
+ ),
+ );
+ const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults);
+ return txHash;
+ },
+ async estimateGasAsync(
+ target: string,
+ txData: Partial<TxData> = {},
+ ): Promise<number> {
+ const self = this as any as ERC721ProxyContract;
+ const inputAbi = self._lookupAbi('removeAuthorizedAddress(address)').inputs;
+ [target
+ ] = BaseContract._formatABIDataItemList(inputAbi, [target
+ ], BaseContract._bigNumberToString);
+ const encodedData = self._lookupEthersInterface('removeAuthorizedAddress(address)').functions.removeAuthorizedAddress.encode([target
+ ]);
+ const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
+ {
+ to: self.address,
+ ...txData,
+ data: encodedData,
+ },
+ self._web3Wrapper.getContractDefaults(),
+ );
+ const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults);
+ return gas;
+ },
+ getABIEncodedTransactionData(
+ target: string,
+ ): string {
+ const self = this as any as ERC721ProxyContract;
+ const inputAbi = self._lookupAbi('removeAuthorizedAddress(address)').inputs;
+ [target
+ ] = BaseContract._formatABIDataItemList(inputAbi, [target
+ ], BaseContract._bigNumberToString);
+ const abiEncodedTransactionData = self._lookupEthersInterface('removeAuthorizedAddress(address)').functions.removeAuthorizedAddress.encode([target
+ ]);
+ return abiEncodedTransactionData;
+ },
+ async callAsync(
+ target: string,
+ callData: Partial<CallData> = {},
+ defaultBlock?: BlockParam,
+ ): Promise<void
+ > {
+ const self = this as any as ERC721ProxyContract;
+ const functionSignature = 'removeAuthorizedAddress(address)';
+ const inputAbi = self._lookupAbi(functionSignature).inputs;
+ [target
+ ] = BaseContract._formatABIDataItemList(inputAbi, [target
+ ], BaseContract._bigNumberToString.bind(self));
+ BaseContract.strictArgumentEncodingCheck(inputAbi, [target
+ ]);
+ const ethersFunction = self._lookupEthersInterface(functionSignature).functions.removeAuthorizedAddress;
+ const encodedData = ethersFunction.encode([target
+ ]);
+ const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
+ {
+ to: self.address,
+ ...callData,
+ data: encodedData,
+ },
+ self._web3Wrapper.getContractDefaults(),
+ );
+ const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
+ BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
+ let resultArray = ethersFunction.decode(rawCallResult);
+ const outputAbi = (_.find(self.abi, {name: 'removeAuthorizedAddress'}) as MethodAbi).outputs;
+ resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this));
+ resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this));
+ return resultArray;
+ },
+ };
+ public owner = {
+ async callAsync(
+ callData: Partial<CallData> = {},
+ defaultBlock?: BlockParam,
+ ): Promise<string
+ > {
+ const self = this as any as ERC721ProxyContract;
+ const functionSignature = 'owner()';
+ const inputAbi = self._lookupAbi(functionSignature).inputs;
+ [] = BaseContract._formatABIDataItemList(inputAbi, [], BaseContract._bigNumberToString.bind(self));
+ BaseContract.strictArgumentEncodingCheck(inputAbi, []);
+ const ethersFunction = self._lookupEthersInterface(functionSignature).functions.owner;
+ const encodedData = ethersFunction.encode([]);
+ const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
+ {
+ to: self.address,
+ ...callData,
+ data: encodedData,
+ },
+ self._web3Wrapper.getContractDefaults(),
+ );
+ const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
+ BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
+ let resultArray = ethersFunction.decode(rawCallResult);
+ const outputAbi = (_.find(self.abi, {name: 'owner'}) as MethodAbi).outputs;
+ resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this));
+ resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this));
+ return resultArray[0];
+ },
+ };
+ public removeAuthorizedAddressAtIndex = {
+ async sendTransactionAsync(
+ target: string,
+ index: BigNumber,
+ txData: Partial<TxData> = {},
+ ): Promise<string> {
+ const self = this as any as ERC721ProxyContract;
+ const inputAbi = self._lookupAbi('removeAuthorizedAddressAtIndex(address,uint256)').inputs;
+ [target,
+ index
+ ] = BaseContract._formatABIDataItemList(inputAbi, [target,
+ index
+ ], BaseContract._bigNumberToString.bind(self));
+ BaseContract.strictArgumentEncodingCheck(inputAbi, [target,
+ index
+ ]);
+ const encodedData = self._lookupEthersInterface('removeAuthorizedAddressAtIndex(address,uint256)').functions.removeAuthorizedAddressAtIndex.encode([target,
+ index
+ ]);
+ const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
+ {
+ to: self.address,
+ ...txData,
+ data: encodedData,
+ },
+ self._web3Wrapper.getContractDefaults(),
+ self.removeAuthorizedAddressAtIndex.estimateGasAsync.bind(
+ self,
+ target,
+ index
+ ),
+ );
+ const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults);
+ return txHash;
+ },
+ async estimateGasAsync(
+ target: string,
+ index: BigNumber,
+ txData: Partial<TxData> = {},
+ ): Promise<number> {
+ const self = this as any as ERC721ProxyContract;
+ const inputAbi = self._lookupAbi('removeAuthorizedAddressAtIndex(address,uint256)').inputs;
+ [target,
+ index
+ ] = BaseContract._formatABIDataItemList(inputAbi, [target,
+ index
+ ], BaseContract._bigNumberToString);
+ const encodedData = self._lookupEthersInterface('removeAuthorizedAddressAtIndex(address,uint256)').functions.removeAuthorizedAddressAtIndex.encode([target,
+ index
+ ]);
+ const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
+ {
+ to: self.address,
+ ...txData,
+ data: encodedData,
+ },
+ self._web3Wrapper.getContractDefaults(),
+ );
+ const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults);
+ return gas;
+ },
+ getABIEncodedTransactionData(
+ target: string,
+ index: BigNumber,
+ ): string {
+ const self = this as any as ERC721ProxyContract;
+ const inputAbi = self._lookupAbi('removeAuthorizedAddressAtIndex(address,uint256)').inputs;
+ [target,
+ index
+ ] = BaseContract._formatABIDataItemList(inputAbi, [target,
+ index
+ ], BaseContract._bigNumberToString);
+ const abiEncodedTransactionData = self._lookupEthersInterface('removeAuthorizedAddressAtIndex(address,uint256)').functions.removeAuthorizedAddressAtIndex.encode([target,
+ index
+ ]);
+ return abiEncodedTransactionData;
+ },
+ async callAsync(
+ target: string,
+ index: BigNumber,
+ callData: Partial<CallData> = {},
+ defaultBlock?: BlockParam,
+ ): Promise<void
+ > {
+ const self = this as any as ERC721ProxyContract;
+ const functionSignature = 'removeAuthorizedAddressAtIndex(address,uint256)';
+ const inputAbi = self._lookupAbi(functionSignature).inputs;
+ [target,
+ index
+ ] = BaseContract._formatABIDataItemList(inputAbi, [target,
+ index
+ ], BaseContract._bigNumberToString.bind(self));
+ BaseContract.strictArgumentEncodingCheck(inputAbi, [target,
+ index
+ ]);
+ const ethersFunction = self._lookupEthersInterface(functionSignature).functions.removeAuthorizedAddressAtIndex;
+ const encodedData = ethersFunction.encode([target,
+ index
+ ]);
+ const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
+ {
+ to: self.address,
+ ...callData,
+ data: encodedData,
+ },
+ self._web3Wrapper.getContractDefaults(),
+ );
+ const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
+ BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
+ let resultArray = ethersFunction.decode(rawCallResult);
+ const outputAbi = (_.find(self.abi, {name: 'removeAuthorizedAddressAtIndex'}) as MethodAbi).outputs;
+ resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this));
+ resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this));
+ return resultArray;
+ },
+ };
+ public getProxyId = {
+ async callAsync(
+ callData: Partial<CallData> = {},
+ defaultBlock?: BlockParam,
+ ): Promise<string
+ > {
+ const self = this as any as ERC721ProxyContract;
+ const functionSignature = 'getProxyId()';
+ const inputAbi = self._lookupAbi(functionSignature).inputs;
+ [] = BaseContract._formatABIDataItemList(inputAbi, [], BaseContract._bigNumberToString.bind(self));
+ BaseContract.strictArgumentEncodingCheck(inputAbi, []);
+ const ethersFunction = self._lookupEthersInterface(functionSignature).functions.getProxyId;
+ const encodedData = ethersFunction.encode([]);
+ const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
+ {
+ to: self.address,
+ ...callData,
+ data: encodedData,
+ },
+ self._web3Wrapper.getContractDefaults(),
+ );
+ const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
+ BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
+ let resultArray = ethersFunction.decode(rawCallResult);
+ const outputAbi = (_.find(self.abi, {name: 'getProxyId'}) as MethodAbi).outputs;
+ resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this));
+ resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this));
+ return resultArray[0];
+ },
+ };
+ public authorized = {
+ async callAsync(
+ index_0: string,
+ callData: Partial<CallData> = {},
+ defaultBlock?: BlockParam,
+ ): Promise<boolean
+ > {
+ const self = this as any as ERC721ProxyContract;
+ const functionSignature = 'authorized(address)';
+ const inputAbi = self._lookupAbi(functionSignature).inputs;
+ [index_0
+ ] = BaseContract._formatABIDataItemList(inputAbi, [index_0
+ ], BaseContract._bigNumberToString.bind(self));
+ BaseContract.strictArgumentEncodingCheck(inputAbi, [index_0
+ ]);
+ const ethersFunction = self._lookupEthersInterface(functionSignature).functions.authorized;
+ const encodedData = ethersFunction.encode([index_0
+ ]);
+ const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
+ {
+ to: self.address,
+ ...callData,
+ data: encodedData,
+ },
+ self._web3Wrapper.getContractDefaults(),
+ );
+ const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
+ BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
+ let resultArray = ethersFunction.decode(rawCallResult);
+ const outputAbi = (_.find(self.abi, {name: 'authorized'}) as MethodAbi).outputs;
+ resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this));
+ resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this));
+ return resultArray[0];
+ },
+ };
+ public getAuthorizedAddresses = {
+ async callAsync(
+ callData: Partial<CallData> = {},
+ defaultBlock?: BlockParam,
+ ): Promise<string[]
+ > {
+ const self = this as any as ERC721ProxyContract;
+ const functionSignature = 'getAuthorizedAddresses()';
+ const inputAbi = self._lookupAbi(functionSignature).inputs;
+ [] = BaseContract._formatABIDataItemList(inputAbi, [], BaseContract._bigNumberToString.bind(self));
+ BaseContract.strictArgumentEncodingCheck(inputAbi, []);
+ const ethersFunction = self._lookupEthersInterface(functionSignature).functions.getAuthorizedAddresses;
+ const encodedData = ethersFunction.encode([]);
+ const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
+ {
+ to: self.address,
+ ...callData,
+ data: encodedData,
+ },
+ self._web3Wrapper.getContractDefaults(),
+ );
+ const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
+ BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
+ let resultArray = ethersFunction.decode(rawCallResult);
+ const outputAbi = (_.find(self.abi, {name: 'getAuthorizedAddresses'}) as MethodAbi).outputs;
+ resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this));
+ resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this));
+ return resultArray[0];
+ },
+ };
+ public transferOwnership = {
+ async sendTransactionAsync(
+ newOwner: string,
+ txData: Partial<TxData> = {},
+ ): Promise<string> {
+ const self = this as any as ERC721ProxyContract;
+ const inputAbi = self._lookupAbi('transferOwnership(address)').inputs;
+ [newOwner
+ ] = BaseContract._formatABIDataItemList(inputAbi, [newOwner
+ ], BaseContract._bigNumberToString.bind(self));
+ BaseContract.strictArgumentEncodingCheck(inputAbi, [newOwner
+ ]);
+ const encodedData = self._lookupEthersInterface('transferOwnership(address)').functions.transferOwnership.encode([newOwner
+ ]);
+ const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
+ {
+ to: self.address,
+ ...txData,
+ data: encodedData,
+ },
+ self._web3Wrapper.getContractDefaults(),
+ self.transferOwnership.estimateGasAsync.bind(
+ self,
+ newOwner
+ ),
+ );
+ const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults);
+ return txHash;
+ },
+ async estimateGasAsync(
+ newOwner: string,
+ txData: Partial<TxData> = {},
+ ): Promise<number> {
+ const self = this as any as ERC721ProxyContract;
+ const inputAbi = self._lookupAbi('transferOwnership(address)').inputs;
+ [newOwner
+ ] = BaseContract._formatABIDataItemList(inputAbi, [newOwner
+ ], BaseContract._bigNumberToString);
+ const encodedData = self._lookupEthersInterface('transferOwnership(address)').functions.transferOwnership.encode([newOwner
+ ]);
+ const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
+ {
+ to: self.address,
+ ...txData,
+ data: encodedData,
+ },
+ self._web3Wrapper.getContractDefaults(),
+ );
+ const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults);
+ return gas;
+ },
+ getABIEncodedTransactionData(
+ newOwner: string,
+ ): string {
+ const self = this as any as ERC721ProxyContract;
+ const inputAbi = self._lookupAbi('transferOwnership(address)').inputs;
+ [newOwner
+ ] = BaseContract._formatABIDataItemList(inputAbi, [newOwner
+ ], BaseContract._bigNumberToString);
+ const abiEncodedTransactionData = self._lookupEthersInterface('transferOwnership(address)').functions.transferOwnership.encode([newOwner
+ ]);
+ return abiEncodedTransactionData;
+ },
+ async callAsync(
+ newOwner: string,
+ callData: Partial<CallData> = {},
+ defaultBlock?: BlockParam,
+ ): Promise<void
+ > {
+ const self = this as any as ERC721ProxyContract;
+ const functionSignature = 'transferOwnership(address)';
+ const inputAbi = self._lookupAbi(functionSignature).inputs;
+ [newOwner
+ ] = BaseContract._formatABIDataItemList(inputAbi, [newOwner
+ ], BaseContract._bigNumberToString.bind(self));
+ BaseContract.strictArgumentEncodingCheck(inputAbi, [newOwner
+ ]);
+ const ethersFunction = self._lookupEthersInterface(functionSignature).functions.transferOwnership;
+ const encodedData = ethersFunction.encode([newOwner
+ ]);
+ const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
+ {
+ to: self.address,
+ ...callData,
+ data: encodedData,
+ },
+ self._web3Wrapper.getContractDefaults(),
+ );
+ const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
+ BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
+ let resultArray = ethersFunction.decode(rawCallResult);
+ const outputAbi = (_.find(self.abi, {name: 'transferOwnership'}) as MethodAbi).outputs;
+ resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this));
+ resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this));
+ return resultArray;
+ },
+ };
+ public static async deployFrom0xArtifactAsync(
+ artifact: ContractArtifact,
+ provider: Provider,
+ txDefaults: Partial<TxData>,
+ ): Promise<ERC721ProxyContract> {
+ if (_.isUndefined(artifact.compilerOutput)) {
+ throw new Error('Compiler output not found in the artifact file');
+ }
+ const bytecode = artifact.compilerOutput.evm.bytecode.object;
+ const abi = artifact.compilerOutput.abi;
+ return ERC721ProxyContract.deployAsync(bytecode, abi, provider, txDefaults, );
+ }
+ public static async deployAsync(
+ bytecode: string,
+ abi: ContractAbi,
+ provider: Provider,
+ txDefaults: Partial<TxData>,
+ ): Promise<ERC721ProxyContract> {
+ const constructorAbi = BaseContract._lookupConstructorAbi(abi);
+ [] = BaseContract._formatABIDataItemList(
+ constructorAbi.inputs,
+ [],
+ BaseContract._bigNumberToString,
+ );
+ const iface = new ethers.utils.Interface(abi);
+ const deployInfo = iface.deployFunction;
+ const txData = deployInfo.encode(bytecode, []);
+ const web3Wrapper = new Web3Wrapper(provider);
+ const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
+ {data: txData},
+ txDefaults,
+ web3Wrapper.estimateGasAsync.bind(web3Wrapper),
+ );
+ const txHash = await web3Wrapper.sendTransactionAsync(txDataWithDefaults);
+ logUtils.log(`transactionHash: ${txHash}`);
+ const txReceipt = await web3Wrapper.awaitTransactionSuccessAsync(txHash);
+ logUtils.log(`ERC721Proxy successfully deployed at ${txReceipt.contractAddress}`);
+ const contractInstance = new ERC721ProxyContract(abi, txReceipt.contractAddress as string, provider, txDefaults);
+ contractInstance.constructorArgs = [];
+ return contractInstance;
+ }
+ constructor(abi: ContractAbi, address: string, provider: Provider, txDefaults?: Partial<TxData>) {
+ super('ERC721Proxy', abi, address, provider, txDefaults);
+ classUtils.bindAll(this, ['_ethersInterfacesByFunctionSignature', 'address', 'abi', '_web3Wrapper']);
+ }
+} // tslint:disable:max-file-line-count
+// tslint:enable:no-unbound-method
diff --git a/packages/abi-gen-wrappers/src/generated-wrappers/erc721_token.ts b/packages/abi-gen-wrappers/src/generated-wrappers/erc721_token.ts
new file mode 100644
index 000000000..0e25c97b8
--- /dev/null
+++ b/packages/abi-gen-wrappers/src/generated-wrappers/erc721_token.ts
@@ -0,0 +1,893 @@
+// tslint:disable:no-consecutive-blank-lines ordered-imports align trailing-comma whitespace class-name
+// tslint:disable:no-unused-variable
+// tslint:disable:no-unbound-method
+import { BaseContract } from '@0xproject/base-contract';
+import { BlockParam, BlockParamLiteral, CallData, ContractAbi, ContractArtifact, DecodedLogArgs, MethodAbi, Provider, TxData, TxDataPayable } from 'ethereum-types';
+import { BigNumber, classUtils, logUtils } from '@0xproject/utils';
+import { Web3Wrapper } from '@0xproject/web3-wrapper';
+import * as ethers from 'ethers';
+import * as _ from 'lodash';
+// tslint:enable:no-unused-variable
+
+export type ERC721TokenEventArgs =
+ | ERC721TokenTransferEventArgs
+ | ERC721TokenApprovalEventArgs
+ | ERC721TokenApprovalForAllEventArgs;
+
+export enum ERC721TokenEvents {
+ Transfer = 'Transfer',
+ Approval = 'Approval',
+ ApprovalForAll = 'ApprovalForAll',
+}
+
+export interface ERC721TokenTransferEventArgs extends DecodedLogArgs {
+ _from: string;
+ _to: string;
+ _tokenId: BigNumber;
+}
+
+export interface ERC721TokenApprovalEventArgs extends DecodedLogArgs {
+ _owner: string;
+ _approved: string;
+ _tokenId: BigNumber;
+}
+
+export interface ERC721TokenApprovalForAllEventArgs extends DecodedLogArgs {
+ _owner: string;
+ _operator: string;
+ _approved: boolean;
+}
+
+
+/* istanbul ignore next */
+// tslint:disable:no-parameter-reassignment
+// tslint:disable-next-line:class-name
+export class ERC721TokenContract extends BaseContract {
+ public getApproved = {
+ async callAsync(
+ _tokenId: BigNumber,
+ callData: Partial<CallData> = {},
+ defaultBlock?: BlockParam,
+ ): Promise<string
+ > {
+ const self = this as any as ERC721TokenContract;
+ const functionSignature = 'getApproved(uint256)';
+ const inputAbi = self._lookupAbi(functionSignature).inputs;
+ [_tokenId
+ ] = BaseContract._formatABIDataItemList(inputAbi, [_tokenId
+ ], BaseContract._bigNumberToString.bind(self));
+ BaseContract.strictArgumentEncodingCheck(inputAbi, [_tokenId
+ ]);
+ const ethersFunction = self._lookupEthersInterface(functionSignature).functions.getApproved;
+ const encodedData = ethersFunction.encode([_tokenId
+ ]);
+ const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
+ {
+ to: self.address,
+ ...callData,
+ data: encodedData,
+ },
+ self._web3Wrapper.getContractDefaults(),
+ );
+ const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
+ BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
+ let resultArray = ethersFunction.decode(rawCallResult);
+ const outputAbi = (_.find(self.abi, {name: 'getApproved'}) as MethodAbi).outputs;
+ resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this));
+ resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this));
+ return resultArray[0];
+ },
+ };
+ public approve = {
+ async sendTransactionAsync(
+ _approved: string,
+ _tokenId: BigNumber,
+ txData: Partial<TxData> = {},
+ ): Promise<string> {
+ const self = this as any as ERC721TokenContract;
+ const inputAbi = self._lookupAbi('approve(address,uint256)').inputs;
+ [_approved,
+ _tokenId
+ ] = BaseContract._formatABIDataItemList(inputAbi, [_approved,
+ _tokenId
+ ], BaseContract._bigNumberToString.bind(self));
+ BaseContract.strictArgumentEncodingCheck(inputAbi, [_approved,
+ _tokenId
+ ]);
+ const encodedData = self._lookupEthersInterface('approve(address,uint256)').functions.approve.encode([_approved,
+ _tokenId
+ ]);
+ const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
+ {
+ to: self.address,
+ ...txData,
+ data: encodedData,
+ },
+ self._web3Wrapper.getContractDefaults(),
+ self.approve.estimateGasAsync.bind(
+ self,
+ _approved,
+ _tokenId
+ ),
+ );
+ const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults);
+ return txHash;
+ },
+ async estimateGasAsync(
+ _approved: string,
+ _tokenId: BigNumber,
+ txData: Partial<TxData> = {},
+ ): Promise<number> {
+ const self = this as any as ERC721TokenContract;
+ const inputAbi = self._lookupAbi('approve(address,uint256)').inputs;
+ [_approved,
+ _tokenId
+ ] = BaseContract._formatABIDataItemList(inputAbi, [_approved,
+ _tokenId
+ ], BaseContract._bigNumberToString);
+ const encodedData = self._lookupEthersInterface('approve(address,uint256)').functions.approve.encode([_approved,
+ _tokenId
+ ]);
+ const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
+ {
+ to: self.address,
+ ...txData,
+ data: encodedData,
+ },
+ self._web3Wrapper.getContractDefaults(),
+ );
+ const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults);
+ return gas;
+ },
+ getABIEncodedTransactionData(
+ _approved: string,
+ _tokenId: BigNumber,
+ ): string {
+ const self = this as any as ERC721TokenContract;
+ const inputAbi = self._lookupAbi('approve(address,uint256)').inputs;
+ [_approved,
+ _tokenId
+ ] = BaseContract._formatABIDataItemList(inputAbi, [_approved,
+ _tokenId
+ ], BaseContract._bigNumberToString);
+ const abiEncodedTransactionData = self._lookupEthersInterface('approve(address,uint256)').functions.approve.encode([_approved,
+ _tokenId
+ ]);
+ return abiEncodedTransactionData;
+ },
+ async callAsync(
+ _approved: string,
+ _tokenId: BigNumber,
+ callData: Partial<CallData> = {},
+ defaultBlock?: BlockParam,
+ ): Promise<void
+ > {
+ const self = this as any as ERC721TokenContract;
+ const functionSignature = 'approve(address,uint256)';
+ const inputAbi = self._lookupAbi(functionSignature).inputs;
+ [_approved,
+ _tokenId
+ ] = BaseContract._formatABIDataItemList(inputAbi, [_approved,
+ _tokenId
+ ], BaseContract._bigNumberToString.bind(self));
+ BaseContract.strictArgumentEncodingCheck(inputAbi, [_approved,
+ _tokenId
+ ]);
+ const ethersFunction = self._lookupEthersInterface(functionSignature).functions.approve;
+ const encodedData = ethersFunction.encode([_approved,
+ _tokenId
+ ]);
+ const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
+ {
+ to: self.address,
+ ...callData,
+ data: encodedData,
+ },
+ self._web3Wrapper.getContractDefaults(),
+ );
+ const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
+ BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
+ let resultArray = ethersFunction.decode(rawCallResult);
+ const outputAbi = (_.find(self.abi, {name: 'approve'}) as MethodAbi).outputs;
+ resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this));
+ resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this));
+ return resultArray;
+ },
+ };
+ public transferFrom = {
+ async sendTransactionAsync(
+ _from: string,
+ _to: string,
+ _tokenId: BigNumber,
+ txData: Partial<TxData> = {},
+ ): Promise<string> {
+ const self = this as any as ERC721TokenContract;
+ const inputAbi = self._lookupAbi('transferFrom(address,address,uint256)').inputs;
+ [_from,
+ _to,
+ _tokenId
+ ] = BaseContract._formatABIDataItemList(inputAbi, [_from,
+ _to,
+ _tokenId
+ ], BaseContract._bigNumberToString.bind(self));
+ BaseContract.strictArgumentEncodingCheck(inputAbi, [_from,
+ _to,
+ _tokenId
+ ]);
+ const encodedData = self._lookupEthersInterface('transferFrom(address,address,uint256)').functions.transferFrom.encode([_from,
+ _to,
+ _tokenId
+ ]);
+ const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
+ {
+ to: self.address,
+ ...txData,
+ data: encodedData,
+ },
+ self._web3Wrapper.getContractDefaults(),
+ self.transferFrom.estimateGasAsync.bind(
+ self,
+ _from,
+ _to,
+ _tokenId
+ ),
+ );
+ const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults);
+ return txHash;
+ },
+ async estimateGasAsync(
+ _from: string,
+ _to: string,
+ _tokenId: BigNumber,
+ txData: Partial<TxData> = {},
+ ): Promise<number> {
+ const self = this as any as ERC721TokenContract;
+ const inputAbi = self._lookupAbi('transferFrom(address,address,uint256)').inputs;
+ [_from,
+ _to,
+ _tokenId
+ ] = BaseContract._formatABIDataItemList(inputAbi, [_from,
+ _to,
+ _tokenId
+ ], BaseContract._bigNumberToString);
+ const encodedData = self._lookupEthersInterface('transferFrom(address,address,uint256)').functions.transferFrom.encode([_from,
+ _to,
+ _tokenId
+ ]);
+ const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
+ {
+ to: self.address,
+ ...txData,
+ data: encodedData,
+ },
+ self._web3Wrapper.getContractDefaults(),
+ );
+ const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults);
+ return gas;
+ },
+ getABIEncodedTransactionData(
+ _from: string,
+ _to: string,
+ _tokenId: BigNumber,
+ ): string {
+ const self = this as any as ERC721TokenContract;
+ const inputAbi = self._lookupAbi('transferFrom(address,address,uint256)').inputs;
+ [_from,
+ _to,
+ _tokenId
+ ] = BaseContract._formatABIDataItemList(inputAbi, [_from,
+ _to,
+ _tokenId
+ ], BaseContract._bigNumberToString);
+ const abiEncodedTransactionData = self._lookupEthersInterface('transferFrom(address,address,uint256)').functions.transferFrom.encode([_from,
+ _to,
+ _tokenId
+ ]);
+ return abiEncodedTransactionData;
+ },
+ async callAsync(
+ _from: string,
+ _to: string,
+ _tokenId: BigNumber,
+ callData: Partial<CallData> = {},
+ defaultBlock?: BlockParam,
+ ): Promise<void
+ > {
+ const self = this as any as ERC721TokenContract;
+ const functionSignature = 'transferFrom(address,address,uint256)';
+ const inputAbi = self._lookupAbi(functionSignature).inputs;
+ [_from,
+ _to,
+ _tokenId
+ ] = BaseContract._formatABIDataItemList(inputAbi, [_from,
+ _to,
+ _tokenId
+ ], BaseContract._bigNumberToString.bind(self));
+ BaseContract.strictArgumentEncodingCheck(inputAbi, [_from,
+ _to,
+ _tokenId
+ ]);
+ const ethersFunction = self._lookupEthersInterface(functionSignature).functions.transferFrom;
+ const encodedData = ethersFunction.encode([_from,
+ _to,
+ _tokenId
+ ]);
+ const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
+ {
+ to: self.address,
+ ...callData,
+ data: encodedData,
+ },
+ self._web3Wrapper.getContractDefaults(),
+ );
+ const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
+ BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
+ let resultArray = ethersFunction.decode(rawCallResult);
+ const outputAbi = (_.find(self.abi, {name: 'transferFrom'}) as MethodAbi).outputs;
+ resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this));
+ resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this));
+ return resultArray;
+ },
+ };
+ public safeTransferFrom1 = {
+ async sendTransactionAsync(
+ _from: string,
+ _to: string,
+ _tokenId: BigNumber,
+ txData: Partial<TxData> = {},
+ ): Promise<string> {
+ const self = this as any as ERC721TokenContract;
+ const inputAbi = self._lookupAbi('safeTransferFrom(address,address,uint256)').inputs;
+ [_from,
+ _to,
+ _tokenId
+ ] = BaseContract._formatABIDataItemList(inputAbi, [_from,
+ _to,
+ _tokenId
+ ], BaseContract._bigNumberToString.bind(self));
+ BaseContract.strictArgumentEncodingCheck(inputAbi, [_from,
+ _to,
+ _tokenId
+ ]);
+ const encodedData = self._lookupEthersInterface('safeTransferFrom(address,address,uint256)').functions.safeTransferFrom.encode([_from,
+ _to,
+ _tokenId
+ ]);
+ const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
+ {
+ to: self.address,
+ ...txData,
+ data: encodedData,
+ },
+ self._web3Wrapper.getContractDefaults(),
+ self.safeTransferFrom1.estimateGasAsync.bind(
+ self,
+ _from,
+ _to,
+ _tokenId
+ ),
+ );
+ const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults);
+ return txHash;
+ },
+ async estimateGasAsync(
+ _from: string,
+ _to: string,
+ _tokenId: BigNumber,
+ txData: Partial<TxData> = {},
+ ): Promise<number> {
+ const self = this as any as ERC721TokenContract;
+ const inputAbi = self._lookupAbi('safeTransferFrom(address,address,uint256)').inputs;
+ [_from,
+ _to,
+ _tokenId
+ ] = BaseContract._formatABIDataItemList(inputAbi, [_from,
+ _to,
+ _tokenId
+ ], BaseContract._bigNumberToString);
+ const encodedData = self._lookupEthersInterface('safeTransferFrom(address,address,uint256)').functions.safeTransferFrom.encode([_from,
+ _to,
+ _tokenId
+ ]);
+ const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
+ {
+ to: self.address,
+ ...txData,
+ data: encodedData,
+ },
+ self._web3Wrapper.getContractDefaults(),
+ );
+ const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults);
+ return gas;
+ },
+ getABIEncodedTransactionData(
+ _from: string,
+ _to: string,
+ _tokenId: BigNumber,
+ ): string {
+ const self = this as any as ERC721TokenContract;
+ const inputAbi = self._lookupAbi('safeTransferFrom(address,address,uint256)').inputs;
+ [_from,
+ _to,
+ _tokenId
+ ] = BaseContract._formatABIDataItemList(inputAbi, [_from,
+ _to,
+ _tokenId
+ ], BaseContract._bigNumberToString);
+ const abiEncodedTransactionData = self._lookupEthersInterface('safeTransferFrom(address,address,uint256)').functions.safeTransferFrom.encode([_from,
+ _to,
+ _tokenId
+ ]);
+ return abiEncodedTransactionData;
+ },
+ async callAsync(
+ _from: string,
+ _to: string,
+ _tokenId: BigNumber,
+ callData: Partial<CallData> = {},
+ defaultBlock?: BlockParam,
+ ): Promise<void
+ > {
+ const self = this as any as ERC721TokenContract;
+ const functionSignature = 'safeTransferFrom(address,address,uint256)';
+ const inputAbi = self._lookupAbi(functionSignature).inputs;
+ [_from,
+ _to,
+ _tokenId
+ ] = BaseContract._formatABIDataItemList(inputAbi, [_from,
+ _to,
+ _tokenId
+ ], BaseContract._bigNumberToString.bind(self));
+ BaseContract.strictArgumentEncodingCheck(inputAbi, [_from,
+ _to,
+ _tokenId
+ ]);
+ const ethersFunction = self._lookupEthersInterface(functionSignature).functions.safeTransferFrom;
+ const encodedData = ethersFunction.encode([_from,
+ _to,
+ _tokenId
+ ]);
+ const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
+ {
+ to: self.address,
+ ...callData,
+ data: encodedData,
+ },
+ self._web3Wrapper.getContractDefaults(),
+ );
+ const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
+ BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
+ let resultArray = ethersFunction.decode(rawCallResult);
+ const outputAbi = (_.find(self.abi, {name: 'safeTransferFrom'}) as MethodAbi).outputs;
+ resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this));
+ resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this));
+ return resultArray;
+ },
+ };
+ public ownerOf = {
+ async callAsync(
+ _tokenId: BigNumber,
+ callData: Partial<CallData> = {},
+ defaultBlock?: BlockParam,
+ ): Promise<string
+ > {
+ const self = this as any as ERC721TokenContract;
+ const functionSignature = 'ownerOf(uint256)';
+ const inputAbi = self._lookupAbi(functionSignature).inputs;
+ [_tokenId
+ ] = BaseContract._formatABIDataItemList(inputAbi, [_tokenId
+ ], BaseContract._bigNumberToString.bind(self));
+ BaseContract.strictArgumentEncodingCheck(inputAbi, [_tokenId
+ ]);
+ const ethersFunction = self._lookupEthersInterface(functionSignature).functions.ownerOf;
+ const encodedData = ethersFunction.encode([_tokenId
+ ]);
+ const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
+ {
+ to: self.address,
+ ...callData,
+ data: encodedData,
+ },
+ self._web3Wrapper.getContractDefaults(),
+ );
+ const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
+ BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
+ let resultArray = ethersFunction.decode(rawCallResult);
+ const outputAbi = (_.find(self.abi, {name: 'ownerOf'}) as MethodAbi).outputs;
+ resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this));
+ resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this));
+ return resultArray[0];
+ },
+ };
+ public balanceOf = {
+ async callAsync(
+ _owner: string,
+ callData: Partial<CallData> = {},
+ defaultBlock?: BlockParam,
+ ): Promise<BigNumber
+ > {
+ const self = this as any as ERC721TokenContract;
+ const functionSignature = 'balanceOf(address)';
+ const inputAbi = self._lookupAbi(functionSignature).inputs;
+ [_owner
+ ] = BaseContract._formatABIDataItemList(inputAbi, [_owner
+ ], BaseContract._bigNumberToString.bind(self));
+ BaseContract.strictArgumentEncodingCheck(inputAbi, [_owner
+ ]);
+ const ethersFunction = self._lookupEthersInterface(functionSignature).functions.balanceOf;
+ const encodedData = ethersFunction.encode([_owner
+ ]);
+ const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
+ {
+ to: self.address,
+ ...callData,
+ data: encodedData,
+ },
+ self._web3Wrapper.getContractDefaults(),
+ );
+ const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
+ BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
+ let resultArray = ethersFunction.decode(rawCallResult);
+ const outputAbi = (_.find(self.abi, {name: 'balanceOf'}) as MethodAbi).outputs;
+ resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this));
+ resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this));
+ return resultArray[0];
+ },
+ };
+ public setApprovalForAll = {
+ async sendTransactionAsync(
+ _operator: string,
+ _approved: boolean,
+ txData: Partial<TxData> = {},
+ ): Promise<string> {
+ const self = this as any as ERC721TokenContract;
+ const inputAbi = self._lookupAbi('setApprovalForAll(address,bool)').inputs;
+ [_operator,
+ _approved
+ ] = BaseContract._formatABIDataItemList(inputAbi, [_operator,
+ _approved
+ ], BaseContract._bigNumberToString.bind(self));
+ BaseContract.strictArgumentEncodingCheck(inputAbi, [_operator,
+ _approved
+ ]);
+ const encodedData = self._lookupEthersInterface('setApprovalForAll(address,bool)').functions.setApprovalForAll.encode([_operator,
+ _approved
+ ]);
+ const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
+ {
+ to: self.address,
+ ...txData,
+ data: encodedData,
+ },
+ self._web3Wrapper.getContractDefaults(),
+ self.setApprovalForAll.estimateGasAsync.bind(
+ self,
+ _operator,
+ _approved
+ ),
+ );
+ const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults);
+ return txHash;
+ },
+ async estimateGasAsync(
+ _operator: string,
+ _approved: boolean,
+ txData: Partial<TxData> = {},
+ ): Promise<number> {
+ const self = this as any as ERC721TokenContract;
+ const inputAbi = self._lookupAbi('setApprovalForAll(address,bool)').inputs;
+ [_operator,
+ _approved
+ ] = BaseContract._formatABIDataItemList(inputAbi, [_operator,
+ _approved
+ ], BaseContract._bigNumberToString);
+ const encodedData = self._lookupEthersInterface('setApprovalForAll(address,bool)').functions.setApprovalForAll.encode([_operator,
+ _approved
+ ]);
+ const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
+ {
+ to: self.address,
+ ...txData,
+ data: encodedData,
+ },
+ self._web3Wrapper.getContractDefaults(),
+ );
+ const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults);
+ return gas;
+ },
+ getABIEncodedTransactionData(
+ _operator: string,
+ _approved: boolean,
+ ): string {
+ const self = this as any as ERC721TokenContract;
+ const inputAbi = self._lookupAbi('setApprovalForAll(address,bool)').inputs;
+ [_operator,
+ _approved
+ ] = BaseContract._formatABIDataItemList(inputAbi, [_operator,
+ _approved
+ ], BaseContract._bigNumberToString);
+ const abiEncodedTransactionData = self._lookupEthersInterface('setApprovalForAll(address,bool)').functions.setApprovalForAll.encode([_operator,
+ _approved
+ ]);
+ return abiEncodedTransactionData;
+ },
+ async callAsync(
+ _operator: string,
+ _approved: boolean,
+ callData: Partial<CallData> = {},
+ defaultBlock?: BlockParam,
+ ): Promise<void
+ > {
+ const self = this as any as ERC721TokenContract;
+ const functionSignature = 'setApprovalForAll(address,bool)';
+ const inputAbi = self._lookupAbi(functionSignature).inputs;
+ [_operator,
+ _approved
+ ] = BaseContract._formatABIDataItemList(inputAbi, [_operator,
+ _approved
+ ], BaseContract._bigNumberToString.bind(self));
+ BaseContract.strictArgumentEncodingCheck(inputAbi, [_operator,
+ _approved
+ ]);
+ const ethersFunction = self._lookupEthersInterface(functionSignature).functions.setApprovalForAll;
+ const encodedData = ethersFunction.encode([_operator,
+ _approved
+ ]);
+ const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
+ {
+ to: self.address,
+ ...callData,
+ data: encodedData,
+ },
+ self._web3Wrapper.getContractDefaults(),
+ );
+ const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
+ BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
+ let resultArray = ethersFunction.decode(rawCallResult);
+ const outputAbi = (_.find(self.abi, {name: 'setApprovalForAll'}) as MethodAbi).outputs;
+ resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this));
+ resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this));
+ return resultArray;
+ },
+ };
+ public safeTransferFrom2 = {
+ async sendTransactionAsync(
+ _from: string,
+ _to: string,
+ _tokenId: BigNumber,
+ _data: string,
+ txData: Partial<TxData> = {},
+ ): Promise<string> {
+ const self = this as any as ERC721TokenContract;
+ const inputAbi = self._lookupAbi('safeTransferFrom(address,address,uint256,bytes)').inputs;
+ [_from,
+ _to,
+ _tokenId,
+ _data
+ ] = BaseContract._formatABIDataItemList(inputAbi, [_from,
+ _to,
+ _tokenId,
+ _data
+ ], BaseContract._bigNumberToString.bind(self));
+ BaseContract.strictArgumentEncodingCheck(inputAbi, [_from,
+ _to,
+ _tokenId,
+ _data
+ ]);
+ const encodedData = self._lookupEthersInterface('safeTransferFrom(address,address,uint256,bytes)').functions.safeTransferFrom.encode([_from,
+ _to,
+ _tokenId,
+ _data
+ ]);
+ const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
+ {
+ to: self.address,
+ ...txData,
+ data: encodedData,
+ },
+ self._web3Wrapper.getContractDefaults(),
+ self.safeTransferFrom2.estimateGasAsync.bind(
+ self,
+ _from,
+ _to,
+ _tokenId,
+ _data
+ ),
+ );
+ const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults);
+ return txHash;
+ },
+ async estimateGasAsync(
+ _from: string,
+ _to: string,
+ _tokenId: BigNumber,
+ _data: string,
+ txData: Partial<TxData> = {},
+ ): Promise<number> {
+ const self = this as any as ERC721TokenContract;
+ const inputAbi = self._lookupAbi('safeTransferFrom(address,address,uint256,bytes)').inputs;
+ [_from,
+ _to,
+ _tokenId,
+ _data
+ ] = BaseContract._formatABIDataItemList(inputAbi, [_from,
+ _to,
+ _tokenId,
+ _data
+ ], BaseContract._bigNumberToString);
+ const encodedData = self._lookupEthersInterface('safeTransferFrom(address,address,uint256,bytes)').functions.safeTransferFrom.encode([_from,
+ _to,
+ _tokenId,
+ _data
+ ]);
+ const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
+ {
+ to: self.address,
+ ...txData,
+ data: encodedData,
+ },
+ self._web3Wrapper.getContractDefaults(),
+ );
+ const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults);
+ return gas;
+ },
+ getABIEncodedTransactionData(
+ _from: string,
+ _to: string,
+ _tokenId: BigNumber,
+ _data: string,
+ ): string {
+ const self = this as any as ERC721TokenContract;
+ const inputAbi = self._lookupAbi('safeTransferFrom(address,address,uint256,bytes)').inputs;
+ [_from,
+ _to,
+ _tokenId,
+ _data
+ ] = BaseContract._formatABIDataItemList(inputAbi, [_from,
+ _to,
+ _tokenId,
+ _data
+ ], BaseContract._bigNumberToString);
+ const abiEncodedTransactionData = self._lookupEthersInterface('safeTransferFrom(address,address,uint256,bytes)').functions.safeTransferFrom.encode([_from,
+ _to,
+ _tokenId,
+ _data
+ ]);
+ return abiEncodedTransactionData;
+ },
+ async callAsync(
+ _from: string,
+ _to: string,
+ _tokenId: BigNumber,
+ _data: string,
+ callData: Partial<CallData> = {},
+ defaultBlock?: BlockParam,
+ ): Promise<void
+ > {
+ const self = this as any as ERC721TokenContract;
+ const functionSignature = 'safeTransferFrom(address,address,uint256,bytes)';
+ const inputAbi = self._lookupAbi(functionSignature).inputs;
+ [_from,
+ _to,
+ _tokenId,
+ _data
+ ] = BaseContract._formatABIDataItemList(inputAbi, [_from,
+ _to,
+ _tokenId,
+ _data
+ ], BaseContract._bigNumberToString.bind(self));
+ BaseContract.strictArgumentEncodingCheck(inputAbi, [_from,
+ _to,
+ _tokenId,
+ _data
+ ]);
+ const ethersFunction = self._lookupEthersInterface(functionSignature).functions.safeTransferFrom;
+ const encodedData = ethersFunction.encode([_from,
+ _to,
+ _tokenId,
+ _data
+ ]);
+ const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
+ {
+ to: self.address,
+ ...callData,
+ data: encodedData,
+ },
+ self._web3Wrapper.getContractDefaults(),
+ );
+ const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
+ BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
+ let resultArray = ethersFunction.decode(rawCallResult);
+ const outputAbi = (_.find(self.abi, {name: 'safeTransferFrom'}) as MethodAbi).outputs;
+ resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this));
+ resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this));
+ return resultArray;
+ },
+ };
+ public isApprovedForAll = {
+ async callAsync(
+ _owner: string,
+ _operator: string,
+ callData: Partial<CallData> = {},
+ defaultBlock?: BlockParam,
+ ): Promise<boolean
+ > {
+ const self = this as any as ERC721TokenContract;
+ const functionSignature = 'isApprovedForAll(address,address)';
+ const inputAbi = self._lookupAbi(functionSignature).inputs;
+ [_owner,
+ _operator
+ ] = BaseContract._formatABIDataItemList(inputAbi, [_owner,
+ _operator
+ ], BaseContract._bigNumberToString.bind(self));
+ BaseContract.strictArgumentEncodingCheck(inputAbi, [_owner,
+ _operator
+ ]);
+ const ethersFunction = self._lookupEthersInterface(functionSignature).functions.isApprovedForAll;
+ const encodedData = ethersFunction.encode([_owner,
+ _operator
+ ]);
+ const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
+ {
+ to: self.address,
+ ...callData,
+ data: encodedData,
+ },
+ self._web3Wrapper.getContractDefaults(),
+ );
+ const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
+ BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
+ let resultArray = ethersFunction.decode(rawCallResult);
+ const outputAbi = (_.find(self.abi, {name: 'isApprovedForAll'}) as MethodAbi).outputs;
+ resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this));
+ resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this));
+ return resultArray[0];
+ },
+ };
+ public static async deployFrom0xArtifactAsync(
+ artifact: ContractArtifact,
+ provider: Provider,
+ txDefaults: Partial<TxData>,
+ ): Promise<ERC721TokenContract> {
+ if (_.isUndefined(artifact.compilerOutput)) {
+ throw new Error('Compiler output not found in the artifact file');
+ }
+ const bytecode = artifact.compilerOutput.evm.bytecode.object;
+ const abi = artifact.compilerOutput.abi;
+ return ERC721TokenContract.deployAsync(bytecode, abi, provider, txDefaults, );
+ }
+ public static async deployAsync(
+ bytecode: string,
+ abi: ContractAbi,
+ provider: Provider,
+ txDefaults: Partial<TxData>,
+ ): Promise<ERC721TokenContract> {
+ const constructorAbi = BaseContract._lookupConstructorAbi(abi);
+ [] = BaseContract._formatABIDataItemList(
+ constructorAbi.inputs,
+ [],
+ BaseContract._bigNumberToString,
+ );
+ const iface = new ethers.utils.Interface(abi);
+ const deployInfo = iface.deployFunction;
+ const txData = deployInfo.encode(bytecode, []);
+ const web3Wrapper = new Web3Wrapper(provider);
+ const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
+ {data: txData},
+ txDefaults,
+ web3Wrapper.estimateGasAsync.bind(web3Wrapper),
+ );
+ const txHash = await web3Wrapper.sendTransactionAsync(txDataWithDefaults);
+ logUtils.log(`transactionHash: ${txHash}`);
+ const txReceipt = await web3Wrapper.awaitTransactionSuccessAsync(txHash);
+ logUtils.log(`ERC721Token successfully deployed at ${txReceipt.contractAddress}`);
+ const contractInstance = new ERC721TokenContract(abi, txReceipt.contractAddress as string, provider, txDefaults);
+ contractInstance.constructorArgs = [];
+ return contractInstance;
+ }
+ constructor(abi: ContractAbi, address: string, provider: Provider, txDefaults?: Partial<TxData>) {
+ super('ERC721Token', abi, address, provider, txDefaults);
+ classUtils.bindAll(this, ['_ethersInterfacesByFunctionSignature', 'address', 'abi', '_web3Wrapper']);
+ }
+} // tslint:disable:max-file-line-count
+// tslint:enable:no-unbound-method
diff --git a/packages/abi-gen-wrappers/src/generated-wrappers/exchange.ts b/packages/abi-gen-wrappers/src/generated-wrappers/exchange.ts
new file mode 100644
index 000000000..869ad6f10
--- /dev/null
+++ b/packages/abi-gen-wrappers/src/generated-wrappers/exchange.ts
@@ -0,0 +1,3072 @@
+// tslint:disable:no-consecutive-blank-lines ordered-imports align trailing-comma whitespace class-name
+// tslint:disable:no-unused-variable
+// tslint:disable:no-unbound-method
+import { BaseContract } from '@0xproject/base-contract';
+import { BlockParam, BlockParamLiteral, CallData, ContractAbi, ContractArtifact, DecodedLogArgs, MethodAbi, Provider, TxData, TxDataPayable } from 'ethereum-types';
+import { BigNumber, classUtils, logUtils } from '@0xproject/utils';
+import { Web3Wrapper } from '@0xproject/web3-wrapper';
+import * as ethers from 'ethers';
+import * as _ from 'lodash';
+// tslint:enable:no-unused-variable
+
+export type ExchangeEventArgs =
+ | ExchangeSignatureValidatorApprovalEventArgs
+ | ExchangeFillEventArgs
+ | ExchangeCancelEventArgs
+ | ExchangeCancelUpToEventArgs
+ | ExchangeAssetProxyRegisteredEventArgs;
+
+export enum ExchangeEvents {
+ SignatureValidatorApproval = 'SignatureValidatorApproval',
+ Fill = 'Fill',
+ Cancel = 'Cancel',
+ CancelUpTo = 'CancelUpTo',
+ AssetProxyRegistered = 'AssetProxyRegistered',
+}
+
+export interface ExchangeSignatureValidatorApprovalEventArgs extends DecodedLogArgs {
+ signerAddress: string;
+ validatorAddress: string;
+ approved: boolean;
+}
+
+export interface ExchangeFillEventArgs extends DecodedLogArgs {
+ makerAddress: string;
+ feeRecipientAddress: string;
+ takerAddress: string;
+ senderAddress: string;
+ makerAssetFilledAmount: BigNumber;
+ takerAssetFilledAmount: BigNumber;
+ makerFeePaid: BigNumber;
+ takerFeePaid: BigNumber;
+ orderHash: string;
+ makerAssetData: string;
+ takerAssetData: string;
+}
+
+export interface ExchangeCancelEventArgs extends DecodedLogArgs {
+ makerAddress: string;
+ feeRecipientAddress: string;
+ senderAddress: string;
+ orderHash: string;
+ makerAssetData: string;
+ takerAssetData: string;
+}
+
+export interface ExchangeCancelUpToEventArgs extends DecodedLogArgs {
+ makerAddress: string;
+ senderAddress: string;
+ orderEpoch: BigNumber;
+}
+
+export interface ExchangeAssetProxyRegisteredEventArgs extends DecodedLogArgs {
+ id: string;
+ assetProxy: string;
+}
+
+
+/* istanbul ignore next */
+// tslint:disable:no-parameter-reassignment
+// tslint:disable-next-line:class-name
+export class ExchangeContract extends BaseContract {
+ public filled = {
+ async callAsync(
+ index_0: string,
+ callData: Partial<CallData> = {},
+ defaultBlock?: BlockParam,
+ ): Promise<BigNumber
+ > {
+ const self = this as any as ExchangeContract;
+ const functionSignature = 'filled(bytes32)';
+ const inputAbi = self._lookupAbi(functionSignature).inputs;
+ [index_0
+ ] = BaseContract._formatABIDataItemList(inputAbi, [index_0
+ ], BaseContract._bigNumberToString.bind(self));
+ BaseContract.strictArgumentEncodingCheck(inputAbi, [index_0
+ ]);
+ const ethersFunction = self._lookupEthersInterface(functionSignature).functions.filled;
+ const encodedData = ethersFunction.encode([index_0
+ ]);
+ const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
+ {
+ to: self.address,
+ ...callData,
+ data: encodedData,
+ },
+ self._web3Wrapper.getContractDefaults(),
+ );
+ const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
+ BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
+ let resultArray = ethersFunction.decode(rawCallResult);
+ const outputAbi = (_.find(self.abi, {name: 'filled'}) as MethodAbi).outputs;
+ resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this));
+ resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this));
+ return resultArray[0];
+ },
+ };
+ public batchFillOrders = {
+ async sendTransactionAsync(
+ orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>,
+ takerAssetFillAmounts: BigNumber[],
+ signatures: string[],
+ txData: Partial<TxData> = {},
+ ): Promise<string> {
+ const self = this as any as ExchangeContract;
+ const inputAbi = self._lookupAbi('batchFillOrders(tuple[],uint256[],bytes[])').inputs;
+ [orders,
+ takerAssetFillAmounts,
+ signatures
+ ] = BaseContract._formatABIDataItemList(inputAbi, [orders,
+ takerAssetFillAmounts,
+ signatures
+ ], BaseContract._bigNumberToString.bind(self));
+ BaseContract.strictArgumentEncodingCheck(inputAbi, [orders,
+ takerAssetFillAmounts,
+ signatures
+ ]);
+ const encodedData = self._lookupEthersInterface('batchFillOrders(tuple[],uint256[],bytes[])').functions.batchFillOrders.encode([orders,
+ takerAssetFillAmounts,
+ signatures
+ ]);
+ const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
+ {
+ to: self.address,
+ ...txData,
+ data: encodedData,
+ },
+ self._web3Wrapper.getContractDefaults(),
+ self.batchFillOrders.estimateGasAsync.bind(
+ self,
+ orders,
+ takerAssetFillAmounts,
+ signatures
+ ),
+ );
+ const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults);
+ return txHash;
+ },
+ async estimateGasAsync(
+ orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>,
+ takerAssetFillAmounts: BigNumber[],
+ signatures: string[],
+ txData: Partial<TxData> = {},
+ ): Promise<number> {
+ const self = this as any as ExchangeContract;
+ const inputAbi = self._lookupAbi('batchFillOrders(tuple[],uint256[],bytes[])').inputs;
+ [orders,
+ takerAssetFillAmounts,
+ signatures
+ ] = BaseContract._formatABIDataItemList(inputAbi, [orders,
+ takerAssetFillAmounts,
+ signatures
+ ], BaseContract._bigNumberToString);
+ const encodedData = self._lookupEthersInterface('batchFillOrders(tuple[],uint256[],bytes[])').functions.batchFillOrders.encode([orders,
+ takerAssetFillAmounts,
+ signatures
+ ]);
+ const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
+ {
+ to: self.address,
+ ...txData,
+ data: encodedData,
+ },
+ self._web3Wrapper.getContractDefaults(),
+ );
+ const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults);
+ return gas;
+ },
+ getABIEncodedTransactionData(
+ orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>,
+ takerAssetFillAmounts: BigNumber[],
+ signatures: string[],
+ ): string {
+ const self = this as any as ExchangeContract;
+ const inputAbi = self._lookupAbi('batchFillOrders(tuple[],uint256[],bytes[])').inputs;
+ [orders,
+ takerAssetFillAmounts,
+ signatures
+ ] = BaseContract._formatABIDataItemList(inputAbi, [orders,
+ takerAssetFillAmounts,
+ signatures
+ ], BaseContract._bigNumberToString);
+ const abiEncodedTransactionData = self._lookupEthersInterface('batchFillOrders(tuple[],uint256[],bytes[])').functions.batchFillOrders.encode([orders,
+ takerAssetFillAmounts,
+ signatures
+ ]);
+ return abiEncodedTransactionData;
+ },
+ async callAsync(
+ orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>,
+ takerAssetFillAmounts: BigNumber[],
+ signatures: string[],
+ callData: Partial<CallData> = {},
+ defaultBlock?: BlockParam,
+ ): Promise<{makerAssetFilledAmount: BigNumber;takerAssetFilledAmount: BigNumber;makerFeePaid: BigNumber;takerFeePaid: BigNumber}
+ > {
+ const self = this as any as ExchangeContract;
+ const functionSignature = 'batchFillOrders(tuple[],uint256[],bytes[])';
+ const inputAbi = self._lookupAbi(functionSignature).inputs;
+ [orders,
+ takerAssetFillAmounts,
+ signatures
+ ] = BaseContract._formatABIDataItemList(inputAbi, [orders,
+ takerAssetFillAmounts,
+ signatures
+ ], BaseContract._bigNumberToString.bind(self));
+ BaseContract.strictArgumentEncodingCheck(inputAbi, [orders,
+ takerAssetFillAmounts,
+ signatures
+ ]);
+ const ethersFunction = self._lookupEthersInterface(functionSignature).functions.batchFillOrders;
+ const encodedData = ethersFunction.encode([orders,
+ takerAssetFillAmounts,
+ signatures
+ ]);
+ const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
+ {
+ to: self.address,
+ ...callData,
+ data: encodedData,
+ },
+ self._web3Wrapper.getContractDefaults(),
+ );
+ const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
+ BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
+ let resultArray = ethersFunction.decode(rawCallResult);
+ const outputAbi = (_.find(self.abi, {name: 'batchFillOrders'}) as MethodAbi).outputs;
+ resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this));
+ resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this));
+ return resultArray[0];
+ },
+ };
+ public cancelled = {
+ async callAsync(
+ index_0: string,
+ callData: Partial<CallData> = {},
+ defaultBlock?: BlockParam,
+ ): Promise<boolean
+ > {
+ const self = this as any as ExchangeContract;
+ const functionSignature = 'cancelled(bytes32)';
+ const inputAbi = self._lookupAbi(functionSignature).inputs;
+ [index_0
+ ] = BaseContract._formatABIDataItemList(inputAbi, [index_0
+ ], BaseContract._bigNumberToString.bind(self));
+ BaseContract.strictArgumentEncodingCheck(inputAbi, [index_0
+ ]);
+ const ethersFunction = self._lookupEthersInterface(functionSignature).functions.cancelled;
+ const encodedData = ethersFunction.encode([index_0
+ ]);
+ const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
+ {
+ to: self.address,
+ ...callData,
+ data: encodedData,
+ },
+ self._web3Wrapper.getContractDefaults(),
+ );
+ const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
+ BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
+ let resultArray = ethersFunction.decode(rawCallResult);
+ const outputAbi = (_.find(self.abi, {name: 'cancelled'}) as MethodAbi).outputs;
+ resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this));
+ resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this));
+ return resultArray[0];
+ },
+ };
+ public preSign = {
+ async sendTransactionAsync(
+ hash: string,
+ signerAddress: string,
+ signature: string,
+ txData: Partial<TxData> = {},
+ ): Promise<string> {
+ const self = this as any as ExchangeContract;
+ const inputAbi = self._lookupAbi('preSign(bytes32,address,bytes)').inputs;
+ [hash,
+ signerAddress,
+ signature
+ ] = BaseContract._formatABIDataItemList(inputAbi, [hash,
+ signerAddress,
+ signature
+ ], BaseContract._bigNumberToString.bind(self));
+ BaseContract.strictArgumentEncodingCheck(inputAbi, [hash,
+ signerAddress,
+ signature
+ ]);
+ const encodedData = self._lookupEthersInterface('preSign(bytes32,address,bytes)').functions.preSign.encode([hash,
+ signerAddress,
+ signature
+ ]);
+ const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
+ {
+ to: self.address,
+ ...txData,
+ data: encodedData,
+ },
+ self._web3Wrapper.getContractDefaults(),
+ self.preSign.estimateGasAsync.bind(
+ self,
+ hash,
+ signerAddress,
+ signature
+ ),
+ );
+ const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults);
+ return txHash;
+ },
+ async estimateGasAsync(
+ hash: string,
+ signerAddress: string,
+ signature: string,
+ txData: Partial<TxData> = {},
+ ): Promise<number> {
+ const self = this as any as ExchangeContract;
+ const inputAbi = self._lookupAbi('preSign(bytes32,address,bytes)').inputs;
+ [hash,
+ signerAddress,
+ signature
+ ] = BaseContract._formatABIDataItemList(inputAbi, [hash,
+ signerAddress,
+ signature
+ ], BaseContract._bigNumberToString);
+ const encodedData = self._lookupEthersInterface('preSign(bytes32,address,bytes)').functions.preSign.encode([hash,
+ signerAddress,
+ signature
+ ]);
+ const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
+ {
+ to: self.address,
+ ...txData,
+ data: encodedData,
+ },
+ self._web3Wrapper.getContractDefaults(),
+ );
+ const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults);
+ return gas;
+ },
+ getABIEncodedTransactionData(
+ hash: string,
+ signerAddress: string,
+ signature: string,
+ ): string {
+ const self = this as any as ExchangeContract;
+ const inputAbi = self._lookupAbi('preSign(bytes32,address,bytes)').inputs;
+ [hash,
+ signerAddress,
+ signature
+ ] = BaseContract._formatABIDataItemList(inputAbi, [hash,
+ signerAddress,
+ signature
+ ], BaseContract._bigNumberToString);
+ const abiEncodedTransactionData = self._lookupEthersInterface('preSign(bytes32,address,bytes)').functions.preSign.encode([hash,
+ signerAddress,
+ signature
+ ]);
+ return abiEncodedTransactionData;
+ },
+ async callAsync(
+ hash: string,
+ signerAddress: string,
+ signature: string,
+ callData: Partial<CallData> = {},
+ defaultBlock?: BlockParam,
+ ): Promise<void
+ > {
+ const self = this as any as ExchangeContract;
+ const functionSignature = 'preSign(bytes32,address,bytes)';
+ const inputAbi = self._lookupAbi(functionSignature).inputs;
+ [hash,
+ signerAddress,
+ signature
+ ] = BaseContract._formatABIDataItemList(inputAbi, [hash,
+ signerAddress,
+ signature
+ ], BaseContract._bigNumberToString.bind(self));
+ BaseContract.strictArgumentEncodingCheck(inputAbi, [hash,
+ signerAddress,
+ signature
+ ]);
+ const ethersFunction = self._lookupEthersInterface(functionSignature).functions.preSign;
+ const encodedData = ethersFunction.encode([hash,
+ signerAddress,
+ signature
+ ]);
+ const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
+ {
+ to: self.address,
+ ...callData,
+ data: encodedData,
+ },
+ self._web3Wrapper.getContractDefaults(),
+ );
+ const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
+ BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
+ let resultArray = ethersFunction.decode(rawCallResult);
+ const outputAbi = (_.find(self.abi, {name: 'preSign'}) as MethodAbi).outputs;
+ resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this));
+ resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this));
+ return resultArray;
+ },
+ };
+ public matchOrders = {
+ async sendTransactionAsync(
+ leftOrder: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string},
+ rightOrder: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string},
+ leftSignature: string,
+ rightSignature: string,
+ txData: Partial<TxData> = {},
+ ): Promise<string> {
+ const self = this as any as ExchangeContract;
+ const inputAbi = self._lookupAbi('matchOrders({address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes},{address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes},bytes,bytes)').inputs;
+ [leftOrder,
+ rightOrder,
+ leftSignature,
+ rightSignature
+ ] = BaseContract._formatABIDataItemList(inputAbi, [leftOrder,
+ rightOrder,
+ leftSignature,
+ rightSignature
+ ], BaseContract._bigNumberToString.bind(self));
+ BaseContract.strictArgumentEncodingCheck(inputAbi, [leftOrder,
+ rightOrder,
+ leftSignature,
+ rightSignature
+ ]);
+ const encodedData = self._lookupEthersInterface('matchOrders({address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes},{address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes},bytes,bytes)').functions.matchOrders.encode([leftOrder,
+ rightOrder,
+ leftSignature,
+ rightSignature
+ ]);
+ const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
+ {
+ to: self.address,
+ ...txData,
+ data: encodedData,
+ },
+ self._web3Wrapper.getContractDefaults(),
+ self.matchOrders.estimateGasAsync.bind(
+ self,
+ leftOrder,
+ rightOrder,
+ leftSignature,
+ rightSignature
+ ),
+ );
+ const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults);
+ return txHash;
+ },
+ async estimateGasAsync(
+ leftOrder: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string},
+ rightOrder: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string},
+ leftSignature: string,
+ rightSignature: string,
+ txData: Partial<TxData> = {},
+ ): Promise<number> {
+ const self = this as any as ExchangeContract;
+ const inputAbi = self._lookupAbi('matchOrders({address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes},{address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes},bytes,bytes)').inputs;
+ [leftOrder,
+ rightOrder,
+ leftSignature,
+ rightSignature
+ ] = BaseContract._formatABIDataItemList(inputAbi, [leftOrder,
+ rightOrder,
+ leftSignature,
+ rightSignature
+ ], BaseContract._bigNumberToString);
+ const encodedData = self._lookupEthersInterface('matchOrders({address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes},{address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes},bytes,bytes)').functions.matchOrders.encode([leftOrder,
+ rightOrder,
+ leftSignature,
+ rightSignature
+ ]);
+ const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
+ {
+ to: self.address,
+ ...txData,
+ data: encodedData,
+ },
+ self._web3Wrapper.getContractDefaults(),
+ );
+ const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults);
+ return gas;
+ },
+ getABIEncodedTransactionData(
+ leftOrder: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string},
+ rightOrder: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string},
+ leftSignature: string,
+ rightSignature: string,
+ ): string {
+ const self = this as any as ExchangeContract;
+ const inputAbi = self._lookupAbi('matchOrders({address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes},{address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes},bytes,bytes)').inputs;
+ [leftOrder,
+ rightOrder,
+ leftSignature,
+ rightSignature
+ ] = BaseContract._formatABIDataItemList(inputAbi, [leftOrder,
+ rightOrder,
+ leftSignature,
+ rightSignature
+ ], BaseContract._bigNumberToString);
+ const abiEncodedTransactionData = self._lookupEthersInterface('matchOrders({address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes},{address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes},bytes,bytes)').functions.matchOrders.encode([leftOrder,
+ rightOrder,
+ leftSignature,
+ rightSignature
+ ]);
+ return abiEncodedTransactionData;
+ },
+ async callAsync(
+ leftOrder: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string},
+ rightOrder: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string},
+ leftSignature: string,
+ rightSignature: string,
+ callData: Partial<CallData> = {},
+ defaultBlock?: BlockParam,
+ ): Promise<{left: {makerAssetFilledAmount: BigNumber;takerAssetFilledAmount: BigNumber;makerFeePaid: BigNumber;takerFeePaid: BigNumber};right: {makerAssetFilledAmount: BigNumber;takerAssetFilledAmount: BigNumber;makerFeePaid: BigNumber;takerFeePaid: BigNumber};leftMakerAssetSpreadAmount: BigNumber}
+ > {
+ const self = this as any as ExchangeContract;
+ const functionSignature = 'matchOrders({address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes},{address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes},bytes,bytes)';
+ const inputAbi = self._lookupAbi(functionSignature).inputs;
+ [leftOrder,
+ rightOrder,
+ leftSignature,
+ rightSignature
+ ] = BaseContract._formatABIDataItemList(inputAbi, [leftOrder,
+ rightOrder,
+ leftSignature,
+ rightSignature
+ ], BaseContract._bigNumberToString.bind(self));
+ BaseContract.strictArgumentEncodingCheck(inputAbi, [leftOrder,
+ rightOrder,
+ leftSignature,
+ rightSignature
+ ]);
+ const ethersFunction = self._lookupEthersInterface(functionSignature).functions.matchOrders;
+ const encodedData = ethersFunction.encode([leftOrder,
+ rightOrder,
+ leftSignature,
+ rightSignature
+ ]);
+ const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
+ {
+ to: self.address,
+ ...callData,
+ data: encodedData,
+ },
+ self._web3Wrapper.getContractDefaults(),
+ );
+ const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
+ BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
+ let resultArray = ethersFunction.decode(rawCallResult);
+ const outputAbi = (_.find(self.abi, {name: 'matchOrders'}) as MethodAbi).outputs;
+ resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this));
+ resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this));
+ return resultArray[0];
+ },
+ };
+ public fillOrderNoThrow = {
+ async sendTransactionAsync(
+ order: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string},
+ takerAssetFillAmount: BigNumber,
+ signature: string,
+ txData: Partial<TxData> = {},
+ ): Promise<string> {
+ const self = this as any as ExchangeContract;
+ const inputAbi = self._lookupAbi('fillOrderNoThrow({address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes},uint256,bytes)').inputs;
+ [order,
+ takerAssetFillAmount,
+ signature
+ ] = BaseContract._formatABIDataItemList(inputAbi, [order,
+ takerAssetFillAmount,
+ signature
+ ], BaseContract._bigNumberToString.bind(self));
+ BaseContract.strictArgumentEncodingCheck(inputAbi, [order,
+ takerAssetFillAmount,
+ signature
+ ]);
+ const encodedData = self._lookupEthersInterface('fillOrderNoThrow({address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes},uint256,bytes)').functions.fillOrderNoThrow.encode([order,
+ takerAssetFillAmount,
+ signature
+ ]);
+ const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
+ {
+ to: self.address,
+ ...txData,
+ data: encodedData,
+ },
+ self._web3Wrapper.getContractDefaults(),
+ self.fillOrderNoThrow.estimateGasAsync.bind(
+ self,
+ order,
+ takerAssetFillAmount,
+ signature
+ ),
+ );
+ const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults);
+ return txHash;
+ },
+ async estimateGasAsync(
+ order: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string},
+ takerAssetFillAmount: BigNumber,
+ signature: string,
+ txData: Partial<TxData> = {},
+ ): Promise<number> {
+ const self = this as any as ExchangeContract;
+ const inputAbi = self._lookupAbi('fillOrderNoThrow({address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes},uint256,bytes)').inputs;
+ [order,
+ takerAssetFillAmount,
+ signature
+ ] = BaseContract._formatABIDataItemList(inputAbi, [order,
+ takerAssetFillAmount,
+ signature
+ ], BaseContract._bigNumberToString);
+ const encodedData = self._lookupEthersInterface('fillOrderNoThrow({address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes},uint256,bytes)').functions.fillOrderNoThrow.encode([order,
+ takerAssetFillAmount,
+ signature
+ ]);
+ const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
+ {
+ to: self.address,
+ ...txData,
+ data: encodedData,
+ },
+ self._web3Wrapper.getContractDefaults(),
+ );
+ const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults);
+ return gas;
+ },
+ getABIEncodedTransactionData(
+ order: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string},
+ takerAssetFillAmount: BigNumber,
+ signature: string,
+ ): string {
+ const self = this as any as ExchangeContract;
+ const inputAbi = self._lookupAbi('fillOrderNoThrow({address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes},uint256,bytes)').inputs;
+ [order,
+ takerAssetFillAmount,
+ signature
+ ] = BaseContract._formatABIDataItemList(inputAbi, [order,
+ takerAssetFillAmount,
+ signature
+ ], BaseContract._bigNumberToString);
+ const abiEncodedTransactionData = self._lookupEthersInterface('fillOrderNoThrow({address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes},uint256,bytes)').functions.fillOrderNoThrow.encode([order,
+ takerAssetFillAmount,
+ signature
+ ]);
+ return abiEncodedTransactionData;
+ },
+ async callAsync(
+ order: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string},
+ takerAssetFillAmount: BigNumber,
+ signature: string,
+ callData: Partial<CallData> = {},
+ defaultBlock?: BlockParam,
+ ): Promise<{makerAssetFilledAmount: BigNumber;takerAssetFilledAmount: BigNumber;makerFeePaid: BigNumber;takerFeePaid: BigNumber}
+ > {
+ const self = this as any as ExchangeContract;
+ const functionSignature = 'fillOrderNoThrow({address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes},uint256,bytes)';
+ const inputAbi = self._lookupAbi(functionSignature).inputs;
+ [order,
+ takerAssetFillAmount,
+ signature
+ ] = BaseContract._formatABIDataItemList(inputAbi, [order,
+ takerAssetFillAmount,
+ signature
+ ], BaseContract._bigNumberToString.bind(self));
+ BaseContract.strictArgumentEncodingCheck(inputAbi, [order,
+ takerAssetFillAmount,
+ signature
+ ]);
+ const ethersFunction = self._lookupEthersInterface(functionSignature).functions.fillOrderNoThrow;
+ const encodedData = ethersFunction.encode([order,
+ takerAssetFillAmount,
+ signature
+ ]);
+ const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
+ {
+ to: self.address,
+ ...callData,
+ data: encodedData,
+ },
+ self._web3Wrapper.getContractDefaults(),
+ );
+ const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
+ BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
+ let resultArray = ethersFunction.decode(rawCallResult);
+ const outputAbi = (_.find(self.abi, {name: 'fillOrderNoThrow'}) as MethodAbi).outputs;
+ resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this));
+ resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this));
+ return resultArray[0];
+ },
+ };
+ public assetProxies = {
+ async callAsync(
+ index_0: string,
+ callData: Partial<CallData> = {},
+ defaultBlock?: BlockParam,
+ ): Promise<string
+ > {
+ const self = this as any as ExchangeContract;
+ const functionSignature = 'assetProxies(bytes4)';
+ const inputAbi = self._lookupAbi(functionSignature).inputs;
+ [index_0
+ ] = BaseContract._formatABIDataItemList(inputAbi, [index_0
+ ], BaseContract._bigNumberToString.bind(self));
+ BaseContract.strictArgumentEncodingCheck(inputAbi, [index_0
+ ]);
+ const ethersFunction = self._lookupEthersInterface(functionSignature).functions.assetProxies;
+ const encodedData = ethersFunction.encode([index_0
+ ]);
+ const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
+ {
+ to: self.address,
+ ...callData,
+ data: encodedData,
+ },
+ self._web3Wrapper.getContractDefaults(),
+ );
+ const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
+ BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
+ let resultArray = ethersFunction.decode(rawCallResult);
+ const outputAbi = (_.find(self.abi, {name: 'assetProxies'}) as MethodAbi).outputs;
+ resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this));
+ resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this));
+ return resultArray[0];
+ },
+ };
+ public batchCancelOrders = {
+ async sendTransactionAsync(
+ orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>,
+ txData: Partial<TxData> = {},
+ ): Promise<string> {
+ const self = this as any as ExchangeContract;
+ const inputAbi = self._lookupAbi('batchCancelOrders(tuple[])').inputs;
+ [orders
+ ] = BaseContract._formatABIDataItemList(inputAbi, [orders
+ ], BaseContract._bigNumberToString.bind(self));
+ BaseContract.strictArgumentEncodingCheck(inputAbi, [orders
+ ]);
+ const encodedData = self._lookupEthersInterface('batchCancelOrders(tuple[])').functions.batchCancelOrders.encode([orders
+ ]);
+ const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
+ {
+ to: self.address,
+ ...txData,
+ data: encodedData,
+ },
+ self._web3Wrapper.getContractDefaults(),
+ self.batchCancelOrders.estimateGasAsync.bind(
+ self,
+ orders
+ ),
+ );
+ const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults);
+ return txHash;
+ },
+ async estimateGasAsync(
+ orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>,
+ txData: Partial<TxData> = {},
+ ): Promise<number> {
+ const self = this as any as ExchangeContract;
+ const inputAbi = self._lookupAbi('batchCancelOrders(tuple[])').inputs;
+ [orders
+ ] = BaseContract._formatABIDataItemList(inputAbi, [orders
+ ], BaseContract._bigNumberToString);
+ const encodedData = self._lookupEthersInterface('batchCancelOrders(tuple[])').functions.batchCancelOrders.encode([orders
+ ]);
+ const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
+ {
+ to: self.address,
+ ...txData,
+ data: encodedData,
+ },
+ self._web3Wrapper.getContractDefaults(),
+ );
+ const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults);
+ return gas;
+ },
+ getABIEncodedTransactionData(
+ orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>,
+ ): string {
+ const self = this as any as ExchangeContract;
+ const inputAbi = self._lookupAbi('batchCancelOrders(tuple[])').inputs;
+ [orders
+ ] = BaseContract._formatABIDataItemList(inputAbi, [orders
+ ], BaseContract._bigNumberToString);
+ const abiEncodedTransactionData = self._lookupEthersInterface('batchCancelOrders(tuple[])').functions.batchCancelOrders.encode([orders
+ ]);
+ return abiEncodedTransactionData;
+ },
+ async callAsync(
+ orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>,
+ callData: Partial<CallData> = {},
+ defaultBlock?: BlockParam,
+ ): Promise<void
+ > {
+ const self = this as any as ExchangeContract;
+ const functionSignature = 'batchCancelOrders(tuple[])';
+ const inputAbi = self._lookupAbi(functionSignature).inputs;
+ [orders
+ ] = BaseContract._formatABIDataItemList(inputAbi, [orders
+ ], BaseContract._bigNumberToString.bind(self));
+ BaseContract.strictArgumentEncodingCheck(inputAbi, [orders
+ ]);
+ const ethersFunction = self._lookupEthersInterface(functionSignature).functions.batchCancelOrders;
+ const encodedData = ethersFunction.encode([orders
+ ]);
+ const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
+ {
+ to: self.address,
+ ...callData,
+ data: encodedData,
+ },
+ self._web3Wrapper.getContractDefaults(),
+ );
+ const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
+ BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
+ let resultArray = ethersFunction.decode(rawCallResult);
+ const outputAbi = (_.find(self.abi, {name: 'batchCancelOrders'}) as MethodAbi).outputs;
+ resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this));
+ resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this));
+ return resultArray;
+ },
+ };
+ public batchFillOrKillOrders = {
+ async sendTransactionAsync(
+ orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>,
+ takerAssetFillAmounts: BigNumber[],
+ signatures: string[],
+ txData: Partial<TxData> = {},
+ ): Promise<string> {
+ const self = this as any as ExchangeContract;
+ const inputAbi = self._lookupAbi('batchFillOrKillOrders(tuple[],uint256[],bytes[])').inputs;
+ [orders,
+ takerAssetFillAmounts,
+ signatures
+ ] = BaseContract._formatABIDataItemList(inputAbi, [orders,
+ takerAssetFillAmounts,
+ signatures
+ ], BaseContract._bigNumberToString.bind(self));
+ BaseContract.strictArgumentEncodingCheck(inputAbi, [orders,
+ takerAssetFillAmounts,
+ signatures
+ ]);
+ const encodedData = self._lookupEthersInterface('batchFillOrKillOrders(tuple[],uint256[],bytes[])').functions.batchFillOrKillOrders.encode([orders,
+ takerAssetFillAmounts,
+ signatures
+ ]);
+ const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
+ {
+ to: self.address,
+ ...txData,
+ data: encodedData,
+ },
+ self._web3Wrapper.getContractDefaults(),
+ self.batchFillOrKillOrders.estimateGasAsync.bind(
+ self,
+ orders,
+ takerAssetFillAmounts,
+ signatures
+ ),
+ );
+ const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults);
+ return txHash;
+ },
+ async estimateGasAsync(
+ orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>,
+ takerAssetFillAmounts: BigNumber[],
+ signatures: string[],
+ txData: Partial<TxData> = {},
+ ): Promise<number> {
+ const self = this as any as ExchangeContract;
+ const inputAbi = self._lookupAbi('batchFillOrKillOrders(tuple[],uint256[],bytes[])').inputs;
+ [orders,
+ takerAssetFillAmounts,
+ signatures
+ ] = BaseContract._formatABIDataItemList(inputAbi, [orders,
+ takerAssetFillAmounts,
+ signatures
+ ], BaseContract._bigNumberToString);
+ const encodedData = self._lookupEthersInterface('batchFillOrKillOrders(tuple[],uint256[],bytes[])').functions.batchFillOrKillOrders.encode([orders,
+ takerAssetFillAmounts,
+ signatures
+ ]);
+ const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
+ {
+ to: self.address,
+ ...txData,
+ data: encodedData,
+ },
+ self._web3Wrapper.getContractDefaults(),
+ );
+ const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults);
+ return gas;
+ },
+ getABIEncodedTransactionData(
+ orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>,
+ takerAssetFillAmounts: BigNumber[],
+ signatures: string[],
+ ): string {
+ const self = this as any as ExchangeContract;
+ const inputAbi = self._lookupAbi('batchFillOrKillOrders(tuple[],uint256[],bytes[])').inputs;
+ [orders,
+ takerAssetFillAmounts,
+ signatures
+ ] = BaseContract._formatABIDataItemList(inputAbi, [orders,
+ takerAssetFillAmounts,
+ signatures
+ ], BaseContract._bigNumberToString);
+ const abiEncodedTransactionData = self._lookupEthersInterface('batchFillOrKillOrders(tuple[],uint256[],bytes[])').functions.batchFillOrKillOrders.encode([orders,
+ takerAssetFillAmounts,
+ signatures
+ ]);
+ return abiEncodedTransactionData;
+ },
+ async callAsync(
+ orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>,
+ takerAssetFillAmounts: BigNumber[],
+ signatures: string[],
+ callData: Partial<CallData> = {},
+ defaultBlock?: BlockParam,
+ ): Promise<{makerAssetFilledAmount: BigNumber;takerAssetFilledAmount: BigNumber;makerFeePaid: BigNumber;takerFeePaid: BigNumber}
+ > {
+ const self = this as any as ExchangeContract;
+ const functionSignature = 'batchFillOrKillOrders(tuple[],uint256[],bytes[])';
+ const inputAbi = self._lookupAbi(functionSignature).inputs;
+ [orders,
+ takerAssetFillAmounts,
+ signatures
+ ] = BaseContract._formatABIDataItemList(inputAbi, [orders,
+ takerAssetFillAmounts,
+ signatures
+ ], BaseContract._bigNumberToString.bind(self));
+ BaseContract.strictArgumentEncodingCheck(inputAbi, [orders,
+ takerAssetFillAmounts,
+ signatures
+ ]);
+ const ethersFunction = self._lookupEthersInterface(functionSignature).functions.batchFillOrKillOrders;
+ const encodedData = ethersFunction.encode([orders,
+ takerAssetFillAmounts,
+ signatures
+ ]);
+ const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
+ {
+ to: self.address,
+ ...callData,
+ data: encodedData,
+ },
+ self._web3Wrapper.getContractDefaults(),
+ );
+ const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
+ BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
+ let resultArray = ethersFunction.decode(rawCallResult);
+ const outputAbi = (_.find(self.abi, {name: 'batchFillOrKillOrders'}) as MethodAbi).outputs;
+ resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this));
+ resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this));
+ return resultArray[0];
+ },
+ };
+ public cancelOrdersUpTo = {
+ async sendTransactionAsync(
+ targetOrderEpoch: BigNumber,
+ txData: Partial<TxData> = {},
+ ): Promise<string> {
+ const self = this as any as ExchangeContract;
+ const inputAbi = self._lookupAbi('cancelOrdersUpTo(uint256)').inputs;
+ [targetOrderEpoch
+ ] = BaseContract._formatABIDataItemList(inputAbi, [targetOrderEpoch
+ ], BaseContract._bigNumberToString.bind(self));
+ BaseContract.strictArgumentEncodingCheck(inputAbi, [targetOrderEpoch
+ ]);
+ const encodedData = self._lookupEthersInterface('cancelOrdersUpTo(uint256)').functions.cancelOrdersUpTo.encode([targetOrderEpoch
+ ]);
+ const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
+ {
+ to: self.address,
+ ...txData,
+ data: encodedData,
+ },
+ self._web3Wrapper.getContractDefaults(),
+ self.cancelOrdersUpTo.estimateGasAsync.bind(
+ self,
+ targetOrderEpoch
+ ),
+ );
+ const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults);
+ return txHash;
+ },
+ async estimateGasAsync(
+ targetOrderEpoch: BigNumber,
+ txData: Partial<TxData> = {},
+ ): Promise<number> {
+ const self = this as any as ExchangeContract;
+ const inputAbi = self._lookupAbi('cancelOrdersUpTo(uint256)').inputs;
+ [targetOrderEpoch
+ ] = BaseContract._formatABIDataItemList(inputAbi, [targetOrderEpoch
+ ], BaseContract._bigNumberToString);
+ const encodedData = self._lookupEthersInterface('cancelOrdersUpTo(uint256)').functions.cancelOrdersUpTo.encode([targetOrderEpoch
+ ]);
+ const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
+ {
+ to: self.address,
+ ...txData,
+ data: encodedData,
+ },
+ self._web3Wrapper.getContractDefaults(),
+ );
+ const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults);
+ return gas;
+ },
+ getABIEncodedTransactionData(
+ targetOrderEpoch: BigNumber,
+ ): string {
+ const self = this as any as ExchangeContract;
+ const inputAbi = self._lookupAbi('cancelOrdersUpTo(uint256)').inputs;
+ [targetOrderEpoch
+ ] = BaseContract._formatABIDataItemList(inputAbi, [targetOrderEpoch
+ ], BaseContract._bigNumberToString);
+ const abiEncodedTransactionData = self._lookupEthersInterface('cancelOrdersUpTo(uint256)').functions.cancelOrdersUpTo.encode([targetOrderEpoch
+ ]);
+ return abiEncodedTransactionData;
+ },
+ async callAsync(
+ targetOrderEpoch: BigNumber,
+ callData: Partial<CallData> = {},
+ defaultBlock?: BlockParam,
+ ): Promise<void
+ > {
+ const self = this as any as ExchangeContract;
+ const functionSignature = 'cancelOrdersUpTo(uint256)';
+ const inputAbi = self._lookupAbi(functionSignature).inputs;
+ [targetOrderEpoch
+ ] = BaseContract._formatABIDataItemList(inputAbi, [targetOrderEpoch
+ ], BaseContract._bigNumberToString.bind(self));
+ BaseContract.strictArgumentEncodingCheck(inputAbi, [targetOrderEpoch
+ ]);
+ const ethersFunction = self._lookupEthersInterface(functionSignature).functions.cancelOrdersUpTo;
+ const encodedData = ethersFunction.encode([targetOrderEpoch
+ ]);
+ const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
+ {
+ to: self.address,
+ ...callData,
+ data: encodedData,
+ },
+ self._web3Wrapper.getContractDefaults(),
+ );
+ const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
+ BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
+ let resultArray = ethersFunction.decode(rawCallResult);
+ const outputAbi = (_.find(self.abi, {name: 'cancelOrdersUpTo'}) as MethodAbi).outputs;
+ resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this));
+ resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this));
+ return resultArray;
+ },
+ };
+ public batchFillOrdersNoThrow = {
+ async sendTransactionAsync(
+ orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>,
+ takerAssetFillAmounts: BigNumber[],
+ signatures: string[],
+ txData: Partial<TxData> = {},
+ ): Promise<string> {
+ const self = this as any as ExchangeContract;
+ const inputAbi = self._lookupAbi('batchFillOrdersNoThrow(tuple[],uint256[],bytes[])').inputs;
+ [orders,
+ takerAssetFillAmounts,
+ signatures
+ ] = BaseContract._formatABIDataItemList(inputAbi, [orders,
+ takerAssetFillAmounts,
+ signatures
+ ], BaseContract._bigNumberToString.bind(self));
+ BaseContract.strictArgumentEncodingCheck(inputAbi, [orders,
+ takerAssetFillAmounts,
+ signatures
+ ]);
+ const encodedData = self._lookupEthersInterface('batchFillOrdersNoThrow(tuple[],uint256[],bytes[])').functions.batchFillOrdersNoThrow.encode([orders,
+ takerAssetFillAmounts,
+ signatures
+ ]);
+ const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
+ {
+ to: self.address,
+ ...txData,
+ data: encodedData,
+ },
+ self._web3Wrapper.getContractDefaults(),
+ self.batchFillOrdersNoThrow.estimateGasAsync.bind(
+ self,
+ orders,
+ takerAssetFillAmounts,
+ signatures
+ ),
+ );
+ const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults);
+ return txHash;
+ },
+ async estimateGasAsync(
+ orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>,
+ takerAssetFillAmounts: BigNumber[],
+ signatures: string[],
+ txData: Partial<TxData> = {},
+ ): Promise<number> {
+ const self = this as any as ExchangeContract;
+ const inputAbi = self._lookupAbi('batchFillOrdersNoThrow(tuple[],uint256[],bytes[])').inputs;
+ [orders,
+ takerAssetFillAmounts,
+ signatures
+ ] = BaseContract._formatABIDataItemList(inputAbi, [orders,
+ takerAssetFillAmounts,
+ signatures
+ ], BaseContract._bigNumberToString);
+ const encodedData = self._lookupEthersInterface('batchFillOrdersNoThrow(tuple[],uint256[],bytes[])').functions.batchFillOrdersNoThrow.encode([orders,
+ takerAssetFillAmounts,
+ signatures
+ ]);
+ const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
+ {
+ to: self.address,
+ ...txData,
+ data: encodedData,
+ },
+ self._web3Wrapper.getContractDefaults(),
+ );
+ const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults);
+ return gas;
+ },
+ getABIEncodedTransactionData(
+ orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>,
+ takerAssetFillAmounts: BigNumber[],
+ signatures: string[],
+ ): string {
+ const self = this as any as ExchangeContract;
+ const inputAbi = self._lookupAbi('batchFillOrdersNoThrow(tuple[],uint256[],bytes[])').inputs;
+ [orders,
+ takerAssetFillAmounts,
+ signatures
+ ] = BaseContract._formatABIDataItemList(inputAbi, [orders,
+ takerAssetFillAmounts,
+ signatures
+ ], BaseContract._bigNumberToString);
+ const abiEncodedTransactionData = self._lookupEthersInterface('batchFillOrdersNoThrow(tuple[],uint256[],bytes[])').functions.batchFillOrdersNoThrow.encode([orders,
+ takerAssetFillAmounts,
+ signatures
+ ]);
+ return abiEncodedTransactionData;
+ },
+ async callAsync(
+ orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>,
+ takerAssetFillAmounts: BigNumber[],
+ signatures: string[],
+ callData: Partial<CallData> = {},
+ defaultBlock?: BlockParam,
+ ): Promise<{makerAssetFilledAmount: BigNumber;takerAssetFilledAmount: BigNumber;makerFeePaid: BigNumber;takerFeePaid: BigNumber}
+ > {
+ const self = this as any as ExchangeContract;
+ const functionSignature = 'batchFillOrdersNoThrow(tuple[],uint256[],bytes[])';
+ const inputAbi = self._lookupAbi(functionSignature).inputs;
+ [orders,
+ takerAssetFillAmounts,
+ signatures
+ ] = BaseContract._formatABIDataItemList(inputAbi, [orders,
+ takerAssetFillAmounts,
+ signatures
+ ], BaseContract._bigNumberToString.bind(self));
+ BaseContract.strictArgumentEncodingCheck(inputAbi, [orders,
+ takerAssetFillAmounts,
+ signatures
+ ]);
+ const ethersFunction = self._lookupEthersInterface(functionSignature).functions.batchFillOrdersNoThrow;
+ const encodedData = ethersFunction.encode([orders,
+ takerAssetFillAmounts,
+ signatures
+ ]);
+ const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
+ {
+ to: self.address,
+ ...callData,
+ data: encodedData,
+ },
+ self._web3Wrapper.getContractDefaults(),
+ );
+ const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
+ BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
+ let resultArray = ethersFunction.decode(rawCallResult);
+ const outputAbi = (_.find(self.abi, {name: 'batchFillOrdersNoThrow'}) as MethodAbi).outputs;
+ resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this));
+ resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this));
+ return resultArray[0];
+ },
+ };
+ public getAssetProxy = {
+ async callAsync(
+ assetProxyId: string,
+ callData: Partial<CallData> = {},
+ defaultBlock?: BlockParam,
+ ): Promise<string
+ > {
+ const self = this as any as ExchangeContract;
+ const functionSignature = 'getAssetProxy(bytes4)';
+ const inputAbi = self._lookupAbi(functionSignature).inputs;
+ [assetProxyId
+ ] = BaseContract._formatABIDataItemList(inputAbi, [assetProxyId
+ ], BaseContract._bigNumberToString.bind(self));
+ BaseContract.strictArgumentEncodingCheck(inputAbi, [assetProxyId
+ ]);
+ const ethersFunction = self._lookupEthersInterface(functionSignature).functions.getAssetProxy;
+ const encodedData = ethersFunction.encode([assetProxyId
+ ]);
+ const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
+ {
+ to: self.address,
+ ...callData,
+ data: encodedData,
+ },
+ self._web3Wrapper.getContractDefaults(),
+ );
+ const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
+ BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
+ let resultArray = ethersFunction.decode(rawCallResult);
+ const outputAbi = (_.find(self.abi, {name: 'getAssetProxy'}) as MethodAbi).outputs;
+ resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this));
+ resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this));
+ return resultArray[0];
+ },
+ };
+ public transactions = {
+ async callAsync(
+ index_0: string,
+ callData: Partial<CallData> = {},
+ defaultBlock?: BlockParam,
+ ): Promise<boolean
+ > {
+ const self = this as any as ExchangeContract;
+ const functionSignature = 'transactions(bytes32)';
+ const inputAbi = self._lookupAbi(functionSignature).inputs;
+ [index_0
+ ] = BaseContract._formatABIDataItemList(inputAbi, [index_0
+ ], BaseContract._bigNumberToString.bind(self));
+ BaseContract.strictArgumentEncodingCheck(inputAbi, [index_0
+ ]);
+ const ethersFunction = self._lookupEthersInterface(functionSignature).functions.transactions;
+ const encodedData = ethersFunction.encode([index_0
+ ]);
+ const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
+ {
+ to: self.address,
+ ...callData,
+ data: encodedData,
+ },
+ self._web3Wrapper.getContractDefaults(),
+ );
+ const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
+ BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
+ let resultArray = ethersFunction.decode(rawCallResult);
+ const outputAbi = (_.find(self.abi, {name: 'transactions'}) as MethodAbi).outputs;
+ resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this));
+ resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this));
+ return resultArray[0];
+ },
+ };
+ public fillOrKillOrder = {
+ async sendTransactionAsync(
+ order: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string},
+ takerAssetFillAmount: BigNumber,
+ signature: string,
+ txData: Partial<TxData> = {},
+ ): Promise<string> {
+ const self = this as any as ExchangeContract;
+ const inputAbi = self._lookupAbi('fillOrKillOrder({address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes},uint256,bytes)').inputs;
+ [order,
+ takerAssetFillAmount,
+ signature
+ ] = BaseContract._formatABIDataItemList(inputAbi, [order,
+ takerAssetFillAmount,
+ signature
+ ], BaseContract._bigNumberToString.bind(self));
+ BaseContract.strictArgumentEncodingCheck(inputAbi, [order,
+ takerAssetFillAmount,
+ signature
+ ]);
+ const encodedData = self._lookupEthersInterface('fillOrKillOrder({address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes},uint256,bytes)').functions.fillOrKillOrder.encode([order,
+ takerAssetFillAmount,
+ signature
+ ]);
+ const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
+ {
+ to: self.address,
+ ...txData,
+ data: encodedData,
+ },
+ self._web3Wrapper.getContractDefaults(),
+ self.fillOrKillOrder.estimateGasAsync.bind(
+ self,
+ order,
+ takerAssetFillAmount,
+ signature
+ ),
+ );
+ const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults);
+ return txHash;
+ },
+ async estimateGasAsync(
+ order: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string},
+ takerAssetFillAmount: BigNumber,
+ signature: string,
+ txData: Partial<TxData> = {},
+ ): Promise<number> {
+ const self = this as any as ExchangeContract;
+ const inputAbi = self._lookupAbi('fillOrKillOrder({address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes},uint256,bytes)').inputs;
+ [order,
+ takerAssetFillAmount,
+ signature
+ ] = BaseContract._formatABIDataItemList(inputAbi, [order,
+ takerAssetFillAmount,
+ signature
+ ], BaseContract._bigNumberToString);
+ const encodedData = self._lookupEthersInterface('fillOrKillOrder({address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes},uint256,bytes)').functions.fillOrKillOrder.encode([order,
+ takerAssetFillAmount,
+ signature
+ ]);
+ const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
+ {
+ to: self.address,
+ ...txData,
+ data: encodedData,
+ },
+ self._web3Wrapper.getContractDefaults(),
+ );
+ const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults);
+ return gas;
+ },
+ getABIEncodedTransactionData(
+ order: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string},
+ takerAssetFillAmount: BigNumber,
+ signature: string,
+ ): string {
+ const self = this as any as ExchangeContract;
+ const inputAbi = self._lookupAbi('fillOrKillOrder({address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes},uint256,bytes)').inputs;
+ [order,
+ takerAssetFillAmount,
+ signature
+ ] = BaseContract._formatABIDataItemList(inputAbi, [order,
+ takerAssetFillAmount,
+ signature
+ ], BaseContract._bigNumberToString);
+ const abiEncodedTransactionData = self._lookupEthersInterface('fillOrKillOrder({address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes},uint256,bytes)').functions.fillOrKillOrder.encode([order,
+ takerAssetFillAmount,
+ signature
+ ]);
+ return abiEncodedTransactionData;
+ },
+ async callAsync(
+ order: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string},
+ takerAssetFillAmount: BigNumber,
+ signature: string,
+ callData: Partial<CallData> = {},
+ defaultBlock?: BlockParam,
+ ): Promise<{makerAssetFilledAmount: BigNumber;takerAssetFilledAmount: BigNumber;makerFeePaid: BigNumber;takerFeePaid: BigNumber}
+ > {
+ const self = this as any as ExchangeContract;
+ const functionSignature = 'fillOrKillOrder({address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes},uint256,bytes)';
+ const inputAbi = self._lookupAbi(functionSignature).inputs;
+ [order,
+ takerAssetFillAmount,
+ signature
+ ] = BaseContract._formatABIDataItemList(inputAbi, [order,
+ takerAssetFillAmount,
+ signature
+ ], BaseContract._bigNumberToString.bind(self));
+ BaseContract.strictArgumentEncodingCheck(inputAbi, [order,
+ takerAssetFillAmount,
+ signature
+ ]);
+ const ethersFunction = self._lookupEthersInterface(functionSignature).functions.fillOrKillOrder;
+ const encodedData = ethersFunction.encode([order,
+ takerAssetFillAmount,
+ signature
+ ]);
+ const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
+ {
+ to: self.address,
+ ...callData,
+ data: encodedData,
+ },
+ self._web3Wrapper.getContractDefaults(),
+ );
+ const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
+ BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
+ let resultArray = ethersFunction.decode(rawCallResult);
+ const outputAbi = (_.find(self.abi, {name: 'fillOrKillOrder'}) as MethodAbi).outputs;
+ resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this));
+ resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this));
+ return resultArray[0];
+ },
+ };
+ public setSignatureValidatorApproval = {
+ async sendTransactionAsync(
+ validatorAddress: string,
+ approval: boolean,
+ txData: Partial<TxData> = {},
+ ): Promise<string> {
+ const self = this as any as ExchangeContract;
+ const inputAbi = self._lookupAbi('setSignatureValidatorApproval(address,bool)').inputs;
+ [validatorAddress,
+ approval
+ ] = BaseContract._formatABIDataItemList(inputAbi, [validatorAddress,
+ approval
+ ], BaseContract._bigNumberToString.bind(self));
+ BaseContract.strictArgumentEncodingCheck(inputAbi, [validatorAddress,
+ approval
+ ]);
+ const encodedData = self._lookupEthersInterface('setSignatureValidatorApproval(address,bool)').functions.setSignatureValidatorApproval.encode([validatorAddress,
+ approval
+ ]);
+ const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
+ {
+ to: self.address,
+ ...txData,
+ data: encodedData,
+ },
+ self._web3Wrapper.getContractDefaults(),
+ self.setSignatureValidatorApproval.estimateGasAsync.bind(
+ self,
+ validatorAddress,
+ approval
+ ),
+ );
+ const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults);
+ return txHash;
+ },
+ async estimateGasAsync(
+ validatorAddress: string,
+ approval: boolean,
+ txData: Partial<TxData> = {},
+ ): Promise<number> {
+ const self = this as any as ExchangeContract;
+ const inputAbi = self._lookupAbi('setSignatureValidatorApproval(address,bool)').inputs;
+ [validatorAddress,
+ approval
+ ] = BaseContract._formatABIDataItemList(inputAbi, [validatorAddress,
+ approval
+ ], BaseContract._bigNumberToString);
+ const encodedData = self._lookupEthersInterface('setSignatureValidatorApproval(address,bool)').functions.setSignatureValidatorApproval.encode([validatorAddress,
+ approval
+ ]);
+ const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
+ {
+ to: self.address,
+ ...txData,
+ data: encodedData,
+ },
+ self._web3Wrapper.getContractDefaults(),
+ );
+ const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults);
+ return gas;
+ },
+ getABIEncodedTransactionData(
+ validatorAddress: string,
+ approval: boolean,
+ ): string {
+ const self = this as any as ExchangeContract;
+ const inputAbi = self._lookupAbi('setSignatureValidatorApproval(address,bool)').inputs;
+ [validatorAddress,
+ approval
+ ] = BaseContract._formatABIDataItemList(inputAbi, [validatorAddress,
+ approval
+ ], BaseContract._bigNumberToString);
+ const abiEncodedTransactionData = self._lookupEthersInterface('setSignatureValidatorApproval(address,bool)').functions.setSignatureValidatorApproval.encode([validatorAddress,
+ approval
+ ]);
+ return abiEncodedTransactionData;
+ },
+ async callAsync(
+ validatorAddress: string,
+ approval: boolean,
+ callData: Partial<CallData> = {},
+ defaultBlock?: BlockParam,
+ ): Promise<void
+ > {
+ const self = this as any as ExchangeContract;
+ const functionSignature = 'setSignatureValidatorApproval(address,bool)';
+ const inputAbi = self._lookupAbi(functionSignature).inputs;
+ [validatorAddress,
+ approval
+ ] = BaseContract._formatABIDataItemList(inputAbi, [validatorAddress,
+ approval
+ ], BaseContract._bigNumberToString.bind(self));
+ BaseContract.strictArgumentEncodingCheck(inputAbi, [validatorAddress,
+ approval
+ ]);
+ const ethersFunction = self._lookupEthersInterface(functionSignature).functions.setSignatureValidatorApproval;
+ const encodedData = ethersFunction.encode([validatorAddress,
+ approval
+ ]);
+ const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
+ {
+ to: self.address,
+ ...callData,
+ data: encodedData,
+ },
+ self._web3Wrapper.getContractDefaults(),
+ );
+ const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
+ BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
+ let resultArray = ethersFunction.decode(rawCallResult);
+ const outputAbi = (_.find(self.abi, {name: 'setSignatureValidatorApproval'}) as MethodAbi).outputs;
+ resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this));
+ resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this));
+ return resultArray;
+ },
+ };
+ public allowedValidators = {
+ async callAsync(
+ index_0: string,
+ index_1: string,
+ callData: Partial<CallData> = {},
+ defaultBlock?: BlockParam,
+ ): Promise<boolean
+ > {
+ const self = this as any as ExchangeContract;
+ const functionSignature = 'allowedValidators(address,address)';
+ const inputAbi = self._lookupAbi(functionSignature).inputs;
+ [index_0,
+ index_1
+ ] = BaseContract._formatABIDataItemList(inputAbi, [index_0,
+ index_1
+ ], BaseContract._bigNumberToString.bind(self));
+ BaseContract.strictArgumentEncodingCheck(inputAbi, [index_0,
+ index_1
+ ]);
+ const ethersFunction = self._lookupEthersInterface(functionSignature).functions.allowedValidators;
+ const encodedData = ethersFunction.encode([index_0,
+ index_1
+ ]);
+ const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
+ {
+ to: self.address,
+ ...callData,
+ data: encodedData,
+ },
+ self._web3Wrapper.getContractDefaults(),
+ );
+ const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
+ BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
+ let resultArray = ethersFunction.decode(rawCallResult);
+ const outputAbi = (_.find(self.abi, {name: 'allowedValidators'}) as MethodAbi).outputs;
+ resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this));
+ resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this));
+ return resultArray[0];
+ },
+ };
+ public marketSellOrders = {
+ async sendTransactionAsync(
+ orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>,
+ takerAssetFillAmount: BigNumber,
+ signatures: string[],
+ txData: Partial<TxData> = {},
+ ): Promise<string> {
+ const self = this as any as ExchangeContract;
+ const inputAbi = self._lookupAbi('marketSellOrders(tuple[],uint256,bytes[])').inputs;
+ [orders,
+ takerAssetFillAmount,
+ signatures
+ ] = BaseContract._formatABIDataItemList(inputAbi, [orders,
+ takerAssetFillAmount,
+ signatures
+ ], BaseContract._bigNumberToString.bind(self));
+ BaseContract.strictArgumentEncodingCheck(inputAbi, [orders,
+ takerAssetFillAmount,
+ signatures
+ ]);
+ const encodedData = self._lookupEthersInterface('marketSellOrders(tuple[],uint256,bytes[])').functions.marketSellOrders.encode([orders,
+ takerAssetFillAmount,
+ signatures
+ ]);
+ const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
+ {
+ to: self.address,
+ ...txData,
+ data: encodedData,
+ },
+ self._web3Wrapper.getContractDefaults(),
+ self.marketSellOrders.estimateGasAsync.bind(
+ self,
+ orders,
+ takerAssetFillAmount,
+ signatures
+ ),
+ );
+ const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults);
+ return txHash;
+ },
+ async estimateGasAsync(
+ orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>,
+ takerAssetFillAmount: BigNumber,
+ signatures: string[],
+ txData: Partial<TxData> = {},
+ ): Promise<number> {
+ const self = this as any as ExchangeContract;
+ const inputAbi = self._lookupAbi('marketSellOrders(tuple[],uint256,bytes[])').inputs;
+ [orders,
+ takerAssetFillAmount,
+ signatures
+ ] = BaseContract._formatABIDataItemList(inputAbi, [orders,
+ takerAssetFillAmount,
+ signatures
+ ], BaseContract._bigNumberToString);
+ const encodedData = self._lookupEthersInterface('marketSellOrders(tuple[],uint256,bytes[])').functions.marketSellOrders.encode([orders,
+ takerAssetFillAmount,
+ signatures
+ ]);
+ const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
+ {
+ to: self.address,
+ ...txData,
+ data: encodedData,
+ },
+ self._web3Wrapper.getContractDefaults(),
+ );
+ const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults);
+ return gas;
+ },
+ getABIEncodedTransactionData(
+ orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>,
+ takerAssetFillAmount: BigNumber,
+ signatures: string[],
+ ): string {
+ const self = this as any as ExchangeContract;
+ const inputAbi = self._lookupAbi('marketSellOrders(tuple[],uint256,bytes[])').inputs;
+ [orders,
+ takerAssetFillAmount,
+ signatures
+ ] = BaseContract._formatABIDataItemList(inputAbi, [orders,
+ takerAssetFillAmount,
+ signatures
+ ], BaseContract._bigNumberToString);
+ const abiEncodedTransactionData = self._lookupEthersInterface('marketSellOrders(tuple[],uint256,bytes[])').functions.marketSellOrders.encode([orders,
+ takerAssetFillAmount,
+ signatures
+ ]);
+ return abiEncodedTransactionData;
+ },
+ async callAsync(
+ orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>,
+ takerAssetFillAmount: BigNumber,
+ signatures: string[],
+ callData: Partial<CallData> = {},
+ defaultBlock?: BlockParam,
+ ): Promise<{makerAssetFilledAmount: BigNumber;takerAssetFilledAmount: BigNumber;makerFeePaid: BigNumber;takerFeePaid: BigNumber}
+ > {
+ const self = this as any as ExchangeContract;
+ const functionSignature = 'marketSellOrders(tuple[],uint256,bytes[])';
+ const inputAbi = self._lookupAbi(functionSignature).inputs;
+ [orders,
+ takerAssetFillAmount,
+ signatures
+ ] = BaseContract._formatABIDataItemList(inputAbi, [orders,
+ takerAssetFillAmount,
+ signatures
+ ], BaseContract._bigNumberToString.bind(self));
+ BaseContract.strictArgumentEncodingCheck(inputAbi, [orders,
+ takerAssetFillAmount,
+ signatures
+ ]);
+ const ethersFunction = self._lookupEthersInterface(functionSignature).functions.marketSellOrders;
+ const encodedData = ethersFunction.encode([orders,
+ takerAssetFillAmount,
+ signatures
+ ]);
+ const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
+ {
+ to: self.address,
+ ...callData,
+ data: encodedData,
+ },
+ self._web3Wrapper.getContractDefaults(),
+ );
+ const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
+ BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
+ let resultArray = ethersFunction.decode(rawCallResult);
+ const outputAbi = (_.find(self.abi, {name: 'marketSellOrders'}) as MethodAbi).outputs;
+ resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this));
+ resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this));
+ return resultArray[0];
+ },
+ };
+ public getOrdersInfo = {
+ async callAsync(
+ orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>,
+ callData: Partial<CallData> = {},
+ defaultBlock?: BlockParam,
+ ): Promise<Array<{orderStatus: number;orderHash: string;orderTakerAssetFilledAmount: BigNumber}>
+ > {
+ const self = this as any as ExchangeContract;
+ const functionSignature = 'getOrdersInfo(tuple[])';
+ const inputAbi = self._lookupAbi(functionSignature).inputs;
+ [orders
+ ] = BaseContract._formatABIDataItemList(inputAbi, [orders
+ ], BaseContract._bigNumberToString.bind(self));
+ BaseContract.strictArgumentEncodingCheck(inputAbi, [orders
+ ]);
+ const ethersFunction = self._lookupEthersInterface(functionSignature).functions.getOrdersInfo;
+ const encodedData = ethersFunction.encode([orders
+ ]);
+ const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
+ {
+ to: self.address,
+ ...callData,
+ data: encodedData,
+ },
+ self._web3Wrapper.getContractDefaults(),
+ );
+ const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
+ BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
+ let resultArray = ethersFunction.decode(rawCallResult);
+ const outputAbi = (_.find(self.abi, {name: 'getOrdersInfo'}) as MethodAbi).outputs;
+ resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this));
+ resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this));
+ return resultArray[0];
+ },
+ };
+ public preSigned = {
+ async callAsync(
+ index_0: string,
+ index_1: string,
+ callData: Partial<CallData> = {},
+ defaultBlock?: BlockParam,
+ ): Promise<boolean
+ > {
+ const self = this as any as ExchangeContract;
+ const functionSignature = 'preSigned(bytes32,address)';
+ const inputAbi = self._lookupAbi(functionSignature).inputs;
+ [index_0,
+ index_1
+ ] = BaseContract._formatABIDataItemList(inputAbi, [index_0,
+ index_1
+ ], BaseContract._bigNumberToString.bind(self));
+ BaseContract.strictArgumentEncodingCheck(inputAbi, [index_0,
+ index_1
+ ]);
+ const ethersFunction = self._lookupEthersInterface(functionSignature).functions.preSigned;
+ const encodedData = ethersFunction.encode([index_0,
+ index_1
+ ]);
+ const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
+ {
+ to: self.address,
+ ...callData,
+ data: encodedData,
+ },
+ self._web3Wrapper.getContractDefaults(),
+ );
+ const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
+ BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
+ let resultArray = ethersFunction.decode(rawCallResult);
+ const outputAbi = (_.find(self.abi, {name: 'preSigned'}) as MethodAbi).outputs;
+ resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this));
+ resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this));
+ return resultArray[0];
+ },
+ };
+ public owner = {
+ async callAsync(
+ callData: Partial<CallData> = {},
+ defaultBlock?: BlockParam,
+ ): Promise<string
+ > {
+ const self = this as any as ExchangeContract;
+ const functionSignature = 'owner()';
+ const inputAbi = self._lookupAbi(functionSignature).inputs;
+ [] = BaseContract._formatABIDataItemList(inputAbi, [], BaseContract._bigNumberToString.bind(self));
+ BaseContract.strictArgumentEncodingCheck(inputAbi, []);
+ const ethersFunction = self._lookupEthersInterface(functionSignature).functions.owner;
+ const encodedData = ethersFunction.encode([]);
+ const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
+ {
+ to: self.address,
+ ...callData,
+ data: encodedData,
+ },
+ self._web3Wrapper.getContractDefaults(),
+ );
+ const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
+ BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
+ let resultArray = ethersFunction.decode(rawCallResult);
+ const outputAbi = (_.find(self.abi, {name: 'owner'}) as MethodAbi).outputs;
+ resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this));
+ resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this));
+ return resultArray[0];
+ },
+ };
+ public isValidSignature = {
+ async callAsync(
+ hash: string,
+ signerAddress: string,
+ signature: string,
+ callData: Partial<CallData> = {},
+ defaultBlock?: BlockParam,
+ ): Promise<boolean
+ > {
+ const self = this as any as ExchangeContract;
+ const functionSignature = 'isValidSignature(bytes32,address,bytes)';
+ const inputAbi = self._lookupAbi(functionSignature).inputs;
+ [hash,
+ signerAddress,
+ signature
+ ] = BaseContract._formatABIDataItemList(inputAbi, [hash,
+ signerAddress,
+ signature
+ ], BaseContract._bigNumberToString.bind(self));
+ BaseContract.strictArgumentEncodingCheck(inputAbi, [hash,
+ signerAddress,
+ signature
+ ]);
+ const ethersFunction = self._lookupEthersInterface(functionSignature).functions.isValidSignature;
+ const encodedData = ethersFunction.encode([hash,
+ signerAddress,
+ signature
+ ]);
+ const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
+ {
+ to: self.address,
+ ...callData,
+ data: encodedData,
+ },
+ self._web3Wrapper.getContractDefaults(),
+ );
+ const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
+ BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
+ let resultArray = ethersFunction.decode(rawCallResult);
+ const outputAbi = (_.find(self.abi, {name: 'isValidSignature'}) as MethodAbi).outputs;
+ resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this));
+ resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this));
+ return resultArray[0];
+ },
+ };
+ public marketBuyOrdersNoThrow = {
+ async sendTransactionAsync(
+ orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>,
+ makerAssetFillAmount: BigNumber,
+ signatures: string[],
+ txData: Partial<TxData> = {},
+ ): Promise<string> {
+ const self = this as any as ExchangeContract;
+ const inputAbi = self._lookupAbi('marketBuyOrdersNoThrow(tuple[],uint256,bytes[])').inputs;
+ [orders,
+ makerAssetFillAmount,
+ signatures
+ ] = BaseContract._formatABIDataItemList(inputAbi, [orders,
+ makerAssetFillAmount,
+ signatures
+ ], BaseContract._bigNumberToString.bind(self));
+ BaseContract.strictArgumentEncodingCheck(inputAbi, [orders,
+ makerAssetFillAmount,
+ signatures
+ ]);
+ const encodedData = self._lookupEthersInterface('marketBuyOrdersNoThrow(tuple[],uint256,bytes[])').functions.marketBuyOrdersNoThrow.encode([orders,
+ makerAssetFillAmount,
+ signatures
+ ]);
+ const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
+ {
+ to: self.address,
+ ...txData,
+ data: encodedData,
+ },
+ self._web3Wrapper.getContractDefaults(),
+ self.marketBuyOrdersNoThrow.estimateGasAsync.bind(
+ self,
+ orders,
+ makerAssetFillAmount,
+ signatures
+ ),
+ );
+ const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults);
+ return txHash;
+ },
+ async estimateGasAsync(
+ orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>,
+ makerAssetFillAmount: BigNumber,
+ signatures: string[],
+ txData: Partial<TxData> = {},
+ ): Promise<number> {
+ const self = this as any as ExchangeContract;
+ const inputAbi = self._lookupAbi('marketBuyOrdersNoThrow(tuple[],uint256,bytes[])').inputs;
+ [orders,
+ makerAssetFillAmount,
+ signatures
+ ] = BaseContract._formatABIDataItemList(inputAbi, [orders,
+ makerAssetFillAmount,
+ signatures
+ ], BaseContract._bigNumberToString);
+ const encodedData = self._lookupEthersInterface('marketBuyOrdersNoThrow(tuple[],uint256,bytes[])').functions.marketBuyOrdersNoThrow.encode([orders,
+ makerAssetFillAmount,
+ signatures
+ ]);
+ const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
+ {
+ to: self.address,
+ ...txData,
+ data: encodedData,
+ },
+ self._web3Wrapper.getContractDefaults(),
+ );
+ const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults);
+ return gas;
+ },
+ getABIEncodedTransactionData(
+ orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>,
+ makerAssetFillAmount: BigNumber,
+ signatures: string[],
+ ): string {
+ const self = this as any as ExchangeContract;
+ const inputAbi = self._lookupAbi('marketBuyOrdersNoThrow(tuple[],uint256,bytes[])').inputs;
+ [orders,
+ makerAssetFillAmount,
+ signatures
+ ] = BaseContract._formatABIDataItemList(inputAbi, [orders,
+ makerAssetFillAmount,
+ signatures
+ ], BaseContract._bigNumberToString);
+ const abiEncodedTransactionData = self._lookupEthersInterface('marketBuyOrdersNoThrow(tuple[],uint256,bytes[])').functions.marketBuyOrdersNoThrow.encode([orders,
+ makerAssetFillAmount,
+ signatures
+ ]);
+ return abiEncodedTransactionData;
+ },
+ async callAsync(
+ orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>,
+ makerAssetFillAmount: BigNumber,
+ signatures: string[],
+ callData: Partial<CallData> = {},
+ defaultBlock?: BlockParam,
+ ): Promise<{makerAssetFilledAmount: BigNumber;takerAssetFilledAmount: BigNumber;makerFeePaid: BigNumber;takerFeePaid: BigNumber}
+ > {
+ const self = this as any as ExchangeContract;
+ const functionSignature = 'marketBuyOrdersNoThrow(tuple[],uint256,bytes[])';
+ const inputAbi = self._lookupAbi(functionSignature).inputs;
+ [orders,
+ makerAssetFillAmount,
+ signatures
+ ] = BaseContract._formatABIDataItemList(inputAbi, [orders,
+ makerAssetFillAmount,
+ signatures
+ ], BaseContract._bigNumberToString.bind(self));
+ BaseContract.strictArgumentEncodingCheck(inputAbi, [orders,
+ makerAssetFillAmount,
+ signatures
+ ]);
+ const ethersFunction = self._lookupEthersInterface(functionSignature).functions.marketBuyOrdersNoThrow;
+ const encodedData = ethersFunction.encode([orders,
+ makerAssetFillAmount,
+ signatures
+ ]);
+ const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
+ {
+ to: self.address,
+ ...callData,
+ data: encodedData,
+ },
+ self._web3Wrapper.getContractDefaults(),
+ );
+ const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
+ BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
+ let resultArray = ethersFunction.decode(rawCallResult);
+ const outputAbi = (_.find(self.abi, {name: 'marketBuyOrdersNoThrow'}) as MethodAbi).outputs;
+ resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this));
+ resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this));
+ return resultArray[0];
+ },
+ };
+ public fillOrder = {
+ async sendTransactionAsync(
+ order: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string},
+ takerAssetFillAmount: BigNumber,
+ signature: string,
+ txData: Partial<TxData> = {},
+ ): Promise<string> {
+ const self = this as any as ExchangeContract;
+ const inputAbi = self._lookupAbi('fillOrder({address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes},uint256,bytes)').inputs;
+ [order,
+ takerAssetFillAmount,
+ signature
+ ] = BaseContract._formatABIDataItemList(inputAbi, [order,
+ takerAssetFillAmount,
+ signature
+ ], BaseContract._bigNumberToString.bind(self));
+ BaseContract.strictArgumentEncodingCheck(inputAbi, [order,
+ takerAssetFillAmount,
+ signature
+ ]);
+ const encodedData = self._lookupEthersInterface('fillOrder({address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes},uint256,bytes)').functions.fillOrder.encode([order,
+ takerAssetFillAmount,
+ signature
+ ]);
+ const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
+ {
+ to: self.address,
+ ...txData,
+ data: encodedData,
+ },
+ self._web3Wrapper.getContractDefaults(),
+ self.fillOrder.estimateGasAsync.bind(
+ self,
+ order,
+ takerAssetFillAmount,
+ signature
+ ),
+ );
+ const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults);
+ return txHash;
+ },
+ async estimateGasAsync(
+ order: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string},
+ takerAssetFillAmount: BigNumber,
+ signature: string,
+ txData: Partial<TxData> = {},
+ ): Promise<number> {
+ const self = this as any as ExchangeContract;
+ const inputAbi = self._lookupAbi('fillOrder({address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes},uint256,bytes)').inputs;
+ [order,
+ takerAssetFillAmount,
+ signature
+ ] = BaseContract._formatABIDataItemList(inputAbi, [order,
+ takerAssetFillAmount,
+ signature
+ ], BaseContract._bigNumberToString);
+ const encodedData = self._lookupEthersInterface('fillOrder({address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes},uint256,bytes)').functions.fillOrder.encode([order,
+ takerAssetFillAmount,
+ signature
+ ]);
+ const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
+ {
+ to: self.address,
+ ...txData,
+ data: encodedData,
+ },
+ self._web3Wrapper.getContractDefaults(),
+ );
+ const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults);
+ return gas;
+ },
+ getABIEncodedTransactionData(
+ order: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string},
+ takerAssetFillAmount: BigNumber,
+ signature: string,
+ ): string {
+ const self = this as any as ExchangeContract;
+ const inputAbi = self._lookupAbi('fillOrder({address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes},uint256,bytes)').inputs;
+ [order,
+ takerAssetFillAmount,
+ signature
+ ] = BaseContract._formatABIDataItemList(inputAbi, [order,
+ takerAssetFillAmount,
+ signature
+ ], BaseContract._bigNumberToString);
+ const abiEncodedTransactionData = self._lookupEthersInterface('fillOrder({address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes},uint256,bytes)').functions.fillOrder.encode([order,
+ takerAssetFillAmount,
+ signature
+ ]);
+ return abiEncodedTransactionData;
+ },
+ async callAsync(
+ order: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string},
+ takerAssetFillAmount: BigNumber,
+ signature: string,
+ callData: Partial<CallData> = {},
+ defaultBlock?: BlockParam,
+ ): Promise<{makerAssetFilledAmount: BigNumber;takerAssetFilledAmount: BigNumber;makerFeePaid: BigNumber;takerFeePaid: BigNumber}
+ > {
+ const self = this as any as ExchangeContract;
+ const functionSignature = 'fillOrder({address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes},uint256,bytes)';
+ const inputAbi = self._lookupAbi(functionSignature).inputs;
+ [order,
+ takerAssetFillAmount,
+ signature
+ ] = BaseContract._formatABIDataItemList(inputAbi, [order,
+ takerAssetFillAmount,
+ signature
+ ], BaseContract._bigNumberToString.bind(self));
+ BaseContract.strictArgumentEncodingCheck(inputAbi, [order,
+ takerAssetFillAmount,
+ signature
+ ]);
+ const ethersFunction = self._lookupEthersInterface(functionSignature).functions.fillOrder;
+ const encodedData = ethersFunction.encode([order,
+ takerAssetFillAmount,
+ signature
+ ]);
+ const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
+ {
+ to: self.address,
+ ...callData,
+ data: encodedData,
+ },
+ self._web3Wrapper.getContractDefaults(),
+ );
+ const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
+ BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
+ let resultArray = ethersFunction.decode(rawCallResult);
+ const outputAbi = (_.find(self.abi, {name: 'fillOrder'}) as MethodAbi).outputs;
+ resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this));
+ resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this));
+ return resultArray[0];
+ },
+ };
+ public executeTransaction = {
+ async sendTransactionAsync(
+ salt: BigNumber,
+ signerAddress: string,
+ data: string,
+ signature: string,
+ txData: Partial<TxData> = {},
+ ): Promise<string> {
+ const self = this as any as ExchangeContract;
+ const inputAbi = self._lookupAbi('executeTransaction(uint256,address,bytes,bytes)').inputs;
+ [salt,
+ signerAddress,
+ data,
+ signature
+ ] = BaseContract._formatABIDataItemList(inputAbi, [salt,
+ signerAddress,
+ data,
+ signature
+ ], BaseContract._bigNumberToString.bind(self));
+ BaseContract.strictArgumentEncodingCheck(inputAbi, [salt,
+ signerAddress,
+ data,
+ signature
+ ]);
+ const encodedData = self._lookupEthersInterface('executeTransaction(uint256,address,bytes,bytes)').functions.executeTransaction.encode([salt,
+ signerAddress,
+ data,
+ signature
+ ]);
+ const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
+ {
+ to: self.address,
+ ...txData,
+ data: encodedData,
+ },
+ self._web3Wrapper.getContractDefaults(),
+ self.executeTransaction.estimateGasAsync.bind(
+ self,
+ salt,
+ signerAddress,
+ data,
+ signature
+ ),
+ );
+ const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults);
+ return txHash;
+ },
+ async estimateGasAsync(
+ salt: BigNumber,
+ signerAddress: string,
+ data: string,
+ signature: string,
+ txData: Partial<TxData> = {},
+ ): Promise<number> {
+ const self = this as any as ExchangeContract;
+ const inputAbi = self._lookupAbi('executeTransaction(uint256,address,bytes,bytes)').inputs;
+ [salt,
+ signerAddress,
+ data,
+ signature
+ ] = BaseContract._formatABIDataItemList(inputAbi, [salt,
+ signerAddress,
+ data,
+ signature
+ ], BaseContract._bigNumberToString);
+ const encodedData = self._lookupEthersInterface('executeTransaction(uint256,address,bytes,bytes)').functions.executeTransaction.encode([salt,
+ signerAddress,
+ data,
+ signature
+ ]);
+ const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
+ {
+ to: self.address,
+ ...txData,
+ data: encodedData,
+ },
+ self._web3Wrapper.getContractDefaults(),
+ );
+ const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults);
+ return gas;
+ },
+ getABIEncodedTransactionData(
+ salt: BigNumber,
+ signerAddress: string,
+ data: string,
+ signature: string,
+ ): string {
+ const self = this as any as ExchangeContract;
+ const inputAbi = self._lookupAbi('executeTransaction(uint256,address,bytes,bytes)').inputs;
+ [salt,
+ signerAddress,
+ data,
+ signature
+ ] = BaseContract._formatABIDataItemList(inputAbi, [salt,
+ signerAddress,
+ data,
+ signature
+ ], BaseContract._bigNumberToString);
+ const abiEncodedTransactionData = self._lookupEthersInterface('executeTransaction(uint256,address,bytes,bytes)').functions.executeTransaction.encode([salt,
+ signerAddress,
+ data,
+ signature
+ ]);
+ return abiEncodedTransactionData;
+ },
+ async callAsync(
+ salt: BigNumber,
+ signerAddress: string,
+ data: string,
+ signature: string,
+ callData: Partial<CallData> = {},
+ defaultBlock?: BlockParam,
+ ): Promise<void
+ > {
+ const self = this as any as ExchangeContract;
+ const functionSignature = 'executeTransaction(uint256,address,bytes,bytes)';
+ const inputAbi = self._lookupAbi(functionSignature).inputs;
+ [salt,
+ signerAddress,
+ data,
+ signature
+ ] = BaseContract._formatABIDataItemList(inputAbi, [salt,
+ signerAddress,
+ data,
+ signature
+ ], BaseContract._bigNumberToString.bind(self));
+ BaseContract.strictArgumentEncodingCheck(inputAbi, [salt,
+ signerAddress,
+ data,
+ signature
+ ]);
+ const ethersFunction = self._lookupEthersInterface(functionSignature).functions.executeTransaction;
+ const encodedData = ethersFunction.encode([salt,
+ signerAddress,
+ data,
+ signature
+ ]);
+ const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
+ {
+ to: self.address,
+ ...callData,
+ data: encodedData,
+ },
+ self._web3Wrapper.getContractDefaults(),
+ );
+ const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
+ BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
+ let resultArray = ethersFunction.decode(rawCallResult);
+ const outputAbi = (_.find(self.abi, {name: 'executeTransaction'}) as MethodAbi).outputs;
+ resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this));
+ resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this));
+ return resultArray;
+ },
+ };
+ public registerAssetProxy = {
+ async sendTransactionAsync(
+ assetProxy: string,
+ txData: Partial<TxData> = {},
+ ): Promise<string> {
+ const self = this as any as ExchangeContract;
+ const inputAbi = self._lookupAbi('registerAssetProxy(address)').inputs;
+ [assetProxy
+ ] = BaseContract._formatABIDataItemList(inputAbi, [assetProxy
+ ], BaseContract._bigNumberToString.bind(self));
+ BaseContract.strictArgumentEncodingCheck(inputAbi, [assetProxy
+ ]);
+ const encodedData = self._lookupEthersInterface('registerAssetProxy(address)').functions.registerAssetProxy.encode([assetProxy
+ ]);
+ const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
+ {
+ to: self.address,
+ ...txData,
+ data: encodedData,
+ },
+ self._web3Wrapper.getContractDefaults(),
+ self.registerAssetProxy.estimateGasAsync.bind(
+ self,
+ assetProxy
+ ),
+ );
+ const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults);
+ return txHash;
+ },
+ async estimateGasAsync(
+ assetProxy: string,
+ txData: Partial<TxData> = {},
+ ): Promise<number> {
+ const self = this as any as ExchangeContract;
+ const inputAbi = self._lookupAbi('registerAssetProxy(address)').inputs;
+ [assetProxy
+ ] = BaseContract._formatABIDataItemList(inputAbi, [assetProxy
+ ], BaseContract._bigNumberToString);
+ const encodedData = self._lookupEthersInterface('registerAssetProxy(address)').functions.registerAssetProxy.encode([assetProxy
+ ]);
+ const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
+ {
+ to: self.address,
+ ...txData,
+ data: encodedData,
+ },
+ self._web3Wrapper.getContractDefaults(),
+ );
+ const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults);
+ return gas;
+ },
+ getABIEncodedTransactionData(
+ assetProxy: string,
+ ): string {
+ const self = this as any as ExchangeContract;
+ const inputAbi = self._lookupAbi('registerAssetProxy(address)').inputs;
+ [assetProxy
+ ] = BaseContract._formatABIDataItemList(inputAbi, [assetProxy
+ ], BaseContract._bigNumberToString);
+ const abiEncodedTransactionData = self._lookupEthersInterface('registerAssetProxy(address)').functions.registerAssetProxy.encode([assetProxy
+ ]);
+ return abiEncodedTransactionData;
+ },
+ async callAsync(
+ assetProxy: string,
+ callData: Partial<CallData> = {},
+ defaultBlock?: BlockParam,
+ ): Promise<void
+ > {
+ const self = this as any as ExchangeContract;
+ const functionSignature = 'registerAssetProxy(address)';
+ const inputAbi = self._lookupAbi(functionSignature).inputs;
+ [assetProxy
+ ] = BaseContract._formatABIDataItemList(inputAbi, [assetProxy
+ ], BaseContract._bigNumberToString.bind(self));
+ BaseContract.strictArgumentEncodingCheck(inputAbi, [assetProxy
+ ]);
+ const ethersFunction = self._lookupEthersInterface(functionSignature).functions.registerAssetProxy;
+ const encodedData = ethersFunction.encode([assetProxy
+ ]);
+ const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
+ {
+ to: self.address,
+ ...callData,
+ data: encodedData,
+ },
+ self._web3Wrapper.getContractDefaults(),
+ );
+ const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
+ BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
+ let resultArray = ethersFunction.decode(rawCallResult);
+ const outputAbi = (_.find(self.abi, {name: 'registerAssetProxy'}) as MethodAbi).outputs;
+ resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this));
+ resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this));
+ return resultArray;
+ },
+ };
+ public getOrderInfo = {
+ async callAsync(
+ order: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string},
+ callData: Partial<CallData> = {},
+ defaultBlock?: BlockParam,
+ ): Promise<{orderStatus: number;orderHash: string;orderTakerAssetFilledAmount: BigNumber}
+ > {
+ const self = this as any as ExchangeContract;
+ const functionSignature = 'getOrderInfo({address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes})';
+ const inputAbi = self._lookupAbi(functionSignature).inputs;
+ [order
+ ] = BaseContract._formatABIDataItemList(inputAbi, [order
+ ], BaseContract._bigNumberToString.bind(self));
+ BaseContract.strictArgumentEncodingCheck(inputAbi, [order
+ ]);
+ const ethersFunction = self._lookupEthersInterface(functionSignature).functions.getOrderInfo;
+ const encodedData = ethersFunction.encode([order
+ ]);
+ const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
+ {
+ to: self.address,
+ ...callData,
+ data: encodedData,
+ },
+ self._web3Wrapper.getContractDefaults(),
+ );
+ const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
+ BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
+ let resultArray = ethersFunction.decode(rawCallResult);
+ const outputAbi = (_.find(self.abi, {name: 'getOrderInfo'}) as MethodAbi).outputs;
+ resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this));
+ resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this));
+ return resultArray[0];
+ },
+ };
+ public cancelOrder = {
+ async sendTransactionAsync(
+ order: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string},
+ txData: Partial<TxData> = {},
+ ): Promise<string> {
+ const self = this as any as ExchangeContract;
+ const inputAbi = self._lookupAbi('cancelOrder({address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes})').inputs;
+ [order
+ ] = BaseContract._formatABIDataItemList(inputAbi, [order
+ ], BaseContract._bigNumberToString.bind(self));
+ BaseContract.strictArgumentEncodingCheck(inputAbi, [order
+ ]);
+ const encodedData = self._lookupEthersInterface('cancelOrder({address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes})').functions.cancelOrder.encode([order
+ ]);
+ const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
+ {
+ to: self.address,
+ ...txData,
+ data: encodedData,
+ },
+ self._web3Wrapper.getContractDefaults(),
+ self.cancelOrder.estimateGasAsync.bind(
+ self,
+ order
+ ),
+ );
+ const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults);
+ return txHash;
+ },
+ async estimateGasAsync(
+ order: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string},
+ txData: Partial<TxData> = {},
+ ): Promise<number> {
+ const self = this as any as ExchangeContract;
+ const inputAbi = self._lookupAbi('cancelOrder({address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes})').inputs;
+ [order
+ ] = BaseContract._formatABIDataItemList(inputAbi, [order
+ ], BaseContract._bigNumberToString);
+ const encodedData = self._lookupEthersInterface('cancelOrder({address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes})').functions.cancelOrder.encode([order
+ ]);
+ const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
+ {
+ to: self.address,
+ ...txData,
+ data: encodedData,
+ },
+ self._web3Wrapper.getContractDefaults(),
+ );
+ const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults);
+ return gas;
+ },
+ getABIEncodedTransactionData(
+ order: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string},
+ ): string {
+ const self = this as any as ExchangeContract;
+ const inputAbi = self._lookupAbi('cancelOrder({address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes})').inputs;
+ [order
+ ] = BaseContract._formatABIDataItemList(inputAbi, [order
+ ], BaseContract._bigNumberToString);
+ const abiEncodedTransactionData = self._lookupEthersInterface('cancelOrder({address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes})').functions.cancelOrder.encode([order
+ ]);
+ return abiEncodedTransactionData;
+ },
+ async callAsync(
+ order: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string},
+ callData: Partial<CallData> = {},
+ defaultBlock?: BlockParam,
+ ): Promise<void
+ > {
+ const self = this as any as ExchangeContract;
+ const functionSignature = 'cancelOrder({address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes})';
+ const inputAbi = self._lookupAbi(functionSignature).inputs;
+ [order
+ ] = BaseContract._formatABIDataItemList(inputAbi, [order
+ ], BaseContract._bigNumberToString.bind(self));
+ BaseContract.strictArgumentEncodingCheck(inputAbi, [order
+ ]);
+ const ethersFunction = self._lookupEthersInterface(functionSignature).functions.cancelOrder;
+ const encodedData = ethersFunction.encode([order
+ ]);
+ const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
+ {
+ to: self.address,
+ ...callData,
+ data: encodedData,
+ },
+ self._web3Wrapper.getContractDefaults(),
+ );
+ const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
+ BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
+ let resultArray = ethersFunction.decode(rawCallResult);
+ const outputAbi = (_.find(self.abi, {name: 'cancelOrder'}) as MethodAbi).outputs;
+ resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this));
+ resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this));
+ return resultArray;
+ },
+ };
+ public orderEpoch = {
+ async callAsync(
+ index_0: string,
+ index_1: string,
+ callData: Partial<CallData> = {},
+ defaultBlock?: BlockParam,
+ ): Promise<BigNumber
+ > {
+ const self = this as any as ExchangeContract;
+ const functionSignature = 'orderEpoch(address,address)';
+ const inputAbi = self._lookupAbi(functionSignature).inputs;
+ [index_0,
+ index_1
+ ] = BaseContract._formatABIDataItemList(inputAbi, [index_0,
+ index_1
+ ], BaseContract._bigNumberToString.bind(self));
+ BaseContract.strictArgumentEncodingCheck(inputAbi, [index_0,
+ index_1
+ ]);
+ const ethersFunction = self._lookupEthersInterface(functionSignature).functions.orderEpoch;
+ const encodedData = ethersFunction.encode([index_0,
+ index_1
+ ]);
+ const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
+ {
+ to: self.address,
+ ...callData,
+ data: encodedData,
+ },
+ self._web3Wrapper.getContractDefaults(),
+ );
+ const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
+ BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
+ let resultArray = ethersFunction.decode(rawCallResult);
+ const outputAbi = (_.find(self.abi, {name: 'orderEpoch'}) as MethodAbi).outputs;
+ resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this));
+ resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this));
+ return resultArray[0];
+ },
+ };
+ public ZRX_ASSET_DATA = {
+ async callAsync(
+ callData: Partial<CallData> = {},
+ defaultBlock?: BlockParam,
+ ): Promise<string
+ > {
+ const self = this as any as ExchangeContract;
+ const functionSignature = 'ZRX_ASSET_DATA()';
+ const inputAbi = self._lookupAbi(functionSignature).inputs;
+ [] = BaseContract._formatABIDataItemList(inputAbi, [], BaseContract._bigNumberToString.bind(self));
+ BaseContract.strictArgumentEncodingCheck(inputAbi, []);
+ const ethersFunction = self._lookupEthersInterface(functionSignature).functions.ZRX_ASSET_DATA;
+ const encodedData = ethersFunction.encode([]);
+ const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
+ {
+ to: self.address,
+ ...callData,
+ data: encodedData,
+ },
+ self._web3Wrapper.getContractDefaults(),
+ );
+ const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
+ BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
+ let resultArray = ethersFunction.decode(rawCallResult);
+ const outputAbi = (_.find(self.abi, {name: 'ZRX_ASSET_DATA'}) as MethodAbi).outputs;
+ resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this));
+ resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this));
+ return resultArray[0];
+ },
+ };
+ public marketSellOrdersNoThrow = {
+ async sendTransactionAsync(
+ orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>,
+ takerAssetFillAmount: BigNumber,
+ signatures: string[],
+ txData: Partial<TxData> = {},
+ ): Promise<string> {
+ const self = this as any as ExchangeContract;
+ const inputAbi = self._lookupAbi('marketSellOrdersNoThrow(tuple[],uint256,bytes[])').inputs;
+ [orders,
+ takerAssetFillAmount,
+ signatures
+ ] = BaseContract._formatABIDataItemList(inputAbi, [orders,
+ takerAssetFillAmount,
+ signatures
+ ], BaseContract._bigNumberToString.bind(self));
+ BaseContract.strictArgumentEncodingCheck(inputAbi, [orders,
+ takerAssetFillAmount,
+ signatures
+ ]);
+ const encodedData = self._lookupEthersInterface('marketSellOrdersNoThrow(tuple[],uint256,bytes[])').functions.marketSellOrdersNoThrow.encode([orders,
+ takerAssetFillAmount,
+ signatures
+ ]);
+ const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
+ {
+ to: self.address,
+ ...txData,
+ data: encodedData,
+ },
+ self._web3Wrapper.getContractDefaults(),
+ self.marketSellOrdersNoThrow.estimateGasAsync.bind(
+ self,
+ orders,
+ takerAssetFillAmount,
+ signatures
+ ),
+ );
+ const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults);
+ return txHash;
+ },
+ async estimateGasAsync(
+ orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>,
+ takerAssetFillAmount: BigNumber,
+ signatures: string[],
+ txData: Partial<TxData> = {},
+ ): Promise<number> {
+ const self = this as any as ExchangeContract;
+ const inputAbi = self._lookupAbi('marketSellOrdersNoThrow(tuple[],uint256,bytes[])').inputs;
+ [orders,
+ takerAssetFillAmount,
+ signatures
+ ] = BaseContract._formatABIDataItemList(inputAbi, [orders,
+ takerAssetFillAmount,
+ signatures
+ ], BaseContract._bigNumberToString);
+ const encodedData = self._lookupEthersInterface('marketSellOrdersNoThrow(tuple[],uint256,bytes[])').functions.marketSellOrdersNoThrow.encode([orders,
+ takerAssetFillAmount,
+ signatures
+ ]);
+ const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
+ {
+ to: self.address,
+ ...txData,
+ data: encodedData,
+ },
+ self._web3Wrapper.getContractDefaults(),
+ );
+ const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults);
+ return gas;
+ },
+ getABIEncodedTransactionData(
+ orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>,
+ takerAssetFillAmount: BigNumber,
+ signatures: string[],
+ ): string {
+ const self = this as any as ExchangeContract;
+ const inputAbi = self._lookupAbi('marketSellOrdersNoThrow(tuple[],uint256,bytes[])').inputs;
+ [orders,
+ takerAssetFillAmount,
+ signatures
+ ] = BaseContract._formatABIDataItemList(inputAbi, [orders,
+ takerAssetFillAmount,
+ signatures
+ ], BaseContract._bigNumberToString);
+ const abiEncodedTransactionData = self._lookupEthersInterface('marketSellOrdersNoThrow(tuple[],uint256,bytes[])').functions.marketSellOrdersNoThrow.encode([orders,
+ takerAssetFillAmount,
+ signatures
+ ]);
+ return abiEncodedTransactionData;
+ },
+ async callAsync(
+ orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>,
+ takerAssetFillAmount: BigNumber,
+ signatures: string[],
+ callData: Partial<CallData> = {},
+ defaultBlock?: BlockParam,
+ ): Promise<{makerAssetFilledAmount: BigNumber;takerAssetFilledAmount: BigNumber;makerFeePaid: BigNumber;takerFeePaid: BigNumber}
+ > {
+ const self = this as any as ExchangeContract;
+ const functionSignature = 'marketSellOrdersNoThrow(tuple[],uint256,bytes[])';
+ const inputAbi = self._lookupAbi(functionSignature).inputs;
+ [orders,
+ takerAssetFillAmount,
+ signatures
+ ] = BaseContract._formatABIDataItemList(inputAbi, [orders,
+ takerAssetFillAmount,
+ signatures
+ ], BaseContract._bigNumberToString.bind(self));
+ BaseContract.strictArgumentEncodingCheck(inputAbi, [orders,
+ takerAssetFillAmount,
+ signatures
+ ]);
+ const ethersFunction = self._lookupEthersInterface(functionSignature).functions.marketSellOrdersNoThrow;
+ const encodedData = ethersFunction.encode([orders,
+ takerAssetFillAmount,
+ signatures
+ ]);
+ const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
+ {
+ to: self.address,
+ ...callData,
+ data: encodedData,
+ },
+ self._web3Wrapper.getContractDefaults(),
+ );
+ const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
+ BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
+ let resultArray = ethersFunction.decode(rawCallResult);
+ const outputAbi = (_.find(self.abi, {name: 'marketSellOrdersNoThrow'}) as MethodAbi).outputs;
+ resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this));
+ resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this));
+ return resultArray[0];
+ },
+ };
+ public EIP712_DOMAIN_HASH = {
+ async callAsync(
+ callData: Partial<CallData> = {},
+ defaultBlock?: BlockParam,
+ ): Promise<string
+ > {
+ const self = this as any as ExchangeContract;
+ const functionSignature = 'EIP712_DOMAIN_HASH()';
+ const inputAbi = self._lookupAbi(functionSignature).inputs;
+ [] = BaseContract._formatABIDataItemList(inputAbi, [], BaseContract._bigNumberToString.bind(self));
+ BaseContract.strictArgumentEncodingCheck(inputAbi, []);
+ const ethersFunction = self._lookupEthersInterface(functionSignature).functions.EIP712_DOMAIN_HASH;
+ const encodedData = ethersFunction.encode([]);
+ const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
+ {
+ to: self.address,
+ ...callData,
+ data: encodedData,
+ },
+ self._web3Wrapper.getContractDefaults(),
+ );
+ const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
+ BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
+ let resultArray = ethersFunction.decode(rawCallResult);
+ const outputAbi = (_.find(self.abi, {name: 'EIP712_DOMAIN_HASH'}) as MethodAbi).outputs;
+ resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this));
+ resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this));
+ return resultArray[0];
+ },
+ };
+ public marketBuyOrders = {
+ async sendTransactionAsync(
+ orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>,
+ makerAssetFillAmount: BigNumber,
+ signatures: string[],
+ txData: Partial<TxData> = {},
+ ): Promise<string> {
+ const self = this as any as ExchangeContract;
+ const inputAbi = self._lookupAbi('marketBuyOrders(tuple[],uint256,bytes[])').inputs;
+ [orders,
+ makerAssetFillAmount,
+ signatures
+ ] = BaseContract._formatABIDataItemList(inputAbi, [orders,
+ makerAssetFillAmount,
+ signatures
+ ], BaseContract._bigNumberToString.bind(self));
+ BaseContract.strictArgumentEncodingCheck(inputAbi, [orders,
+ makerAssetFillAmount,
+ signatures
+ ]);
+ const encodedData = self._lookupEthersInterface('marketBuyOrders(tuple[],uint256,bytes[])').functions.marketBuyOrders.encode([orders,
+ makerAssetFillAmount,
+ signatures
+ ]);
+ const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
+ {
+ to: self.address,
+ ...txData,
+ data: encodedData,
+ },
+ self._web3Wrapper.getContractDefaults(),
+ self.marketBuyOrders.estimateGasAsync.bind(
+ self,
+ orders,
+ makerAssetFillAmount,
+ signatures
+ ),
+ );
+ const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults);
+ return txHash;
+ },
+ async estimateGasAsync(
+ orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>,
+ makerAssetFillAmount: BigNumber,
+ signatures: string[],
+ txData: Partial<TxData> = {},
+ ): Promise<number> {
+ const self = this as any as ExchangeContract;
+ const inputAbi = self._lookupAbi('marketBuyOrders(tuple[],uint256,bytes[])').inputs;
+ [orders,
+ makerAssetFillAmount,
+ signatures
+ ] = BaseContract._formatABIDataItemList(inputAbi, [orders,
+ makerAssetFillAmount,
+ signatures
+ ], BaseContract._bigNumberToString);
+ const encodedData = self._lookupEthersInterface('marketBuyOrders(tuple[],uint256,bytes[])').functions.marketBuyOrders.encode([orders,
+ makerAssetFillAmount,
+ signatures
+ ]);
+ const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
+ {
+ to: self.address,
+ ...txData,
+ data: encodedData,
+ },
+ self._web3Wrapper.getContractDefaults(),
+ );
+ const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults);
+ return gas;
+ },
+ getABIEncodedTransactionData(
+ orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>,
+ makerAssetFillAmount: BigNumber,
+ signatures: string[],
+ ): string {
+ const self = this as any as ExchangeContract;
+ const inputAbi = self._lookupAbi('marketBuyOrders(tuple[],uint256,bytes[])').inputs;
+ [orders,
+ makerAssetFillAmount,
+ signatures
+ ] = BaseContract._formatABIDataItemList(inputAbi, [orders,
+ makerAssetFillAmount,
+ signatures
+ ], BaseContract._bigNumberToString);
+ const abiEncodedTransactionData = self._lookupEthersInterface('marketBuyOrders(tuple[],uint256,bytes[])').functions.marketBuyOrders.encode([orders,
+ makerAssetFillAmount,
+ signatures
+ ]);
+ return abiEncodedTransactionData;
+ },
+ async callAsync(
+ orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>,
+ makerAssetFillAmount: BigNumber,
+ signatures: string[],
+ callData: Partial<CallData> = {},
+ defaultBlock?: BlockParam,
+ ): Promise<{makerAssetFilledAmount: BigNumber;takerAssetFilledAmount: BigNumber;makerFeePaid: BigNumber;takerFeePaid: BigNumber}
+ > {
+ const self = this as any as ExchangeContract;
+ const functionSignature = 'marketBuyOrders(tuple[],uint256,bytes[])';
+ const inputAbi = self._lookupAbi(functionSignature).inputs;
+ [orders,
+ makerAssetFillAmount,
+ signatures
+ ] = BaseContract._formatABIDataItemList(inputAbi, [orders,
+ makerAssetFillAmount,
+ signatures
+ ], BaseContract._bigNumberToString.bind(self));
+ BaseContract.strictArgumentEncodingCheck(inputAbi, [orders,
+ makerAssetFillAmount,
+ signatures
+ ]);
+ const ethersFunction = self._lookupEthersInterface(functionSignature).functions.marketBuyOrders;
+ const encodedData = ethersFunction.encode([orders,
+ makerAssetFillAmount,
+ signatures
+ ]);
+ const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
+ {
+ to: self.address,
+ ...callData,
+ data: encodedData,
+ },
+ self._web3Wrapper.getContractDefaults(),
+ );
+ const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
+ BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
+ let resultArray = ethersFunction.decode(rawCallResult);
+ const outputAbi = (_.find(self.abi, {name: 'marketBuyOrders'}) as MethodAbi).outputs;
+ resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this));
+ resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this));
+ return resultArray[0];
+ },
+ };
+ public currentContextAddress = {
+ async callAsync(
+ callData: Partial<CallData> = {},
+ defaultBlock?: BlockParam,
+ ): Promise<string
+ > {
+ const self = this as any as ExchangeContract;
+ const functionSignature = 'currentContextAddress()';
+ const inputAbi = self._lookupAbi(functionSignature).inputs;
+ [] = BaseContract._formatABIDataItemList(inputAbi, [], BaseContract._bigNumberToString.bind(self));
+ BaseContract.strictArgumentEncodingCheck(inputAbi, []);
+ const ethersFunction = self._lookupEthersInterface(functionSignature).functions.currentContextAddress;
+ const encodedData = ethersFunction.encode([]);
+ const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
+ {
+ to: self.address,
+ ...callData,
+ data: encodedData,
+ },
+ self._web3Wrapper.getContractDefaults(),
+ );
+ const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
+ BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
+ let resultArray = ethersFunction.decode(rawCallResult);
+ const outputAbi = (_.find(self.abi, {name: 'currentContextAddress'}) as MethodAbi).outputs;
+ resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this));
+ resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this));
+ return resultArray[0];
+ },
+ };
+ public transferOwnership = {
+ async sendTransactionAsync(
+ newOwner: string,
+ txData: Partial<TxData> = {},
+ ): Promise<string> {
+ const self = this as any as ExchangeContract;
+ const inputAbi = self._lookupAbi('transferOwnership(address)').inputs;
+ [newOwner
+ ] = BaseContract._formatABIDataItemList(inputAbi, [newOwner
+ ], BaseContract._bigNumberToString.bind(self));
+ BaseContract.strictArgumentEncodingCheck(inputAbi, [newOwner
+ ]);
+ const encodedData = self._lookupEthersInterface('transferOwnership(address)').functions.transferOwnership.encode([newOwner
+ ]);
+ const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
+ {
+ to: self.address,
+ ...txData,
+ data: encodedData,
+ },
+ self._web3Wrapper.getContractDefaults(),
+ self.transferOwnership.estimateGasAsync.bind(
+ self,
+ newOwner
+ ),
+ );
+ const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults);
+ return txHash;
+ },
+ async estimateGasAsync(
+ newOwner: string,
+ txData: Partial<TxData> = {},
+ ): Promise<number> {
+ const self = this as any as ExchangeContract;
+ const inputAbi = self._lookupAbi('transferOwnership(address)').inputs;
+ [newOwner
+ ] = BaseContract._formatABIDataItemList(inputAbi, [newOwner
+ ], BaseContract._bigNumberToString);
+ const encodedData = self._lookupEthersInterface('transferOwnership(address)').functions.transferOwnership.encode([newOwner
+ ]);
+ const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
+ {
+ to: self.address,
+ ...txData,
+ data: encodedData,
+ },
+ self._web3Wrapper.getContractDefaults(),
+ );
+ const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults);
+ return gas;
+ },
+ getABIEncodedTransactionData(
+ newOwner: string,
+ ): string {
+ const self = this as any as ExchangeContract;
+ const inputAbi = self._lookupAbi('transferOwnership(address)').inputs;
+ [newOwner
+ ] = BaseContract._formatABIDataItemList(inputAbi, [newOwner
+ ], BaseContract._bigNumberToString);
+ const abiEncodedTransactionData = self._lookupEthersInterface('transferOwnership(address)').functions.transferOwnership.encode([newOwner
+ ]);
+ return abiEncodedTransactionData;
+ },
+ async callAsync(
+ newOwner: string,
+ callData: Partial<CallData> = {},
+ defaultBlock?: BlockParam,
+ ): Promise<void
+ > {
+ const self = this as any as ExchangeContract;
+ const functionSignature = 'transferOwnership(address)';
+ const inputAbi = self._lookupAbi(functionSignature).inputs;
+ [newOwner
+ ] = BaseContract._formatABIDataItemList(inputAbi, [newOwner
+ ], BaseContract._bigNumberToString.bind(self));
+ BaseContract.strictArgumentEncodingCheck(inputAbi, [newOwner
+ ]);
+ const ethersFunction = self._lookupEthersInterface(functionSignature).functions.transferOwnership;
+ const encodedData = ethersFunction.encode([newOwner
+ ]);
+ const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
+ {
+ to: self.address,
+ ...callData,
+ data: encodedData,
+ },
+ self._web3Wrapper.getContractDefaults(),
+ );
+ const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
+ BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
+ let resultArray = ethersFunction.decode(rawCallResult);
+ const outputAbi = (_.find(self.abi, {name: 'transferOwnership'}) as MethodAbi).outputs;
+ resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this));
+ resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this));
+ return resultArray;
+ },
+ };
+ public VERSION = {
+ async callAsync(
+ callData: Partial<CallData> = {},
+ defaultBlock?: BlockParam,
+ ): Promise<string
+ > {
+ const self = this as any as ExchangeContract;
+ const functionSignature = 'VERSION()';
+ const inputAbi = self._lookupAbi(functionSignature).inputs;
+ [] = BaseContract._formatABIDataItemList(inputAbi, [], BaseContract._bigNumberToString.bind(self));
+ BaseContract.strictArgumentEncodingCheck(inputAbi, []);
+ const ethersFunction = self._lookupEthersInterface(functionSignature).functions.VERSION;
+ const encodedData = ethersFunction.encode([]);
+ const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
+ {
+ to: self.address,
+ ...callData,
+ data: encodedData,
+ },
+ self._web3Wrapper.getContractDefaults(),
+ );
+ const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
+ BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
+ let resultArray = ethersFunction.decode(rawCallResult);
+ const outputAbi = (_.find(self.abi, {name: 'VERSION'}) as MethodAbi).outputs;
+ resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this));
+ resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this));
+ return resultArray[0];
+ },
+ };
+ public static async deployFrom0xArtifactAsync(
+ artifact: ContractArtifact,
+ provider: Provider,
+ txDefaults: Partial<TxData>,
+ ): Promise<ExchangeContract> {
+ if (_.isUndefined(artifact.compilerOutput)) {
+ throw new Error('Compiler output not found in the artifact file');
+ }
+ const bytecode = artifact.compilerOutput.evm.bytecode.object;
+ const abi = artifact.compilerOutput.abi;
+ return ExchangeContract.deployAsync(bytecode, abi, provider, txDefaults, );
+ }
+ public static async deployAsync(
+ bytecode: string,
+ abi: ContractAbi,
+ provider: Provider,
+ txDefaults: Partial<TxData>,
+ ): Promise<ExchangeContract> {
+ const constructorAbi = BaseContract._lookupConstructorAbi(abi);
+ [] = BaseContract._formatABIDataItemList(
+ constructorAbi.inputs,
+ [],
+ BaseContract._bigNumberToString,
+ );
+ const iface = new ethers.utils.Interface(abi);
+ const deployInfo = iface.deployFunction;
+ const txData = deployInfo.encode(bytecode, []);
+ const web3Wrapper = new Web3Wrapper(provider);
+ const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
+ {data: txData},
+ txDefaults,
+ web3Wrapper.estimateGasAsync.bind(web3Wrapper),
+ );
+ const txHash = await web3Wrapper.sendTransactionAsync(txDataWithDefaults);
+ logUtils.log(`transactionHash: ${txHash}`);
+ const txReceipt = await web3Wrapper.awaitTransactionSuccessAsync(txHash);
+ logUtils.log(`Exchange successfully deployed at ${txReceipt.contractAddress}`);
+ const contractInstance = new ExchangeContract(abi, txReceipt.contractAddress as string, provider, txDefaults);
+ contractInstance.constructorArgs = [];
+ return contractInstance;
+ }
+ constructor(abi: ContractAbi, address: string, provider: Provider, txDefaults?: Partial<TxData>) {
+ super('Exchange', abi, address, provider, txDefaults);
+ classUtils.bindAll(this, ['_ethersInterfacesByFunctionSignature', 'address', 'abi', '_web3Wrapper']);
+ }
+} // tslint:disable:max-file-line-count
+// tslint:enable:no-unbound-method
diff --git a/packages/abi-gen-wrappers/src/generated-wrappers/forwarder.ts b/packages/abi-gen-wrappers/src/generated-wrappers/forwarder.ts
new file mode 100644
index 000000000..afcf90234
--- /dev/null
+++ b/packages/abi-gen-wrappers/src/generated-wrappers/forwarder.ts
@@ -0,0 +1,730 @@
+// tslint:disable:no-consecutive-blank-lines ordered-imports align trailing-comma whitespace class-name
+// tslint:disable:no-unused-variable
+// tslint:disable:no-unbound-method
+import { BaseContract } from '@0xproject/base-contract';
+import { BlockParam, BlockParamLiteral, CallData, ContractAbi, ContractArtifact, DecodedLogArgs, MethodAbi, Provider, TxData, TxDataPayable } from 'ethereum-types';
+import { BigNumber, classUtils, logUtils } from '@0xproject/utils';
+import { Web3Wrapper } from '@0xproject/web3-wrapper';
+import * as ethers from 'ethers';
+import * as _ from 'lodash';
+// tslint:enable:no-unused-variable
+
+
+/* istanbul ignore next */
+// tslint:disable:no-parameter-reassignment
+// tslint:disable-next-line:class-name
+export class ForwarderContract extends BaseContract {
+ public marketBuyOrdersWithEth = {
+ async sendTransactionAsync(
+ orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>,
+ makerAssetFillAmount: BigNumber,
+ signatures: string[],
+ feeOrders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>,
+ feeSignatures: string[],
+ feePercentage: BigNumber,
+ feeRecipient: string,
+ txData: Partial<TxDataPayable> = {},
+ ): Promise<string> {
+ const self = this as any as ForwarderContract;
+ const inputAbi = self._lookupAbi('marketBuyOrdersWithEth(tuple[],uint256,bytes[],tuple[],bytes[],uint256,address)').inputs;
+ [orders,
+ makerAssetFillAmount,
+ signatures,
+ feeOrders,
+ feeSignatures,
+ feePercentage,
+ feeRecipient
+ ] = BaseContract._formatABIDataItemList(inputAbi, [orders,
+ makerAssetFillAmount,
+ signatures,
+ feeOrders,
+ feeSignatures,
+ feePercentage,
+ feeRecipient
+ ], BaseContract._bigNumberToString.bind(self));
+ BaseContract.strictArgumentEncodingCheck(inputAbi, [orders,
+ makerAssetFillAmount,
+ signatures,
+ feeOrders,
+ feeSignatures,
+ feePercentage,
+ feeRecipient
+ ]);
+ const encodedData = self._lookupEthersInterface('marketBuyOrdersWithEth(tuple[],uint256,bytes[],tuple[],bytes[],uint256,address)').functions.marketBuyOrdersWithEth.encode([orders,
+ makerAssetFillAmount,
+ signatures,
+ feeOrders,
+ feeSignatures,
+ feePercentage,
+ feeRecipient
+ ]);
+ const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
+ {
+ to: self.address,
+ ...txData,
+ data: encodedData,
+ },
+ self._web3Wrapper.getContractDefaults(),
+ self.marketBuyOrdersWithEth.estimateGasAsync.bind(
+ self,
+ orders,
+ makerAssetFillAmount,
+ signatures,
+ feeOrders,
+ feeSignatures,
+ feePercentage,
+ feeRecipient
+ ),
+ );
+ const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults);
+ return txHash;
+ },
+ async estimateGasAsync(
+ orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>,
+ makerAssetFillAmount: BigNumber,
+ signatures: string[],
+ feeOrders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>,
+ feeSignatures: string[],
+ feePercentage: BigNumber,
+ feeRecipient: string,
+ txData: Partial<TxData> = {},
+ ): Promise<number> {
+ const self = this as any as ForwarderContract;
+ const inputAbi = self._lookupAbi('marketBuyOrdersWithEth(tuple[],uint256,bytes[],tuple[],bytes[],uint256,address)').inputs;
+ [orders,
+ makerAssetFillAmount,
+ signatures,
+ feeOrders,
+ feeSignatures,
+ feePercentage,
+ feeRecipient
+ ] = BaseContract._formatABIDataItemList(inputAbi, [orders,
+ makerAssetFillAmount,
+ signatures,
+ feeOrders,
+ feeSignatures,
+ feePercentage,
+ feeRecipient
+ ], BaseContract._bigNumberToString);
+ const encodedData = self._lookupEthersInterface('marketBuyOrdersWithEth(tuple[],uint256,bytes[],tuple[],bytes[],uint256,address)').functions.marketBuyOrdersWithEth.encode([orders,
+ makerAssetFillAmount,
+ signatures,
+ feeOrders,
+ feeSignatures,
+ feePercentage,
+ feeRecipient
+ ]);
+ const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
+ {
+ to: self.address,
+ ...txData,
+ data: encodedData,
+ },
+ self._web3Wrapper.getContractDefaults(),
+ );
+ const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults);
+ return gas;
+ },
+ getABIEncodedTransactionData(
+ orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>,
+ makerAssetFillAmount: BigNumber,
+ signatures: string[],
+ feeOrders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>,
+ feeSignatures: string[],
+ feePercentage: BigNumber,
+ feeRecipient: string,
+ ): string {
+ const self = this as any as ForwarderContract;
+ const inputAbi = self._lookupAbi('marketBuyOrdersWithEth(tuple[],uint256,bytes[],tuple[],bytes[],uint256,address)').inputs;
+ [orders,
+ makerAssetFillAmount,
+ signatures,
+ feeOrders,
+ feeSignatures,
+ feePercentage,
+ feeRecipient
+ ] = BaseContract._formatABIDataItemList(inputAbi, [orders,
+ makerAssetFillAmount,
+ signatures,
+ feeOrders,
+ feeSignatures,
+ feePercentage,
+ feeRecipient
+ ], BaseContract._bigNumberToString);
+ const abiEncodedTransactionData = self._lookupEthersInterface('marketBuyOrdersWithEth(tuple[],uint256,bytes[],tuple[],bytes[],uint256,address)').functions.marketBuyOrdersWithEth.encode([orders,
+ makerAssetFillAmount,
+ signatures,
+ feeOrders,
+ feeSignatures,
+ feePercentage,
+ feeRecipient
+ ]);
+ return abiEncodedTransactionData;
+ },
+ async callAsync(
+ orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>,
+ makerAssetFillAmount: BigNumber,
+ signatures: string[],
+ feeOrders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>,
+ feeSignatures: string[],
+ feePercentage: BigNumber,
+ feeRecipient: string,
+ callData: Partial<CallData> = {},
+ defaultBlock?: BlockParam,
+ ): Promise<[{makerAssetFilledAmount: BigNumber;takerAssetFilledAmount: BigNumber;makerFeePaid: BigNumber;takerFeePaid: BigNumber}, {makerAssetFilledAmount: BigNumber;takerAssetFilledAmount: BigNumber;makerFeePaid: BigNumber;takerFeePaid: BigNumber}]
+ > {
+ const self = this as any as ForwarderContract;
+ const functionSignature = 'marketBuyOrdersWithEth(tuple[],uint256,bytes[],tuple[],bytes[],uint256,address)';
+ const inputAbi = self._lookupAbi(functionSignature).inputs;
+ [orders,
+ makerAssetFillAmount,
+ signatures,
+ feeOrders,
+ feeSignatures,
+ feePercentage,
+ feeRecipient
+ ] = BaseContract._formatABIDataItemList(inputAbi, [orders,
+ makerAssetFillAmount,
+ signatures,
+ feeOrders,
+ feeSignatures,
+ feePercentage,
+ feeRecipient
+ ], BaseContract._bigNumberToString.bind(self));
+ BaseContract.strictArgumentEncodingCheck(inputAbi, [orders,
+ makerAssetFillAmount,
+ signatures,
+ feeOrders,
+ feeSignatures,
+ feePercentage,
+ feeRecipient
+ ]);
+ const ethersFunction = self._lookupEthersInterface(functionSignature).functions.marketBuyOrdersWithEth;
+ const encodedData = ethersFunction.encode([orders,
+ makerAssetFillAmount,
+ signatures,
+ feeOrders,
+ feeSignatures,
+ feePercentage,
+ feeRecipient
+ ]);
+ const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
+ {
+ to: self.address,
+ ...callData,
+ data: encodedData,
+ },
+ self._web3Wrapper.getContractDefaults(),
+ );
+ const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
+ BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
+ let resultArray = ethersFunction.decode(rawCallResult);
+ const outputAbi = (_.find(self.abi, {name: 'marketBuyOrdersWithEth'}) as MethodAbi).outputs;
+ resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this));
+ resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this));
+ return resultArray;
+ },
+ };
+ public withdrawAsset = {
+ async sendTransactionAsync(
+ assetData: string,
+ amount: BigNumber,
+ txData: Partial<TxData> = {},
+ ): Promise<string> {
+ const self = this as any as ForwarderContract;
+ const inputAbi = self._lookupAbi('withdrawAsset(bytes,uint256)').inputs;
+ [assetData,
+ amount
+ ] = BaseContract._formatABIDataItemList(inputAbi, [assetData,
+ amount
+ ], BaseContract._bigNumberToString.bind(self));
+ BaseContract.strictArgumentEncodingCheck(inputAbi, [assetData,
+ amount
+ ]);
+ const encodedData = self._lookupEthersInterface('withdrawAsset(bytes,uint256)').functions.withdrawAsset.encode([assetData,
+ amount
+ ]);
+ const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
+ {
+ to: self.address,
+ ...txData,
+ data: encodedData,
+ },
+ self._web3Wrapper.getContractDefaults(),
+ self.withdrawAsset.estimateGasAsync.bind(
+ self,
+ assetData,
+ amount
+ ),
+ );
+ const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults);
+ return txHash;
+ },
+ async estimateGasAsync(
+ assetData: string,
+ amount: BigNumber,
+ txData: Partial<TxData> = {},
+ ): Promise<number> {
+ const self = this as any as ForwarderContract;
+ const inputAbi = self._lookupAbi('withdrawAsset(bytes,uint256)').inputs;
+ [assetData,
+ amount
+ ] = BaseContract._formatABIDataItemList(inputAbi, [assetData,
+ amount
+ ], BaseContract._bigNumberToString);
+ const encodedData = self._lookupEthersInterface('withdrawAsset(bytes,uint256)').functions.withdrawAsset.encode([assetData,
+ amount
+ ]);
+ const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
+ {
+ to: self.address,
+ ...txData,
+ data: encodedData,
+ },
+ self._web3Wrapper.getContractDefaults(),
+ );
+ const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults);
+ return gas;
+ },
+ getABIEncodedTransactionData(
+ assetData: string,
+ amount: BigNumber,
+ ): string {
+ const self = this as any as ForwarderContract;
+ const inputAbi = self._lookupAbi('withdrawAsset(bytes,uint256)').inputs;
+ [assetData,
+ amount
+ ] = BaseContract._formatABIDataItemList(inputAbi, [assetData,
+ amount
+ ], BaseContract._bigNumberToString);
+ const abiEncodedTransactionData = self._lookupEthersInterface('withdrawAsset(bytes,uint256)').functions.withdrawAsset.encode([assetData,
+ amount
+ ]);
+ return abiEncodedTransactionData;
+ },
+ async callAsync(
+ assetData: string,
+ amount: BigNumber,
+ callData: Partial<CallData> = {},
+ defaultBlock?: BlockParam,
+ ): Promise<void
+ > {
+ const self = this as any as ForwarderContract;
+ const functionSignature = 'withdrawAsset(bytes,uint256)';
+ const inputAbi = self._lookupAbi(functionSignature).inputs;
+ [assetData,
+ amount
+ ] = BaseContract._formatABIDataItemList(inputAbi, [assetData,
+ amount
+ ], BaseContract._bigNumberToString.bind(self));
+ BaseContract.strictArgumentEncodingCheck(inputAbi, [assetData,
+ amount
+ ]);
+ const ethersFunction = self._lookupEthersInterface(functionSignature).functions.withdrawAsset;
+ const encodedData = ethersFunction.encode([assetData,
+ amount
+ ]);
+ const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
+ {
+ to: self.address,
+ ...callData,
+ data: encodedData,
+ },
+ self._web3Wrapper.getContractDefaults(),
+ );
+ const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
+ BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
+ let resultArray = ethersFunction.decode(rawCallResult);
+ const outputAbi = (_.find(self.abi, {name: 'withdrawAsset'}) as MethodAbi).outputs;
+ resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this));
+ resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this));
+ return resultArray;
+ },
+ };
+ public owner = {
+ async callAsync(
+ callData: Partial<CallData> = {},
+ defaultBlock?: BlockParam,
+ ): Promise<string
+ > {
+ const self = this as any as ForwarderContract;
+ const functionSignature = 'owner()';
+ const inputAbi = self._lookupAbi(functionSignature).inputs;
+ [] = BaseContract._formatABIDataItemList(inputAbi, [], BaseContract._bigNumberToString.bind(self));
+ BaseContract.strictArgumentEncodingCheck(inputAbi, []);
+ const ethersFunction = self._lookupEthersInterface(functionSignature).functions.owner;
+ const encodedData = ethersFunction.encode([]);
+ const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
+ {
+ to: self.address,
+ ...callData,
+ data: encodedData,
+ },
+ self._web3Wrapper.getContractDefaults(),
+ );
+ const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
+ BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
+ let resultArray = ethersFunction.decode(rawCallResult);
+ const outputAbi = (_.find(self.abi, {name: 'owner'}) as MethodAbi).outputs;
+ resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this));
+ resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this));
+ return resultArray[0];
+ },
+ };
+ public marketSellOrdersWithEth = {
+ async sendTransactionAsync(
+ orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>,
+ signatures: string[],
+ feeOrders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>,
+ feeSignatures: string[],
+ feePercentage: BigNumber,
+ feeRecipient: string,
+ txData: Partial<TxDataPayable> = {},
+ ): Promise<string> {
+ const self = this as any as ForwarderContract;
+ const inputAbi = self._lookupAbi('marketSellOrdersWithEth(tuple[],bytes[],tuple[],bytes[],uint256,address)').inputs;
+ [orders,
+ signatures,
+ feeOrders,
+ feeSignatures,
+ feePercentage,
+ feeRecipient
+ ] = BaseContract._formatABIDataItemList(inputAbi, [orders,
+ signatures,
+ feeOrders,
+ feeSignatures,
+ feePercentage,
+ feeRecipient
+ ], BaseContract._bigNumberToString.bind(self));
+ BaseContract.strictArgumentEncodingCheck(inputAbi, [orders,
+ signatures,
+ feeOrders,
+ feeSignatures,
+ feePercentage,
+ feeRecipient
+ ]);
+ const encodedData = self._lookupEthersInterface('marketSellOrdersWithEth(tuple[],bytes[],tuple[],bytes[],uint256,address)').functions.marketSellOrdersWithEth.encode([orders,
+ signatures,
+ feeOrders,
+ feeSignatures,
+ feePercentage,
+ feeRecipient
+ ]);
+ const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
+ {
+ to: self.address,
+ ...txData,
+ data: encodedData,
+ },
+ self._web3Wrapper.getContractDefaults(),
+ self.marketSellOrdersWithEth.estimateGasAsync.bind(
+ self,
+ orders,
+ signatures,
+ feeOrders,
+ feeSignatures,
+ feePercentage,
+ feeRecipient
+ ),
+ );
+ const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults);
+ return txHash;
+ },
+ async estimateGasAsync(
+ orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>,
+ signatures: string[],
+ feeOrders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>,
+ feeSignatures: string[],
+ feePercentage: BigNumber,
+ feeRecipient: string,
+ txData: Partial<TxData> = {},
+ ): Promise<number> {
+ const self = this as any as ForwarderContract;
+ const inputAbi = self._lookupAbi('marketSellOrdersWithEth(tuple[],bytes[],tuple[],bytes[],uint256,address)').inputs;
+ [orders,
+ signatures,
+ feeOrders,
+ feeSignatures,
+ feePercentage,
+ feeRecipient
+ ] = BaseContract._formatABIDataItemList(inputAbi, [orders,
+ signatures,
+ feeOrders,
+ feeSignatures,
+ feePercentage,
+ feeRecipient
+ ], BaseContract._bigNumberToString);
+ const encodedData = self._lookupEthersInterface('marketSellOrdersWithEth(tuple[],bytes[],tuple[],bytes[],uint256,address)').functions.marketSellOrdersWithEth.encode([orders,
+ signatures,
+ feeOrders,
+ feeSignatures,
+ feePercentage,
+ feeRecipient
+ ]);
+ const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
+ {
+ to: self.address,
+ ...txData,
+ data: encodedData,
+ },
+ self._web3Wrapper.getContractDefaults(),
+ );
+ const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults);
+ return gas;
+ },
+ getABIEncodedTransactionData(
+ orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>,
+ signatures: string[],
+ feeOrders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>,
+ feeSignatures: string[],
+ feePercentage: BigNumber,
+ feeRecipient: string,
+ ): string {
+ const self = this as any as ForwarderContract;
+ const inputAbi = self._lookupAbi('marketSellOrdersWithEth(tuple[],bytes[],tuple[],bytes[],uint256,address)').inputs;
+ [orders,
+ signatures,
+ feeOrders,
+ feeSignatures,
+ feePercentage,
+ feeRecipient
+ ] = BaseContract._formatABIDataItemList(inputAbi, [orders,
+ signatures,
+ feeOrders,
+ feeSignatures,
+ feePercentage,
+ feeRecipient
+ ], BaseContract._bigNumberToString);
+ const abiEncodedTransactionData = self._lookupEthersInterface('marketSellOrdersWithEth(tuple[],bytes[],tuple[],bytes[],uint256,address)').functions.marketSellOrdersWithEth.encode([orders,
+ signatures,
+ feeOrders,
+ feeSignatures,
+ feePercentage,
+ feeRecipient
+ ]);
+ return abiEncodedTransactionData;
+ },
+ async callAsync(
+ orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>,
+ signatures: string[],
+ feeOrders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>,
+ feeSignatures: string[],
+ feePercentage: BigNumber,
+ feeRecipient: string,
+ callData: Partial<CallData> = {},
+ defaultBlock?: BlockParam,
+ ): Promise<[{makerAssetFilledAmount: BigNumber;takerAssetFilledAmount: BigNumber;makerFeePaid: BigNumber;takerFeePaid: BigNumber}, {makerAssetFilledAmount: BigNumber;takerAssetFilledAmount: BigNumber;makerFeePaid: BigNumber;takerFeePaid: BigNumber}]
+ > {
+ const self = this as any as ForwarderContract;
+ const functionSignature = 'marketSellOrdersWithEth(tuple[],bytes[],tuple[],bytes[],uint256,address)';
+ const inputAbi = self._lookupAbi(functionSignature).inputs;
+ [orders,
+ signatures,
+ feeOrders,
+ feeSignatures,
+ feePercentage,
+ feeRecipient
+ ] = BaseContract._formatABIDataItemList(inputAbi, [orders,
+ signatures,
+ feeOrders,
+ feeSignatures,
+ feePercentage,
+ feeRecipient
+ ], BaseContract._bigNumberToString.bind(self));
+ BaseContract.strictArgumentEncodingCheck(inputAbi, [orders,
+ signatures,
+ feeOrders,
+ feeSignatures,
+ feePercentage,
+ feeRecipient
+ ]);
+ const ethersFunction = self._lookupEthersInterface(functionSignature).functions.marketSellOrdersWithEth;
+ const encodedData = ethersFunction.encode([orders,
+ signatures,
+ feeOrders,
+ feeSignatures,
+ feePercentage,
+ feeRecipient
+ ]);
+ const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
+ {
+ to: self.address,
+ ...callData,
+ data: encodedData,
+ },
+ self._web3Wrapper.getContractDefaults(),
+ );
+ const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
+ BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
+ let resultArray = ethersFunction.decode(rawCallResult);
+ const outputAbi = (_.find(self.abi, {name: 'marketSellOrdersWithEth'}) as MethodAbi).outputs;
+ resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this));
+ resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this));
+ return resultArray;
+ },
+ };
+ public transferOwnership = {
+ async sendTransactionAsync(
+ newOwner: string,
+ txData: Partial<TxData> = {},
+ ): Promise<string> {
+ const self = this as any as ForwarderContract;
+ const inputAbi = self._lookupAbi('transferOwnership(address)').inputs;
+ [newOwner
+ ] = BaseContract._formatABIDataItemList(inputAbi, [newOwner
+ ], BaseContract._bigNumberToString.bind(self));
+ BaseContract.strictArgumentEncodingCheck(inputAbi, [newOwner
+ ]);
+ const encodedData = self._lookupEthersInterface('transferOwnership(address)').functions.transferOwnership.encode([newOwner
+ ]);
+ const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
+ {
+ to: self.address,
+ ...txData,
+ data: encodedData,
+ },
+ self._web3Wrapper.getContractDefaults(),
+ self.transferOwnership.estimateGasAsync.bind(
+ self,
+ newOwner
+ ),
+ );
+ const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults);
+ return txHash;
+ },
+ async estimateGasAsync(
+ newOwner: string,
+ txData: Partial<TxData> = {},
+ ): Promise<number> {
+ const self = this as any as ForwarderContract;
+ const inputAbi = self._lookupAbi('transferOwnership(address)').inputs;
+ [newOwner
+ ] = BaseContract._formatABIDataItemList(inputAbi, [newOwner
+ ], BaseContract._bigNumberToString);
+ const encodedData = self._lookupEthersInterface('transferOwnership(address)').functions.transferOwnership.encode([newOwner
+ ]);
+ const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
+ {
+ to: self.address,
+ ...txData,
+ data: encodedData,
+ },
+ self._web3Wrapper.getContractDefaults(),
+ );
+ const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults);
+ return gas;
+ },
+ getABIEncodedTransactionData(
+ newOwner: string,
+ ): string {
+ const self = this as any as ForwarderContract;
+ const inputAbi = self._lookupAbi('transferOwnership(address)').inputs;
+ [newOwner
+ ] = BaseContract._formatABIDataItemList(inputAbi, [newOwner
+ ], BaseContract._bigNumberToString);
+ const abiEncodedTransactionData = self._lookupEthersInterface('transferOwnership(address)').functions.transferOwnership.encode([newOwner
+ ]);
+ return abiEncodedTransactionData;
+ },
+ async callAsync(
+ newOwner: string,
+ callData: Partial<CallData> = {},
+ defaultBlock?: BlockParam,
+ ): Promise<void
+ > {
+ const self = this as any as ForwarderContract;
+ const functionSignature = 'transferOwnership(address)';
+ const inputAbi = self._lookupAbi(functionSignature).inputs;
+ [newOwner
+ ] = BaseContract._formatABIDataItemList(inputAbi, [newOwner
+ ], BaseContract._bigNumberToString.bind(self));
+ BaseContract.strictArgumentEncodingCheck(inputAbi, [newOwner
+ ]);
+ const ethersFunction = self._lookupEthersInterface(functionSignature).functions.transferOwnership;
+ const encodedData = ethersFunction.encode([newOwner
+ ]);
+ const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
+ {
+ to: self.address,
+ ...callData,
+ data: encodedData,
+ },
+ self._web3Wrapper.getContractDefaults(),
+ );
+ const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
+ BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
+ let resultArray = ethersFunction.decode(rawCallResult);
+ const outputAbi = (_.find(self.abi, {name: 'transferOwnership'}) as MethodAbi).outputs;
+ resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this));
+ resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this));
+ return resultArray;
+ },
+ };
+ public static async deployFrom0xArtifactAsync(
+ artifact: ContractArtifact,
+ provider: Provider,
+ txDefaults: Partial<TxData>,
+ _exchange: string,
+ _zrxAssetData: string,
+ _wethAssetData: string,
+ ): Promise<ForwarderContract> {
+ if (_.isUndefined(artifact.compilerOutput)) {
+ throw new Error('Compiler output not found in the artifact file');
+ }
+ const bytecode = artifact.compilerOutput.evm.bytecode.object;
+ const abi = artifact.compilerOutput.abi;
+ return ForwarderContract.deployAsync(bytecode, abi, provider, txDefaults, _exchange,
+_zrxAssetData,
+_wethAssetData
+);
+ }
+ public static async deployAsync(
+ bytecode: string,
+ abi: ContractAbi,
+ provider: Provider,
+ txDefaults: Partial<TxData>,
+ _exchange: string,
+ _zrxAssetData: string,
+ _wethAssetData: string,
+ ): Promise<ForwarderContract> {
+ const constructorAbi = BaseContract._lookupConstructorAbi(abi);
+ [_exchange,
+_zrxAssetData,
+_wethAssetData
+] = BaseContract._formatABIDataItemList(
+ constructorAbi.inputs,
+ [_exchange,
+_zrxAssetData,
+_wethAssetData
+],
+ BaseContract._bigNumberToString,
+ );
+ const iface = new ethers.utils.Interface(abi);
+ const deployInfo = iface.deployFunction;
+ const txData = deployInfo.encode(bytecode, [_exchange,
+_zrxAssetData,
+_wethAssetData
+]);
+ const web3Wrapper = new Web3Wrapper(provider);
+ const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
+ {data: txData},
+ txDefaults,
+ web3Wrapper.estimateGasAsync.bind(web3Wrapper),
+ );
+ const txHash = await web3Wrapper.sendTransactionAsync(txDataWithDefaults);
+ logUtils.log(`transactionHash: ${txHash}`);
+ const txReceipt = await web3Wrapper.awaitTransactionSuccessAsync(txHash);
+ logUtils.log(`Forwarder successfully deployed at ${txReceipt.contractAddress}`);
+ const contractInstance = new ForwarderContract(abi, txReceipt.contractAddress as string, provider, txDefaults);
+ contractInstance.constructorArgs = [_exchange,
+_zrxAssetData,
+_wethAssetData
+];
+ return contractInstance;
+ }
+ constructor(abi: ContractAbi, address: string, provider: Provider, txDefaults?: Partial<TxData>) {
+ super('Forwarder', abi, address, provider, txDefaults);
+ classUtils.bindAll(this, ['_ethersInterfacesByFunctionSignature', 'address', 'abi', '_web3Wrapper']);
+ }
+} // tslint:disable:max-file-line-count
+// tslint:enable:no-unbound-method
diff --git a/packages/abi-gen-wrappers/src/generated-wrappers/i_validator.ts b/packages/abi-gen-wrappers/src/generated-wrappers/i_validator.ts
new file mode 100644
index 000000000..ff5160680
--- /dev/null
+++ b/packages/abi-gen-wrappers/src/generated-wrappers/i_validator.ts
@@ -0,0 +1,108 @@
+// tslint:disable:no-consecutive-blank-lines ordered-imports align trailing-comma whitespace class-name
+// tslint:disable:no-unused-variable
+// tslint:disable:no-unbound-method
+import { BaseContract } from '@0xproject/base-contract';
+import { BlockParam, BlockParamLiteral, CallData, ContractAbi, ContractArtifact, DecodedLogArgs, MethodAbi, Provider, TxData, TxDataPayable } from 'ethereum-types';
+import { BigNumber, classUtils, logUtils } from '@0xproject/utils';
+import { Web3Wrapper } from '@0xproject/web3-wrapper';
+import * as ethers from 'ethers';
+import * as _ from 'lodash';
+// tslint:enable:no-unused-variable
+
+
+/* istanbul ignore next */
+// tslint:disable:no-parameter-reassignment
+// tslint:disable-next-line:class-name
+export class IValidatorContract extends BaseContract {
+ public isValidSignature = {
+ async callAsync(
+ hash: string,
+ signerAddress: string,
+ signature: string,
+ callData: Partial<CallData> = {},
+ defaultBlock?: BlockParam,
+ ): Promise<boolean
+ > {
+ const self = this as any as IValidatorContract;
+ const functionSignature = 'isValidSignature(bytes32,address,bytes)';
+ const inputAbi = self._lookupAbi(functionSignature).inputs;
+ [hash,
+ signerAddress,
+ signature
+ ] = BaseContract._formatABIDataItemList(inputAbi, [hash,
+ signerAddress,
+ signature
+ ], BaseContract._bigNumberToString.bind(self));
+ BaseContract.strictArgumentEncodingCheck(inputAbi, [hash,
+ signerAddress,
+ signature
+ ]);
+ const ethersFunction = self._lookupEthersInterface(functionSignature).functions.isValidSignature;
+ const encodedData = ethersFunction.encode([hash,
+ signerAddress,
+ signature
+ ]);
+ const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
+ {
+ to: self.address,
+ ...callData,
+ data: encodedData,
+ },
+ self._web3Wrapper.getContractDefaults(),
+ );
+ const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
+ BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
+ let resultArray = ethersFunction.decode(rawCallResult);
+ const outputAbi = (_.find(self.abi, {name: 'isValidSignature'}) as MethodAbi).outputs;
+ resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this));
+ resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this));
+ return resultArray[0];
+ },
+ };
+ public static async deployFrom0xArtifactAsync(
+ artifact: ContractArtifact,
+ provider: Provider,
+ txDefaults: Partial<TxData>,
+ ): Promise<IValidatorContract> {
+ if (_.isUndefined(artifact.compilerOutput)) {
+ throw new Error('Compiler output not found in the artifact file');
+ }
+ const bytecode = artifact.compilerOutput.evm.bytecode.object;
+ const abi = artifact.compilerOutput.abi;
+ return IValidatorContract.deployAsync(bytecode, abi, provider, txDefaults, );
+ }
+ public static async deployAsync(
+ bytecode: string,
+ abi: ContractAbi,
+ provider: Provider,
+ txDefaults: Partial<TxData>,
+ ): Promise<IValidatorContract> {
+ const constructorAbi = BaseContract._lookupConstructorAbi(abi);
+ [] = BaseContract._formatABIDataItemList(
+ constructorAbi.inputs,
+ [],
+ BaseContract._bigNumberToString,
+ );
+ const iface = new ethers.utils.Interface(abi);
+ const deployInfo = iface.deployFunction;
+ const txData = deployInfo.encode(bytecode, []);
+ const web3Wrapper = new Web3Wrapper(provider);
+ const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
+ {data: txData},
+ txDefaults,
+ web3Wrapper.estimateGasAsync.bind(web3Wrapper),
+ );
+ const txHash = await web3Wrapper.sendTransactionAsync(txDataWithDefaults);
+ logUtils.log(`transactionHash: ${txHash}`);
+ const txReceipt = await web3Wrapper.awaitTransactionSuccessAsync(txHash);
+ logUtils.log(`IValidator successfully deployed at ${txReceipt.contractAddress}`);
+ const contractInstance = new IValidatorContract(abi, txReceipt.contractAddress as string, provider, txDefaults);
+ contractInstance.constructorArgs = [];
+ return contractInstance;
+ }
+ constructor(abi: ContractAbi, address: string, provider: Provider, txDefaults?: Partial<TxData>) {
+ super('IValidator', abi, address, provider, txDefaults);
+ classUtils.bindAll(this, ['_ethersInterfacesByFunctionSignature', 'address', 'abi', '_web3Wrapper']);
+ }
+} // tslint:disable:max-file-line-count
+// tslint:enable:no-unbound-method
diff --git a/packages/abi-gen-wrappers/src/generated-wrappers/i_wallet.ts b/packages/abi-gen-wrappers/src/generated-wrappers/i_wallet.ts
new file mode 100644
index 000000000..a9a56ad14
--- /dev/null
+++ b/packages/abi-gen-wrappers/src/generated-wrappers/i_wallet.ts
@@ -0,0 +1,103 @@
+// tslint:disable:no-consecutive-blank-lines ordered-imports align trailing-comma whitespace class-name
+// tslint:disable:no-unused-variable
+// tslint:disable:no-unbound-method
+import { BaseContract } from '@0xproject/base-contract';
+import { BlockParam, BlockParamLiteral, CallData, ContractAbi, ContractArtifact, DecodedLogArgs, MethodAbi, Provider, TxData, TxDataPayable } from 'ethereum-types';
+import { BigNumber, classUtils, logUtils } from '@0xproject/utils';
+import { Web3Wrapper } from '@0xproject/web3-wrapper';
+import * as ethers from 'ethers';
+import * as _ from 'lodash';
+// tslint:enable:no-unused-variable
+
+
+/* istanbul ignore next */
+// tslint:disable:no-parameter-reassignment
+// tslint:disable-next-line:class-name
+export class IWalletContract extends BaseContract {
+ public isValidSignature = {
+ async callAsync(
+ hash: string,
+ signature: string,
+ callData: Partial<CallData> = {},
+ defaultBlock?: BlockParam,
+ ): Promise<boolean
+ > {
+ const self = this as any as IWalletContract;
+ const functionSignature = 'isValidSignature(bytes32,bytes)';
+ const inputAbi = self._lookupAbi(functionSignature).inputs;
+ [hash,
+ signature
+ ] = BaseContract._formatABIDataItemList(inputAbi, [hash,
+ signature
+ ], BaseContract._bigNumberToString.bind(self));
+ BaseContract.strictArgumentEncodingCheck(inputAbi, [hash,
+ signature
+ ]);
+ const ethersFunction = self._lookupEthersInterface(functionSignature).functions.isValidSignature;
+ const encodedData = ethersFunction.encode([hash,
+ signature
+ ]);
+ const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
+ {
+ to: self.address,
+ ...callData,
+ data: encodedData,
+ },
+ self._web3Wrapper.getContractDefaults(),
+ );
+ const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
+ BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
+ let resultArray = ethersFunction.decode(rawCallResult);
+ const outputAbi = (_.find(self.abi, {name: 'isValidSignature'}) as MethodAbi).outputs;
+ resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this));
+ resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this));
+ return resultArray[0];
+ },
+ };
+ public static async deployFrom0xArtifactAsync(
+ artifact: ContractArtifact,
+ provider: Provider,
+ txDefaults: Partial<TxData>,
+ ): Promise<IWalletContract> {
+ if (_.isUndefined(artifact.compilerOutput)) {
+ throw new Error('Compiler output not found in the artifact file');
+ }
+ const bytecode = artifact.compilerOutput.evm.bytecode.object;
+ const abi = artifact.compilerOutput.abi;
+ return IWalletContract.deployAsync(bytecode, abi, provider, txDefaults, );
+ }
+ public static async deployAsync(
+ bytecode: string,
+ abi: ContractAbi,
+ provider: Provider,
+ txDefaults: Partial<TxData>,
+ ): Promise<IWalletContract> {
+ const constructorAbi = BaseContract._lookupConstructorAbi(abi);
+ [] = BaseContract._formatABIDataItemList(
+ constructorAbi.inputs,
+ [],
+ BaseContract._bigNumberToString,
+ );
+ const iface = new ethers.utils.Interface(abi);
+ const deployInfo = iface.deployFunction;
+ const txData = deployInfo.encode(bytecode, []);
+ const web3Wrapper = new Web3Wrapper(provider);
+ const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
+ {data: txData},
+ txDefaults,
+ web3Wrapper.estimateGasAsync.bind(web3Wrapper),
+ );
+ const txHash = await web3Wrapper.sendTransactionAsync(txDataWithDefaults);
+ logUtils.log(`transactionHash: ${txHash}`);
+ const txReceipt = await web3Wrapper.awaitTransactionSuccessAsync(txHash);
+ logUtils.log(`IWallet successfully deployed at ${txReceipt.contractAddress}`);
+ const contractInstance = new IWalletContract(abi, txReceipt.contractAddress as string, provider, txDefaults);
+ contractInstance.constructorArgs = [];
+ return contractInstance;
+ }
+ constructor(abi: ContractAbi, address: string, provider: Provider, txDefaults?: Partial<TxData>) {
+ super('IWallet', abi, address, provider, txDefaults);
+ classUtils.bindAll(this, ['_ethersInterfacesByFunctionSignature', 'address', 'abi', '_web3Wrapper']);
+ }
+} // tslint:disable:max-file-line-count
+// tslint:enable:no-unbound-method
diff --git a/packages/abi-gen-wrappers/src/generated-wrappers/order_validator.ts b/packages/abi-gen-wrappers/src/generated-wrappers/order_validator.ts
new file mode 100644
index 000000000..6be61656b
--- /dev/null
+++ b/packages/abi-gen-wrappers/src/generated-wrappers/order_validator.ts
@@ -0,0 +1,357 @@
+// tslint:disable:no-consecutive-blank-lines ordered-imports align trailing-comma whitespace class-name
+// tslint:disable:no-unused-variable
+// tslint:disable:no-unbound-method
+import { BaseContract } from '@0xproject/base-contract';
+import { BlockParam, BlockParamLiteral, CallData, ContractAbi, ContractArtifact, DecodedLogArgs, MethodAbi, Provider, TxData, TxDataPayable } from 'ethereum-types';
+import { BigNumber, classUtils, logUtils } from '@0xproject/utils';
+import { Web3Wrapper } from '@0xproject/web3-wrapper';
+import * as ethers from 'ethers';
+import * as _ from 'lodash';
+// tslint:enable:no-unused-variable
+
+
+/* istanbul ignore next */
+// tslint:disable:no-parameter-reassignment
+// tslint:disable-next-line:class-name
+export class OrderValidatorContract extends BaseContract {
+ public getOrderAndTraderInfo = {
+ async callAsync(
+ order: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string},
+ takerAddress: string,
+ callData: Partial<CallData> = {},
+ defaultBlock?: BlockParam,
+ ): Promise<[{orderStatus: number;orderHash: string;orderTakerAssetFilledAmount: BigNumber}, {makerBalance: BigNumber;makerAllowance: BigNumber;takerBalance: BigNumber;takerAllowance: BigNumber;makerZrxBalance: BigNumber;makerZrxAllowance: BigNumber;takerZrxBalance: BigNumber;takerZrxAllowance: BigNumber}]
+ > {
+ const self = this as any as OrderValidatorContract;
+ const functionSignature = 'getOrderAndTraderInfo({address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes},address)';
+ const inputAbi = self._lookupAbi(functionSignature).inputs;
+ [order,
+ takerAddress
+ ] = BaseContract._formatABIDataItemList(inputAbi, [order,
+ takerAddress
+ ], BaseContract._bigNumberToString.bind(self));
+ BaseContract.strictArgumentEncodingCheck(inputAbi, [order,
+ takerAddress
+ ]);
+ const ethersFunction = self._lookupEthersInterface(functionSignature).functions.getOrderAndTraderInfo;
+ const encodedData = ethersFunction.encode([order,
+ takerAddress
+ ]);
+ const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
+ {
+ to: self.address,
+ ...callData,
+ data: encodedData,
+ },
+ self._web3Wrapper.getContractDefaults(),
+ );
+ const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
+ BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
+ let resultArray = ethersFunction.decode(rawCallResult);
+ const outputAbi = (_.find(self.abi, {name: 'getOrderAndTraderInfo'}) as MethodAbi).outputs;
+ resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this));
+ resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this));
+ return resultArray;
+ },
+ };
+ public getBalanceAndAllowance = {
+ async callAsync(
+ target: string,
+ assetData: string,
+ callData: Partial<CallData> = {},
+ defaultBlock?: BlockParam,
+ ): Promise<[BigNumber, BigNumber]
+ > {
+ const self = this as any as OrderValidatorContract;
+ const functionSignature = 'getBalanceAndAllowance(address,bytes)';
+ const inputAbi = self._lookupAbi(functionSignature).inputs;
+ [target,
+ assetData
+ ] = BaseContract._formatABIDataItemList(inputAbi, [target,
+ assetData
+ ], BaseContract._bigNumberToString.bind(self));
+ BaseContract.strictArgumentEncodingCheck(inputAbi, [target,
+ assetData
+ ]);
+ const ethersFunction = self._lookupEthersInterface(functionSignature).functions.getBalanceAndAllowance;
+ const encodedData = ethersFunction.encode([target,
+ assetData
+ ]);
+ const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
+ {
+ to: self.address,
+ ...callData,
+ data: encodedData,
+ },
+ self._web3Wrapper.getContractDefaults(),
+ );
+ const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
+ BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
+ let resultArray = ethersFunction.decode(rawCallResult);
+ const outputAbi = (_.find(self.abi, {name: 'getBalanceAndAllowance'}) as MethodAbi).outputs;
+ resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this));
+ resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this));
+ return resultArray;
+ },
+ };
+ public getOrdersAndTradersInfo = {
+ async callAsync(
+ orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>,
+ takerAddresses: string[],
+ callData: Partial<CallData> = {},
+ defaultBlock?: BlockParam,
+ ): Promise<[Array<{orderStatus: number;orderHash: string;orderTakerAssetFilledAmount: BigNumber}>, Array<{makerBalance: BigNumber;makerAllowance: BigNumber;takerBalance: BigNumber;takerAllowance: BigNumber;makerZrxBalance: BigNumber;makerZrxAllowance: BigNumber;takerZrxBalance: BigNumber;takerZrxAllowance: BigNumber}>]
+ > {
+ const self = this as any as OrderValidatorContract;
+ const functionSignature = 'getOrdersAndTradersInfo(tuple[],address[])';
+ const inputAbi = self._lookupAbi(functionSignature).inputs;
+ [orders,
+ takerAddresses
+ ] = BaseContract._formatABIDataItemList(inputAbi, [orders,
+ takerAddresses
+ ], BaseContract._bigNumberToString.bind(self));
+ BaseContract.strictArgumentEncodingCheck(inputAbi, [orders,
+ takerAddresses
+ ]);
+ const ethersFunction = self._lookupEthersInterface(functionSignature).functions.getOrdersAndTradersInfo;
+ const encodedData = ethersFunction.encode([orders,
+ takerAddresses
+ ]);
+ const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
+ {
+ to: self.address,
+ ...callData,
+ data: encodedData,
+ },
+ self._web3Wrapper.getContractDefaults(),
+ );
+ const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
+ BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
+ let resultArray = ethersFunction.decode(rawCallResult);
+ const outputAbi = (_.find(self.abi, {name: 'getOrdersAndTradersInfo'}) as MethodAbi).outputs;
+ resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this));
+ resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this));
+ return resultArray;
+ },
+ };
+ public getTradersInfo = {
+ async callAsync(
+ orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>,
+ takerAddresses: string[],
+ callData: Partial<CallData> = {},
+ defaultBlock?: BlockParam,
+ ): Promise<Array<{makerBalance: BigNumber;makerAllowance: BigNumber;takerBalance: BigNumber;takerAllowance: BigNumber;makerZrxBalance: BigNumber;makerZrxAllowance: BigNumber;takerZrxBalance: BigNumber;takerZrxAllowance: BigNumber}>
+ > {
+ const self = this as any as OrderValidatorContract;
+ const functionSignature = 'getTradersInfo(tuple[],address[])';
+ const inputAbi = self._lookupAbi(functionSignature).inputs;
+ [orders,
+ takerAddresses
+ ] = BaseContract._formatABIDataItemList(inputAbi, [orders,
+ takerAddresses
+ ], BaseContract._bigNumberToString.bind(self));
+ BaseContract.strictArgumentEncodingCheck(inputAbi, [orders,
+ takerAddresses
+ ]);
+ const ethersFunction = self._lookupEthersInterface(functionSignature).functions.getTradersInfo;
+ const encodedData = ethersFunction.encode([orders,
+ takerAddresses
+ ]);
+ const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
+ {
+ to: self.address,
+ ...callData,
+ data: encodedData,
+ },
+ self._web3Wrapper.getContractDefaults(),
+ );
+ const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
+ BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
+ let resultArray = ethersFunction.decode(rawCallResult);
+ const outputAbi = (_.find(self.abi, {name: 'getTradersInfo'}) as MethodAbi).outputs;
+ resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this));
+ resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this));
+ return resultArray[0];
+ },
+ };
+ public getERC721TokenOwner = {
+ async callAsync(
+ token: string,
+ tokenId: BigNumber,
+ callData: Partial<CallData> = {},
+ defaultBlock?: BlockParam,
+ ): Promise<string
+ > {
+ const self = this as any as OrderValidatorContract;
+ const functionSignature = 'getERC721TokenOwner(address,uint256)';
+ const inputAbi = self._lookupAbi(functionSignature).inputs;
+ [token,
+ tokenId
+ ] = BaseContract._formatABIDataItemList(inputAbi, [token,
+ tokenId
+ ], BaseContract._bigNumberToString.bind(self));
+ BaseContract.strictArgumentEncodingCheck(inputAbi, [token,
+ tokenId
+ ]);
+ const ethersFunction = self._lookupEthersInterface(functionSignature).functions.getERC721TokenOwner;
+ const encodedData = ethersFunction.encode([token,
+ tokenId
+ ]);
+ const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
+ {
+ to: self.address,
+ ...callData,
+ data: encodedData,
+ },
+ self._web3Wrapper.getContractDefaults(),
+ );
+ const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
+ BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
+ let resultArray = ethersFunction.decode(rawCallResult);
+ const outputAbi = (_.find(self.abi, {name: 'getERC721TokenOwner'}) as MethodAbi).outputs;
+ resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this));
+ resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this));
+ return resultArray[0];
+ },
+ };
+ public getBalancesAndAllowances = {
+ async callAsync(
+ target: string,
+ assetData: string[],
+ callData: Partial<CallData> = {},
+ defaultBlock?: BlockParam,
+ ): Promise<[BigNumber[], BigNumber[]]
+ > {
+ const self = this as any as OrderValidatorContract;
+ const functionSignature = 'getBalancesAndAllowances(address,bytes[])';
+ const inputAbi = self._lookupAbi(functionSignature).inputs;
+ [target,
+ assetData
+ ] = BaseContract._formatABIDataItemList(inputAbi, [target,
+ assetData
+ ], BaseContract._bigNumberToString.bind(self));
+ BaseContract.strictArgumentEncodingCheck(inputAbi, [target,
+ assetData
+ ]);
+ const ethersFunction = self._lookupEthersInterface(functionSignature).functions.getBalancesAndAllowances;
+ const encodedData = ethersFunction.encode([target,
+ assetData
+ ]);
+ const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
+ {
+ to: self.address,
+ ...callData,
+ data: encodedData,
+ },
+ self._web3Wrapper.getContractDefaults(),
+ );
+ const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
+ BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
+ let resultArray = ethersFunction.decode(rawCallResult);
+ const outputAbi = (_.find(self.abi, {name: 'getBalancesAndAllowances'}) as MethodAbi).outputs;
+ resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this));
+ resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this));
+ return resultArray;
+ },
+ };
+ public getTraderInfo = {
+ async callAsync(
+ order: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string},
+ takerAddress: string,
+ callData: Partial<CallData> = {},
+ defaultBlock?: BlockParam,
+ ): Promise<{makerBalance: BigNumber;makerAllowance: BigNumber;takerBalance: BigNumber;takerAllowance: BigNumber;makerZrxBalance: BigNumber;makerZrxAllowance: BigNumber;takerZrxBalance: BigNumber;takerZrxAllowance: BigNumber}
+ > {
+ const self = this as any as OrderValidatorContract;
+ const functionSignature = 'getTraderInfo({address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes},address)';
+ const inputAbi = self._lookupAbi(functionSignature).inputs;
+ [order,
+ takerAddress
+ ] = BaseContract._formatABIDataItemList(inputAbi, [order,
+ takerAddress
+ ], BaseContract._bigNumberToString.bind(self));
+ BaseContract.strictArgumentEncodingCheck(inputAbi, [order,
+ takerAddress
+ ]);
+ const ethersFunction = self._lookupEthersInterface(functionSignature).functions.getTraderInfo;
+ const encodedData = ethersFunction.encode([order,
+ takerAddress
+ ]);
+ const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
+ {
+ to: self.address,
+ ...callData,
+ data: encodedData,
+ },
+ self._web3Wrapper.getContractDefaults(),
+ );
+ const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
+ BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
+ let resultArray = ethersFunction.decode(rawCallResult);
+ const outputAbi = (_.find(self.abi, {name: 'getTraderInfo'}) as MethodAbi).outputs;
+ resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this));
+ resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this));
+ return resultArray[0];
+ },
+ };
+ public static async deployFrom0xArtifactAsync(
+ artifact: ContractArtifact,
+ provider: Provider,
+ txDefaults: Partial<TxData>,
+ _exchange: string,
+ _zrxAssetData: string,
+ ): Promise<OrderValidatorContract> {
+ if (_.isUndefined(artifact.compilerOutput)) {
+ throw new Error('Compiler output not found in the artifact file');
+ }
+ const bytecode = artifact.compilerOutput.evm.bytecode.object;
+ const abi = artifact.compilerOutput.abi;
+ return OrderValidatorContract.deployAsync(bytecode, abi, provider, txDefaults, _exchange,
+_zrxAssetData
+);
+ }
+ public static async deployAsync(
+ bytecode: string,
+ abi: ContractAbi,
+ provider: Provider,
+ txDefaults: Partial<TxData>,
+ _exchange: string,
+ _zrxAssetData: string,
+ ): Promise<OrderValidatorContract> {
+ const constructorAbi = BaseContract._lookupConstructorAbi(abi);
+ [_exchange,
+_zrxAssetData
+] = BaseContract._formatABIDataItemList(
+ constructorAbi.inputs,
+ [_exchange,
+_zrxAssetData
+],
+ BaseContract._bigNumberToString,
+ );
+ const iface = new ethers.utils.Interface(abi);
+ const deployInfo = iface.deployFunction;
+ const txData = deployInfo.encode(bytecode, [_exchange,
+_zrxAssetData
+]);
+ const web3Wrapper = new Web3Wrapper(provider);
+ const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
+ {data: txData},
+ txDefaults,
+ web3Wrapper.estimateGasAsync.bind(web3Wrapper),
+ );
+ const txHash = await web3Wrapper.sendTransactionAsync(txDataWithDefaults);
+ logUtils.log(`transactionHash: ${txHash}`);
+ const txReceipt = await web3Wrapper.awaitTransactionSuccessAsync(txHash);
+ logUtils.log(`OrderValidator successfully deployed at ${txReceipt.contractAddress}`);
+ const contractInstance = new OrderValidatorContract(abi, txReceipt.contractAddress as string, provider, txDefaults);
+ contractInstance.constructorArgs = [_exchange,
+_zrxAssetData
+];
+ return contractInstance;
+ }
+ constructor(abi: ContractAbi, address: string, provider: Provider, txDefaults?: Partial<TxData>) {
+ super('OrderValidator', abi, address, provider, txDefaults);
+ classUtils.bindAll(this, ['_ethersInterfacesByFunctionSignature', 'address', 'abi', '_web3Wrapper']);
+ }
+} // tslint:disable:max-file-line-count
+// tslint:enable:no-unbound-method
diff --git a/packages/abi-gen-wrappers/src/generated-wrappers/weth9.ts b/packages/abi-gen-wrappers/src/generated-wrappers/weth9.ts
new file mode 100644
index 000000000..b65cf9e9e
--- /dev/null
+++ b/packages/abi-gen-wrappers/src/generated-wrappers/weth9.ts
@@ -0,0 +1,835 @@
+// tslint:disable:no-consecutive-blank-lines ordered-imports align trailing-comma whitespace class-name
+// tslint:disable:no-unused-variable
+// tslint:disable:no-unbound-method
+import { BaseContract } from '@0xproject/base-contract';
+import { BlockParam, BlockParamLiteral, CallData, ContractAbi, ContractArtifact, DecodedLogArgs, MethodAbi, Provider, TxData, TxDataPayable } from 'ethereum-types';
+import { BigNumber, classUtils, logUtils } from '@0xproject/utils';
+import { Web3Wrapper } from '@0xproject/web3-wrapper';
+import * as ethers from 'ethers';
+import * as _ from 'lodash';
+// tslint:enable:no-unused-variable
+
+export type WETH9EventArgs =
+ | WETH9ApprovalEventArgs
+ | WETH9TransferEventArgs
+ | WETH9DepositEventArgs
+ | WETH9WithdrawalEventArgs;
+
+export enum WETH9Events {
+ Approval = 'Approval',
+ Transfer = 'Transfer',
+ Deposit = 'Deposit',
+ Withdrawal = 'Withdrawal',
+}
+
+export interface WETH9ApprovalEventArgs extends DecodedLogArgs {
+ _owner: string;
+ _spender: string;
+ _value: BigNumber;
+}
+
+export interface WETH9TransferEventArgs extends DecodedLogArgs {
+ _from: string;
+ _to: string;
+ _value: BigNumber;
+}
+
+export interface WETH9DepositEventArgs extends DecodedLogArgs {
+ _owner: string;
+ _value: BigNumber;
+}
+
+export interface WETH9WithdrawalEventArgs extends DecodedLogArgs {
+ _owner: string;
+ _value: BigNumber;
+}
+
+
+/* istanbul ignore next */
+// tslint:disable:no-parameter-reassignment
+// tslint:disable-next-line:class-name
+export class WETH9Contract extends BaseContract {
+ public name = {
+ async callAsync(
+ callData: Partial<CallData> = {},
+ defaultBlock?: BlockParam,
+ ): Promise<string
+ > {
+ const self = this as any as WETH9Contract;
+ const functionSignature = 'name()';
+ const inputAbi = self._lookupAbi(functionSignature).inputs;
+ [] = BaseContract._formatABIDataItemList(inputAbi, [], BaseContract._bigNumberToString.bind(self));
+ BaseContract.strictArgumentEncodingCheck(inputAbi, []);
+ const ethersFunction = self._lookupEthersInterface(functionSignature).functions.name;
+ const encodedData = ethersFunction.encode([]);
+ const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
+ {
+ to: self.address,
+ ...callData,
+ data: encodedData,
+ },
+ self._web3Wrapper.getContractDefaults(),
+ );
+ const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
+ BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
+ let resultArray = ethersFunction.decode(rawCallResult);
+ const outputAbi = (_.find(self.abi, {name: 'name'}) as MethodAbi).outputs;
+ resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this));
+ resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this));
+ return resultArray[0];
+ },
+ };
+ public approve = {
+ async sendTransactionAsync(
+ guy: string,
+ wad: BigNumber,
+ txData: Partial<TxData> = {},
+ ): Promise<string> {
+ const self = this as any as WETH9Contract;
+ const inputAbi = self._lookupAbi('approve(address,uint256)').inputs;
+ [guy,
+ wad
+ ] = BaseContract._formatABIDataItemList(inputAbi, [guy,
+ wad
+ ], BaseContract._bigNumberToString.bind(self));
+ BaseContract.strictArgumentEncodingCheck(inputAbi, [guy,
+ wad
+ ]);
+ const encodedData = self._lookupEthersInterface('approve(address,uint256)').functions.approve.encode([guy,
+ wad
+ ]);
+ const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
+ {
+ to: self.address,
+ ...txData,
+ data: encodedData,
+ },
+ self._web3Wrapper.getContractDefaults(),
+ self.approve.estimateGasAsync.bind(
+ self,
+ guy,
+ wad
+ ),
+ );
+ const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults);
+ return txHash;
+ },
+ async estimateGasAsync(
+ guy: string,
+ wad: BigNumber,
+ txData: Partial<TxData> = {},
+ ): Promise<number> {
+ const self = this as any as WETH9Contract;
+ const inputAbi = self._lookupAbi('approve(address,uint256)').inputs;
+ [guy,
+ wad
+ ] = BaseContract._formatABIDataItemList(inputAbi, [guy,
+ wad
+ ], BaseContract._bigNumberToString);
+ const encodedData = self._lookupEthersInterface('approve(address,uint256)').functions.approve.encode([guy,
+ wad
+ ]);
+ const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
+ {
+ to: self.address,
+ ...txData,
+ data: encodedData,
+ },
+ self._web3Wrapper.getContractDefaults(),
+ );
+ const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults);
+ return gas;
+ },
+ getABIEncodedTransactionData(
+ guy: string,
+ wad: BigNumber,
+ ): string {
+ const self = this as any as WETH9Contract;
+ const inputAbi = self._lookupAbi('approve(address,uint256)').inputs;
+ [guy,
+ wad
+ ] = BaseContract._formatABIDataItemList(inputAbi, [guy,
+ wad
+ ], BaseContract._bigNumberToString);
+ const abiEncodedTransactionData = self._lookupEthersInterface('approve(address,uint256)').functions.approve.encode([guy,
+ wad
+ ]);
+ return abiEncodedTransactionData;
+ },
+ async callAsync(
+ guy: string,
+ wad: BigNumber,
+ callData: Partial<CallData> = {},
+ defaultBlock?: BlockParam,
+ ): Promise<boolean
+ > {
+ const self = this as any as WETH9Contract;
+ const functionSignature = 'approve(address,uint256)';
+ const inputAbi = self._lookupAbi(functionSignature).inputs;
+ [guy,
+ wad
+ ] = BaseContract._formatABIDataItemList(inputAbi, [guy,
+ wad
+ ], BaseContract._bigNumberToString.bind(self));
+ BaseContract.strictArgumentEncodingCheck(inputAbi, [guy,
+ wad
+ ]);
+ const ethersFunction = self._lookupEthersInterface(functionSignature).functions.approve;
+ const encodedData = ethersFunction.encode([guy,
+ wad
+ ]);
+ const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
+ {
+ to: self.address,
+ ...callData,
+ data: encodedData,
+ },
+ self._web3Wrapper.getContractDefaults(),
+ );
+ const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
+ BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
+ let resultArray = ethersFunction.decode(rawCallResult);
+ const outputAbi = (_.find(self.abi, {name: 'approve'}) as MethodAbi).outputs;
+ resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this));
+ resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this));
+ return resultArray[0];
+ },
+ };
+ public totalSupply = {
+ async callAsync(
+ callData: Partial<CallData> = {},
+ defaultBlock?: BlockParam,
+ ): Promise<BigNumber
+ > {
+ const self = this as any as WETH9Contract;
+ const functionSignature = 'totalSupply()';
+ const inputAbi = self._lookupAbi(functionSignature).inputs;
+ [] = BaseContract._formatABIDataItemList(inputAbi, [], BaseContract._bigNumberToString.bind(self));
+ BaseContract.strictArgumentEncodingCheck(inputAbi, []);
+ const ethersFunction = self._lookupEthersInterface(functionSignature).functions.totalSupply;
+ const encodedData = ethersFunction.encode([]);
+ const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
+ {
+ to: self.address,
+ ...callData,
+ data: encodedData,
+ },
+ self._web3Wrapper.getContractDefaults(),
+ );
+ const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
+ BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
+ let resultArray = ethersFunction.decode(rawCallResult);
+ const outputAbi = (_.find(self.abi, {name: 'totalSupply'}) as MethodAbi).outputs;
+ resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this));
+ resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this));
+ return resultArray[0];
+ },
+ };
+ public transferFrom = {
+ async sendTransactionAsync(
+ src: string,
+ dst: string,
+ wad: BigNumber,
+ txData: Partial<TxData> = {},
+ ): Promise<string> {
+ const self = this as any as WETH9Contract;
+ const inputAbi = self._lookupAbi('transferFrom(address,address,uint256)').inputs;
+ [src,
+ dst,
+ wad
+ ] = BaseContract._formatABIDataItemList(inputAbi, [src,
+ dst,
+ wad
+ ], BaseContract._bigNumberToString.bind(self));
+ BaseContract.strictArgumentEncodingCheck(inputAbi, [src,
+ dst,
+ wad
+ ]);
+ const encodedData = self._lookupEthersInterface('transferFrom(address,address,uint256)').functions.transferFrom.encode([src,
+ dst,
+ wad
+ ]);
+ const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
+ {
+ to: self.address,
+ ...txData,
+ data: encodedData,
+ },
+ self._web3Wrapper.getContractDefaults(),
+ self.transferFrom.estimateGasAsync.bind(
+ self,
+ src,
+ dst,
+ wad
+ ),
+ );
+ const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults);
+ return txHash;
+ },
+ async estimateGasAsync(
+ src: string,
+ dst: string,
+ wad: BigNumber,
+ txData: Partial<TxData> = {},
+ ): Promise<number> {
+ const self = this as any as WETH9Contract;
+ const inputAbi = self._lookupAbi('transferFrom(address,address,uint256)').inputs;
+ [src,
+ dst,
+ wad
+ ] = BaseContract._formatABIDataItemList(inputAbi, [src,
+ dst,
+ wad
+ ], BaseContract._bigNumberToString);
+ const encodedData = self._lookupEthersInterface('transferFrom(address,address,uint256)').functions.transferFrom.encode([src,
+ dst,
+ wad
+ ]);
+ const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
+ {
+ to: self.address,
+ ...txData,
+ data: encodedData,
+ },
+ self._web3Wrapper.getContractDefaults(),
+ );
+ const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults);
+ return gas;
+ },
+ getABIEncodedTransactionData(
+ src: string,
+ dst: string,
+ wad: BigNumber,
+ ): string {
+ const self = this as any as WETH9Contract;
+ const inputAbi = self._lookupAbi('transferFrom(address,address,uint256)').inputs;
+ [src,
+ dst,
+ wad
+ ] = BaseContract._formatABIDataItemList(inputAbi, [src,
+ dst,
+ wad
+ ], BaseContract._bigNumberToString);
+ const abiEncodedTransactionData = self._lookupEthersInterface('transferFrom(address,address,uint256)').functions.transferFrom.encode([src,
+ dst,
+ wad
+ ]);
+ return abiEncodedTransactionData;
+ },
+ async callAsync(
+ src: string,
+ dst: string,
+ wad: BigNumber,
+ callData: Partial<CallData> = {},
+ defaultBlock?: BlockParam,
+ ): Promise<boolean
+ > {
+ const self = this as any as WETH9Contract;
+ const functionSignature = 'transferFrom(address,address,uint256)';
+ const inputAbi = self._lookupAbi(functionSignature).inputs;
+ [src,
+ dst,
+ wad
+ ] = BaseContract._formatABIDataItemList(inputAbi, [src,
+ dst,
+ wad
+ ], BaseContract._bigNumberToString.bind(self));
+ BaseContract.strictArgumentEncodingCheck(inputAbi, [src,
+ dst,
+ wad
+ ]);
+ const ethersFunction = self._lookupEthersInterface(functionSignature).functions.transferFrom;
+ const encodedData = ethersFunction.encode([src,
+ dst,
+ wad
+ ]);
+ const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
+ {
+ to: self.address,
+ ...callData,
+ data: encodedData,
+ },
+ self._web3Wrapper.getContractDefaults(),
+ );
+ const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
+ BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
+ let resultArray = ethersFunction.decode(rawCallResult);
+ const outputAbi = (_.find(self.abi, {name: 'transferFrom'}) as MethodAbi).outputs;
+ resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this));
+ resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this));
+ return resultArray[0];
+ },
+ };
+ public withdraw = {
+ async sendTransactionAsync(
+ wad: BigNumber,
+ txData: Partial<TxData> = {},
+ ): Promise<string> {
+ const self = this as any as WETH9Contract;
+ const inputAbi = self._lookupAbi('withdraw(uint256)').inputs;
+ [wad
+ ] = BaseContract._formatABIDataItemList(inputAbi, [wad
+ ], BaseContract._bigNumberToString.bind(self));
+ BaseContract.strictArgumentEncodingCheck(inputAbi, [wad
+ ]);
+ const encodedData = self._lookupEthersInterface('withdraw(uint256)').functions.withdraw.encode([wad
+ ]);
+ const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
+ {
+ to: self.address,
+ ...txData,
+ data: encodedData,
+ },
+ self._web3Wrapper.getContractDefaults(),
+ self.withdraw.estimateGasAsync.bind(
+ self,
+ wad
+ ),
+ );
+ const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults);
+ return txHash;
+ },
+ async estimateGasAsync(
+ wad: BigNumber,
+ txData: Partial<TxData> = {},
+ ): Promise<number> {
+ const self = this as any as WETH9Contract;
+ const inputAbi = self._lookupAbi('withdraw(uint256)').inputs;
+ [wad
+ ] = BaseContract._formatABIDataItemList(inputAbi, [wad
+ ], BaseContract._bigNumberToString);
+ const encodedData = self._lookupEthersInterface('withdraw(uint256)').functions.withdraw.encode([wad
+ ]);
+ const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
+ {
+ to: self.address,
+ ...txData,
+ data: encodedData,
+ },
+ self._web3Wrapper.getContractDefaults(),
+ );
+ const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults);
+ return gas;
+ },
+ getABIEncodedTransactionData(
+ wad: BigNumber,
+ ): string {
+ const self = this as any as WETH9Contract;
+ const inputAbi = self._lookupAbi('withdraw(uint256)').inputs;
+ [wad
+ ] = BaseContract._formatABIDataItemList(inputAbi, [wad
+ ], BaseContract._bigNumberToString);
+ const abiEncodedTransactionData = self._lookupEthersInterface('withdraw(uint256)').functions.withdraw.encode([wad
+ ]);
+ return abiEncodedTransactionData;
+ },
+ async callAsync(
+ wad: BigNumber,
+ callData: Partial<CallData> = {},
+ defaultBlock?: BlockParam,
+ ): Promise<void
+ > {
+ const self = this as any as WETH9Contract;
+ const functionSignature = 'withdraw(uint256)';
+ const inputAbi = self._lookupAbi(functionSignature).inputs;
+ [wad
+ ] = BaseContract._formatABIDataItemList(inputAbi, [wad
+ ], BaseContract._bigNumberToString.bind(self));
+ BaseContract.strictArgumentEncodingCheck(inputAbi, [wad
+ ]);
+ const ethersFunction = self._lookupEthersInterface(functionSignature).functions.withdraw;
+ const encodedData = ethersFunction.encode([wad
+ ]);
+ const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
+ {
+ to: self.address,
+ ...callData,
+ data: encodedData,
+ },
+ self._web3Wrapper.getContractDefaults(),
+ );
+ const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
+ BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
+ let resultArray = ethersFunction.decode(rawCallResult);
+ const outputAbi = (_.find(self.abi, {name: 'withdraw'}) as MethodAbi).outputs;
+ resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this));
+ resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this));
+ return resultArray;
+ },
+ };
+ public decimals = {
+ async callAsync(
+ callData: Partial<CallData> = {},
+ defaultBlock?: BlockParam,
+ ): Promise<number
+ > {
+ const self = this as any as WETH9Contract;
+ const functionSignature = 'decimals()';
+ const inputAbi = self._lookupAbi(functionSignature).inputs;
+ [] = BaseContract._formatABIDataItemList(inputAbi, [], BaseContract._bigNumberToString.bind(self));
+ BaseContract.strictArgumentEncodingCheck(inputAbi, []);
+ const ethersFunction = self._lookupEthersInterface(functionSignature).functions.decimals;
+ const encodedData = ethersFunction.encode([]);
+ const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
+ {
+ to: self.address,
+ ...callData,
+ data: encodedData,
+ },
+ self._web3Wrapper.getContractDefaults(),
+ );
+ const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
+ BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
+ let resultArray = ethersFunction.decode(rawCallResult);
+ const outputAbi = (_.find(self.abi, {name: 'decimals'}) as MethodAbi).outputs;
+ resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this));
+ resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this));
+ return resultArray[0];
+ },
+ };
+ public balanceOf = {
+ async callAsync(
+ index_0: string,
+ callData: Partial<CallData> = {},
+ defaultBlock?: BlockParam,
+ ): Promise<BigNumber
+ > {
+ const self = this as any as WETH9Contract;
+ const functionSignature = 'balanceOf(address)';
+ const inputAbi = self._lookupAbi(functionSignature).inputs;
+ [index_0
+ ] = BaseContract._formatABIDataItemList(inputAbi, [index_0
+ ], BaseContract._bigNumberToString.bind(self));
+ BaseContract.strictArgumentEncodingCheck(inputAbi, [index_0
+ ]);
+ const ethersFunction = self._lookupEthersInterface(functionSignature).functions.balanceOf;
+ const encodedData = ethersFunction.encode([index_0
+ ]);
+ const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
+ {
+ to: self.address,
+ ...callData,
+ data: encodedData,
+ },
+ self._web3Wrapper.getContractDefaults(),
+ );
+ const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
+ BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
+ let resultArray = ethersFunction.decode(rawCallResult);
+ const outputAbi = (_.find(self.abi, {name: 'balanceOf'}) as MethodAbi).outputs;
+ resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this));
+ resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this));
+ return resultArray[0];
+ },
+ };
+ public symbol = {
+ async callAsync(
+ callData: Partial<CallData> = {},
+ defaultBlock?: BlockParam,
+ ): Promise<string
+ > {
+ const self = this as any as WETH9Contract;
+ const functionSignature = 'symbol()';
+ const inputAbi = self._lookupAbi(functionSignature).inputs;
+ [] = BaseContract._formatABIDataItemList(inputAbi, [], BaseContract._bigNumberToString.bind(self));
+ BaseContract.strictArgumentEncodingCheck(inputAbi, []);
+ const ethersFunction = self._lookupEthersInterface(functionSignature).functions.symbol;
+ const encodedData = ethersFunction.encode([]);
+ const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
+ {
+ to: self.address,
+ ...callData,
+ data: encodedData,
+ },
+ self._web3Wrapper.getContractDefaults(),
+ );
+ const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
+ BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
+ let resultArray = ethersFunction.decode(rawCallResult);
+ const outputAbi = (_.find(self.abi, {name: 'symbol'}) as MethodAbi).outputs;
+ resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this));
+ resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this));
+ return resultArray[0];
+ },
+ };
+ public transfer = {
+ async sendTransactionAsync(
+ dst: string,
+ wad: BigNumber,
+ txData: Partial<TxData> = {},
+ ): Promise<string> {
+ const self = this as any as WETH9Contract;
+ const inputAbi = self._lookupAbi('transfer(address,uint256)').inputs;
+ [dst,
+ wad
+ ] = BaseContract._formatABIDataItemList(inputAbi, [dst,
+ wad
+ ], BaseContract._bigNumberToString.bind(self));
+ BaseContract.strictArgumentEncodingCheck(inputAbi, [dst,
+ wad
+ ]);
+ const encodedData = self._lookupEthersInterface('transfer(address,uint256)').functions.transfer.encode([dst,
+ wad
+ ]);
+ const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
+ {
+ to: self.address,
+ ...txData,
+ data: encodedData,
+ },
+ self._web3Wrapper.getContractDefaults(),
+ self.transfer.estimateGasAsync.bind(
+ self,
+ dst,
+ wad
+ ),
+ );
+ const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults);
+ return txHash;
+ },
+ async estimateGasAsync(
+ dst: string,
+ wad: BigNumber,
+ txData: Partial<TxData> = {},
+ ): Promise<number> {
+ const self = this as any as WETH9Contract;
+ const inputAbi = self._lookupAbi('transfer(address,uint256)').inputs;
+ [dst,
+ wad
+ ] = BaseContract._formatABIDataItemList(inputAbi, [dst,
+ wad
+ ], BaseContract._bigNumberToString);
+ const encodedData = self._lookupEthersInterface('transfer(address,uint256)').functions.transfer.encode([dst,
+ wad
+ ]);
+ const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
+ {
+ to: self.address,
+ ...txData,
+ data: encodedData,
+ },
+ self._web3Wrapper.getContractDefaults(),
+ );
+ const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults);
+ return gas;
+ },
+ getABIEncodedTransactionData(
+ dst: string,
+ wad: BigNumber,
+ ): string {
+ const self = this as any as WETH9Contract;
+ const inputAbi = self._lookupAbi('transfer(address,uint256)').inputs;
+ [dst,
+ wad
+ ] = BaseContract._formatABIDataItemList(inputAbi, [dst,
+ wad
+ ], BaseContract._bigNumberToString);
+ const abiEncodedTransactionData = self._lookupEthersInterface('transfer(address,uint256)').functions.transfer.encode([dst,
+ wad
+ ]);
+ return abiEncodedTransactionData;
+ },
+ async callAsync(
+ dst: string,
+ wad: BigNumber,
+ callData: Partial<CallData> = {},
+ defaultBlock?: BlockParam,
+ ): Promise<boolean
+ > {
+ const self = this as any as WETH9Contract;
+ const functionSignature = 'transfer(address,uint256)';
+ const inputAbi = self._lookupAbi(functionSignature).inputs;
+ [dst,
+ wad
+ ] = BaseContract._formatABIDataItemList(inputAbi, [dst,
+ wad
+ ], BaseContract._bigNumberToString.bind(self));
+ BaseContract.strictArgumentEncodingCheck(inputAbi, [dst,
+ wad
+ ]);
+ const ethersFunction = self._lookupEthersInterface(functionSignature).functions.transfer;
+ const encodedData = ethersFunction.encode([dst,
+ wad
+ ]);
+ const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
+ {
+ to: self.address,
+ ...callData,
+ data: encodedData,
+ },
+ self._web3Wrapper.getContractDefaults(),
+ );
+ const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
+ BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
+ let resultArray = ethersFunction.decode(rawCallResult);
+ const outputAbi = (_.find(self.abi, {name: 'transfer'}) as MethodAbi).outputs;
+ resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this));
+ resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this));
+ return resultArray[0];
+ },
+ };
+ public deposit = {
+ async sendTransactionAsync(
+ txData: Partial<TxDataPayable> = {},
+ ): Promise<string> {
+ const self = this as any as WETH9Contract;
+ const inputAbi = self._lookupAbi('deposit()').inputs;
+ [] = BaseContract._formatABIDataItemList(inputAbi, [], BaseContract._bigNumberToString.bind(self));
+ BaseContract.strictArgumentEncodingCheck(inputAbi, []);
+ const encodedData = self._lookupEthersInterface('deposit()').functions.deposit.encode([]);
+ const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
+ {
+ to: self.address,
+ ...txData,
+ data: encodedData,
+ },
+ self._web3Wrapper.getContractDefaults(),
+ self.deposit.estimateGasAsync.bind(
+ self,
+ ),
+ );
+ const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults);
+ return txHash;
+ },
+ async estimateGasAsync(
+ txData: Partial<TxData> = {},
+ ): Promise<number> {
+ const self = this as any as WETH9Contract;
+ const inputAbi = self._lookupAbi('deposit()').inputs;
+ [] = BaseContract._formatABIDataItemList(inputAbi, [], BaseContract._bigNumberToString);
+ const encodedData = self._lookupEthersInterface('deposit()').functions.deposit.encode([]);
+ const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
+ {
+ to: self.address,
+ ...txData,
+ data: encodedData,
+ },
+ self._web3Wrapper.getContractDefaults(),
+ );
+ const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults);
+ return gas;
+ },
+ getABIEncodedTransactionData(
+ ): string {
+ const self = this as any as WETH9Contract;
+ const inputAbi = self._lookupAbi('deposit()').inputs;
+ [] = BaseContract._formatABIDataItemList(inputAbi, [], BaseContract._bigNumberToString);
+ const abiEncodedTransactionData = self._lookupEthersInterface('deposit()').functions.deposit.encode([]);
+ return abiEncodedTransactionData;
+ },
+ async callAsync(
+ callData: Partial<CallData> = {},
+ defaultBlock?: BlockParam,
+ ): Promise<void
+ > {
+ const self = this as any as WETH9Contract;
+ const functionSignature = 'deposit()';
+ const inputAbi = self._lookupAbi(functionSignature).inputs;
+ [] = BaseContract._formatABIDataItemList(inputAbi, [], BaseContract._bigNumberToString.bind(self));
+ BaseContract.strictArgumentEncodingCheck(inputAbi, []);
+ const ethersFunction = self._lookupEthersInterface(functionSignature).functions.deposit;
+ const encodedData = ethersFunction.encode([]);
+ const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
+ {
+ to: self.address,
+ ...callData,
+ data: encodedData,
+ },
+ self._web3Wrapper.getContractDefaults(),
+ );
+ const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
+ BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
+ let resultArray = ethersFunction.decode(rawCallResult);
+ const outputAbi = (_.find(self.abi, {name: 'deposit'}) as MethodAbi).outputs;
+ resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this));
+ resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this));
+ return resultArray;
+ },
+ };
+ public allowance = {
+ async callAsync(
+ index_0: string,
+ index_1: string,
+ callData: Partial<CallData> = {},
+ defaultBlock?: BlockParam,
+ ): Promise<BigNumber
+ > {
+ const self = this as any as WETH9Contract;
+ const functionSignature = 'allowance(address,address)';
+ const inputAbi = self._lookupAbi(functionSignature).inputs;
+ [index_0,
+ index_1
+ ] = BaseContract._formatABIDataItemList(inputAbi, [index_0,
+ index_1
+ ], BaseContract._bigNumberToString.bind(self));
+ BaseContract.strictArgumentEncodingCheck(inputAbi, [index_0,
+ index_1
+ ]);
+ const ethersFunction = self._lookupEthersInterface(functionSignature).functions.allowance;
+ const encodedData = ethersFunction.encode([index_0,
+ index_1
+ ]);
+ const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
+ {
+ to: self.address,
+ ...callData,
+ data: encodedData,
+ },
+ self._web3Wrapper.getContractDefaults(),
+ );
+ const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
+ BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
+ let resultArray = ethersFunction.decode(rawCallResult);
+ const outputAbi = (_.find(self.abi, {name: 'allowance'}) as MethodAbi).outputs;
+ resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this));
+ resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this));
+ return resultArray[0];
+ },
+ };
+ public static async deployFrom0xArtifactAsync(
+ artifact: ContractArtifact,
+ provider: Provider,
+ txDefaults: Partial<TxData>,
+ ): Promise<WETH9Contract> {
+ if (_.isUndefined(artifact.compilerOutput)) {
+ throw new Error('Compiler output not found in the artifact file');
+ }
+ const bytecode = artifact.compilerOutput.evm.bytecode.object;
+ const abi = artifact.compilerOutput.abi;
+ return WETH9Contract.deployAsync(bytecode, abi, provider, txDefaults, );
+ }
+ public static async deployAsync(
+ bytecode: string,
+ abi: ContractAbi,
+ provider: Provider,
+ txDefaults: Partial<TxData>,
+ ): Promise<WETH9Contract> {
+ const constructorAbi = BaseContract._lookupConstructorAbi(abi);
+ [] = BaseContract._formatABIDataItemList(
+ constructorAbi.inputs,
+ [],
+ BaseContract._bigNumberToString,
+ );
+ const iface = new ethers.utils.Interface(abi);
+ const deployInfo = iface.deployFunction;
+ const txData = deployInfo.encode(bytecode, []);
+ const web3Wrapper = new Web3Wrapper(provider);
+ const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
+ {data: txData},
+ txDefaults,
+ web3Wrapper.estimateGasAsync.bind(web3Wrapper),
+ );
+ const txHash = await web3Wrapper.sendTransactionAsync(txDataWithDefaults);
+ logUtils.log(`transactionHash: ${txHash}`);
+ const txReceipt = await web3Wrapper.awaitTransactionSuccessAsync(txHash);
+ logUtils.log(`WETH9 successfully deployed at ${txReceipt.contractAddress}`);
+ const contractInstance = new WETH9Contract(abi, txReceipt.contractAddress as string, provider, txDefaults);
+ contractInstance.constructorArgs = [];
+ return contractInstance;
+ }
+ constructor(abi: ContractAbi, address: string, provider: Provider, txDefaults?: Partial<TxData>) {
+ super('WETH9', abi, address, provider, txDefaults);
+ classUtils.bindAll(this, ['_ethersInterfacesByFunctionSignature', 'address', 'abi', '_web3Wrapper']);
+ }
+} // tslint:disable:max-file-line-count
+// tslint:enable:no-unbound-method
diff --git a/packages/abi-gen-wrappers/src/generated-wrappers/zrx_token.ts b/packages/abi-gen-wrappers/src/generated-wrappers/zrx_token.ts
new file mode 100644
index 000000000..818509972
--- /dev/null
+++ b/packages/abi-gen-wrappers/src/generated-wrappers/zrx_token.ts
@@ -0,0 +1,646 @@
+// tslint:disable:no-consecutive-blank-lines ordered-imports align trailing-comma whitespace class-name
+// tslint:disable:no-unused-variable
+// tslint:disable:no-unbound-method
+import { BaseContract } from '@0xproject/base-contract';
+import { BlockParam, BlockParamLiteral, CallData, ContractAbi, ContractArtifact, DecodedLogArgs, MethodAbi, Provider, TxData, TxDataPayable } from 'ethereum-types';
+import { BigNumber, classUtils, logUtils } from '@0xproject/utils';
+import { Web3Wrapper } from '@0xproject/web3-wrapper';
+import * as ethers from 'ethers';
+import * as _ from 'lodash';
+// tslint:enable:no-unused-variable
+
+export type ZRXTokenEventArgs =
+ | ZRXTokenTransferEventArgs
+ | ZRXTokenApprovalEventArgs;
+
+export enum ZRXTokenEvents {
+ Transfer = 'Transfer',
+ Approval = 'Approval',
+}
+
+export interface ZRXTokenTransferEventArgs extends DecodedLogArgs {
+ _from: string;
+ _to: string;
+ _value: BigNumber;
+}
+
+export interface ZRXTokenApprovalEventArgs extends DecodedLogArgs {
+ _owner: string;
+ _spender: string;
+ _value: BigNumber;
+}
+
+
+/* istanbul ignore next */
+// tslint:disable:no-parameter-reassignment
+// tslint:disable-next-line:class-name
+export class ZRXTokenContract extends BaseContract {
+ public name = {
+ async callAsync(
+ callData: Partial<CallData> = {},
+ defaultBlock?: BlockParam,
+ ): Promise<string
+ > {
+ const self = this as any as ZRXTokenContract;
+ const functionSignature = 'name()';
+ const inputAbi = self._lookupAbi(functionSignature).inputs;
+ [] = BaseContract._formatABIDataItemList(inputAbi, [], BaseContract._bigNumberToString.bind(self));
+ BaseContract.strictArgumentEncodingCheck(inputAbi, []);
+ const ethersFunction = self._lookupEthersInterface(functionSignature).functions.name;
+ const encodedData = ethersFunction.encode([]);
+ const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
+ {
+ to: self.address,
+ ...callData,
+ data: encodedData,
+ },
+ self._web3Wrapper.getContractDefaults(),
+ );
+ const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
+ BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
+ let resultArray = ethersFunction.decode(rawCallResult);
+ const outputAbi = (_.find(self.abi, {name: 'name'}) as MethodAbi).outputs;
+ resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this));
+ resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this));
+ return resultArray[0];
+ },
+ };
+ public approve = {
+ async sendTransactionAsync(
+ _spender: string,
+ _value: BigNumber,
+ txData: Partial<TxData> = {},
+ ): Promise<string> {
+ const self = this as any as ZRXTokenContract;
+ const inputAbi = self._lookupAbi('approve(address,uint256)').inputs;
+ [_spender,
+ _value
+ ] = BaseContract._formatABIDataItemList(inputAbi, [_spender,
+ _value
+ ], BaseContract._bigNumberToString.bind(self));
+ BaseContract.strictArgumentEncodingCheck(inputAbi, [_spender,
+ _value
+ ]);
+ const encodedData = self._lookupEthersInterface('approve(address,uint256)').functions.approve.encode([_spender,
+ _value
+ ]);
+ const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
+ {
+ to: self.address,
+ ...txData,
+ data: encodedData,
+ },
+ self._web3Wrapper.getContractDefaults(),
+ self.approve.estimateGasAsync.bind(
+ self,
+ _spender,
+ _value
+ ),
+ );
+ const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults);
+ return txHash;
+ },
+ async estimateGasAsync(
+ _spender: string,
+ _value: BigNumber,
+ txData: Partial<TxData> = {},
+ ): Promise<number> {
+ const self = this as any as ZRXTokenContract;
+ const inputAbi = self._lookupAbi('approve(address,uint256)').inputs;
+ [_spender,
+ _value
+ ] = BaseContract._formatABIDataItemList(inputAbi, [_spender,
+ _value
+ ], BaseContract._bigNumberToString);
+ const encodedData = self._lookupEthersInterface('approve(address,uint256)').functions.approve.encode([_spender,
+ _value
+ ]);
+ const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
+ {
+ to: self.address,
+ ...txData,
+ data: encodedData,
+ },
+ self._web3Wrapper.getContractDefaults(),
+ );
+ const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults);
+ return gas;
+ },
+ getABIEncodedTransactionData(
+ _spender: string,
+ _value: BigNumber,
+ ): string {
+ const self = this as any as ZRXTokenContract;
+ const inputAbi = self._lookupAbi('approve(address,uint256)').inputs;
+ [_spender,
+ _value
+ ] = BaseContract._formatABIDataItemList(inputAbi, [_spender,
+ _value
+ ], BaseContract._bigNumberToString);
+ const abiEncodedTransactionData = self._lookupEthersInterface('approve(address,uint256)').functions.approve.encode([_spender,
+ _value
+ ]);
+ return abiEncodedTransactionData;
+ },
+ async callAsync(
+ _spender: string,
+ _value: BigNumber,
+ callData: Partial<CallData> = {},
+ defaultBlock?: BlockParam,
+ ): Promise<boolean
+ > {
+ const self = this as any as ZRXTokenContract;
+ const functionSignature = 'approve(address,uint256)';
+ const inputAbi = self._lookupAbi(functionSignature).inputs;
+ [_spender,
+ _value
+ ] = BaseContract._formatABIDataItemList(inputAbi, [_spender,
+ _value
+ ], BaseContract._bigNumberToString.bind(self));
+ BaseContract.strictArgumentEncodingCheck(inputAbi, [_spender,
+ _value
+ ]);
+ const ethersFunction = self._lookupEthersInterface(functionSignature).functions.approve;
+ const encodedData = ethersFunction.encode([_spender,
+ _value
+ ]);
+ const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
+ {
+ to: self.address,
+ ...callData,
+ data: encodedData,
+ },
+ self._web3Wrapper.getContractDefaults(),
+ );
+ const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
+ BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
+ let resultArray = ethersFunction.decode(rawCallResult);
+ const outputAbi = (_.find(self.abi, {name: 'approve'}) as MethodAbi).outputs;
+ resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this));
+ resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this));
+ return resultArray[0];
+ },
+ };
+ public totalSupply = {
+ async callAsync(
+ callData: Partial<CallData> = {},
+ defaultBlock?: BlockParam,
+ ): Promise<BigNumber
+ > {
+ const self = this as any as ZRXTokenContract;
+ const functionSignature = 'totalSupply()';
+ const inputAbi = self._lookupAbi(functionSignature).inputs;
+ [] = BaseContract._formatABIDataItemList(inputAbi, [], BaseContract._bigNumberToString.bind(self));
+ BaseContract.strictArgumentEncodingCheck(inputAbi, []);
+ const ethersFunction = self._lookupEthersInterface(functionSignature).functions.totalSupply;
+ const encodedData = ethersFunction.encode([]);
+ const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
+ {
+ to: self.address,
+ ...callData,
+ data: encodedData,
+ },
+ self._web3Wrapper.getContractDefaults(),
+ );
+ const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
+ BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
+ let resultArray = ethersFunction.decode(rawCallResult);
+ const outputAbi = (_.find(self.abi, {name: 'totalSupply'}) as MethodAbi).outputs;
+ resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this));
+ resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this));
+ return resultArray[0];
+ },
+ };
+ public transferFrom = {
+ async sendTransactionAsync(
+ _from: string,
+ _to: string,
+ _value: BigNumber,
+ txData: Partial<TxData> = {},
+ ): Promise<string> {
+ const self = this as any as ZRXTokenContract;
+ const inputAbi = self._lookupAbi('transferFrom(address,address,uint256)').inputs;
+ [_from,
+ _to,
+ _value
+ ] = BaseContract._formatABIDataItemList(inputAbi, [_from,
+ _to,
+ _value
+ ], BaseContract._bigNumberToString.bind(self));
+ BaseContract.strictArgumentEncodingCheck(inputAbi, [_from,
+ _to,
+ _value
+ ]);
+ const encodedData = self._lookupEthersInterface('transferFrom(address,address,uint256)').functions.transferFrom.encode([_from,
+ _to,
+ _value
+ ]);
+ const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
+ {
+ to: self.address,
+ ...txData,
+ data: encodedData,
+ },
+ self._web3Wrapper.getContractDefaults(),
+ self.transferFrom.estimateGasAsync.bind(
+ self,
+ _from,
+ _to,
+ _value
+ ),
+ );
+ const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults);
+ return txHash;
+ },
+ async estimateGasAsync(
+ _from: string,
+ _to: string,
+ _value: BigNumber,
+ txData: Partial<TxData> = {},
+ ): Promise<number> {
+ const self = this as any as ZRXTokenContract;
+ const inputAbi = self._lookupAbi('transferFrom(address,address,uint256)').inputs;
+ [_from,
+ _to,
+ _value
+ ] = BaseContract._formatABIDataItemList(inputAbi, [_from,
+ _to,
+ _value
+ ], BaseContract._bigNumberToString);
+ const encodedData = self._lookupEthersInterface('transferFrom(address,address,uint256)').functions.transferFrom.encode([_from,
+ _to,
+ _value
+ ]);
+ const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
+ {
+ to: self.address,
+ ...txData,
+ data: encodedData,
+ },
+ self._web3Wrapper.getContractDefaults(),
+ );
+ const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults);
+ return gas;
+ },
+ getABIEncodedTransactionData(
+ _from: string,
+ _to: string,
+ _value: BigNumber,
+ ): string {
+ const self = this as any as ZRXTokenContract;
+ const inputAbi = self._lookupAbi('transferFrom(address,address,uint256)').inputs;
+ [_from,
+ _to,
+ _value
+ ] = BaseContract._formatABIDataItemList(inputAbi, [_from,
+ _to,
+ _value
+ ], BaseContract._bigNumberToString);
+ const abiEncodedTransactionData = self._lookupEthersInterface('transferFrom(address,address,uint256)').functions.transferFrom.encode([_from,
+ _to,
+ _value
+ ]);
+ return abiEncodedTransactionData;
+ },
+ async callAsync(
+ _from: string,
+ _to: string,
+ _value: BigNumber,
+ callData: Partial<CallData> = {},
+ defaultBlock?: BlockParam,
+ ): Promise<boolean
+ > {
+ const self = this as any as ZRXTokenContract;
+ const functionSignature = 'transferFrom(address,address,uint256)';
+ const inputAbi = self._lookupAbi(functionSignature).inputs;
+ [_from,
+ _to,
+ _value
+ ] = BaseContract._formatABIDataItemList(inputAbi, [_from,
+ _to,
+ _value
+ ], BaseContract._bigNumberToString.bind(self));
+ BaseContract.strictArgumentEncodingCheck(inputAbi, [_from,
+ _to,
+ _value
+ ]);
+ const ethersFunction = self._lookupEthersInterface(functionSignature).functions.transferFrom;
+ const encodedData = ethersFunction.encode([_from,
+ _to,
+ _value
+ ]);
+ const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
+ {
+ to: self.address,
+ ...callData,
+ data: encodedData,
+ },
+ self._web3Wrapper.getContractDefaults(),
+ );
+ const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
+ BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
+ let resultArray = ethersFunction.decode(rawCallResult);
+ const outputAbi = (_.find(self.abi, {name: 'transferFrom'}) as MethodAbi).outputs;
+ resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this));
+ resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this));
+ return resultArray[0];
+ },
+ };
+ public decimals = {
+ async callAsync(
+ callData: Partial<CallData> = {},
+ defaultBlock?: BlockParam,
+ ): Promise<number
+ > {
+ const self = this as any as ZRXTokenContract;
+ const functionSignature = 'decimals()';
+ const inputAbi = self._lookupAbi(functionSignature).inputs;
+ [] = BaseContract._formatABIDataItemList(inputAbi, [], BaseContract._bigNumberToString.bind(self));
+ BaseContract.strictArgumentEncodingCheck(inputAbi, []);
+ const ethersFunction = self._lookupEthersInterface(functionSignature).functions.decimals;
+ const encodedData = ethersFunction.encode([]);
+ const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
+ {
+ to: self.address,
+ ...callData,
+ data: encodedData,
+ },
+ self._web3Wrapper.getContractDefaults(),
+ );
+ const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
+ BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
+ let resultArray = ethersFunction.decode(rawCallResult);
+ const outputAbi = (_.find(self.abi, {name: 'decimals'}) as MethodAbi).outputs;
+ resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this));
+ resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this));
+ return resultArray[0];
+ },
+ };
+ public balanceOf = {
+ async callAsync(
+ _owner: string,
+ callData: Partial<CallData> = {},
+ defaultBlock?: BlockParam,
+ ): Promise<BigNumber
+ > {
+ const self = this as any as ZRXTokenContract;
+ const functionSignature = 'balanceOf(address)';
+ const inputAbi = self._lookupAbi(functionSignature).inputs;
+ [_owner
+ ] = BaseContract._formatABIDataItemList(inputAbi, [_owner
+ ], BaseContract._bigNumberToString.bind(self));
+ BaseContract.strictArgumentEncodingCheck(inputAbi, [_owner
+ ]);
+ const ethersFunction = self._lookupEthersInterface(functionSignature).functions.balanceOf;
+ const encodedData = ethersFunction.encode([_owner
+ ]);
+ const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
+ {
+ to: self.address,
+ ...callData,
+ data: encodedData,
+ },
+ self._web3Wrapper.getContractDefaults(),
+ );
+ const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
+ BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
+ let resultArray = ethersFunction.decode(rawCallResult);
+ const outputAbi = (_.find(self.abi, {name: 'balanceOf'}) as MethodAbi).outputs;
+ resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this));
+ resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this));
+ return resultArray[0];
+ },
+ };
+ public symbol = {
+ async callAsync(
+ callData: Partial<CallData> = {},
+ defaultBlock?: BlockParam,
+ ): Promise<string
+ > {
+ const self = this as any as ZRXTokenContract;
+ const functionSignature = 'symbol()';
+ const inputAbi = self._lookupAbi(functionSignature).inputs;
+ [] = BaseContract._formatABIDataItemList(inputAbi, [], BaseContract._bigNumberToString.bind(self));
+ BaseContract.strictArgumentEncodingCheck(inputAbi, []);
+ const ethersFunction = self._lookupEthersInterface(functionSignature).functions.symbol;
+ const encodedData = ethersFunction.encode([]);
+ const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
+ {
+ to: self.address,
+ ...callData,
+ data: encodedData,
+ },
+ self._web3Wrapper.getContractDefaults(),
+ );
+ const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
+ BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
+ let resultArray = ethersFunction.decode(rawCallResult);
+ const outputAbi = (_.find(self.abi, {name: 'symbol'}) as MethodAbi).outputs;
+ resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this));
+ resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this));
+ return resultArray[0];
+ },
+ };
+ public transfer = {
+ async sendTransactionAsync(
+ _to: string,
+ _value: BigNumber,
+ txData: Partial<TxData> = {},
+ ): Promise<string> {
+ const self = this as any as ZRXTokenContract;
+ const inputAbi = self._lookupAbi('transfer(address,uint256)').inputs;
+ [_to,
+ _value
+ ] = BaseContract._formatABIDataItemList(inputAbi, [_to,
+ _value
+ ], BaseContract._bigNumberToString.bind(self));
+ BaseContract.strictArgumentEncodingCheck(inputAbi, [_to,
+ _value
+ ]);
+ const encodedData = self._lookupEthersInterface('transfer(address,uint256)').functions.transfer.encode([_to,
+ _value
+ ]);
+ const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
+ {
+ to: self.address,
+ ...txData,
+ data: encodedData,
+ },
+ self._web3Wrapper.getContractDefaults(),
+ self.transfer.estimateGasAsync.bind(
+ self,
+ _to,
+ _value
+ ),
+ );
+ const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults);
+ return txHash;
+ },
+ async estimateGasAsync(
+ _to: string,
+ _value: BigNumber,
+ txData: Partial<TxData> = {},
+ ): Promise<number> {
+ const self = this as any as ZRXTokenContract;
+ const inputAbi = self._lookupAbi('transfer(address,uint256)').inputs;
+ [_to,
+ _value
+ ] = BaseContract._formatABIDataItemList(inputAbi, [_to,
+ _value
+ ], BaseContract._bigNumberToString);
+ const encodedData = self._lookupEthersInterface('transfer(address,uint256)').functions.transfer.encode([_to,
+ _value
+ ]);
+ const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
+ {
+ to: self.address,
+ ...txData,
+ data: encodedData,
+ },
+ self._web3Wrapper.getContractDefaults(),
+ );
+ const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults);
+ return gas;
+ },
+ getABIEncodedTransactionData(
+ _to: string,
+ _value: BigNumber,
+ ): string {
+ const self = this as any as ZRXTokenContract;
+ const inputAbi = self._lookupAbi('transfer(address,uint256)').inputs;
+ [_to,
+ _value
+ ] = BaseContract._formatABIDataItemList(inputAbi, [_to,
+ _value
+ ], BaseContract._bigNumberToString);
+ const abiEncodedTransactionData = self._lookupEthersInterface('transfer(address,uint256)').functions.transfer.encode([_to,
+ _value
+ ]);
+ return abiEncodedTransactionData;
+ },
+ async callAsync(
+ _to: string,
+ _value: BigNumber,
+ callData: Partial<CallData> = {},
+ defaultBlock?: BlockParam,
+ ): Promise<boolean
+ > {
+ const self = this as any as ZRXTokenContract;
+ const functionSignature = 'transfer(address,uint256)';
+ const inputAbi = self._lookupAbi(functionSignature).inputs;
+ [_to,
+ _value
+ ] = BaseContract._formatABIDataItemList(inputAbi, [_to,
+ _value
+ ], BaseContract._bigNumberToString.bind(self));
+ BaseContract.strictArgumentEncodingCheck(inputAbi, [_to,
+ _value
+ ]);
+ const ethersFunction = self._lookupEthersInterface(functionSignature).functions.transfer;
+ const encodedData = ethersFunction.encode([_to,
+ _value
+ ]);
+ const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
+ {
+ to: self.address,
+ ...callData,
+ data: encodedData,
+ },
+ self._web3Wrapper.getContractDefaults(),
+ );
+ const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
+ BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
+ let resultArray = ethersFunction.decode(rawCallResult);
+ const outputAbi = (_.find(self.abi, {name: 'transfer'}) as MethodAbi).outputs;
+ resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this));
+ resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this));
+ return resultArray[0];
+ },
+ };
+ public allowance = {
+ async callAsync(
+ _owner: string,
+ _spender: string,
+ callData: Partial<CallData> = {},
+ defaultBlock?: BlockParam,
+ ): Promise<BigNumber
+ > {
+ const self = this as any as ZRXTokenContract;
+ const functionSignature = 'allowance(address,address)';
+ const inputAbi = self._lookupAbi(functionSignature).inputs;
+ [_owner,
+ _spender
+ ] = BaseContract._formatABIDataItemList(inputAbi, [_owner,
+ _spender
+ ], BaseContract._bigNumberToString.bind(self));
+ BaseContract.strictArgumentEncodingCheck(inputAbi, [_owner,
+ _spender
+ ]);
+ const ethersFunction = self._lookupEthersInterface(functionSignature).functions.allowance;
+ const encodedData = ethersFunction.encode([_owner,
+ _spender
+ ]);
+ const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
+ {
+ to: self.address,
+ ...callData,
+ data: encodedData,
+ },
+ self._web3Wrapper.getContractDefaults(),
+ );
+ const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
+ BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
+ let resultArray = ethersFunction.decode(rawCallResult);
+ const outputAbi = (_.find(self.abi, {name: 'allowance'}) as MethodAbi).outputs;
+ resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this));
+ resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this));
+ return resultArray[0];
+ },
+ };
+ public static async deployFrom0xArtifactAsync(
+ artifact: ContractArtifact,
+ provider: Provider,
+ txDefaults: Partial<TxData>,
+ ): Promise<ZRXTokenContract> {
+ if (_.isUndefined(artifact.compilerOutput)) {
+ throw new Error('Compiler output not found in the artifact file');
+ }
+ const bytecode = artifact.compilerOutput.evm.bytecode.object;
+ const abi = artifact.compilerOutput.abi;
+ return ZRXTokenContract.deployAsync(bytecode, abi, provider, txDefaults, );
+ }
+ public static async deployAsync(
+ bytecode: string,
+ abi: ContractAbi,
+ provider: Provider,
+ txDefaults: Partial<TxData>,
+ ): Promise<ZRXTokenContract> {
+ const constructorAbi = BaseContract._lookupConstructorAbi(abi);
+ [] = BaseContract._formatABIDataItemList(
+ constructorAbi.inputs,
+ [],
+ BaseContract._bigNumberToString,
+ );
+ const iface = new ethers.utils.Interface(abi);
+ const deployInfo = iface.deployFunction;
+ const txData = deployInfo.encode(bytecode, []);
+ const web3Wrapper = new Web3Wrapper(provider);
+ const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
+ {data: txData},
+ txDefaults,
+ web3Wrapper.estimateGasAsync.bind(web3Wrapper),
+ );
+ const txHash = await web3Wrapper.sendTransactionAsync(txDataWithDefaults);
+ logUtils.log(`transactionHash: ${txHash}`);
+ const txReceipt = await web3Wrapper.awaitTransactionSuccessAsync(txHash);
+ logUtils.log(`ZRXToken successfully deployed at ${txReceipt.contractAddress}`);
+ const contractInstance = new ZRXTokenContract(abi, txReceipt.contractAddress as string, provider, txDefaults);
+ contractInstance.constructorArgs = [];
+ return contractInstance;
+ }
+ constructor(abi: ContractAbi, address: string, provider: Provider, txDefaults?: Partial<TxData>) {
+ super('ZRXToken', abi, address, provider, txDefaults);
+ classUtils.bindAll(this, ['_ethersInterfacesByFunctionSignature', 'address', 'abi', '_web3Wrapper']);
+ }
+} // tslint:disable:max-file-line-count
+// tslint:enable:no-unbound-method
diff --git a/packages/abi-gen-wrappers/src/index.ts b/packages/abi-gen-wrappers/src/index.ts
new file mode 100644
index 000000000..de418214b
--- /dev/null
+++ b/packages/abi-gen-wrappers/src/index.ts
@@ -0,0 +1,14 @@
+export * from './generated-wrappers/asset_proxy_owner';
+export * from './generated-wrappers/dummy_erc20_token';
+export * from './generated-wrappers/dummy_erc721_token';
+export * from './generated-wrappers/erc20_proxy';
+export * from './generated-wrappers/erc20_token';
+export * from './generated-wrappers/erc721_proxy';
+export * from './generated-wrappers/erc721_token';
+export * from './generated-wrappers/exchange';
+export * from './generated-wrappers/forwarder';
+export * from './generated-wrappers/i_validator';
+export * from './generated-wrappers/i_wallet';
+export * from './generated-wrappers/order_validator';
+export * from './generated-wrappers/weth9';
+export * from './generated-wrappers/zrx_token';
diff --git a/packages/abi-gen-wrappers/tsconfig.json b/packages/abi-gen-wrappers/tsconfig.json
new file mode 100644
index 000000000..233008d61
--- /dev/null
+++ b/packages/abi-gen-wrappers/tsconfig.json
@@ -0,0 +1,8 @@
+{
+ "extends": "../../tsconfig",
+ "compilerOptions": {
+ "outDir": "lib",
+ "rootDir": "."
+ },
+ "include": ["./src/**/*"]
+}
diff --git a/packages/abi-gen/package.json b/packages/abi-gen/package.json
index d6cd80978..bd8c2e749 100644
--- a/packages/abi-gen/package.json
+++ b/packages/abi-gen/package.json
@@ -54,7 +54,6 @@
"@types/tmp": "^0.0.33",
"@types/yargs": "^10.0.0",
"chai": "^4.1.2",
- "copyfiles": "^2.0.0",
"dirty-chai": "^2.0.1",
"make-promises-safe": "^1.1.0",
"mocha": "^5.2.0",
diff --git a/packages/assert/package.json b/packages/assert/package.json
index 795010cd0..3cd09e307 100644
--- a/packages/assert/package.json
+++ b/packages/assert/package.json
@@ -34,7 +34,6 @@
"@types/mocha": "^2.2.42",
"@types/valid-url": "^1.0.2",
"chai": "^4.0.1",
- "copyfiles": "^2.0.0",
"dirty-chai": "^2.0.1",
"make-promises-safe": "^1.1.0",
"mocha": "^4.1.0",
diff --git a/packages/asset-buyer/CHANGELOG.json b/packages/asset-buyer/CHANGELOG.json
index cb364effa..ad9257276 100644
--- a/packages/asset-buyer/CHANGELOG.json
+++ b/packages/asset-buyer/CHANGELOG.json
@@ -8,6 +8,11 @@
{
"note": "Export `BuyQuoteInfo` type",
"pr": 1131
+ },
+ {
+ "note":
+ "Updated to use new modularized artifacts and the latest version of @0xproject/contract-wrappers",
+ "pr": 1105
}
]
},
diff --git a/packages/asset-buyer/package.json b/packages/asset-buyer/package.json
index 291342169..8c8f3c92c 100644
--- a/packages/asset-buyer/package.json
+++ b/packages/asset-buyer/package.json
@@ -8,7 +8,8 @@
"main": "lib/src/index.js",
"types": "lib/src/index.d.ts",
"scripts": {
- "watch_without_deps": "tsc -w",
+ "build": "yarn tsc -b",
+ "build:ci": "yarn build",
"lint": "tslint --project .",
"test": "yarn run_mocha",
"rebuild_and_test": "run-s clean build test",
@@ -16,10 +17,7 @@
"coverage:report:lcov": "nyc report --reporter=text-lcov > coverage/lcov.info",
"test:circleci": "yarn test:coverage",
"run_mocha": "mocha --require source-map-support/register --require make-promises-safe lib/test/**/*_test.js --exit",
- "clean": "shx rm -rf lib test_temp scripts",
- "build": "tsc && copyfiles -u 3 './lib/src/monorepo_scripts/**/*' ./scripts",
- "build:ci": "yarn build",
- "manual:postpublish": "yarn build; node ./scripts/postpublish.js"
+ "clean": "shx rm -rf lib test_temp"
},
"config": {
"postpublish": {
@@ -58,7 +56,6 @@
"chai": "^4.0.1",
"chai-as-promised": "^7.1.0",
"chai-bignumber": "^2.0.1",
- "copyfiles": "^1.2.0",
"dirty-chai": "^2.0.1",
"make-promises-safe": "^1.1.0",
"mocha": "^4.1.0",
diff --git a/packages/asset-buyer/src/asset_buyer.ts b/packages/asset-buyer/src/asset_buyer.ts
index 50343efde..4739e5a29 100644
--- a/packages/asset-buyer/src/asset_buyer.ts
+++ b/packages/asset-buyer/src/asset_buyer.ts
@@ -283,13 +283,13 @@ export class AssetBuyer {
* Will throw if WETH does not exist for the current network.
*/
private _getEtherTokenAssetDataOrThrow(): string {
- return assetDataUtils.getEtherTokenAssetDataOrThrow(this._contractWrappers);
+ return assetDataUtils.getEtherTokenAssetData(this._contractWrappers);
}
/**
* Get the assetData that represents the ZRX token.
* Will throw if ZRX does not exist for the current network.
*/
private _getZrxTokenAssetDataOrThrow(): string {
- return assetDataUtils.getZrxTokenAssetDataOrThrow(this._contractWrappers);
+ return this._contractWrappers.exchange.getZRXAssetData();
}
}
diff --git a/packages/asset-buyer/src/utils/asset_data_utils.ts b/packages/asset-buyer/src/utils/asset_data_utils.ts
index d05ff2504..f54462a23 100644
--- a/packages/asset-buyer/src/utils/asset_data_utils.ts
+++ b/packages/asset-buyer/src/utils/asset_data_utils.ts
@@ -2,25 +2,11 @@ import { ContractWrappers } from '@0xproject/contract-wrappers';
import { assetDataUtils as sharedAssetDataUtils } from '@0xproject/order-utils';
import * as _ from 'lodash';
-import { AssetBuyerError } from '../types';
-
export const assetDataUtils = {
...sharedAssetDataUtils,
- getEtherTokenAssetDataOrThrow(contractWrappers: ContractWrappers): string {
- const etherTokenAddressIfExists = contractWrappers.etherToken.getContractAddressIfExists();
- if (_.isUndefined(etherTokenAddressIfExists)) {
- throw new Error(AssetBuyerError.NoEtherTokenContractFound);
- }
- const etherTokenAssetData = sharedAssetDataUtils.encodeERC20AssetData(etherTokenAddressIfExists);
+ getEtherTokenAssetData(contractWrappers: ContractWrappers): string {
+ const etherTokenAddress = contractWrappers.forwarder.etherTokenAddress;
+ const etherTokenAssetData = sharedAssetDataUtils.encodeERC20AssetData(etherTokenAddress);
return etherTokenAssetData;
},
- getZrxTokenAssetDataOrThrow(contractWrappers: ContractWrappers): string {
- let zrxTokenAssetData: string;
- try {
- zrxTokenAssetData = contractWrappers.exchange.getZRXAssetData();
- } catch (err) {
- throw new Error(AssetBuyerError.NoZrxTokenContractFound);
- }
- return zrxTokenAssetData;
- },
};
diff --git a/packages/base-contract/package.json b/packages/base-contract/package.json
index 4ee471219..3758dd1a7 100644
--- a/packages/base-contract/package.json
+++ b/packages/base-contract/package.json
@@ -32,7 +32,6 @@
"@0xproject/tslint-config": "^1.0.8",
"@types/lodash": "4.14.104",
"chai": "^4.0.1",
- "copyfiles": "^2.0.0",
"make-promises-safe": "^1.1.0",
"mocha": "^4.1.0",
"npm-run-all": "^4.1.2",
diff --git a/packages/contract-addresses/CHANGELOG.json b/packages/contract-addresses/CHANGELOG.json
new file mode 100644
index 000000000..d91ad0b36
--- /dev/null
+++ b/packages/contract-addresses/CHANGELOG.json
@@ -0,0 +1,11 @@
+[
+ {
+ "version": "1.0.0",
+ "changes": [
+ {
+ "pr": 1105,
+ "note": "Initial release"
+ }
+ ]
+ }
+]
diff --git a/packages/contract-addresses/README.md b/packages/contract-addresses/README.md
new file mode 100644
index 000000000..6c615c422
--- /dev/null
+++ b/packages/contract-addresses/README.md
@@ -0,0 +1,69 @@
+## @0xproject/contract-addresses
+
+A tiny utility library for getting known deployed contract addresses for a
+particular network.
+
+## Installation
+
+```bash
+yarn add @0xproject/contract-addresses
+```
+
+**Import**
+
+```typescript
+import { getContractAddressesForNetworkOrThrow } from '@0xproject/contract-addresses';
+```
+
+or
+
+```javascript
+var getContractAddressesForNetworkOrThrow = require('@0xproject/contract-addresses')
+ .getContractAddressesForNetworkOrThrow;
+```
+
+## Contributing
+
+We welcome improvements and fixes from the wider community! To report bugs within this package, please create an issue in this repository.
+
+Please read our [contribution guidelines](../../CONTRIBUTING.md) before getting started.
+
+### Install dependencies
+
+If you don't have yarn workspaces enabled (Yarn < v1.0) - enable them:
+
+```bash
+yarn config set workspaces-experimental true
+```
+
+Then install dependencies
+
+```bash
+yarn install
+```
+
+### Build
+
+To build this package and all other monorepo packages that it depends on, run the following from the monorepo root directory:
+
+```bash
+PKG=@0xproject/contract-addresses yarn build
+```
+
+### Clean
+
+```bash
+yarn clean
+```
+
+### Lint
+
+```bash
+yarn lint
+```
+
+### Run Tests
+
+```bash
+yarn test
+```
diff --git a/packages/contract-addresses/package.json b/packages/contract-addresses/package.json
new file mode 100644
index 000000000..60642224f
--- /dev/null
+++ b/packages/contract-addresses/package.json
@@ -0,0 +1,37 @@
+{
+ "name": "@0xproject/contract-addresses",
+ "version": "1.0.0",
+ "engines": {
+ "node": ">=6.12"
+ },
+ "description": "Used to get known addresses of deployed 0x contracts",
+ "main": "lib/src/index.js",
+ "directories": {
+ "test": "test"
+ },
+ "scripts": {
+ "build": "yarn tsc -b",
+ "build:ci": "yarn build",
+ "clean": "shx rm -rf lib"
+ },
+ "repository": {
+ "type": "git",
+ "url": "https://github.com/0xProject/0x-monorepo.git"
+ },
+ "license": "Apache-2.0",
+ "bugs": {
+ "url": "https://github.com/0xProject/0x-monorepo/issues"
+ },
+ "homepage": "https://github.com/0xProject/0x-monorepo/packages/contract-addresses/README.md",
+ "devDependencies": {
+ "@types/lodash": "4.14.104",
+ "typescript": "3.0.1",
+ "shx": "^0.2.2"
+ },
+ "dependencies": {
+ "lodash": "^4.17.5"
+ },
+ "publishConfig": {
+ "access": "public"
+ }
+}
diff --git a/packages/contract-addresses/src/index.ts b/packages/contract-addresses/src/index.ts
new file mode 100644
index 000000000..1ea8c61dd
--- /dev/null
+++ b/packages/contract-addresses/src/index.ts
@@ -0,0 +1,66 @@
+import * as _ from 'lodash';
+
+export interface ContractAddresses {
+ erc20Proxy: string;
+ erc721Proxy: string;
+ zrxToken: string;
+ etherToken: string;
+ exchange: string;
+ assetProxyOwner: string;
+ forwarder: string;
+ orderValidator: string;
+}
+
+export enum NetworkId {
+ Mainnet = 1,
+ Ropsten = 3,
+ Kovan = 42,
+}
+
+const networkToAddresses: { [networkId: number]: ContractAddresses } = {
+ 1: {
+ erc20Proxy: '0x2240dab907db71e64d3e0dba4800c83b5c502d4e',
+ erc721Proxy: '0x208e41fb445f1bb1b6780d58356e81405f3e6127',
+ zrxToken: '0xe41d2489571d322189246dafa5ebde1f4699f498',
+ etherToken: '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2',
+ exchange: '0x4f833a24e1f95d70f028921e27040ca56e09ab0b',
+ assetProxyOwner: '0x17992e4ffb22730138e4b62aaa6367fa9d3699a6',
+ forwarder: '0x7afc2d5107af94c462a194d2c21b5bdd238709d6',
+ orderValidator: '0x9463e518dea6810309563c81d5266c1b1d149138',
+ },
+ 3: {
+ erc20Proxy: '0xb1408f4c245a23c31b98d2c626777d4c0d766caa',
+ erc721Proxy: '0xe654aac058bfbf9f83fcaee7793311dd82f6ddb4',
+ zrxToken: '0xff67881f8d12f372d91baae9752eb3631ff0ed00',
+ etherToken: '0xc778417e063141139fce010982780140aa0cd5ab',
+ exchange: '0x4530c0483a1633c7a1c97d2c53721caff2caaaaf',
+ assetProxyOwner: '0xf5fa5b5fed2727a0e44ac67f6772e97977aa358b',
+ forwarder: '0x3983e204b12b3c02fb0638caf2cd406a62e0ead3',
+ orderValidator: '0x90431a90516ab49af23a0530e04e8c7836e7122f',
+ },
+ 42: {
+ erc20Proxy: '0xf1ec01d6236d3cd881a0bf0130ea25fe4234003e',
+ erc721Proxy: '0x2a9127c745688a165106c11cd4d647d2220af821',
+ zrxToken: '0x2002d3812f58e35f0ea1ffbf80a75a38c32175fa',
+ etherToken: '0xd0a1e359811322d97991e03f863a0c30c2cf029c',
+ exchange: '0x35dd2932454449b14cee11a94d3674a936d5d7b2',
+ assetProxyOwner: '0x2c824d2882baa668e0d5202b1e7f2922278703f8',
+ forwarder: '0xd85e2fa7e7e252b27b01bf0d65c946959d2f45b8',
+ orderValidator: '0xb389da3d204b412df2f75c6afb3d0a7ce0bc283d',
+ },
+};
+
+/**
+ * Used to get addresses of contracts that have been deployed to either the
+ * Ethereum mainnet or a supported testnet. Throws if there are no known
+ * contracts deployed on the corresponding network.
+ * @param networkId The desired networkId.
+ * @returns The set of addresses for contracts which have been deployed on the
+ * given networkId.
+ */
+export function getContractAddressesForNetworkOrThrow(networkId: NetworkId): ContractAddresses {
+ if (_.isUndefined(networkToAddresses[networkId])) {
+ throw new Error(`Unknown network id (${networkId}). No known 0x contracts have been deployed on this network.`);
+ }
+ return networkToAddresses[networkId];
+}
diff --git a/packages/contract-addresses/tsconfig.json b/packages/contract-addresses/tsconfig.json
new file mode 100644
index 000000000..233008d61
--- /dev/null
+++ b/packages/contract-addresses/tsconfig.json
@@ -0,0 +1,8 @@
+{
+ "extends": "../../tsconfig",
+ "compilerOptions": {
+ "outDir": "lib",
+ "rootDir": "."
+ },
+ "include": ["./src/**/*"]
+}
diff --git a/packages/contract-addresses/tslint.json b/packages/contract-addresses/tslint.json
new file mode 100644
index 000000000..ffaefe83a
--- /dev/null
+++ b/packages/contract-addresses/tslint.json
@@ -0,0 +1,3 @@
+{
+ "extends": ["@0xproject/tslint-config"]
+}
diff --git a/packages/contract-artifacts/CHANGELOG.json b/packages/contract-artifacts/CHANGELOG.json
new file mode 100644
index 000000000..d91ad0b36
--- /dev/null
+++ b/packages/contract-artifacts/CHANGELOG.json
@@ -0,0 +1,11 @@
+[
+ {
+ "version": "1.0.0",
+ "changes": [
+ {
+ "pr": 1105,
+ "note": "Initial release"
+ }
+ ]
+ }
+]
diff --git a/packages/contract-artifacts/README.md b/packages/contract-artifacts/README.md
new file mode 100644
index 000000000..f8901266d
--- /dev/null
+++ b/packages/contract-artifacts/README.md
@@ -0,0 +1,67 @@
+## @0xproject/contract-artifacts
+
+Smart contract compilation artifacts for the latest version of the 0x Protocol.
+
+## Installation
+
+```bash
+yarn add @0xproject/contract-artifacts
+```
+
+**Import**
+
+```typescript
+import * as artifacts from '@0xproject/contract-artifacts';
+```
+
+or
+
+```javascript
+var artifacts = require('@0xproject/contract-artifacts');
+```
+
+## Contributing
+
+We welcome improvements and fixes from the wider community! To report bugs within this package, please create an issue in this repository.
+
+Please read our [contribution guidelines](../../CONTRIBUTING.md) before getting started.
+
+### Install dependencies
+
+If you don't have yarn workspaces enabled (Yarn < v1.0) - enable them:
+
+```bash
+yarn config set workspaces-experimental true
+```
+
+Then install dependencies
+
+```bash
+yarn install
+```
+
+### Build
+
+To build this package and all other monorepo packages that it depends on, run the following from the monorepo root directory:
+
+```bash
+PKG=@0xproject/contract-artifacts yarn build
+```
+
+### Clean
+
+```bash
+yarn clean
+```
+
+### Lint
+
+```bash
+yarn lint
+```
+
+### Run Tests
+
+```bash
+yarn test
+```
diff --git a/packages/migrations/artifacts/2.0.0-trimmed/AssetProxyOwner.json b/packages/contract-artifacts/artifacts/AssetProxyOwner.json
index a9e97c572..e5fad3aef 100644
--- a/packages/migrations/artifacts/2.0.0-trimmed/AssetProxyOwner.json
+++ b/packages/contract-artifacts/artifacts/AssetProxyOwner.json
@@ -695,30 +695,5 @@
}
}
},
- "networks": {
- "1": {
- "address": "0x17992e4ffb22730138e4b62aaa6367fa9d3699a6",
- "links": {},
- "constructorArgs":
- "[[\"0x257619b7155d247e43c8b6d90c8c17278ae481f0\",\"0x5ee2a00f8f01d099451844af7f894f26a57fcbf2\",\"0x894d623e0e0e8ed12c4a73dada999e275684a37d\"],[\"0x2240dab907db71e64d3e0dba4800c83b5c502d4e\",\"0x208e41fb445f1bb1b6780d58356e81405f3e6127\"],\"2\",\"1209600\"]"
- },
- "3": {
- "address": "0xf5fa5b5fed2727a0e44ac67f6772e97977aa358b",
- "links": {},
- "constructorArgs":
- "[[\"0x9df8137872ac09a8fee71d0da5c7539923fb9bf0\",\"0xcf34d44db312d188789f43a63d11cf2bebb4da15\",\"0x73fd50f2a6beac9cdac9fe87ef68a18edc415831\"],[\"0xb1408f4c245a23c31b98d2c626777d4c0d766caa\",\"0xe654aac058bfbf9f83fcaee7793311dd82f6ddb4\"],\"1\",\"0\"]"
- },
- "42": {
- "address": "0x2c824d2882baa668e0d5202b1e7f2922278703f8",
- "links": {},
- "constructorArgs":
- "[[\"0x9df8137872ac09a8fee71d0da5c7539923fb9bf0\",\"0xcf34d44db312d188789f43a63d11cf2bebb4da15\",\"0x73fd50f2a6beac9cdac9fe87ef68a18edc415831\"],[\"0xf1ec01d6236d3cd881a0bf0130ea25fe4234003e\",\"0x2a9127c745688a165106c11cd4d647d2220af821\"],\"1\",\"0\"]"
- },
- "50": {
- "address": "0x34d402f14d58e001d8efbe6585051bf9706aa064",
- "links": {},
- "constructorArgs":
- "[[\"0x9df8137872ac09a8fee71d0da5c7539923fb9bf0\",\"0xcf34d44db312d188789f43a63d11cf2bebb4da15\",\"0x73fd50f2a6beac9cdac9fe87ef68a18edc415831\"],[\"0x1dc4c1cefef38a777b15aa20260a54e584b16c48\",\"0x1d7022f5b17d2f8b695918fb48fa1089c9f85401\"],\"1\",\"0\"]"
- }
- }
+ "networks": {}
}
diff --git a/packages/migrations/artifacts/2.0.0-trimmed/DummyERC20Token.json b/packages/contract-artifacts/artifacts/DummyERC20Token.json
index 1a5b796b9..7b8e7c3a8 100644
--- a/packages/migrations/artifacts/2.0.0-trimmed/DummyERC20Token.json
+++ b/packages/contract-artifacts/artifacts/DummyERC20Token.json
@@ -324,22 +324,5 @@
}
}
},
- "networks": {
- "3": {
- "address": "0xff67881f8d12f372d91baae9752eb3631ff0ed00",
- "links": {},
- "constructorArgs": "[\"0x Protocol Token\",\"ZRX\",\"18\",\"1000000000000000000000000000\"]"
- },
- "42": {
- "address": "0x2002d3812f58e35f0ea1ffbf80a75a38c32175fa",
- "links": {},
- "constructorArgs": "[\"0x Protocol Token\",\"ZRX\",\"18\",\"1000000000000000000000000000\"]"
- },
- "50": {
- "address": "0x871dd7c2b4b25e1aa18728e9d5f2af4c4e431f5c",
- "links": {},
- "constructorArgs":
- "[\"0x Protocol Token\",\"ZRX\",\"18\",\"115792089237316195423570985008687907853269984665640564039457584007913129639935\"]"
- }
- }
+ "networks": {}
}
diff --git a/packages/migrations/artifacts/2.0.0-trimmed/DummyERC721Token.json b/packages/contract-artifacts/artifacts/DummyERC721Token.json
index 7472a5a03..7472a5a03 100644
--- a/packages/migrations/artifacts/2.0.0-trimmed/DummyERC721Token.json
+++ b/packages/contract-artifacts/artifacts/DummyERC721Token.json
diff --git a/packages/migrations/artifacts/2.0.0-trimmed/ERC20Proxy.json b/packages/contract-artifacts/artifacts/ERC20Proxy.json
index 59531be20..33af866e7 100644
--- a/packages/migrations/artifacts/2.0.0-trimmed/ERC20Proxy.json
+++ b/packages/contract-artifacts/artifacts/ERC20Proxy.json
@@ -191,26 +191,5 @@
}
}
},
- "networks": {
- "1": {
- "address": "0x2240dab907db71e64d3e0dba4800c83b5c502d4e",
- "links": {},
- "constructorArgs": "[]"
- },
- "3": {
- "address": "0xb1408f4c245a23c31b98d2c626777d4c0d766caa",
- "links": {},
- "constructorArgs": "[]"
- },
- "42": {
- "address": "0xf1ec01d6236d3cd881a0bf0130ea25fe4234003e",
- "links": {},
- "constructorArgs": "[]"
- },
- "50": {
- "address": "0x1dc4c1cefef38a777b15aa20260a54e584b16c48",
- "links": {},
- "constructorArgs": "[]"
- }
- }
+ "networks": {}
}
diff --git a/packages/migrations/artifacts/2.0.0-trimmed/ERC20Token.json b/packages/contract-artifacts/artifacts/ERC20Token.json
index d89d08a77..d89d08a77 100644
--- a/packages/migrations/artifacts/2.0.0-trimmed/ERC20Token.json
+++ b/packages/contract-artifacts/artifacts/ERC20Token.json
diff --git a/packages/migrations/artifacts/2.0.0-trimmed/ERC721Proxy.json b/packages/contract-artifacts/artifacts/ERC721Proxy.json
index 44614fa1f..db01e40f0 100644
--- a/packages/migrations/artifacts/2.0.0-trimmed/ERC721Proxy.json
+++ b/packages/contract-artifacts/artifacts/ERC721Proxy.json
@@ -191,26 +191,5 @@
}
}
},
- "networks": {
- "1": {
- "address": "0x208e41fb445f1bb1b6780d58356e81405f3e6127",
- "links": {},
- "constructorArgs": "[]"
- },
- "3": {
- "address": "0xe654aac058bfbf9f83fcaee7793311dd82f6ddb4",
- "links": {},
- "constructorArgs": "[]"
- },
- "42": {
- "address": "0x2a9127c745688a165106c11cd4d647d2220af821",
- "links": {},
- "constructorArgs": "[]"
- },
- "50": {
- "address": "0x1d7022f5b17d2f8b695918fb48fa1089c9f85401",
- "links": {},
- "constructorArgs": "[]"
- }
- }
+ "networks": {}
}
diff --git a/packages/migrations/artifacts/2.0.0-trimmed/ERC721Token.json b/packages/contract-artifacts/artifacts/ERC721Token.json
index d189090e8..d189090e8 100644
--- a/packages/migrations/artifacts/2.0.0-trimmed/ERC721Token.json
+++ b/packages/contract-artifacts/artifacts/ERC721Token.json
diff --git a/packages/migrations/artifacts/2.0.0-trimmed/Exchange.json b/packages/contract-artifacts/artifacts/Exchange.json
index 3eb231c7a..893bc5eae 100644
--- a/packages/migrations/artifacts/2.0.0-trimmed/Exchange.json
+++ b/packages/contract-artifacts/artifacts/Exchange.json
@@ -1972,26 +1972,5 @@
}
}
},
- "networks": {
- "1": {
- "address": "0x4f833a24e1f95d70f028921e27040ca56e09ab0b",
- "links": {},
- "constructorArgs": "[]"
- },
- "3": {
- "address": "0x4530c0483a1633c7a1c97d2c53721caff2caaaaf",
- "links": {},
- "constructorArgs": "[\"0xf47261b0000000000000000000000000ff67881f8d12f372d91baae9752eb3631ff0ed00\"]"
- },
- "42": {
- "address": "0x35dd2932454449b14cee11a94d3674a936d5d7b2",
- "links": {},
- "constructorArgs": "[\"0xf47261b00000000000000000000000002002d3812f58e35f0ea1ffbf80a75a38c32175fa\"]"
- },
- "50": {
- "address": "0x48bacb9266a570d521063ef5dd96e61686dbe788",
- "links": {},
- "constructorArgs": "[\"0xf47261b0000000000000000000000000871dd7c2b4b25e1aa18728e9d5f2af4c4e431f5c\"]"
- }
- }
+ "networks": {}
}
diff --git a/packages/migrations/artifacts/2.0.0-trimmed/Forwarder.json b/packages/contract-artifacts/artifacts/Forwarder.json
index 9fe4fd601..4f93b231b 100644
--- a/packages/migrations/artifacts/2.0.0-trimmed/Forwarder.json
+++ b/packages/contract-artifacts/artifacts/Forwarder.json
@@ -444,30 +444,5 @@
}
}
},
- "networks": {
- "1": {
- "address": "0x7afc2d5107af94c462a194d2c21b5bdd238709d6",
- "links": {},
- "constructorArgs":
- "[\"0x4f833a24e1f95d70f028921e27040ca56e09ab0b\",\"0xf47261b0000000000000000000000000e41d2489571d322189246dafa5ebde1f4699f498\",\"0xf47261b0000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2\"]"
- },
- "3": {
- "address": "0x3983e204b12b3c02fb0638caf2cd406a62e0ead3",
- "links": {},
- "constructorArgs":
- "[\"0x4530c0483a1633c7a1c97d2c53721caff2caaaaf\",\"0xf47261b0000000000000000000000000ff67881f8d12f372d91baae9752eb3631ff0ed00\",\"0xf47261b0000000000000000000000000c778417e063141139fce010982780140aa0cd5ab\"]"
- },
- "42": {
- "address": "0xd85e2fa7e7e252b27b01bf0d65c946959d2f45b8",
- "links": {},
- "constructorArgs":
- "[\"0x35dd2932454449b14cee11a94d3674a936d5d7b2\",\"0xf47261b00000000000000000000000002002d3812f58e35f0ea1ffbf80a75a38c32175fa\",\"0xf47261b0000000000000000000000000d0a1e359811322d97991e03f863a0c30c2cf029c\"]"
- },
- "50": {
- "address": "0xb69e673309512a9d726f87304c6984054f87a93b",
- "links": {},
- "constructorArgs":
- "[\"0x0b1ba0af832d7c05fd64161e0db78e85978e8082\",\"0xf47261b0000000000000000000000000871dd7c2b4b25e1aa18728e9d5f2af4c4e431f5c\",\"0xf47261b00000000000000000000000000000000000000000000000000000000000000000\"]"
- }
- }
+ "networks": {}
}
diff --git a/packages/migrations/artifacts/2.0.0-trimmed/IValidator.json b/packages/contract-artifacts/artifacts/IValidator.json
index 8ca99f261..8ca99f261 100644
--- a/packages/migrations/artifacts/2.0.0-trimmed/IValidator.json
+++ b/packages/contract-artifacts/artifacts/IValidator.json
diff --git a/packages/migrations/artifacts/2.0.0-trimmed/IWallet.json b/packages/contract-artifacts/artifacts/IWallet.json
index 2a8f975cc..2a8f975cc 100644
--- a/packages/migrations/artifacts/2.0.0-trimmed/IWallet.json
+++ b/packages/contract-artifacts/artifacts/IWallet.json
diff --git a/packages/migrations/artifacts/2.0.0-trimmed/OrderValidator.json b/packages/contract-artifacts/artifacts/OrderValidator.json
index 85032bbeb..90a92e7cb 100644
--- a/packages/migrations/artifacts/2.0.0-trimmed/OrderValidator.json
+++ b/packages/contract-artifacts/artifacts/OrderValidator.json
@@ -568,30 +568,5 @@
}
}
},
- "networks": {
- "1": {
- "address": "0x9463e518dea6810309563c81d5266c1b1d149138",
- "links": {},
- "constructorArgs":
- "[\"0x4f833a24e1f95d70f028921e27040ca56e09ab0b\",\"0xf47261b0000000000000000000000000e41d2489571d322189246dafa5ebde1f4699f498\"]"
- },
- "3": {
- "address": "0x90431a90516ab49af23a0530e04e8c7836e7122f",
- "links": {},
- "constructorArgs":
- "[\"0x4530c0483a1633c7a1c97d2c53721caff2caaaaf\",\"0xf47261b0000000000000000000000000ff67881f8d12f372d91baae9752eb3631ff0ed00\"]"
- },
- "42": {
- "address": "0xb389da3d204b412df2f75c6afb3d0a7ce0bc283d",
- "links": {},
- "constructorArgs":
- "[\"0x35dd2932454449b14cee11a94d3674a936d5d7b2\",\"0xf47261b00000000000000000000000002002d3812f58e35f0ea1ffbf80a75a38c32175fa\"]"
- },
- "50": {
- "address": "0xe86bb98fcf9bff3512c74589b78fb168200cc546",
- "links": {},
- "constructorArgs":
- "[\"0x48bacb9266a570d521063ef5dd96e61686dbe788\",\"0xf47261b0000000000000000000000000871dd7c2b4b25e1aa18728e9d5f2af4c4e431f5c\"]"
- }
- }
+ "networks": {}
}
diff --git a/packages/migrations/artifacts/2.0.0-trimmed/WETH9.json b/packages/contract-artifacts/artifacts/WETH9.json
index cd2d83104..e6ce25f7d 100644
--- a/packages/migrations/artifacts/2.0.0-trimmed/WETH9.json
+++ b/packages/contract-artifacts/artifacts/WETH9.json
@@ -289,26 +289,5 @@
}
}
},
- "networks": {
- "1": {
- "address": "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2",
- "links": {},
- "constructorArgs": "[]"
- },
- "3": {
- "address": "0xc778417e063141139fce010982780140aa0cd5ab",
- "links": {},
- "constructorArgs": "[]"
- },
- "42": {
- "address": "0xd0a1e359811322d97991e03f863a0c30c2cf029c",
- "links": {},
- "constructorArgs": "[]"
- },
- "50": {
- "address": "0x0b1ba0af832d7c05fd64161e0db78e85978e8082",
- "links": {},
- "constructorArgs": "[]"
- }
- }
+ "networks": {}
}
diff --git a/packages/migrations/artifacts/2.0.0-trimmed/ZRXToken.json b/packages/contract-artifacts/artifacts/ZRXToken.json
index c2053578f..29bb55824 100644
--- a/packages/migrations/artifacts/2.0.0-trimmed/ZRXToken.json
+++ b/packages/contract-artifacts/artifacts/ZRXToken.json
@@ -223,26 +223,5 @@
}
}
},
- "networks": {
- "1": {
- "address": "0xe41d2489571d322189246dafa5ebde1f4699f498",
- "links": {},
- "constructorArgs": "[]"
- },
- "3": {
- "address": "0xff67881f8d12f372d91baae9752eb3631ff0ed00",
- "links": {},
- "constructorArgs": "[\"0x Protocol Token\",\"ZRX\",\"18\",\"1000000000000000000000000000\"]"
- },
- "42": {
- "address": "0x2002d3812f58e35f0ea1ffbf80a75a38c32175fa",
- "links": {},
- "constructorArgs": "[\"0x Protocol Token\",\"ZRX\",\"18\",\"1000000000000000000000000000\"]"
- },
- "50": {
- "address": "0x871dd7c2b4b25e1aa18728e9d5f2af4c4e431f5c",
- "links": {},
- "constructorArgs": "[]"
- }
- }
+ "networks": {}
}
diff --git a/packages/contract-artifacts/package.json b/packages/contract-artifacts/package.json
new file mode 100644
index 000000000..3e1696695
--- /dev/null
+++ b/packages/contract-artifacts/package.json
@@ -0,0 +1,33 @@
+{
+ "name": "@0xproject/contract-artifacts",
+ "version": "1.0.0",
+ "engines": {
+ "node": ">=6.12"
+ },
+ "description": "0x smart contract compilation artifacts",
+ "main": "lib/src/index.js",
+ "directories": {
+ "test": "test"
+ },
+ "scripts": {
+ "build": "yarn tsc -b",
+ "build:ci": "yarn build",
+ "clean": "shx rm -rf lib"
+ },
+ "repository": {
+ "type": "git",
+ "url": "https://github.com/0xProject/0x-monorepo.git"
+ },
+ "license": "Apache-2.0",
+ "bugs": {
+ "url": "https://github.com/0xProject/0x-monorepo/issues"
+ },
+ "homepage": "https://github.com/0xProject/0x-monorepo/packages/contract-artifacts/README.md",
+ "devDependencies": {
+ "typescript": "3.0.1",
+ "shx": "^0.2.2"
+ },
+ "publishConfig": {
+ "access": "public"
+ }
+}
diff --git a/packages/contract-artifacts/src/index.ts b/packages/contract-artifacts/src/index.ts
new file mode 100644
index 000000000..f30276dd9
--- /dev/null
+++ b/packages/contract-artifacts/src/index.ts
@@ -0,0 +1,31 @@
+import * as AssetProxyOwner from '../artifacts/AssetProxyOwner.json';
+import * as DummyERC20Token from '../artifacts/DummyERC20Token.json';
+import * as DummyERC721Token from '../artifacts/DummyERC721Token.json';
+import * as ERC20Proxy from '../artifacts/ERC20Proxy.json';
+import * as ERC20Token from '../artifacts/ERC20Token.json';
+import * as ERC721Proxy from '../artifacts/ERC721Proxy.json';
+import * as ERC721Token from '../artifacts/ERC721Token.json';
+import * as Exchange from '../artifacts/Exchange.json';
+import * as Forwarder from '../artifacts/Forwarder.json';
+import * as IValidator from '../artifacts/IValidator.json';
+import * as IWallet from '../artifacts/IWallet.json';
+import * as OrderValidator from '../artifacts/OrderValidator.json';
+import * as WETH9 from '../artifacts/WETH9.json';
+import * as ZRXToken from '../artifacts/ZRXToken.json';
+
+export {
+ AssetProxyOwner,
+ DummyERC20Token,
+ DummyERC721Token,
+ ERC20Proxy,
+ ERC20Token,
+ ERC721Proxy,
+ ERC721Token,
+ Exchange,
+ Forwarder,
+ IValidator,
+ IWallet,
+ OrderValidator,
+ WETH9,
+ ZRXToken,
+};
diff --git a/packages/contract-artifacts/tsconfig.json b/packages/contract-artifacts/tsconfig.json
new file mode 100644
index 000000000..cce086209
--- /dev/null
+++ b/packages/contract-artifacts/tsconfig.json
@@ -0,0 +1,25 @@
+{
+ "extends": "../../tsconfig",
+ "compilerOptions": {
+ "outDir": "lib",
+ "rootDir": ".",
+ "resolveJsonModule": true
+ },
+ "include": ["./src/**/*"],
+ "files": [
+ "./artifacts/AssetProxyOwner.json",
+ "./artifacts/DummyERC20Token.json",
+ "./artifacts/DummyERC721Token.json",
+ "./artifacts/ERC20Proxy.json",
+ "./artifacts/ERC20Token.json",
+ "./artifacts/ERC721Proxy.json",
+ "./artifacts/ERC721Token.json",
+ "./artifacts/Exchange.json",
+ "./artifacts/Forwarder.json",
+ "./artifacts/IValidator.json",
+ "./artifacts/IWallet.json",
+ "./artifacts/OrderValidator.json",
+ "./artifacts/WETH9.json",
+ "./artifacts/ZRXToken.json"
+ ]
+}
diff --git a/packages/contract-artifacts/tslint.json b/packages/contract-artifacts/tslint.json
new file mode 100644
index 000000000..ffaefe83a
--- /dev/null
+++ b/packages/contract-artifacts/tslint.json
@@ -0,0 +1,3 @@
+{
+ "extends": ["@0xproject/tslint-config"]
+}
diff --git a/packages/contract-wrappers/CHANGELOG.json b/packages/contract-wrappers/CHANGELOG.json
index 0770b6c0d..9bb5e5fc5 100644
--- a/packages/contract-wrappers/CHANGELOG.json
+++ b/packages/contract-wrappers/CHANGELOG.json
@@ -1,9 +1,42 @@
[
{
- "version": "2.1.0",
+ "version": "3.0.0",
"changes": [
{
"note": "Add optional validation to the forwarder wrapper methods"
+ },
+ {
+ "note": "Updated to use new modularized artifacts.",
+ "pr": 1105
+ },
+ {
+ "note": "Top-level `ContractWrappers` class has a new optional `contractAddresses` parameter.",
+ "pr": 1105
+ },
+ {
+ "note":
+ "Default contract addresses are no longer stored in artifacts and are instead loaded from the `@0xproject/contract-addresses` package.",
+ "pr": 1105
+ },
+ {
+ "note":
+ "Most contract addresses are now defined at instantiation time and are available as properties (e.g., `exchangeWrapper.address`) instead of methods (e.g., `exchangeWrapper.getContractAddress()`).",
+ "pr": 1105
+ },
+ {
+ "note":
+ "Removed `setProvider` method in top-level `ContractWrapper` class and added new `unsubscribeAll` method.",
+ "pr": 1105
+ },
+ {
+ "note":
+ "Some properties and methods have been renamed. For example, some methods that previously could throw no longer can, and so their names have been updated accordingly.",
+ "pr": 1105
+ },
+ {
+ "note":
+ "Removed ContractNotFound errors. Checking for this error was somewhat ineffecient. Relevant methods/functions now return the default error from web3-wrapper, which we feel provides enough information.",
+ "pr": 1105
}
]
},
diff --git a/packages/contract-wrappers/package.json b/packages/contract-wrappers/package.json
index 35f27d77c..3924378d3 100644
--- a/packages/contract-wrappers/package.json
+++ b/packages/contract-wrappers/package.json
@@ -11,24 +11,19 @@
"main": "lib/src/index.js",
"types": "lib/src/index.d.ts",
"scripts": {
- "build": "yarn pre_build && tsc -b",
+ "build": "tsc -b",
"build:ci": "yarn build",
- "pre_build": "run-s update_artifacts generate_contract_wrappers copy_artifacts",
- "generate_contract_wrappers": "abi-gen --abis 'src/artifacts/@(Exchange|DummyERC20Token|DummyERC721Token|ZRXToken|ERC20Token|ERC721Token|WETH9|ERC20Proxy|ERC721Proxy|Forwarder|OrderValidator).json' --template ../contract_templates/contract.handlebars --partials '../contract_templates/partials/**/*.handlebars' --output src/contract_wrappers/generated --backend ethers",
"lint": "tslint --project . --exclude **/src/contract_wrappers/**/* --exclude **/lib/**/*",
"test:circleci": "run-s test:coverage",
"test": "yarn run_mocha",
"rebuild_and_test": "run-s build test",
"test:coverage": "nyc npm run test --all && yarn coverage:report:lcov",
"coverage:report:lcov": "nyc report --reporter=text-lcov > coverage/lcov.info",
- "update_artifacts": "for i in ${npm_package_config_contracts_v2}; do copyfiles -u 4 ../migrations/artifacts/2.0.0-trimmed/$i.json src/artifacts; done;",
- "copy_artifacts": "copyfiles -u 2 './src/artifacts/**/*.json' ./lib/src/artifacts",
- "clean": "shx rm -rf _bundles lib test_temp test/artifacts src/contract_wrappers/generated src/artifacts generated_docs",
+ "clean": "shx rm -rf _bundles lib test_temp generated_docs",
"run_mocha": "mocha --require source-map-support/register --require make-promises-safe lib/test/**/*_test.js lib/test/global_hooks.js --timeout 10000 --bail --exit",
"docs:json": "typedoc --excludePrivate --excludeExternals --target ES5 --tsconfig typedoc-tsconfig.json --json $JSON_FILE_PATH $PROJECT_FILES"
},
"config": {
- "contracts_v2": "AssetProxyOwner Exchange ERC20Proxy ERC20Token ERC721Proxy ERC721Token WETH9 ZRXToken Forwarder OrderValidator DummyERC20Token DummyERC721Token",
"postpublish": {
"assets": []
}
@@ -42,7 +37,6 @@
"node": ">=6.0.0"
},
"devDependencies": {
- "@0xproject/abi-gen": "^1.0.13",
"@0xproject/dev-utils": "^1.0.12",
"@0xproject/migrations": "^1.0.14",
"@0xproject/subproviders": "^2.0.7",
@@ -56,7 +50,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",
@@ -72,8 +65,10 @@
"web3-provider-engine": "14.0.6"
},
"dependencies": {
+ "@0xproject/abi-gen-wrappers": "^1.0.0",
"@0xproject/assert": "^1.0.13",
- "@0xproject/base-contract": "^3.0.1",
+ "@0xproject/contract-addresses": "^1.0.0",
+ "@0xproject/contract-artifacts": "^1.0.0",
"@0xproject/fill-scenarios": "^1.0.7",
"@0xproject/json-schemas": "^1.0.7",
"@0xproject/order-utils": "^1.0.7",
diff --git a/packages/contract-wrappers/src/artifacts.ts b/packages/contract-wrappers/src/artifacts.ts
deleted file mode 100644
index 925f34162..000000000
--- a/packages/contract-wrappers/src/artifacts.ts
+++ /dev/null
@@ -1,27 +0,0 @@
-import { ContractArtifact } from 'ethereum-types';
-
-import * as DummyERC20Token from './artifacts/DummyERC20Token.json';
-import * as DummyERC721Token from './artifacts/DummyERC721Token.json';
-import * as ERC20Proxy from './artifacts/ERC20Proxy.json';
-import * as ERC20Token from './artifacts/ERC20Token.json';
-import * as ERC721Proxy from './artifacts/ERC721Proxy.json';
-import * as ERC721Token from './artifacts/ERC721Token.json';
-import * as Exchange from './artifacts/Exchange.json';
-import * as Forwarder from './artifacts/Forwarder.json';
-import * as OrderValidator from './artifacts/OrderValidator.json';
-import * as EtherToken from './artifacts/WETH9.json';
-import * as ZRXToken from './artifacts/ZRXToken.json';
-
-export const artifacts = {
- ZRXToken: (ZRXToken as any) as ContractArtifact,
- DummyERC20Token: (DummyERC20Token as any) as ContractArtifact,
- DummyERC721Token: (DummyERC721Token as any) as ContractArtifact,
- ERC20Token: (ERC20Token as any) as ContractArtifact,
- ERC721Token: (ERC721Token as any) as ContractArtifact,
- Exchange: (Exchange as any) as ContractArtifact,
- EtherToken: (EtherToken as any) as ContractArtifact,
- ERC20Proxy: (ERC20Proxy as any) as ContractArtifact,
- ERC721Proxy: (ERC721Proxy as any) as ContractArtifact,
- Forwarder: (Forwarder as any) as ContractArtifact,
- OrderValidator: (OrderValidator as any) as ContractArtifact,
-};
diff --git a/packages/contract-wrappers/src/contract_wrappers.ts b/packages/contract-wrappers/src/contract_wrappers.ts
index 89402029b..36381c623 100644
--- a/packages/contract-wrappers/src/contract_wrappers.ts
+++ b/packages/contract-wrappers/src/contract_wrappers.ts
@@ -1,10 +1,17 @@
+import {
+ ERC20Proxy,
+ ERC20Token,
+ ERC721Proxy,
+ ERC721Token,
+ Exchange,
+ Forwarder,
+ OrderValidator,
+ WETH9,
+} from '@0xproject/contract-artifacts';
import { Web3Wrapper } from '@0xproject/web3-wrapper';
import { Provider } from 'ethereum-types';
import * as _ from 'lodash';
-import { constants } from './utils/constants';
-
-import { artifacts } from './artifacts';
import { ERC20ProxyWrapper } from './contract_wrappers/erc20_proxy_wrapper';
import { ERC20TokenWrapper } from './contract_wrappers/erc20_token_wrapper';
import { ERC721ProxyWrapper } from './contract_wrappers/erc721_proxy_wrapper';
@@ -14,10 +21,11 @@ import { ExchangeWrapper } from './contract_wrappers/exchange_wrapper';
import { ForwarderWrapper } from './contract_wrappers/forwarder_wrapper';
import { OrderValidatorWrapper } from './contract_wrappers/order_validator_wrapper';
import { ContractWrappersConfigSchema } from './schemas/contract_wrappers_config_schema';
-import { contractWrappersPrivateNetworkConfigSchema } from './schemas/contract_wrappers_private_network_config_schema';
-import { contractWrappersPublicNetworkConfigSchema } from './schemas/contract_wrappers_public_network_config_schema';
import { ContractWrappersConfig } from './types';
import { assert } from './utils/assert';
+import { constants } from './utils/constants';
+import { _getDefaultContractAddresses } from './utils/contract_addresses';
+
/**
* The ContractWrappers class contains smart contract wrappers helpful when building on 0x protocol.
*/
@@ -61,35 +69,39 @@ export class ContractWrappers {
private readonly _web3Wrapper: Web3Wrapper;
/**
* Instantiates a new ContractWrappers instance.
- * @param provider The Provider instance you would like the 0x.js library to use for interacting with
+ * @param provider The Provider instance you would like the contract-wrappers library to use for interacting with
* the Ethereum network.
* @param config The configuration object. Look up the type for the description.
* @return An instance of the ContractWrappers class.
*/
constructor(provider: Provider, config: ContractWrappersConfig) {
assert.isWeb3Provider('provider', provider);
- assert.doesConformToSchema('config', config, ContractWrappersConfigSchema, [
- contractWrappersPrivateNetworkConfigSchema,
- contractWrappersPublicNetworkConfigSchema,
- ]);
- const artifactJSONs = _.values(artifacts);
- const abiArrays = _.map(artifactJSONs, artifact => artifact.compilerOutput.abi);
+ assert.doesConformToSchema('config', config, ContractWrappersConfigSchema);
const txDefaults = {
gasPrice: config.gasPrice,
};
this._web3Wrapper = new Web3Wrapper(provider, txDefaults);
- _.forEach(abiArrays, abi => {
- this._web3Wrapper.abiDecoder.addABI(abi);
+ const artifactsArray = [
+ ERC20Proxy,
+ ERC20Token,
+ ERC721Proxy,
+ ERC721Token,
+ Exchange,
+ Forwarder,
+ OrderValidator,
+ WETH9,
+ ];
+ _.forEach(artifactsArray, artifact => {
+ this._web3Wrapper.abiDecoder.addABI(artifact.compilerOutput.abi);
});
const blockPollingIntervalMs = _.isUndefined(config.blockPollingIntervalMs)
? constants.DEFAULT_BLOCK_POLLING_INTERVAL
: config.blockPollingIntervalMs;
- this.erc20Proxy = new ERC20ProxyWrapper(this._web3Wrapper, config.networkId, config.erc20ProxyContractAddress);
- this.erc721Proxy = new ERC721ProxyWrapper(
- this._web3Wrapper,
- config.networkId,
- config.erc721ProxyContractAddress,
- );
+ const contractAddresses = _.isUndefined(config.contractAddresses)
+ ? _getDefaultContractAddresses(config.networkId)
+ : config.contractAddresses;
+ this.erc20Proxy = new ERC20ProxyWrapper(this._web3Wrapper, config.networkId, contractAddresses.erc20Proxy);
+ this.erc721Proxy = new ERC721ProxyWrapper(this._web3Wrapper, config.networkId, contractAddresses.erc721Proxy);
this.erc20Token = new ERC20TokenWrapper(
this._web3Wrapper,
config.networkId,
@@ -113,37 +125,34 @@ export class ContractWrappers {
config.networkId,
this.erc20Token,
this.erc721Token,
- config.exchangeContractAddress,
- config.zrxContractAddress,
+ contractAddresses.exchange,
+ contractAddresses.zrxToken,
blockPollingIntervalMs,
);
this.forwarder = new ForwarderWrapper(
this._web3Wrapper,
config.networkId,
- config.forwarderContractAddress,
- config.zrxContractAddress,
+ contractAddresses.forwarder,
+ contractAddresses.zrxToken,
+ contractAddresses.etherToken,
+ );
+ this.orderValidator = new OrderValidatorWrapper(
+ this._web3Wrapper,
+ config.networkId,
+ contractAddresses.orderValidator,
);
- this.orderValidator = new OrderValidatorWrapper(this._web3Wrapper, config.networkId);
}
/**
- * Sets a new web3 provider for 0x.js. Updating the provider will stop all
- * subscriptions so you will need to re-subscribe to all events relevant to your app after this call.
- * @param provider The Web3Provider you would like the 0x.js library to use from now on.
- * @param networkId The id of the network your provider is connected to
+ * Unsubscribes from all subscriptions for all contracts.
*/
- public setProvider(provider: Provider, networkId: number): void {
- this._web3Wrapper.setProvider(provider);
- (this.exchange as any)._invalidateContractInstances();
- (this.exchange as any)._setNetworkId(networkId);
- (this.erc20Token as any)._invalidateContractInstances();
- (this.erc20Token as any)._setNetworkId(networkId);
- (this.erc20Proxy as any)._invalidateContractInstance();
- (this.erc20Proxy as any)._setNetworkId(networkId);
- (this.etherToken as any)._invalidateContractInstance();
- (this.etherToken as any)._setNetworkId(networkId);
+ public unsubscribeAll(): void {
+ this.exchange.unsubscribeAll();
+ this.erc20Token.unsubscribeAll();
+ this.erc721Token.unsubscribeAll();
+ this.etherToken.unsubscribeAll();
}
/**
- * Get the provider instance currently used by 0x.js
+ * Get the provider instance currently used by contract-wrappers
* @return Web3 provider instance
*/
public getProvider(): Provider {
diff --git a/packages/contract-wrappers/src/contract_wrappers/contract_wrapper.ts b/packages/contract-wrappers/src/contract_wrappers/contract_wrapper.ts
index f7a89e3be..e03e4188b 100644
--- a/packages/contract-wrappers/src/contract_wrappers/contract_wrapper.ts
+++ b/packages/contract-wrappers/src/contract_wrappers/contract_wrapper.ts
@@ -3,7 +3,6 @@ import { marshaller, Web3Wrapper } from '@0xproject/web3-wrapper';
import {
BlockParamLiteral,
ContractAbi,
- ContractArtifact,
FilterObject,
LogEntry,
LogWithDecodedArgs,
@@ -24,22 +23,10 @@ import {
import { constants } from '../utils/constants';
import { filterUtils } from '../utils/filter_utils';
-const CONTRACT_NAME_TO_NOT_FOUND_ERROR: {
- [contractName: string]: ContractWrappersError;
-} = {
- ZRX: ContractWrappersError.ZRXContractDoesNotExist,
- EtherToken: ContractWrappersError.EtherTokenContractDoesNotExist,
- ERC20Token: ContractWrappersError.ERC20TokenContractDoesNotExist,
- ERC20Proxy: ContractWrappersError.ERC20ProxyContractDoesNotExist,
- ERC721Token: ContractWrappersError.ERC721TokenContractDoesNotExist,
- ERC721Proxy: ContractWrappersError.ERC721ProxyContractDoesNotExist,
- Exchange: ContractWrappersError.ExchangeContractDoesNotExist,
-};
-
export abstract class ContractWrapper {
public abstract abi: ContractAbi;
- protected _web3Wrapper: Web3Wrapper;
protected _networkId: number;
+ protected _web3Wrapper: Web3Wrapper;
private _blockAndLogStreamerIfExists: BlockAndLogStreamer<Block, Log> | undefined;
private _blockPollingIntervalMs: number;
private _blockAndLogStreamIntervalIfExists?: NodeJS.Timer;
@@ -124,40 +111,6 @@ export abstract class ContractWrapper {
const logWithDecodedArgs = abiDecoder.tryToDecodeLogOrNoop(log);
return logWithDecodedArgs;
}
- protected async _getContractAbiAndAddressFromArtifactsAsync(
- artifact: ContractArtifact,
- addressIfExists?: string,
- ): Promise<[ContractAbi, string]> {
- let contractAddress: string;
- if (_.isUndefined(addressIfExists)) {
- if (_.isUndefined(artifact.networks[this._networkId])) {
- throw new Error(ContractWrappersError.ContractNotDeployedOnNetwork);
- }
- contractAddress = artifact.networks[this._networkId].address.toLowerCase();
- } else {
- contractAddress = addressIfExists;
- }
- const doesContractExist = await this._web3Wrapper.doesContractExistAtAddressAsync(contractAddress);
- if (!doesContractExist) {
- throw new Error(CONTRACT_NAME_TO_NOT_FOUND_ERROR[artifact.contractName]);
- }
- const abiAndAddress: [ContractAbi, string] = [artifact.compilerOutput.abi, contractAddress];
- return abiAndAddress;
- }
- protected _getContractAddress(artifact: ContractArtifact, addressIfExists?: string): string {
- if (_.isUndefined(addressIfExists)) {
- if (_.isUndefined(artifact.networks[this._networkId])) {
- throw new Error(ContractWrappersError.ContractNotDeployedOnNetwork);
- }
- const contractAddress = artifact.networks[this._networkId].address;
- if (_.isUndefined(contractAddress)) {
- throw new Error(CONTRACT_NAME_TO_NOT_FOUND_ERROR[artifact.contractName]);
- }
- return contractAddress;
- } else {
- return addressIfExists;
- }
- }
private _onLogStateChanged<ArgsType extends ContractEventArgs>(isRemoved: boolean, rawLog: RawLogEntry): void {
const log: LogEntry = marshaller.unmarshalLog(rawLog);
_.forEach(this._filters, (filter: FilterObject, filterToken: string) => {
@@ -222,14 +175,6 @@ export abstract class ContractWrapper {
});
return logs as RawLogEntry[];
}
- // HACK: This should be a package-scoped method (which doesn't exist in TS)
- // We don't want this method available in the public interface for all classes
- // who inherit from ContractWrapper, and it is only used by the internal implementation
- // of those higher classes.
- // tslint:disable-next-line:no-unused-variable
- private _setNetworkId(networkId: number): void {
- this._networkId = networkId;
- }
private _stopBlockAndLogStream(): void {
if (_.isUndefined(this._blockAndLogStreamerIfExists)) {
throw new Error(ContractWrappersError.SubscriptionNotFound);
diff --git a/packages/contract-wrappers/src/contract_wrappers/erc20_proxy_wrapper.ts b/packages/contract-wrappers/src/contract_wrappers/erc20_proxy_wrapper.ts
index ff027d78a..e59b2c20b 100644
--- a/packages/contract-wrappers/src/contract_wrappers/erc20_proxy_wrapper.ts
+++ b/packages/contract-wrappers/src/contract_wrappers/erc20_proxy_wrapper.ts
@@ -1,38 +1,39 @@
+import { ERC20ProxyContract } from '@0xproject/abi-gen-wrappers';
+import { ERC20Proxy } from '@0xproject/contract-artifacts';
import { AssetProxyId } from '@0xproject/types';
import { Web3Wrapper } from '@0xproject/web3-wrapper';
import { ContractAbi } from 'ethereum-types';
import * as _ from 'lodash';
-import { artifacts } from '../artifacts';
import { assert } from '../utils/assert';
+import { _getDefaultContractAddresses } from '../utils/contract_addresses';
import { ContractWrapper } from './contract_wrapper';
-import { ERC20ProxyContract } from './generated/erc20_proxy';
/**
* This class includes the functionality related to interacting with the ERC20Proxy contract.
*/
export class ERC20ProxyWrapper extends ContractWrapper {
- public abi: ContractAbi = artifacts.ERC20Proxy.compilerOutput.abi;
+ public abi: ContractAbi = ERC20Proxy.compilerOutput.abi;
+ public address: string;
private _erc20ProxyContractIfExists?: ERC20ProxyContract;
- private _contractAddressIfExists?: string;
/**
* Instantiate ERC20ProxyWrapper
* @param web3Wrapper Web3Wrapper instance to use
* @param networkId Desired networkId
- * @param contractAddressIfExists The contract address to use. This is usually pulled from
- * the artifacts but needs to be specified when using with your own custom testnet.
+ * @param address The address of the ERC20Proxy contract. If undefined, will
+ * default to the known address corresponding to the networkId.
*/
- constructor(web3Wrapper: Web3Wrapper, networkId: number, contractAddressIfExists?: string) {
+ constructor(web3Wrapper: Web3Wrapper, networkId: number, address?: string) {
super(web3Wrapper, networkId);
- this._contractAddressIfExists = contractAddressIfExists;
+ this.address = _.isUndefined(address) ? _getDefaultContractAddresses(networkId).erc20Proxy : address;
}
/**
* Get the 4 bytes ID of this asset proxy
* @return Proxy id
*/
public async getProxyIdAsync(): Promise<AssetProxyId> {
- const ERC20ProxyContractInstance = await this._getERC20ProxyContractAsync();
+ const ERC20ProxyContractInstance = this._getERC20ProxyContract();
const proxyId = (await ERC20ProxyContractInstance.getProxyId.callAsync()) as AssetProxyId;
return proxyId;
}
@@ -44,7 +45,7 @@ export class ERC20ProxyWrapper extends ContractWrapper {
public async isAuthorizedAsync(exchangeContractAddress: string): Promise<boolean> {
assert.isETHAddressHex('exchangeContractAddress', exchangeContractAddress);
const normalizedExchangeContractAddress = exchangeContractAddress.toLowerCase();
- const ERC20ProxyContractInstance = await this._getERC20ProxyContractAsync();
+ const ERC20ProxyContractInstance = this._getERC20ProxyContract();
const isAuthorized = await ERC20ProxyContractInstance.authorized.callAsync(normalizedExchangeContractAddress);
return isAuthorized;
}
@@ -53,36 +54,17 @@ export class ERC20ProxyWrapper extends ContractWrapper {
* @return The list of authorized addresses.
*/
public async getAuthorizedAddressesAsync(): Promise<string[]> {
- const ERC20ProxyContractInstance = await this._getERC20ProxyContractAsync();
+ const ERC20ProxyContractInstance = this._getERC20ProxyContract();
const authorizedAddresses = await ERC20ProxyContractInstance.getAuthorizedAddresses.callAsync();
return authorizedAddresses;
}
- /**
- * Retrieves the Ethereum address of the ERC20Proxy contract deployed on the network
- * that the user-passed web3 provider is connected to.
- * @returns The Ethereum address of the ERC20Proxy contract being used.
- */
- public getContractAddress(): string {
- const contractAddress = this._getContractAddress(artifacts.ERC20Proxy, this._contractAddressIfExists);
- return contractAddress;
- }
- // HACK: We don't want this method to be visible to the other units within that package but not to the end user.
- // TS doesn't give that possibility and therefore we make it private and access it over an any cast. Because of that tslint sees it as unused.
- // tslint:disable-next-line:no-unused-variable
- private _invalidateContractInstance(): void {
- delete this._erc20ProxyContractIfExists;
- }
- private async _getERC20ProxyContractAsync(): Promise<ERC20ProxyContract> {
+ private _getERC20ProxyContract(): ERC20ProxyContract {
if (!_.isUndefined(this._erc20ProxyContractIfExists)) {
return this._erc20ProxyContractIfExists;
}
- const [abi, address] = await this._getContractAbiAndAddressFromArtifactsAsync(
- artifacts.ERC20Proxy,
- this._contractAddressIfExists,
- );
const contractInstance = new ERC20ProxyContract(
- abi,
- address,
+ this.abi,
+ this.address,
this._web3Wrapper.getProvider(),
this._web3Wrapper.getContractDefaults(),
);
diff --git a/packages/contract-wrappers/src/contract_wrappers/erc20_token_wrapper.ts b/packages/contract-wrappers/src/contract_wrappers/erc20_token_wrapper.ts
index 4625cef6a..192eaf0a7 100644
--- a/packages/contract-wrappers/src/contract_wrappers/erc20_token_wrapper.ts
+++ b/packages/contract-wrappers/src/contract_wrappers/erc20_token_wrapper.ts
@@ -1,10 +1,11 @@
+import { ERC20TokenContract, ERC20TokenEventArgs, ERC20TokenEvents } from '@0xproject/abi-gen-wrappers';
+import { ERC20Token } from '@0xproject/contract-artifacts';
import { schemas } from '@0xproject/json-schemas';
import { BigNumber } from '@0xproject/utils';
import { Web3Wrapper } from '@0xproject/web3-wrapper';
import { ContractAbi, LogWithDecodedArgs } from 'ethereum-types';
import * as _ from 'lodash';
-import { artifacts } from '../artifacts';
import { methodOptsSchema } from '../schemas/method_opts_schema';
import { txOptsSchema } from '../schemas/tx_opts_schema';
import {
@@ -20,7 +21,6 @@ import { constants } from '../utils/constants';
import { ContractWrapper } from './contract_wrapper';
import { ERC20ProxyWrapper } from './erc20_proxy_wrapper';
-import { ERC20TokenContract, ERC20TokenEventArgs, ERC20TokenEvents } from './generated/erc20_token';
const removeUndefinedProperties = _.pickBy;
@@ -30,7 +30,7 @@ const removeUndefinedProperties = _.pickBy;
* to the 0x ERC20 Proxy smart contract.
*/
export class ERC20TokenWrapper extends ContractWrapper {
- public abi: ContractAbi = artifacts.ERC20Token.compilerOutput.abi;
+ public abi: ContractAbi = ERC20Token.compilerOutput.abi;
public UNLIMITED_ALLOWANCE_IN_BASE_UNITS = constants.UNLIMITED_ALLOWANCE_IN_BASE_UNITS;
private _tokenContractsByAddress: { [address: string]: ERC20TokenContract };
private _erc20ProxyWrapper: ERC20ProxyWrapper;
@@ -189,7 +189,7 @@ export class ERC20TokenWrapper extends ContractWrapper {
ownerAddress: string,
methodOpts: MethodOpts = {},
): Promise<BigNumber> {
- const proxyAddress = this._erc20ProxyWrapper.getContractAddress();
+ const proxyAddress = this._erc20ProxyWrapper.address;
const allowanceInBaseUnits = await this.getAllowanceAsync(tokenAddress, ownerAddress, proxyAddress, methodOpts);
return allowanceInBaseUnits;
}
@@ -209,7 +209,7 @@ export class ERC20TokenWrapper extends ContractWrapper {
amountInBaseUnits: BigNumber,
txOpts: TransactionOpts = {},
): Promise<string> {
- const proxyAddress = this._erc20ProxyWrapper.getContractAddress();
+ const proxyAddress = this._erc20ProxyWrapper.address;
const txHash = await this.setAllowanceAsync(
tokenAddress,
ownerAddress,
@@ -373,7 +373,7 @@ export class ERC20TokenWrapper extends ContractWrapper {
normalizedTokenAddress,
eventName,
indexFilterValues,
- artifacts.ERC20Token.compilerOutput.abi,
+ ERC20Token.compilerOutput.abi,
callback,
isVerbose,
);
@@ -418,30 +418,19 @@ export class ERC20TokenWrapper extends ContractWrapper {
eventName,
blockRange,
indexFilterValues,
- artifacts.ERC20Token.compilerOutput.abi,
+ ERC20Token.compilerOutput.abi,
);
return logs;
}
- // HACK: We don't want this method to be visible to the other units within that package but not to the end user.
- // TS doesn't give that possibility and therefore we make it private and access it over an any cast. Because of that tslint sees it as unused.
- // tslint:disable-next-line:no-unused-variable
- private _invalidateContractInstances(): void {
- this.unsubscribeAll();
- this._tokenContractsByAddress = {};
- }
private async _getTokenContractAsync(tokenAddress: string): Promise<ERC20TokenContract> {
const normalizedTokenAddress = tokenAddress.toLowerCase();
let tokenContract = this._tokenContractsByAddress[normalizedTokenAddress];
if (!_.isUndefined(tokenContract)) {
return tokenContract;
}
- const [abi, address] = await this._getContractAbiAndAddressFromArtifactsAsync(
- artifacts.ERC20Token,
- normalizedTokenAddress,
- );
const contractInstance = new ERC20TokenContract(
- abi,
- address,
+ this.abi,
+ normalizedTokenAddress,
this._web3Wrapper.getProvider(),
this._web3Wrapper.getContractDefaults(),
);
diff --git a/packages/contract-wrappers/src/contract_wrappers/erc721_proxy_wrapper.ts b/packages/contract-wrappers/src/contract_wrappers/erc721_proxy_wrapper.ts
index 933c1dc27..adee3e3ab 100644
--- a/packages/contract-wrappers/src/contract_wrappers/erc721_proxy_wrapper.ts
+++ b/packages/contract-wrappers/src/contract_wrappers/erc721_proxy_wrapper.ts
@@ -1,38 +1,39 @@
+import { ERC721ProxyContract } from '@0xproject/abi-gen-wrappers';
+import { ERC721Proxy } from '@0xproject/contract-artifacts';
import { AssetProxyId } from '@0xproject/types';
import { Web3Wrapper } from '@0xproject/web3-wrapper';
import { ContractAbi } from 'ethereum-types';
import * as _ from 'lodash';
-import { artifacts } from '../artifacts';
import { assert } from '../utils/assert';
+import { _getDefaultContractAddresses } from '../utils/contract_addresses';
import { ContractWrapper } from './contract_wrapper';
-import { ERC721ProxyContract } from './generated/erc721_proxy';
/**
* This class includes the functionality related to interacting with the ERC721Proxy contract.
*/
export class ERC721ProxyWrapper extends ContractWrapper {
- public abi: ContractAbi = artifacts.ERC20Proxy.compilerOutput.abi;
+ public abi: ContractAbi = ERC721Proxy.compilerOutput.abi;
+ public address: string;
private _erc721ProxyContractIfExists?: ERC721ProxyContract;
- private _contractAddressIfExists?: string;
/**
* Instantiate ERC721ProxyWrapper
* @param web3Wrapper Web3Wrapper instance to use
* @param networkId Desired networkId
- * @param contractAddressIfExists The contract address to use. This is usually pulled from
- * the artifacts but needs to be specified when using with your own custom testnet.
+ * @param address The address of the ERC721Proxy contract. If undefined,
+ * will default to the known address corresponding to the networkId.
*/
- constructor(web3Wrapper: Web3Wrapper, networkId: number, contractAddressIfExists?: string) {
+ constructor(web3Wrapper: Web3Wrapper, networkId: number, address?: string) {
super(web3Wrapper, networkId);
- this._contractAddressIfExists = contractAddressIfExists;
+ this.address = _.isUndefined(address) ? _getDefaultContractAddresses(networkId).erc721Proxy : address;
}
/**
* Get the 4 bytes ID of this asset proxy
* @return Proxy id
*/
public async getProxyIdAsync(): Promise<AssetProxyId> {
- const ERC721ProxyContractInstance = await this._getERC721ProxyContractAsync();
+ const ERC721ProxyContractInstance = await this._getERC721ProxyContract();
const proxyId = (await ERC721ProxyContractInstance.getProxyId.callAsync()) as AssetProxyId;
return proxyId;
}
@@ -44,7 +45,7 @@ export class ERC721ProxyWrapper extends ContractWrapper {
public async isAuthorizedAsync(exchangeContractAddress: string): Promise<boolean> {
assert.isETHAddressHex('exchangeContractAddress', exchangeContractAddress);
const normalizedExchangeContractAddress = exchangeContractAddress.toLowerCase();
- const ERC721ProxyContractInstance = await this._getERC721ProxyContractAsync();
+ const ERC721ProxyContractInstance = await this._getERC721ProxyContract();
const isAuthorized = await ERC721ProxyContractInstance.authorized.callAsync(normalizedExchangeContractAddress);
return isAuthorized;
}
@@ -53,36 +54,17 @@ export class ERC721ProxyWrapper extends ContractWrapper {
* @return The list of authorized addresses.
*/
public async getAuthorizedAddressesAsync(): Promise<string[]> {
- const ERC721ProxyContractInstance = await this._getERC721ProxyContractAsync();
+ const ERC721ProxyContractInstance = await this._getERC721ProxyContract();
const authorizedAddresses = await ERC721ProxyContractInstance.getAuthorizedAddresses.callAsync();
return authorizedAddresses;
}
- /**
- * Retrieves the Ethereum address of the ERC721Proxy contract deployed on the network
- * that the user-passed web3 provider is connected to.
- * @returns The Ethereum address of the ERC721Proxy contract being used.
- */
- public getContractAddress(): string {
- const contractAddress = this._getContractAddress(artifacts.ERC721Proxy, this._contractAddressIfExists);
- return contractAddress;
- }
- // HACK: We don't want this method to be visible to the other units within that package but not to the end user.
- // TS doesn't give that possibility and therefore we make it private and access it over an any cast. Because of that tslint sees it as unused.
- // tslint:disable-next-line:no-unused-variable
- private _invalidateContractInstance(): void {
- delete this._erc721ProxyContractIfExists;
- }
- private async _getERC721ProxyContractAsync(): Promise<ERC721ProxyContract> {
+ private _getERC721ProxyContract(): ERC721ProxyContract {
if (!_.isUndefined(this._erc721ProxyContractIfExists)) {
return this._erc721ProxyContractIfExists;
}
- const [abi, address] = await this._getContractAbiAndAddressFromArtifactsAsync(
- artifacts.ERC721Proxy,
- this._contractAddressIfExists,
- );
const contractInstance = new ERC721ProxyContract(
- abi,
- address,
+ this.abi,
+ this.address,
this._web3Wrapper.getProvider(),
this._web3Wrapper.getContractDefaults(),
);
diff --git a/packages/contract-wrappers/src/contract_wrappers/erc721_token_wrapper.ts b/packages/contract-wrappers/src/contract_wrappers/erc721_token_wrapper.ts
index 590dbbf74..d92d7087c 100644
--- a/packages/contract-wrappers/src/contract_wrappers/erc721_token_wrapper.ts
+++ b/packages/contract-wrappers/src/contract_wrappers/erc721_token_wrapper.ts
@@ -1,10 +1,11 @@
+import { ERC721TokenContract, ERC721TokenEventArgs, ERC721TokenEvents } from '@0xproject/abi-gen-wrappers';
+import { ERC721Token } from '@0xproject/contract-artifacts';
import { schemas } from '@0xproject/json-schemas';
import { BigNumber } from '@0xproject/utils';
import { Web3Wrapper } from '@0xproject/web3-wrapper';
import { ContractAbi, LogWithDecodedArgs } from 'ethereum-types';
import * as _ from 'lodash';
-import { artifacts } from '../artifacts';
import { methodOptsSchema } from '../schemas/method_opts_schema';
import { txOptsSchema } from '../schemas/tx_opts_schema';
import {
@@ -20,7 +21,6 @@ import { constants } from '../utils/constants';
import { ContractWrapper } from './contract_wrapper';
import { ERC721ProxyWrapper } from './erc721_proxy_wrapper';
-import { ERC721TokenContract, ERC721TokenEventArgs, ERC721TokenEvents } from './generated/erc721_token';
const removeUndefinedProperties = _.pickBy;
@@ -30,7 +30,7 @@ const removeUndefinedProperties = _.pickBy;
* to the 0x ERC721 Proxy smart contract.
*/
export class ERC721TokenWrapper extends ContractWrapper {
- public abi: ContractAbi = artifacts.ERC721Token.compilerOutput.abi;
+ public abi: ContractAbi = ERC721Token.compilerOutput.abi;
private _tokenContractsByAddress: { [address: string]: ERC721TokenContract };
private _erc721ProxyWrapper: ERC721ProxyWrapper;
/**
@@ -150,7 +150,7 @@ export class ERC721TokenWrapper extends ContractWrapper {
ownerAddress: string,
methodOpts: MethodOpts = {},
): Promise<boolean> {
- const proxyAddress = this._erc721ProxyWrapper.getContractAddress();
+ const proxyAddress = this._erc721ProxyWrapper.address;
const isProxyApprovedForAll = await this.isApprovedForAllAsync(
tokenAddress,
ownerAddress,
@@ -199,7 +199,7 @@ export class ERC721TokenWrapper extends ContractWrapper {
tokenId: BigNumber,
methodOpts: MethodOpts = {},
): Promise<boolean> {
- const proxyAddress = this._erc721ProxyWrapper.getContractAddress();
+ const proxyAddress = this._erc721ProxyWrapper.address;
const approvedAddress = await this.getApprovedIfExistsAsync(tokenAddress, tokenId, methodOpts);
const isProxyApproved = approvedAddress === proxyAddress;
return isProxyApproved;
@@ -260,7 +260,7 @@ export class ERC721TokenWrapper extends ContractWrapper {
isApproved: boolean,
txOpts: TransactionOpts = {},
): Promise<string> {
- const proxyAddress = this._erc721ProxyWrapper.getContractAddress();
+ const proxyAddress = this._erc721ProxyWrapper.address;
const txHash = await this.setApprovalForAllAsync(tokenAddress, ownerAddress, proxyAddress, isApproved, txOpts);
return txHash;
}
@@ -318,7 +318,7 @@ export class ERC721TokenWrapper extends ContractWrapper {
tokenId: BigNumber,
txOpts: TransactionOpts = {},
): Promise<string> {
- const proxyAddress = this._erc721ProxyWrapper.getContractAddress();
+ const proxyAddress = this._erc721ProxyWrapper.address;
const txHash = await this.setApprovalAsync(tokenAddress, proxyAddress, tokenId, txOpts);
return txHash;
}
@@ -400,7 +400,7 @@ export class ERC721TokenWrapper extends ContractWrapper {
normalizedTokenAddress,
eventName,
indexFilterValues,
- artifacts.ERC721Token.compilerOutput.abi,
+ ERC721Token.compilerOutput.abi,
callback,
isVerbose,
);
@@ -445,30 +445,19 @@ export class ERC721TokenWrapper extends ContractWrapper {
eventName,
blockRange,
indexFilterValues,
- artifacts.ERC721Token.compilerOutput.abi,
+ ERC721Token.compilerOutput.abi,
);
return logs;
}
- // HACK: We don't want this method to be visible to the other units within that package but not to the end user.
- // TS doesn't give that possibility and therefore we make it private and access it over an any cast. Because of that tslint sees it as unused.
- // tslint:disable-next-line:no-unused-variable
- private _invalidateContractInstances(): void {
- this.unsubscribeAll();
- this._tokenContractsByAddress = {};
- }
private async _getTokenContractAsync(tokenAddress: string): Promise<ERC721TokenContract> {
const normalizedTokenAddress = tokenAddress.toLowerCase();
let tokenContract = this._tokenContractsByAddress[normalizedTokenAddress];
if (!_.isUndefined(tokenContract)) {
return tokenContract;
}
- const [abi, address] = await this._getContractAbiAndAddressFromArtifactsAsync(
- artifacts.ERC721Token,
- normalizedTokenAddress,
- );
const contractInstance = new ERC721TokenContract(
- abi,
- address,
+ this.abi,
+ normalizedTokenAddress,
this._web3Wrapper.getProvider(),
this._web3Wrapper.getContractDefaults(),
);
diff --git a/packages/contract-wrappers/src/contract_wrappers/ether_token_wrapper.ts b/packages/contract-wrappers/src/contract_wrappers/ether_token_wrapper.ts
index 1ac01812e..d5775208e 100644
--- a/packages/contract-wrappers/src/contract_wrappers/ether_token_wrapper.ts
+++ b/packages/contract-wrappers/src/contract_wrappers/ether_token_wrapper.ts
@@ -1,16 +1,16 @@
+import { WETH9Contract, WETH9EventArgs, WETH9Events } from '@0xproject/abi-gen-wrappers';
+import { WETH9 } from '@0xproject/contract-artifacts';
import { schemas } from '@0xproject/json-schemas';
import { BigNumber } from '@0xproject/utils';
import { Web3Wrapper } from '@0xproject/web3-wrapper';
import { ContractAbi, LogWithDecodedArgs } from 'ethereum-types';
import * as _ from 'lodash';
-import { artifacts } from '../artifacts';
import { BlockRange, ContractWrappersError, EventCallback, IndexedFilterValues, TransactionOpts } from '../types';
import { assert } from '../utils/assert';
import { ContractWrapper } from './contract_wrapper';
import { ERC20TokenWrapper } from './erc20_token_wrapper';
-import { WETH9Contract, WETH9EventArgs, WETH9Events } from './generated/weth9';
const removeUndefinedProperties = _.pickBy;
@@ -19,7 +19,7 @@ const removeUndefinedProperties = _.pickBy;
* The caller can convert ETH into the equivalent number of wrapped ETH ERC20 tokens and back.
*/
export class EtherTokenWrapper extends ContractWrapper {
- public abi: ContractAbi = artifacts.EtherToken.compilerOutput.abi;
+ public abi: ContractAbi = WETH9.compilerOutput.abi;
private _etherTokenContractsByAddress: {
[address: string]: WETH9Contract;
} = {};
@@ -142,7 +142,7 @@ export class EtherTokenWrapper extends ContractWrapper {
eventName,
blockRange,
indexFilterValues,
- artifacts.EtherToken.compilerOutput.abi,
+ WETH9.compilerOutput.abi,
);
return logs;
}
@@ -172,7 +172,7 @@ export class EtherTokenWrapper extends ContractWrapper {
normalizedEtherTokenAddress,
eventName,
indexFilterValues,
- artifacts.EtherToken.compilerOutput.abi,
+ WETH9.compilerOutput.abi,
callback,
isVerbose,
);
@@ -192,36 +192,14 @@ export class EtherTokenWrapper extends ContractWrapper {
public unsubscribeAll(): void {
super._unsubscribeAll();
}
- /**
- * Retrieves the Ethereum address of the EtherToken contract deployed on the network
- * that the user-passed web3 provider is connected to. If it's not Kovan, Ropsten, Rinkeby, Mainnet or TestRPC
- * (networkId: 50), it will return undefined (e.g a private network).
- * @returns The Ethereum address of the EtherToken contract or undefined.
- */
- public getContractAddressIfExists(): string | undefined {
- const networkSpecificArtifact = artifacts.EtherToken.networks[this._networkId];
- const contractAddressIfExists = _.isUndefined(networkSpecificArtifact)
- ? undefined
- : networkSpecificArtifact.address;
- return contractAddressIfExists;
- }
- // tslint:disable-next-line:no-unused-variable
- private _invalidateContractInstance(): void {
- this.unsubscribeAll();
- this._etherTokenContractsByAddress = {};
- }
private async _getEtherTokenContractAsync(etherTokenAddress: string): Promise<WETH9Contract> {
let etherTokenContract = this._etherTokenContractsByAddress[etherTokenAddress];
if (!_.isUndefined(etherTokenContract)) {
return etherTokenContract;
}
- const [abi, address] = await this._getContractAbiAndAddressFromArtifactsAsync(
- artifacts.EtherToken,
- etherTokenAddress,
- );
const contractInstance = new WETH9Contract(
- abi,
- address,
+ this.abi,
+ etherTokenAddress,
this._web3Wrapper.getProvider(),
this._web3Wrapper.getContractDefaults(),
);
diff --git a/packages/contract-wrappers/src/contract_wrappers/exchange_wrapper.ts b/packages/contract-wrappers/src/contract_wrappers/exchange_wrapper.ts
index dc9ffcbf7..9063e0e40 100644
--- a/packages/contract-wrappers/src/contract_wrappers/exchange_wrapper.ts
+++ b/packages/contract-wrappers/src/contract_wrappers/exchange_wrapper.ts
@@ -1,3 +1,5 @@
+import { ExchangeContract, ExchangeEventArgs, ExchangeEvents } from '@0xproject/abi-gen-wrappers';
+import { Exchange } from '@0xproject/contract-artifacts';
import { schemas } from '@0xproject/json-schemas';
import {
assetDataUtils,
@@ -11,7 +13,6 @@ import { Web3Wrapper } from '@0xproject/web3-wrapper';
import { BlockParamLiteral, ContractAbi, LogWithDecodedArgs } from 'ethereum-types';
import * as _ from 'lodash';
-import { artifacts } from '../artifacts';
import { AssetBalanceAndProxyAllowanceFetcher } from '../fetchers/asset_balance_and_proxy_allowance_fetcher';
import { OrderFilledCancelledFetcher } from '../fetchers/order_filled_cancelled_fetcher';
import { methodOptsSchema } from '../schemas/method_opts_schema';
@@ -24,54 +25,58 @@ import {
IndexedFilterValues,
MethodOpts,
OrderInfo,
- OrderStatus,
OrderTransactionOpts,
ValidateOrderFillableOpts,
} from '../types';
import { assert } from '../utils/assert';
+import { _getDefaultContractAddresses } from '../utils/contract_addresses';
import { decorators } from '../utils/decorators';
import { TransactionEncoder } from '../utils/transaction_encoder';
import { ContractWrapper } from './contract_wrapper';
import { ERC20TokenWrapper } from './erc20_token_wrapper';
import { ERC721TokenWrapper } from './erc721_token_wrapper';
-import { ExchangeContract, ExchangeEventArgs, ExchangeEvents } from './generated/exchange';
/**
* This class includes all the functionality related to calling methods, sending transactions and subscribing to
* events of the 0x V2 Exchange smart contract.
*/
export class ExchangeWrapper extends ContractWrapper {
- public abi: ContractAbi = artifacts.Exchange.compilerOutput.abi;
+ public abi: ContractAbi = Exchange.compilerOutput.abi;
+ public address: string;
+ public zrxTokenAddress: string;
private _exchangeContractIfExists?: ExchangeContract;
private _erc721TokenWrapper: ERC721TokenWrapper;
private _erc20TokenWrapper: ERC20TokenWrapper;
- private _contractAddressIfExists?: string;
- private _zrxContractAddressIfExists?: string;
/**
* Instantiate ExchangeWrapper
- * @param web3Wrapper Web3Wrapper instance to use
- * @param networkId Desired networkId
- * @param contractAddressIfExists The exchange contract address to use. This is usually pulled from
- * the artifacts but needs to be specified when using with your own custom testnet.
- * @param zrxContractAddressIfExists The ZRXToken contract address to use. This is usually pulled from
- * the artifacts but needs to be specified when using with your own custom testnet.
- * @param blockPollingIntervalMs The block polling interval to use for active subscriptions
+ * @param web3Wrapper Web3Wrapper instance to use.
+ * @param networkId Desired networkId.
+ * @param erc20TokenWrapper ERC20TokenWrapper instance to use.
+ * @param erc721TokenWrapper ERC721TokenWrapper instance to use.
+ * @param address The address of the Exchange contract. If undefined, will
+ * default to the known address corresponding to the networkId.
+ * @param zrxTokenAddress The address of the ZRXToken contract. If
+ * undefined, will default to the known address corresponding to the
+ * networkId.
+ * @param blockPollingIntervalMs The block polling interval to use for active subscriptions.
*/
constructor(
web3Wrapper: Web3Wrapper,
networkId: number,
erc20TokenWrapper: ERC20TokenWrapper,
erc721TokenWrapper: ERC721TokenWrapper,
- contractAddressIfExists?: string,
- zrxContractAddressIfExists?: string,
+ address?: string,
+ zrxTokenAddress?: string,
blockPollingIntervalMs?: number,
) {
super(web3Wrapper, networkId, blockPollingIntervalMs);
this._erc20TokenWrapper = erc20TokenWrapper;
this._erc721TokenWrapper = erc721TokenWrapper;
- this._contractAddressIfExists = contractAddressIfExists;
- this._zrxContractAddressIfExists = zrxContractAddressIfExists;
+ this.address = _.isUndefined(address) ? _getDefaultContractAddresses(networkId).exchange : address;
+ this.zrxTokenAddress = _.isUndefined(zrxTokenAddress)
+ ? _getDefaultContractAddresses(networkId).zrxToken
+ : zrxTokenAddress;
}
/**
* Retrieve the address of an asset proxy by signature.
@@ -1051,12 +1056,11 @@ export class ExchangeWrapper extends ContractWrapper {
assert.doesBelongToStringEnum('eventName', eventName, ExchangeEvents);
assert.doesConformToSchema('indexFilterValues', indexFilterValues, schemas.indexFilterValuesSchema);
assert.isFunction('callback', callback);
- const exchangeContractAddress = this.getContractAddress();
const subscriptionToken = this._subscribe<ArgsType>(
- exchangeContractAddress,
+ this.address,
eventName,
indexFilterValues,
- artifacts.Exchange.compilerOutput.abi,
+ Exchange.compilerOutput.abi,
callback,
isVerbose,
);
@@ -1091,13 +1095,12 @@ export class ExchangeWrapper extends ContractWrapper {
assert.doesBelongToStringEnum('eventName', eventName, ExchangeEvents);
assert.doesConformToSchema('blockRange', blockRange, schemas.blockRangeSchema);
assert.doesConformToSchema('indexFilterValues', indexFilterValues, schemas.indexFilterValuesSchema);
- const exchangeContractAddress = this.getContractAddress();
const logs = await this._getLogsAsync<ArgsType>(
- exchangeContractAddress,
+ this.address,
eventName,
blockRange,
indexFilterValues,
- artifacts.Exchange.compilerOutput.abi,
+ Exchange.compilerOutput.abi,
);
return logs;
}
@@ -1160,29 +1163,11 @@ export class ExchangeWrapper extends ContractWrapper {
);
}
/**
- * Retrieves the Ethereum address of the Exchange contract deployed on the network
- * that the user-passed web3 provider is connected to.
- * @returns The Ethereum address of the Exchange contract being used.
- */
- public getContractAddress(): string {
- const contractAddress = this._getContractAddress(artifacts.Exchange, this._contractAddressIfExists);
- return contractAddress;
- }
- /**
- * Returns the ZRX token address used by the exchange contract.
- * @return Address of ZRX token
- */
- public getZRXTokenAddress(): string {
- const contractAddress = this._getContractAddress(artifacts.ZRXToken, this._zrxContractAddressIfExists);
- return contractAddress;
- }
- /**
* Returns the ZRX asset data used by the exchange contract.
* @return ZRX asset data
*/
public getZRXAssetData(): string {
- const zrxTokenAddress = this.getZRXTokenAddress();
- const zrxAssetData = assetDataUtils.encodeERC20AssetData(zrxTokenAddress);
+ const zrxAssetData = assetDataUtils.encodeERC20AssetData(this.zrxTokenAddress);
return zrxAssetData;
}
/**
@@ -1195,23 +1180,14 @@ export class ExchangeWrapper extends ContractWrapper {
const encoder = new TransactionEncoder(exchangeInstance);
return encoder;
}
- // tslint:disable:no-unused-variable
- private _invalidateContractInstances(): void {
- this.unsubscribeAll();
- delete this._exchangeContractIfExists;
- }
// tslint:enable:no-unused-variable
private async _getExchangeContractAsync(): Promise<ExchangeContract> {
if (!_.isUndefined(this._exchangeContractIfExists)) {
return this._exchangeContractIfExists;
}
- const [abi, address] = await this._getContractAbiAndAddressFromArtifactsAsync(
- artifacts.Exchange,
- this._contractAddressIfExists,
- );
const contractInstance = new ExchangeContract(
- abi,
- address,
+ this.abi,
+ this.address,
this._web3Wrapper.getProvider(),
this._web3Wrapper.getContractDefaults(),
);
diff --git a/packages/contract-wrappers/src/contract_wrappers/forwarder_wrapper.ts b/packages/contract-wrappers/src/contract_wrappers/forwarder_wrapper.ts
index c19edf188..b6fc071ea 100644
--- a/packages/contract-wrappers/src/contract_wrappers/forwarder_wrapper.ts
+++ b/packages/contract-wrappers/src/contract_wrappers/forwarder_wrapper.ts
@@ -1,3 +1,5 @@
+import { ForwarderContract } from '@0xproject/abi-gen-wrappers';
+import { Forwarder } from '@0xproject/contract-artifacts';
import { schemas } from '@0xproject/json-schemas';
import { AssetProxyId, SignedOrder } from '@0xproject/types';
import { BigNumber } from '@0xproject/utils';
@@ -5,36 +7,56 @@ import { Web3Wrapper } from '@0xproject/web3-wrapper';
import { ContractAbi } from 'ethereum-types';
import * as _ from 'lodash';
-import { artifacts } from '../artifacts';
import { orderTxOptsSchema } from '../schemas/order_tx_opts_schema';
import { txOptsSchema } from '../schemas/tx_opts_schema';
import { OrderTransactionOpts } from '../types';
import { assert } from '../utils/assert';
import { calldataOptimizationUtils } from '../utils/calldata_optimization_utils';
import { constants } from '../utils/constants';
+import { _getDefaultContractAddresses } from '../utils/contract_addresses';
import { decorators } from '../utils/decorators';
import { utils } from '../utils/utils';
import { ContractWrapper } from './contract_wrapper';
-import { ForwarderContract } from './generated/forwarder';
/**
* This class includes the functionality related to interacting with the Forwarder contract.
*/
export class ForwarderWrapper extends ContractWrapper {
- public abi: ContractAbi = artifacts.Forwarder.compilerOutput.abi;
+ public abi: ContractAbi = Forwarder.compilerOutput.abi;
+ public address: string;
+ public zrxTokenAddress: string;
+ public etherTokenAddress: string;
private _forwarderContractIfExists?: ForwarderContract;
- private _contractAddressIfExists?: string;
- private _zrxContractAddressIfExists?: string;
+
+ /**
+ * Instantiate ForwarderWrapper
+ * @param web3Wrapper Web3Wrapper instance to use.
+ * @param networkId Desired networkId.
+ * @param address The address of the Exchange contract. If undefined, will
+ * default to the known address corresponding to the networkId.
+ * @param zrxTokenAddress The address of the ZRXToken contract. If
+ * undefined, will default to the known address corresponding to the
+ * networkId.
+ * @param etherTokenAddress The address of a WETH (Ether token) contract. If
+ * undefined, will default to the known address corresponding to the
+ * networkId.
+ */
constructor(
web3Wrapper: Web3Wrapper,
networkId: number,
- contractAddressIfExists?: string,
- zrxContractAddressIfExists?: string,
+ address?: string,
+ zrxTokenAddress?: string,
+ etherTokenAddress?: string,
) {
super(web3Wrapper, networkId);
- this._contractAddressIfExists = contractAddressIfExists;
- this._zrxContractAddressIfExists = zrxContractAddressIfExists;
+ this.address = _.isUndefined(address) ? _getDefaultContractAddresses(networkId).exchange : address;
+ this.zrxTokenAddress = _.isUndefined(zrxTokenAddress)
+ ? _getDefaultContractAddresses(networkId).zrxToken
+ : zrxTokenAddress;
+ this.etherTokenAddress = _.isUndefined(etherTokenAddress)
+ ? _getDefaultContractAddresses(networkId).etherToken
+ : etherTokenAddress;
}
/**
* Purchases as much of orders' makerAssets as possible by selling up to 95% of transaction's ETH value.
@@ -73,12 +95,8 @@ export class ForwarderWrapper extends ContractWrapper {
assert.isETHAddressHex('feeRecipientAddress', feeRecipientAddress);
assert.doesConformToSchema('orderTransactionOpts', orderTransactionOpts, orderTxOptsSchema, [txOptsSchema]);
// other assertions
- assert.ordersCanBeUsedForForwarderContract(signedOrders, this.getEtherTokenAddress());
- assert.feeOrdersCanBeUsedForForwarderContract(
- signedFeeOrders,
- this.getZRXTokenAddress(),
- this.getEtherTokenAddress(),
- );
+ assert.ordersCanBeUsedForForwarderContract(signedOrders, this.etherTokenAddress);
+ assert.feeOrdersCanBeUsedForForwarderContract(signedFeeOrders, this.zrxTokenAddress, this.etherTokenAddress);
// format feePercentage
const formattedFeePercentage = utils.numberPercentageToEtherTokenAmountPercentage(feePercentage);
// lowercase input addresses
@@ -165,12 +183,8 @@ export class ForwarderWrapper extends ContractWrapper {
assert.isETHAddressHex('feeRecipientAddress', feeRecipientAddress);
assert.doesConformToSchema('orderTransactionOpts', orderTransactionOpts, orderTxOptsSchema, [txOptsSchema]);
// other assertions
- assert.ordersCanBeUsedForForwarderContract(signedOrders, this.getEtherTokenAddress());
- assert.feeOrdersCanBeUsedForForwarderContract(
- signedFeeOrders,
- this.getZRXTokenAddress(),
- this.getEtherTokenAddress(),
- );
+ assert.ordersCanBeUsedForForwarderContract(signedOrders, this.etherTokenAddress);
+ assert.feeOrdersCanBeUsedForForwarderContract(signedFeeOrders, this.zrxTokenAddress, this.etherTokenAddress);
// format feePercentage
const formattedFeePercentage = utils.numberPercentageToEtherTokenAmountPercentage(feePercentage);
// lowercase input addresses
@@ -220,48 +234,13 @@ export class ForwarderWrapper extends ContractWrapper {
);
return txHash;
}
- /**
- * Retrieves the Ethereum address of the Forwarder contract deployed on the network
- * that the user-passed web3 provider is connected to.
- * @returns The Ethereum address of the Forwarder contract being used.
- */
- public getContractAddress(): string {
- const contractAddress = this._getContractAddress(artifacts.Forwarder, this._contractAddressIfExists);
- return contractAddress;
- }
- /**
- * Returns the ZRX token address used by the forwarder contract.
- * @return Address of ZRX token
- */
- public getZRXTokenAddress(): string {
- const contractAddress = this._getContractAddress(artifacts.ZRXToken, this._zrxContractAddressIfExists);
- return contractAddress;
- }
- /**
- * Returns the Ether token address used by the forwarder contract.
- * @return Address of Ether token
- */
- public getEtherTokenAddress(): string {
- const contractAddress = this._getContractAddress(artifacts.EtherToken);
- return contractAddress;
- }
- // HACK: We don't want this method to be visible to the other units within that package but not to the end user.
- // TS doesn't give that possibility and therefore we make it private and access it over an any cast. Because of that tslint sees it as unused.
- // tslint:disable-next-line:no-unused-variable
- private _invalidateContractInstance(): void {
- delete this._forwarderContractIfExists;
- }
private async _getForwarderContractAsync(): Promise<ForwarderContract> {
if (!_.isUndefined(this._forwarderContractIfExists)) {
return this._forwarderContractIfExists;
}
- const [abi, address] = await this._getContractAbiAndAddressFromArtifactsAsync(
- artifacts.Forwarder,
- this._contractAddressIfExists,
- );
const contractInstance = new ForwarderContract(
- abi,
- address,
+ this.abi,
+ this.address,
this._web3Wrapper.getProvider(),
this._web3Wrapper.getContractDefaults(),
);
diff --git a/packages/contract-wrappers/src/contract_wrappers/order_validator_wrapper.ts b/packages/contract-wrappers/src/contract_wrappers/order_validator_wrapper.ts
index 1da88f624..2ae1a158b 100644
--- a/packages/contract-wrappers/src/contract_wrappers/order_validator_wrapper.ts
+++ b/packages/contract-wrappers/src/contract_wrappers/order_validator_wrapper.ts
@@ -1,3 +1,5 @@
+import { OrderValidatorContract } from '@0xproject/abi-gen-wrappers';
+import { OrderValidator } from '@0xproject/contract-artifacts';
import { schemas } from '@0xproject/json-schemas';
import { SignedOrder } from '@0xproject/types';
import { BigNumber } from '@0xproject/utils';
@@ -5,26 +7,29 @@ import { Web3Wrapper } from '@0xproject/web3-wrapper';
import { ContractAbi } from 'ethereum-types';
import * as _ from 'lodash';
-import { artifacts } from '../artifacts';
import { BalanceAndAllowance, OrderAndTraderInfo, TraderInfo } from '../types';
import { assert } from '../utils/assert';
+import { _getDefaultContractAddresses } from '../utils/contract_addresses';
import { ContractWrapper } from './contract_wrapper';
-import { OrderValidatorContract } from './generated/order_validator';
/**
* This class includes the functionality related to interacting with the OrderValidator contract.
*/
export class OrderValidatorWrapper extends ContractWrapper {
- public abi: ContractAbi = artifacts.OrderValidator.compilerOutput.abi;
+ public abi: ContractAbi = OrderValidator.compilerOutput.abi;
+ public address: string;
private _orderValidatorContractIfExists?: OrderValidatorContract;
/**
* Instantiate OrderValidatorWrapper
- * @param web3Wrapper Web3Wrapper instance to use
- * @param networkId Desired networkId
+ * @param web3Wrapper Web3Wrapper instance to use.
+ * @param networkId Desired networkId.
+ * @param address The address of the OrderValidator contract. If undefined,
+ * will default to the known address corresponding to the networkId.
*/
- constructor(web3Wrapper: Web3Wrapper, networkId: number) {
+ constructor(web3Wrapper: Web3Wrapper, networkId: number, address?: string) {
super(web3Wrapper, networkId);
+ this.address = _.isUndefined(address) ? _getDefaultContractAddresses(networkId).exchange : address;
}
/**
* Get an object conforming to OrderAndTraderInfo containing on-chain information of the provided order and address
@@ -164,20 +169,13 @@ export class OrderValidatorWrapper extends ContractWrapper {
const result = await OrderValidatorContractInstance.getERC721TokenOwner.callAsync(tokenAddress, tokenId);
return result;
}
- // HACK: We don't want this method to be visible to the other units within that package but not to the end user.
- // TS doesn't give that possibility and therefore we make it private and access it over an any cast. Because of that tslint sees it as unused.
- // tslint:disable-next-line:no-unused-variable
- private _invalidateContractInstance(): void {
- delete this._orderValidatorContractIfExists;
- }
private async _getOrderValidatorContractAsync(): Promise<OrderValidatorContract> {
if (!_.isUndefined(this._orderValidatorContractIfExists)) {
return this._orderValidatorContractIfExists;
}
- const [abi, address] = await this._getContractAbiAndAddressFromArtifactsAsync(artifacts.OrderValidator);
const contractInstance = new OrderValidatorContract(
- abi,
- address,
+ this.abi,
+ this.address,
this._web3Wrapper.getProvider(),
this._web3Wrapper.getContractDefaults(),
);
diff --git a/packages/contract-wrappers/src/globals.d.ts b/packages/contract-wrappers/src/globals.d.ts
deleted file mode 100644
index 94e63a32d..000000000
--- a/packages/contract-wrappers/src/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/contract-wrappers/src/index.ts b/packages/contract-wrappers/src/index.ts
index e8a53170e..f24828153 100644
--- a/packages/contract-wrappers/src/index.ts
+++ b/packages/contract-wrappers/src/index.ts
@@ -1,3 +1,30 @@
+export { ContractAddresses } from '@0xproject/contract-addresses';
+
+export {
+ WETH9Events,
+ WETH9WithdrawalEventArgs,
+ WETH9ApprovalEventArgs,
+ WETH9EventArgs,
+ WETH9DepositEventArgs,
+ WETH9TransferEventArgs,
+ ERC20TokenTransferEventArgs,
+ ERC20TokenApprovalEventArgs,
+ ERC20TokenEvents,
+ ERC20TokenEventArgs,
+ ERC721TokenApprovalEventArgs,
+ ERC721TokenApprovalForAllEventArgs,
+ ERC721TokenTransferEventArgs,
+ ERC721TokenEvents,
+ ERC721TokenEventArgs,
+ ExchangeCancelUpToEventArgs,
+ ExchangeAssetProxyRegisteredEventArgs,
+ ExchangeSignatureValidatorApprovalEventArgs,
+ ExchangeFillEventArgs,
+ ExchangeCancelEventArgs,
+ ExchangeEventArgs,
+ ExchangeEvents,
+} from '@0xproject/abi-gen-wrappers';
+
export { ContractWrappers } from './contract_wrappers';
export { ERC20TokenWrapper } from './contract_wrappers/erc20_token_wrapper';
export { ERC721TokenWrapper } from './contract_wrappers/erc721_token_wrapper';
@@ -54,40 +81,6 @@ export {
StateMutability,
} from 'ethereum-types';
-export {
- WETH9Events,
- WETH9WithdrawalEventArgs,
- WETH9ApprovalEventArgs,
- WETH9EventArgs,
- WETH9DepositEventArgs,
- WETH9TransferEventArgs,
-} from './contract_wrappers/generated/weth9';
-
-export {
- ERC20TokenTransferEventArgs,
- ERC20TokenApprovalEventArgs,
- ERC20TokenEvents,
- ERC20TokenEventArgs,
-} from './contract_wrappers/generated/erc20_token';
-
-export {
- ERC721TokenApprovalEventArgs,
- ERC721TokenApprovalForAllEventArgs,
- ERC721TokenTransferEventArgs,
- ERC721TokenEvents,
- ERC721TokenEventArgs,
-} from './contract_wrappers/generated/erc721_token';
-
-export {
- ExchangeCancelUpToEventArgs,
- ExchangeAssetProxyRegisteredEventArgs,
- ExchangeSignatureValidatorApprovalEventArgs,
- ExchangeFillEventArgs,
- ExchangeCancelEventArgs,
- ExchangeEventArgs,
- ExchangeEvents,
-} from './contract_wrappers/generated/exchange';
-
export { AbstractBalanceAndProxyAllowanceFetcher, AbstractOrderFilledCancelledFetcher } from '@0xproject/order-utils';
export { AssetBalanceAndProxyAllowanceFetcher } from './fetchers/asset_balance_and_proxy_allowance_fetcher';
diff --git a/packages/contract-wrappers/src/schemas/contract_wrappers_config_schema.ts b/packages/contract-wrappers/src/schemas/contract_wrappers_config_schema.ts
index ac248b2d4..ae1ce668c 100644
--- a/packages/contract-wrappers/src/schemas/contract_wrappers_config_schema.ts
+++ b/packages/contract-wrappers/src/schemas/contract_wrappers_config_schema.ts
@@ -1,5 +1,25 @@
export const ContractWrappersConfigSchema = {
id: '/ContractWrappersConfig',
- oneOf: [{ $ref: '/ZeroExContractPrivateNetworkConfig' }, { $ref: '/ZeroExContractPublicNetworkConfig' }],
+ properties: {
+ networkId: {
+ type: 'number',
+ },
+ gasPrice: { $ref: '/numberSchema' },
+ contractAddresses: {
+ type: 'object',
+ properties: {
+ erc20Proxy: { $ref: '/addressSchema' },
+ erc721Proxy: { $ref: '/addressSchema' },
+ zrxToken: { $ref: '/addressSchema' },
+ etherToken: { $ref: '/addressSchema' },
+ exchange: { $ref: '/addressSchema' },
+ assetProxyOwner: { $ref: '/addressSchema' },
+ forwarder: { $ref: '/addressSchema' },
+ orderValidator: { $ref: '/addressSchema' },
+ },
+ },
+ blockPollingIntervalMs: { type: 'number' },
+ },
type: 'object',
+ required: ['networkId'],
};
diff --git a/packages/contract-wrappers/src/schemas/contract_wrappers_private_network_config_schema.ts b/packages/contract-wrappers/src/schemas/contract_wrappers_private_network_config_schema.ts
deleted file mode 100644
index 904690ae7..000000000
--- a/packages/contract-wrappers/src/schemas/contract_wrappers_private_network_config_schema.ts
+++ /dev/null
@@ -1,36 +0,0 @@
-export const contractWrappersPrivateNetworkConfigSchema = {
- id: '/ZeroExContractPrivateNetworkConfig',
- properties: {
- networkId: {
- type: 'number',
- minimum: 1,
- },
- gasPrice: { $ref: '/numberSchema' },
- zrxContractAddress: { $ref: '/addressSchema' },
- exchangeContractAddress: { $ref: '/addressSchema' },
- erc20ProxyContractAddress: { $ref: '/addressSchema' },
- erc721ProxyContractAddress: { $ref: '/addressSchema' },
- blockPollingIntervalMs: { type: 'number' },
- orderWatcherConfig: {
- type: 'object',
- properties: {
- pollingIntervalMs: {
- type: 'number',
- minimum: 0,
- },
- numConfirmations: {
- type: 'number',
- minimum: 0,
- },
- },
- },
- },
- type: 'object',
- required: [
- 'networkId',
- 'zrxContractAddress',
- 'exchangeContractAddress',
- 'erc20ProxyContractAddress',
- 'erc721ProxyContractAddress',
- ],
-};
diff --git a/packages/contract-wrappers/src/schemas/contract_wrappers_public_network_config_schema.ts b/packages/contract-wrappers/src/schemas/contract_wrappers_public_network_config_schema.ts
deleted file mode 100644
index 5cd008ae0..000000000
--- a/packages/contract-wrappers/src/schemas/contract_wrappers_public_network_config_schema.ts
+++ /dev/null
@@ -1,44 +0,0 @@
-const networkNameToId: { [networkName: string]: number } = {
- mainnet: 1,
- ropsten: 3,
- rinkeby: 4,
- kovan: 42,
- ganache: 50,
-};
-
-export const contractWrappersPublicNetworkConfigSchema = {
- id: '/ZeroExContractPublicNetworkConfig',
- properties: {
- networkId: {
- type: 'number',
- enum: [
- networkNameToId.mainnet,
- networkNameToId.kovan,
- networkNameToId.ropsten,
- networkNameToId.rinkeby,
- networkNameToId.ganache,
- ],
- },
- gasPrice: { $ref: '/numberSchema' },
- zrxContractAddress: { $ref: '/addressSchema' },
- exchangeContractAddress: { $ref: '/addressSchema' },
- erc20ProxyContractAddress: { $ref: '/addressSchema' },
- erc721ProxyContractAddress: { $ref: '/addressSchema' },
- blockPollingIntervalMs: { type: 'number' },
- orderWatcherConfig: {
- type: 'object',
- properties: {
- pollingIntervalMs: {
- type: 'number',
- minimum: 0,
- },
- numConfirmations: {
- type: 'number',
- minimum: 0,
- },
- },
- },
- },
- type: 'object',
- required: ['networkId'],
-};
diff --git a/packages/contract-wrappers/src/types.ts b/packages/contract-wrappers/src/types.ts
index e0b12b7c9..895a47cc1 100644
--- a/packages/contract-wrappers/src/types.ts
+++ b/packages/contract-wrappers/src/types.ts
@@ -1,25 +1,24 @@
+import {
+ ERC20TokenEventArgs,
+ ERC20TokenEvents,
+ ERC721TokenEventArgs,
+ ERC721TokenEvents,
+ ExchangeEventArgs,
+ ExchangeEvents,
+ WETH9EventArgs,
+ WETH9Events,
+} from '@0xproject/abi-gen-wrappers';
+import { ContractAddresses } from '@0xproject/contract-addresses';
+import { OrderState, SignedOrder } from '@0xproject/types';
import { BigNumber } from '@0xproject/utils';
-import { OrderState, SignedOrder } from '@0xproject/types';
import { BlockParam, ContractEventArg, DecodedLogArgs, LogEntryEvent, LogWithDecodedArgs } from 'ethereum-types';
-import { ERC20TokenEventArgs, ERC20TokenEvents } from './contract_wrappers/generated/erc20_token';
-import { ERC721TokenEventArgs, ERC721TokenEvents } from './contract_wrappers/generated/erc721_token';
-import { ExchangeEventArgs, ExchangeEvents } from './contract_wrappers/generated/exchange';
-import { WETH9EventArgs, WETH9Events } from './contract_wrappers/generated/weth9';
-
export enum ExchangeWrapperError {
AssetDataMismatch = 'ASSET_DATA_MISMATCH',
}
export enum ContractWrappersError {
- ExchangeContractDoesNotExist = 'EXCHANGE_CONTRACT_DOES_NOT_EXIST',
- ZRXContractDoesNotExist = 'ZRX_CONTRACT_DOES_NOT_EXIST',
- EtherTokenContractDoesNotExist = 'ETHER_TOKEN_CONTRACT_DOES_NOT_EXIST',
- ERC20ProxyContractDoesNotExist = 'ERC20_PROXY_CONTRACT_DOES_NOT_EXIST',
- ERC721ProxyContractDoesNotExist = 'ERC721_PROXY_CONTRACT_DOES_NOT_EXIST',
- ERC20TokenContractDoesNotExist = 'ERC20_TOKEN_CONTRACT_DOES_NOT_EXIST',
- ERC721TokenContractDoesNotExist = 'ERC721_TOKEN_CONTRACT_DOES_NOT_EXIST',
ContractNotDeployedOnNetwork = 'CONTRACT_NOT_DEPLOYED_ON_NETWORK',
InsufficientAllowanceForTransfer = 'INSUFFICIENT_ALLOWANCE_FOR_TRANSFER',
InsufficientBalanceForTransfer = 'INSUFFICIENT_BALANCE_FOR_TRANSFER',
@@ -105,22 +104,13 @@ export type SyncMethod = (...args: any[]) => any;
/**
* networkId: The id of the underlying ethereum network your provider is connected to. (1-mainnet, 3-ropsten, 4-rinkeby, 42-kovan, 50-testrpc)
* gasPrice: Gas price to use with every transaction
- * exchangeContractAddress: The address of an exchange contract to use
- * zrxContractAddress: The address of the ZRX contract to use
- * erc20ProxyContractAddress: The address of the erc20 token transfer proxy contract to use
- * erc721ProxyContractAddress: The address of the erc721 token transfer proxy contract to use
- * forwarderContractAddress: The address of the forwarder contract to use
- * orderWatcherConfig: All the configs related to the orderWatcher
+ * contractAddresses: The address of all contracts to use. Defaults to the known addresses based on networkId.
* blockPollingIntervalMs: The interval to use for block polling in event watching methods (defaults to 1000)
*/
export interface ContractWrappersConfig {
networkId: number;
gasPrice?: BigNumber;
- exchangeContractAddress?: string;
- zrxContractAddress?: string;
- erc20ProxyContractAddress?: string;
- erc721ProxyContractAddress?: string;
- forwarderContractAddress?: string;
+ contractAddresses?: ContractAddresses;
blockPollingIntervalMs?: number;
}
diff --git a/packages/contract-wrappers/src/utils/contract_addresses.ts b/packages/contract-wrappers/src/utils/contract_addresses.ts
new file mode 100644
index 000000000..98967c52d
--- /dev/null
+++ b/packages/contract-wrappers/src/utils/contract_addresses.ts
@@ -0,0 +1,15 @@
+import { ContractAddresses, getContractAddressesForNetworkOrThrow, NetworkId } from '@0xproject/contract-addresses';
+import * as _ from 'lodash';
+
+/**
+ * Returns the default contract addresses for the given networkId or throws with
+ * a context-specific error message if the networkId is not recognized.
+ */
+export function _getDefaultContractAddresses(networkId: number): ContractAddresses {
+ if (!(networkId in NetworkId)) {
+ throw new Error(
+ `No default contract addresses found for the given network id (${networkId}). If you want to use ContractWrappers on this network, you must manually pass in the contract address(es) to the constructor.`,
+ );
+ }
+ return getContractAddressesForNetworkOrThrow(networkId);
+}
diff --git a/packages/contract-wrappers/src/utils/transaction_encoder.ts b/packages/contract-wrappers/src/utils/transaction_encoder.ts
index 33086944b..d179fa07e 100644
--- a/packages/contract-wrappers/src/utils/transaction_encoder.ts
+++ b/packages/contract-wrappers/src/utils/transaction_encoder.ts
@@ -1,11 +1,11 @@
+import { ExchangeContract } from '@0xproject/abi-gen-wrappers';
+
import { schemas } from '@0xproject/json-schemas';
import { eip712Utils } from '@0xproject/order-utils';
import { Order, SignedOrder } from '@0xproject/types';
import { BigNumber, signTypedDataUtils } from '@0xproject/utils';
import _ = require('lodash');
-import { ExchangeContract } from '../contract_wrappers/generated/exchange';
-
import { assert } from './assert';
/**
diff --git a/packages/contract-wrappers/test/artifacts_test.ts b/packages/contract-wrappers/test/artifacts_test.ts
deleted file mode 100644
index c05d513b3..000000000
--- a/packages/contract-wrappers/test/artifacts_test.ts
+++ /dev/null
@@ -1,43 +0,0 @@
-import { web3Factory } from '@0xproject/dev-utils';
-
-import { ContractWrappers } from '../src';
-
-import { chaiSetup } from './utils/chai_setup';
-import { constants } from './utils/constants';
-
-chaiSetup.configure();
-
-// Those tests are slower cause they're talking to a remote node
-const TIMEOUT = 10000;
-
-// TODO: Re-enable those tests after final kovan and ropsten deployments are done.
-describe.skip('Artifacts', () => {
- describe('contracts are deployed on kovan', () => {
- const kovanRpcUrl = constants.KOVAN_RPC_URL;
- const provider = web3Factory.getRpcProvider({ rpcUrl: kovanRpcUrl });
- const config = {
- networkId: constants.KOVAN_NETWORK_ID,
- };
- const contractWrappers = new ContractWrappers(provider, config);
- it('erc20 proxy contract is deployed', async () => {
- await (contractWrappers.erc20Proxy as any)._getTokenTransferProxyContractAsync();
- }).timeout(TIMEOUT);
- it('erc721 proxy contract is deployed', async () => {
- await (contractWrappers.erc721Proxy as any)._getTokenTransferProxyContractAsync();
- }).timeout(TIMEOUT);
- });
- describe('contracts are deployed on ropsten', () => {
- const ropstenRpcUrl = constants.ROPSTEN_RPC_URL;
- const provider = web3Factory.getRpcProvider({ rpcUrl: ropstenRpcUrl });
- const config = {
- networkId: constants.ROPSTEN_NETWORK_ID,
- };
- const contractWrappers = new ContractWrappers(provider, config);
- it('erc20 proxy contract is deployed', async () => {
- await (contractWrappers.erc20Proxy as any)._getTokenTransferProxyContractAsync();
- }).timeout(TIMEOUT);
- it('erc721 proxy contract is deployed', async () => {
- await (contractWrappers.erc721Proxy as any)._getTokenTransferProxyContractAsync();
- }).timeout(TIMEOUT);
- });
-});
diff --git a/packages/contract-wrappers/test/erc20_proxy_wrapper_test.ts b/packages/contract-wrappers/test/erc20_proxy_wrapper_test.ts
index 6bf9f1e25..d8dfa4204 100644
--- a/packages/contract-wrappers/test/erc20_proxy_wrapper_test.ts
+++ b/packages/contract-wrappers/test/erc20_proxy_wrapper_test.ts
@@ -4,6 +4,7 @@ import { ContractWrappers } from '../src';
import { chaiSetup } from './utils/chai_setup';
import { constants } from './utils/constants';
+import { migrateOnceAsync } from './utils/migrate';
import { provider } from './utils/web3_wrapper';
chaiSetup.configure();
@@ -11,10 +12,13 @@ const expect = chai.expect;
describe('ERC20ProxyWrapper', () => {
let contractWrappers: ContractWrappers;
- const config = {
- networkId: constants.TESTRPC_NETWORK_ID,
- };
before(async () => {
+ const contractAddresses = await migrateOnceAsync();
+ const config = {
+ networkId: constants.TESTRPC_NETWORK_ID,
+ contractAddresses,
+ blockPollingIntervalMs: 10,
+ };
contractWrappers = new ContractWrappers(provider, config);
});
describe('#isAuthorizedAsync', () => {
diff --git a/packages/contract-wrappers/test/erc20_wrapper_test.ts b/packages/contract-wrappers/test/erc20_wrapper_test.ts
index fde587dec..c065f4d63 100644
--- a/packages/contract-wrappers/test/erc20_wrapper_test.ts
+++ b/packages/contract-wrappers/test/erc20_wrapper_test.ts
@@ -1,3 +1,4 @@
+import { ContractAddresses } from '@0xproject/contract-addresses';
import { BlockchainLifecycle, callbackErrorReporter } from '@0xproject/dev-utils';
import { EmptyWalletSubprovider, Web3ProviderEngine } from '@0xproject/subproviders';
import { DoneCallback } from '@0xproject/types';
@@ -10,16 +11,17 @@ import {
BlockParamLiteral,
BlockRange,
ContractWrappers,
+ ContractWrappersConfig,
ContractWrappersError,
+ DecodedLogEvent,
ERC20TokenApprovalEventArgs,
ERC20TokenEvents,
ERC20TokenTransferEventArgs,
} from '../src';
-import { DecodedLogEvent } from '../src/types';
-
import { chaiSetup } from './utils/chai_setup';
import { constants } from './utils/constants';
+import { migrateOnceAsync } from './utils/migrate';
import { tokenUtils } from './utils/token_utils';
import { provider, web3Wrapper } from './utils/web3_wrapper';
@@ -29,14 +31,20 @@ const blockchainLifecycle = new BlockchainLifecycle(web3Wrapper);
describe('ERC20Wrapper', () => {
let contractWrappers: ContractWrappers;
+ let contractAddresses: ContractAddresses;
let userAddresses: string[];
let tokens: string[];
let coinbase: string;
let addressWithoutFunds: string;
- const config = {
- networkId: constants.TESTRPC_NETWORK_ID,
- };
+ let config: ContractWrappersConfig;
+
before(async () => {
+ contractAddresses = await migrateOnceAsync();
+ config = {
+ networkId: constants.TESTRPC_NETWORK_ID,
+ contractAddresses,
+ blockPollingIntervalMs: 10,
+ };
contractWrappers = new ContractWrappers(provider, config);
userAddresses = await web3Wrapper.getAvailableAddressesAsync();
tokens = tokenUtils.getDummyERC20TokenAddresses();
@@ -72,19 +80,6 @@ describe('ERC20Wrapper', () => {
contractWrappers.erc20Token.transferAsync(tokenAddress, fromAddress, toAddress, transferAmount),
).to.be.rejectedWith(ContractWrappersError.InsufficientBalanceForTransfer);
});
- it('should throw a CONTRACT_DOES_NOT_EXIST error for a non-existent token contract', async () => {
- const nonExistentTokenAddress = '0x9dd402f14d67e001d8efbe6583e51bf9706aa065';
- const fromAddress = coinbase;
- const toAddress = coinbase;
- return expect(
- contractWrappers.erc20Token.transferAsync(
- nonExistentTokenAddress,
- fromAddress,
- toAddress,
- transferAmount,
- ),
- ).to.be.rejectedWith(ContractWrappersError.ERC20TokenContractDoesNotExist);
- });
});
describe('#transferFromAsync', () => {
let tokenAddress: string;
@@ -189,19 +184,6 @@ describe('ERC20Wrapper', () => {
const postBalance = await contractWrappers.erc20Token.getBalanceAsync(tokenAddress, toAddress);
return expect(postBalance).to.be.bignumber.equal(transferAmount);
});
- it('should throw a CONTRACT_DOES_NOT_EXIST error for a non-existent token contract', async () => {
- const fromAddress = coinbase;
- const nonExistentTokenAddress = '0x9dd402f14d67e001d8efbe6583e51bf9706aa065';
- return expect(
- contractWrappers.erc20Token.transferFromAsync(
- nonExistentTokenAddress,
- fromAddress,
- toAddress,
- senderAddress,
- new BigNumber(42),
- ),
- ).to.be.rejectedWith(ContractWrappersError.ERC20TokenContractDoesNotExist);
- });
});
describe('#getBalanceAsync', () => {
describe('With provider with accounts', () => {
@@ -212,13 +194,6 @@ describe('ERC20Wrapper', () => {
const expectedBalance = new BigNumber('1000000000000000000000000000');
return expect(balance).to.be.bignumber.equal(expectedBalance);
});
- it('should throw a CONTRACT_DOES_NOT_EXIST error for a non-existent token contract', async () => {
- const nonExistentTokenAddress = '0x9dd402f14d67e001d8efbe6583e51bf9706aa065';
- const ownerAddress = coinbase;
- return expect(
- contractWrappers.erc20Token.getBalanceAsync(nonExistentTokenAddress, ownerAddress),
- ).to.be.rejectedWith(ContractWrappersError.ERC20TokenContractDoesNotExist);
- });
it('should return a balance of 0 for a non-existent owner address', async () => {
const tokenAddress = tokens[0];
const nonExistentOwner = '0x198c6ad858f213fb31b6fe809e25040e6b964593';
@@ -294,7 +269,7 @@ describe('ERC20Wrapper', () => {
});
it('should reduce the gas cost for transfers including tokens with unlimited allowance support', async () => {
const transferAmount = new BigNumber(5);
- const zrxAddress = tokenUtils.getProtocolTokenAddress();
+ const zrxAddress = contractAddresses.zrxToken;
const [, userWithNormalAllowance, userWithUnlimitedAllowance] = userAddresses;
await contractWrappers.erc20Token.setAllowanceAsync(
zrxAddress,
@@ -525,7 +500,7 @@ describe('ERC20Wrapper', () => {
);
})().catch(done);
});
- it('Outstanding subscriptions are cancelled when contractWrappers.setProvider called', (done: DoneCallback) => {
+ it('Outstanding subscriptions are cancelled when contractWrappers.unsubscribeAll called', (done: DoneCallback) => {
(async () => {
const callbackNeverToBeCalled = callbackErrorReporter.reportNodeCallbackErrors(done)(
(_logEvent: DecodedLogEvent<ERC20TokenApprovalEventArgs>) => {
@@ -539,7 +514,7 @@ describe('ERC20Wrapper', () => {
callbackNeverToBeCalled,
);
const callbackToBeCalled = callbackErrorReporter.reportNodeCallbackErrors(done)();
- contractWrappers.setProvider(provider, constants.TESTRPC_NETWORK_ID);
+ contractWrappers.unsubscribeAll();
contractWrappers.erc20Token.subscribe(
tokenAddress,
ERC20TokenEvents.Transfer,
@@ -588,7 +563,7 @@ describe('ERC20Wrapper', () => {
let txHash: string;
before(() => {
tokenAddress = tokens[0];
- tokenTransferProxyAddress = contractWrappers.erc20Proxy.getContractAddress();
+ tokenTransferProxyAddress = contractWrappers.erc20Proxy.address;
});
it('should get logs with decoded args emitted by Approval', async () => {
txHash = await contractWrappers.erc20Token.setUnlimitedProxyAllowanceAsync(tokenAddress, coinbase);
diff --git a/packages/contract-wrappers/test/erc721_proxy_wrapper_test.ts b/packages/contract-wrappers/test/erc721_proxy_wrapper_test.ts
index 9473d930b..9b0fe8817 100644
--- a/packages/contract-wrappers/test/erc721_proxy_wrapper_test.ts
+++ b/packages/contract-wrappers/test/erc721_proxy_wrapper_test.ts
@@ -4,6 +4,7 @@ import { ContractWrappers } from '../src';
import { chaiSetup } from './utils/chai_setup';
import { constants } from './utils/constants';
+import { migrateOnceAsync } from './utils/migrate';
import { provider } from './utils/web3_wrapper';
chaiSetup.configure();
@@ -11,10 +12,13 @@ const expect = chai.expect;
describe('ERC721ProxyWrapper', () => {
let contractWrappers: ContractWrappers;
- const config = {
- networkId: constants.TESTRPC_NETWORK_ID,
- };
before(async () => {
+ const contractAddresses = await migrateOnceAsync();
+ const config = {
+ networkId: constants.TESTRPC_NETWORK_ID,
+ contractAddresses,
+ blockPollingIntervalMs: 10,
+ };
contractWrappers = new ContractWrappers(provider, config);
});
describe('#isAuthorizedAsync', () => {
diff --git a/packages/contract-wrappers/test/erc721_wrapper_test.ts b/packages/contract-wrappers/test/erc721_wrapper_test.ts
index 10bac6086..1efbb37c7 100644
--- a/packages/contract-wrappers/test/erc721_wrapper_test.ts
+++ b/packages/contract-wrappers/test/erc721_wrapper_test.ts
@@ -10,16 +10,18 @@ import {
BlockParamLiteral,
BlockRange,
ContractWrappers,
+ ContractWrappersConfig,
ContractWrappersError,
+ DecodedLogEvent,
ERC721TokenApprovalEventArgs,
ERC721TokenApprovalForAllEventArgs,
ERC721TokenEvents,
ERC721TokenTransferEventArgs,
} from '../src';
-import { DecodedLogEvent } from '../src/types';
import { chaiSetup } from './utils/chai_setup';
import { constants } from './utils/constants';
+import { migrateOnceAsync } from './utils/migrate';
import { tokenUtils } from './utils/token_utils';
import { provider, web3Wrapper } from './utils/web3_wrapper';
@@ -37,10 +39,15 @@ describe('ERC721Wrapper', () => {
let operatorAddress: string;
let approvedAddress: string;
let receiverAddress: string;
- const config = {
- networkId: constants.TESTRPC_NETWORK_ID,
- };
+ let config: ContractWrappersConfig;
+
before(async () => {
+ const contractAddresses = await migrateOnceAsync();
+ config = {
+ networkId: constants.TESTRPC_NETWORK_ID,
+ contractAddresses,
+ blockPollingIntervalMs: 10,
+ };
contractWrappers = new ContractWrappers(provider, config);
userAddresses = await web3Wrapper.getAvailableAddressesAsync();
tokens = tokenUtils.getDummyERC721TokenAddresses();
@@ -108,12 +115,6 @@ describe('ERC721Wrapper', () => {
tokenCount = await contractWrappers.erc721Token.getTokenCountAsync(tokenAddress, ownerAddress);
expect(tokenCount).to.be.bignumber.equal(1);
});
- it('should throw a CONTRACT_DOES_NOT_EXIST error for a non-existent token contract', async () => {
- const nonExistentTokenAddress = '0x9dd402f14d67e001d8efbe6583e51bf9706aa065';
- return expect(
- contractWrappers.erc721Token.getTokenCountAsync(nonExistentTokenAddress, ownerAddress),
- ).to.be.rejectedWith(ContractWrappersError.ERC721TokenContractDoesNotExist);
- });
it('should return a balance of 0 for a non-existent owner address', async () => {
const nonExistentOwner = '0x198c6ad858f213fb31b6fe809e25040e6b964593';
const balance = await contractWrappers.erc721Token.getTokenCountAsync(tokenAddress, nonExistentOwner);
@@ -142,13 +143,6 @@ describe('ERC721Wrapper', () => {
const tokenOwner = await contractWrappers.erc721Token.getOwnerOfAsync(tokenAddress, tokenId);
expect(tokenOwner).to.be.bignumber.equal(ownerAddress);
});
- it('should throw a CONTRACT_DOES_NOT_EXIST error for a non-existent token contract', async () => {
- const nonExistentTokenAddress = '0x9dd402f14d67e001d8efbe6583e51bf9706aa065';
- const fakeTokenId = new BigNumber(42);
- return expect(
- contractWrappers.erc721Token.getOwnerOfAsync(nonExistentTokenAddress, fakeTokenId),
- ).to.be.rejectedWith(ContractWrappersError.ERC721TokenContractDoesNotExist);
- });
it('should return undefined not 0 for a non-existent ERC721', async () => {
const fakeTokenId = new BigNumber(42);
return expect(contractWrappers.erc721Token.getOwnerOfAsync(tokenAddress, fakeTokenId)).to.be.rejectedWith(
@@ -319,7 +313,7 @@ describe('ERC721Wrapper', () => {
);
})().catch(done);
});
- it('Outstanding subscriptions are cancelled when contractWrappers.setProvider called', (done: DoneCallback) => {
+ it('Outstanding subscriptions are cancelled when contractWrappers.unsubscribeAll called', (done: DoneCallback) => {
(async () => {
const callbackNeverToBeCalled = callbackErrorReporter.reportNodeCallbackErrors(done)(
(logEvent: DecodedLogEvent<ERC721TokenApprovalEventArgs>) => {
@@ -333,7 +327,7 @@ describe('ERC721Wrapper', () => {
callbackNeverToBeCalled,
);
const callbackToBeCalled = callbackErrorReporter.reportNodeCallbackErrors(done)();
- contractWrappers.setProvider(provider, constants.TESTRPC_NETWORK_ID);
+ contractWrappers.unsubscribeAll();
contractWrappers.erc721Token.subscribe(
tokenAddress,
ERC721TokenEvents.Approval,
diff --git a/packages/contract-wrappers/test/ether_token_wrapper_test.ts b/packages/contract-wrappers/test/ether_token_wrapper_test.ts
index c48fc224f..74d030e1d 100644
--- a/packages/contract-wrappers/test/ether_token_wrapper_test.ts
+++ b/packages/contract-wrappers/test/ether_token_wrapper_test.ts
@@ -1,3 +1,4 @@
+import { ContractAddresses } from '@0xproject/contract-addresses';
import { BlockchainLifecycle, callbackErrorReporter } from '@0xproject/dev-utils';
import { DoneCallback } from '@0xproject/types';
import { BigNumber } from '@0xproject/utils';
@@ -16,12 +17,11 @@ import {
WETH9TransferEventArgs,
WETH9WithdrawalEventArgs,
} from '../src';
-
import { DecodedLogEvent } from '../src/types';
import { chaiSetup } from './utils/chai_setup';
import { constants } from './utils/constants';
-import { tokenUtils } from './utils/token_utils';
+import { migrateOnceAsync } from './utils/migrate';
import { provider, web3Wrapper } from './utils/web3_wrapper';
chaiSetup.configure();
@@ -36,6 +36,7 @@ const MAX_REASONABLE_GAS_COST_IN_WEI = 62517;
describe('EtherTokenWrapper', () => {
let contractWrappers: ContractWrappers;
+ let contractAddresses: ContractAddresses;
let userAddresses: string[];
let addressWithETH: string;
let wethContractAddress: string;
@@ -43,19 +44,22 @@ describe('EtherTokenWrapper', () => {
const decimalPlaces = 7;
let addressWithoutFunds: string;
const gasPrice = new BigNumber(1);
- const zeroExConfig = {
- gasPrice,
- networkId: constants.TESTRPC_NETWORK_ID,
- };
const transferAmount = new BigNumber(42);
const allowanceAmount = new BigNumber(42);
const depositAmount = new BigNumber(42);
const withdrawalAmount = new BigNumber(42);
before(async () => {
- contractWrappers = new ContractWrappers(provider, zeroExConfig);
+ contractAddresses = await migrateOnceAsync();
+ const config = {
+ gasPrice,
+ networkId: constants.TESTRPC_NETWORK_ID,
+ contractAddresses,
+ blockPollingIntervalMs: 10,
+ };
+ contractWrappers = new ContractWrappers(provider, config);
userAddresses = await web3Wrapper.getAvailableAddressesAsync();
addressWithETH = userAddresses[0];
- wethContractAddress = contractWrappers.etherToken.getContractAddressIfExists() as string;
+ wethContractAddress = contractAddresses.etherToken;
depositWeiAmount = Web3Wrapper.toWei(new BigNumber(5));
addressWithoutFunds = userAddresses[1];
});
@@ -67,7 +71,7 @@ describe('EtherTokenWrapper', () => {
});
describe('#getContractAddressIfExists', async () => {
it('should return contract address if connected to a known network', () => {
- const contractAddressIfExists = contractWrappers.etherToken.getContractAddressIfExists();
+ const contractAddressIfExists = contractAddresses.etherToken;
expect(contractAddressIfExists).to.not.be.undefined();
});
it('should throw if connected to a private network and contract addresses are not specified', () => {
@@ -172,7 +176,7 @@ describe('EtherTokenWrapper', () => {
const indexFilterValues = {};
let etherTokenAddress: string;
before(async () => {
- etherTokenAddress = tokenUtils.getWethTokenAddress();
+ etherTokenAddress = contractAddresses.etherToken;
});
afterEach(() => {
contractWrappers.etherToken.unsubscribeAll();
@@ -279,7 +283,7 @@ describe('EtherTokenWrapper', () => {
await contractWrappers.etherToken.withdrawAsync(etherTokenAddress, withdrawalAmount, addressWithETH);
})().catch(done);
});
- it('should cancel outstanding subscriptions when ZeroEx.setProvider is called', (done: DoneCallback) => {
+ it('should cancel outstanding subscriptions when contractWrappers.unsubscribeAll is called', (done: DoneCallback) => {
(async () => {
const callbackNeverToBeCalled = callbackErrorReporter.reportNodeCallbackErrors(done)(
(_logEvent: DecodedLogEvent<WETH9ApprovalEventArgs>) => {
@@ -293,7 +297,7 @@ describe('EtherTokenWrapper', () => {
callbackNeverToBeCalled,
);
const callbackToBeCalled = callbackErrorReporter.reportNodeCallbackErrors(done)();
- contractWrappers.setProvider(provider, constants.TESTRPC_NETWORK_ID);
+ contractWrappers.unsubscribeAll();
await contractWrappers.etherToken.depositAsync(etherTokenAddress, transferAmount, addressWithETH);
contractWrappers.etherToken.subscribe(
etherTokenAddress,
@@ -341,8 +345,8 @@ describe('EtherTokenWrapper', () => {
let txHash: string;
before(async () => {
addressWithETH = userAddresses[0];
- etherTokenAddress = tokenUtils.getWethTokenAddress();
- erc20ProxyAddress = contractWrappers.erc20Proxy.getContractAddress();
+ etherTokenAddress = contractAddresses.etherToken;
+ erc20ProxyAddress = contractWrappers.erc20Proxy.address;
// Start the block range after all migrations to avoid unexpected logs
const currentBlock: number = await web3Wrapper.getBlockNumberAsync();
const fromBlock = currentBlock + 1;
diff --git a/packages/contract-wrappers/test/exchange_wrapper_test.ts b/packages/contract-wrappers/test/exchange_wrapper_test.ts
index b3bd7c633..4d0176349 100644
--- a/packages/contract-wrappers/test/exchange_wrapper_test.ts
+++ b/packages/contract-wrappers/test/exchange_wrapper_test.ts
@@ -12,6 +12,7 @@ import { DecodedLogEvent } from '../src/types';
import { chaiSetup } from './utils/chai_setup';
import { constants } from './utils/constants';
+import { migrateOnceAsync } from './utils/migrate';
import { tokenUtils } from './utils/token_utils';
import { provider, web3Wrapper } from './utils/web3_wrapper';
@@ -27,37 +28,38 @@ describe('ExchangeWrapper', () => {
let exchangeContractAddress: string;
let makerTokenAddress: string;
let takerTokenAddress: string;
- let coinbase: string;
let makerAddress: string;
let anotherMakerAddress: string;
let takerAddress: string;
let makerAssetData: string;
let takerAssetData: string;
- let feeRecipient: string;
let txHash: string;
const fillableAmount = new BigNumber(5);
const takerTokenFillAmount = new BigNumber(5);
let signedOrder: SignedOrder;
let anotherSignedOrder: SignedOrder;
- const config = {
- networkId: constants.TESTRPC_NETWORK_ID,
- blockPollingIntervalMs: 0,
- };
+
before(async () => {
+ const contractAddresses = await migrateOnceAsync();
await blockchainLifecycle.startAsync();
+ const config = {
+ networkId: constants.TESTRPC_NETWORK_ID,
+ contractAddresses,
+ blockPollingIntervalMs: 10,
+ };
contractWrappers = new ContractWrappers(provider, config);
- exchangeContractAddress = contractWrappers.exchange.getContractAddress();
+ exchangeContractAddress = contractWrappers.exchange.address;
userAddresses = await web3Wrapper.getAvailableAddressesAsync();
- zrxTokenAddress = tokenUtils.getProtocolTokenAddress();
+ zrxTokenAddress = contractWrappers.exchange.zrxTokenAddress;
fillScenarios = new FillScenarios(
provider,
userAddresses,
zrxTokenAddress,
exchangeContractAddress,
- contractWrappers.erc20Proxy.getContractAddress(),
- contractWrappers.erc721Proxy.getContractAddress(),
+ contractWrappers.erc20Proxy.address,
+ contractWrappers.erc721Proxy.address,
);
- [coinbase, makerAddress, takerAddress, feeRecipient, anotherMakerAddress] = userAddresses;
+ [, makerAddress, takerAddress, , anotherMakerAddress] = userAddresses;
[makerTokenAddress, takerTokenAddress] = tokenUtils.getDummyERC20TokenAddresses();
[makerAssetData, takerAssetData] = [
assetDataUtils.encodeERC20AssetData(makerTokenAddress),
@@ -329,11 +331,11 @@ describe('ExchangeWrapper', () => {
it('should fill or kill a valid order', async () => {
const erc20ProxyId = await contractWrappers.erc20Proxy.getProxyIdAsync();
const erc20ProxyAddressById = await contractWrappers.exchange.getAssetProxyBySignatureAsync(erc20ProxyId);
- const erc20ProxyAddress = contractWrappers.erc20Proxy.getContractAddress();
+ const erc20ProxyAddress = contractWrappers.erc20Proxy.address;
expect(erc20ProxyAddressById).to.be.equal(erc20ProxyAddress);
const erc721ProxyId = await contractWrappers.erc721Proxy.getProxyIdAsync();
const erc721ProxyAddressById = await contractWrappers.exchange.getAssetProxyBySignatureAsync(erc721ProxyId);
- const erc721ProxyAddress = contractWrappers.erc721Proxy.getContractAddress();
+ const erc721ProxyAddress = contractWrappers.erc721Proxy.address;
expect(erc721ProxyAddressById).to.be.equal(erc721ProxyAddress);
});
});
@@ -408,7 +410,7 @@ describe('ExchangeWrapper', () => {
await contractWrappers.exchange.cancelOrderAsync(signedOrder);
})().catch(done);
});
- it('Outstanding subscriptions are cancelled when contractWrappers.setProvider called', (done: DoneCallback) => {
+ it('Outstanding subscriptions are cancelled when contractWrappers.unsubscribeAll called', (done: DoneCallback) => {
(async () => {
const callbackNeverToBeCalled = callbackErrorReporter.reportNodeCallbackErrors(done)(
(logEvent: DecodedLogEvent<ExchangeFillEventArgs>) => {
@@ -417,7 +419,7 @@ describe('ExchangeWrapper', () => {
);
contractWrappers.exchange.subscribe(ExchangeEvents.Fill, indexFilterValues, callbackNeverToBeCalled);
- contractWrappers.setProvider(provider, constants.TESTRPC_NETWORK_ID);
+ contractWrappers.unsubscribeAll();
const callback = callbackErrorReporter.reportNodeCallbackErrors(done)(
(logEvent: DecodedLogEvent<ExchangeFillEventArgs>) => {
@@ -454,13 +456,6 @@ describe('ExchangeWrapper', () => {
})().catch(done);
});
});
- describe('#getZRXTokenAddressAsync', () => {
- it('gets the same token as is in token registry', () => {
- const zrxAddressFromExchangeWrapper = contractWrappers.exchange.getZRXTokenAddress();
- const zrxAddress = tokenUtils.getProtocolTokenAddress();
- expect(zrxAddressFromExchangeWrapper).to.equal(zrxAddress);
- });
- });
describe('#getLogsAsync', () => {
const blockRange = {
fromBlock: 0,
diff --git a/packages/contract-wrappers/test/forwarder_wrapper_test.ts b/packages/contract-wrappers/test/forwarder_wrapper_test.ts
index 4329e8770..730658884 100644
--- a/packages/contract-wrappers/test/forwarder_wrapper_test.ts
+++ b/packages/contract-wrappers/test/forwarder_wrapper_test.ts
@@ -10,6 +10,7 @@ import { ContractWrappers, OrderStatus } from '../src';
import { chaiSetup } from './utils/chai_setup';
import { constants } from './utils/constants';
+import { migrateOnceAsync } from './utils/migrate';
import { tokenUtils } from './utils/token_utils';
import { provider, web3Wrapper } from './utils/web3_wrapper';
@@ -19,21 +20,14 @@ const blockchainLifecycle = new BlockchainLifecycle(web3Wrapper);
// tslint:disable:custom-no-magic-numbers
describe('ForwarderWrapper', () => {
- const contractWrappersConfig = {
- networkId: constants.TESTRPC_NETWORK_ID,
- blockPollingIntervalMs: 0,
- };
const fillableAmount = new BigNumber(5);
let contractWrappers: ContractWrappers;
let fillScenarios: FillScenarios;
let exchangeContractAddress: string;
let zrxTokenAddress: string;
let userAddresses: string[];
- let coinbase: string;
let makerAddress: string;
let takerAddress: string;
- let feeRecipient: string;
- let anotherMakerAddress: string;
let makerTokenAddress: string;
let takerTokenAddress: string;
let makerAssetData: string;
@@ -41,22 +35,28 @@ describe('ForwarderWrapper', () => {
let signedOrder: SignedOrder;
let anotherSignedOrder: SignedOrder;
before(async () => {
+ const contractAddresses = await migrateOnceAsync();
await blockchainLifecycle.startAsync();
- contractWrappers = new ContractWrappers(provider, contractWrappersConfig);
- exchangeContractAddress = contractWrappers.exchange.getContractAddress();
+ const config = {
+ networkId: constants.TESTRPC_NETWORK_ID,
+ contractAddresses,
+ blockPollingIntervalMs: 10,
+ };
+ contractWrappers = new ContractWrappers(provider, config);
+ exchangeContractAddress = contractWrappers.exchange.address;
userAddresses = await web3Wrapper.getAvailableAddressesAsync();
- zrxTokenAddress = tokenUtils.getProtocolTokenAddress();
+ zrxTokenAddress = contractWrappers.exchange.zrxTokenAddress;
fillScenarios = new FillScenarios(
provider,
userAddresses,
zrxTokenAddress,
exchangeContractAddress,
- contractWrappers.erc20Proxy.getContractAddress(),
- contractWrappers.erc721Proxy.getContractAddress(),
+ contractWrappers.erc20Proxy.address,
+ contractWrappers.erc721Proxy.address,
);
- [coinbase, makerAddress, takerAddress, feeRecipient, anotherMakerAddress] = userAddresses;
+ [, makerAddress, takerAddress] = userAddresses;
[makerTokenAddress] = tokenUtils.getDummyERC20TokenAddresses();
- takerTokenAddress = tokenUtils.getWethTokenAddress();
+ takerTokenAddress = contractWrappers.forwarder.etherTokenAddress;
[makerAssetData, takerAssetData] = [
assetDataUtils.encodeERC20AssetData(makerTokenAddress),
assetDataUtils.encodeERC20AssetData(takerTokenAddress),
diff --git a/packages/contract-wrappers/test/global_hooks.ts b/packages/contract-wrappers/test/global_hooks.ts
index 8731318e7..e23739b59 100644
--- a/packages/contract-wrappers/test/global_hooks.ts
+++ b/packages/contract-wrappers/test/global_hooks.ts
@@ -1,17 +1,6 @@
-import { devConstants } from '@0xproject/dev-utils';
-import { runV2MigrationsAsync } from '@0xproject/migrations';
-
-import { provider } from './utils/web3_wrapper';
-
-before('migrate contracts', async function(): Promise<void> {
+before('set up mocha', async function(): Promise<void> {
// HACK: Since the migrations take longer then our global mocha timeout limit
// we manually increase it for this before hook.
const mochaTestTimeoutMs = 50000;
this.timeout(mochaTestTimeoutMs); // tslint:disable-line:no-invalid-this
- const txDefaults = {
- gas: devConstants.GAS_LIMIT,
- from: devConstants.TESTRPC_FIRST_ADDRESS,
- };
- const artifactsDir = `src/artifacts`;
- await runV2MigrationsAsync(provider, artifactsDir, txDefaults);
});
diff --git a/packages/contract-wrappers/test/order_validator_wrapper_test.ts b/packages/contract-wrappers/test/order_validator_wrapper_test.ts
index baac3eeee..636aa9a50 100644
--- a/packages/contract-wrappers/test/order_validator_wrapper_test.ts
+++ b/packages/contract-wrappers/test/order_validator_wrapper_test.ts
@@ -1,3 +1,4 @@
+import { ContractAddresses } from '@0xproject/contract-addresses';
import { BlockchainLifecycle } from '@0xproject/dev-utils';
import { FillScenarios } from '@0xproject/fill-scenarios';
import { assetDataUtils } from '@0xproject/order-utils';
@@ -12,6 +13,7 @@ import { OrderInfo, TraderInfo } from '../src/types';
import { chaiSetup } from './utils/chai_setup';
import { constants } from './utils/constants';
+import { migrateOnceAsync } from './utils/migrate';
import { tokenUtils } from './utils/token_utils';
import { provider, web3Wrapper } from './utils/web3_wrapper';
@@ -20,10 +22,6 @@ const expect = chai.expect;
const blockchainLifecycle = new BlockchainLifecycle(web3Wrapper);
describe('OrderValidator', () => {
- const contractWrappersConfig = {
- networkId: constants.TESTRPC_NETWORK_ID,
- blockPollingIntervalMs: 0,
- };
const fillableAmount = new BigNumber(5);
let contractWrappers: ContractWrappers;
let fillScenarios: FillScenarios;
@@ -42,24 +40,32 @@ describe('OrderValidator', () => {
let takerAssetData: string;
let signedOrder: SignedOrder;
let anotherSignedOrder: SignedOrder;
+ let contractAddresses: ContractAddresses;
+
before(async () => {
+ contractAddresses = await migrateOnceAsync();
await blockchainLifecycle.startAsync();
- contractWrappers = new ContractWrappers(provider, contractWrappersConfig);
- exchangeContractAddress = contractWrappers.exchange.getContractAddress();
+ const config = {
+ networkId: constants.TESTRPC_NETWORK_ID,
+ contractAddresses,
+ blockPollingIntervalMs: 10,
+ };
+ contractWrappers = new ContractWrappers(provider, config);
+ exchangeContractAddress = contractWrappers.exchange.address;
userAddresses = await web3Wrapper.getAvailableAddressesAsync();
- zrxTokenAddress = tokenUtils.getProtocolTokenAddress();
+ zrxTokenAddress = contractWrappers.exchange.zrxTokenAddress;
zrxTokenAssetData = assetDataUtils.encodeERC20AssetData(zrxTokenAddress);
fillScenarios = new FillScenarios(
provider,
userAddresses,
zrxTokenAddress,
exchangeContractAddress,
- contractWrappers.erc20Proxy.getContractAddress(),
- contractWrappers.erc721Proxy.getContractAddress(),
+ contractWrappers.erc20Proxy.address,
+ contractWrappers.erc721Proxy.address,
);
[coinbase, makerAddress, takerAddress, feeRecipient, anotherMakerAddress] = userAddresses;
[makerTokenAddress] = tokenUtils.getDummyERC20TokenAddresses();
- takerTokenAddress = tokenUtils.getWethTokenAddress();
+ takerTokenAddress = contractAddresses.etherToken;
[makerAssetData, takerAssetData] = [
assetDataUtils.encodeERC20AssetData(makerTokenAddress),
assetDataUtils.encodeERC20AssetData(takerTokenAddress),
diff --git a/packages/contract-wrappers/test/revert_validation_test.ts b/packages/contract-wrappers/test/revert_validation_test.ts
index da011c1d7..f5f8be6c3 100644
--- a/packages/contract-wrappers/test/revert_validation_test.ts
+++ b/packages/contract-wrappers/test/revert_validation_test.ts
@@ -1,6 +1,6 @@
import { BlockchainLifecycle, devConstants, web3Factory } from '@0xproject/dev-utils';
import { FillScenarios } from '@0xproject/fill-scenarios';
-import { runV2MigrationsAsync } from '@0xproject/migrations';
+import { runMigrationsAsync } from '@0xproject/migrations';
import { assetDataUtils } from '@0xproject/order-utils';
import { SignedOrder } from '@0xproject/types';
import { BigNumber } from '@0xproject/utils';
@@ -20,28 +20,19 @@ const expect = chai.expect;
describe('Revert Validation ExchangeWrapper', () => {
let contractWrappers: ContractWrappers;
let userAddresses: string[];
- let zrxTokenAddress: string;
let fillScenarios: FillScenarios;
- let exchangeContractAddress: string;
let makerTokenAddress: string;
let takerTokenAddress: string;
- let coinbase: string;
let makerAddress: string;
- let anotherMakerAddress: string;
let takerAddress: string;
let makerAssetData: string;
let takerAssetData: string;
- let feeRecipient: string;
let txHash: string;
let blockchainLifecycle: BlockchainLifecycle;
let web3Wrapper: Web3Wrapper;
const fillableAmount = new BigNumber(5);
const takerTokenFillAmount = new BigNumber(5);
let signedOrder: SignedOrder;
- const config = {
- networkId: constants.TESTRPC_NETWORK_ID,
- blockPollingIntervalMs: 0,
- };
before(async () => {
// vmErrorsOnRPCResponse is useful for quick feedback and testing during development
// but is not the default behaviour in production. Here we ensure our failure cases
@@ -52,29 +43,31 @@ describe('Revert Validation ExchangeWrapper', () => {
});
web3Wrapper = new Web3Wrapper(provider);
blockchainLifecycle = new BlockchainLifecycle(web3Wrapper);
+ // Re-deploy the artifacts in this provider, rather than in the default provider exposed in
+ // the beforeAll hook. This is due to the fact that the default provider enabled vmErrorsOnRPCResponse
+ // and we are explicity testing with vmErrorsOnRPCResponse disabled.
const txDefaults = {
gas: devConstants.GAS_LIMIT,
from: devConstants.TESTRPC_FIRST_ADDRESS,
};
- const artifactsDir = `src/artifacts`;
- // Re-deploy the artifacts in this provider, rather than in the default provider exposed in
- // the beforeAll hook. This is due to the fact that the default provider enabled vmErrorsOnRPCResponse
- // and we are explicity testing with vmErrorsOnRPCResponse disabled.
- await runV2MigrationsAsync(provider, artifactsDir, txDefaults);
await blockchainLifecycle.startAsync();
+ const contractAddresses = await runMigrationsAsync(provider, txDefaults);
+ const config = {
+ networkId: constants.TESTRPC_NETWORK_ID,
+ contractAddresses,
+ blockPollingIntervalMs: 10,
+ };
contractWrappers = new ContractWrappers(provider, config);
- exchangeContractAddress = contractWrappers.exchange.getContractAddress();
userAddresses = await web3Wrapper.getAvailableAddressesAsync();
- zrxTokenAddress = tokenUtils.getProtocolTokenAddress();
fillScenarios = new FillScenarios(
provider,
userAddresses,
- zrxTokenAddress,
- exchangeContractAddress,
- contractWrappers.erc20Proxy.getContractAddress(),
- contractWrappers.erc721Proxy.getContractAddress(),
+ contractAddresses.zrxToken,
+ contractAddresses.exchange,
+ contractAddresses.erc20Proxy,
+ contractAddresses.erc721Proxy,
);
- [coinbase, makerAddress, takerAddress, feeRecipient, anotherMakerAddress] = userAddresses;
+ [, makerAddress, takerAddress] = userAddresses;
[makerTokenAddress, takerTokenAddress] = tokenUtils.getDummyERC20TokenAddresses();
[makerAssetData, takerAssetData] = [
assetDataUtils.encodeERC20AssetData(makerTokenAddress),
@@ -112,7 +105,7 @@ describe('Revert Validation ExchangeWrapper', () => {
makerTokenBalance,
);
await web3Wrapper.awaitTransactionSuccessAsync(txHash, constants.AWAIT_TRANSACTION_MINED_MS);
- expect(
+ return expect(
contractWrappers.exchange.fillOrderAsync(signedOrder, takerTokenFillAmount, takerAddress, {
shouldValidate: true,
}),
diff --git a/packages/contract-wrappers/test/subscription_test.ts b/packages/contract-wrappers/test/subscription_test.ts
index 6ec7519fe..40921bce8 100644
--- a/packages/contract-wrappers/test/subscription_test.ts
+++ b/packages/contract-wrappers/test/subscription_test.ts
@@ -4,11 +4,17 @@ import * as _ from 'lodash';
import 'mocha';
import * as Sinon from 'sinon';
-import { ContractWrappers, ERC20TokenApprovalEventArgs, ERC20TokenEvents } from '../src';
-import { DecodedLogEvent } from '../src/types';
+import {
+ ContractWrappers,
+ ContractWrappersConfig,
+ DecodedLogEvent,
+ ERC20TokenApprovalEventArgs,
+ ERC20TokenEvents,
+} from '../src';
import { chaiSetup } from './utils/chai_setup';
import { constants } from './utils/constants';
+import { migrateOnceAsync } from './utils/migrate';
import { tokenUtils } from './utils/token_utils';
import { provider, web3Wrapper } from './utils/web3_wrapper';
@@ -17,10 +23,14 @@ const blockchainLifecycle = new BlockchainLifecycle(web3Wrapper);
describe('SubscriptionTest', () => {
let contractWrappers: ContractWrappers;
- const config = {
- networkId: constants.TESTRPC_NETWORK_ID,
- };
+ let config: ContractWrappersConfig;
+
before(async () => {
+ const contractAddresses = await migrateOnceAsync();
+ config = {
+ networkId: constants.TESTRPC_NETWORK_ID,
+ contractAddresses,
+ };
contractWrappers = new ContractWrappers(provider, config);
});
beforeEach(async () => {
diff --git a/packages/contract-wrappers/test/transaction_encoder_test.ts b/packages/contract-wrappers/test/transaction_encoder_test.ts
index 9da8fe2ca..300f2a330 100644
--- a/packages/contract-wrappers/test/transaction_encoder_test.ts
+++ b/packages/contract-wrappers/test/transaction_encoder_test.ts
@@ -9,6 +9,7 @@ import { ContractWrappers } from '../src';
import { TransactionEncoder } from '../src/utils/transaction_encoder';
import { constants } from './utils/constants';
+import { migrateOnceAsync } from './utils/migrate';
import { tokenUtils } from './utils/token_utils';
import { provider, web3Wrapper } from './utils/web3_wrapper';
@@ -31,23 +32,26 @@ describe('TransactionEncoder', () => {
const fillableAmount = new BigNumber(5);
const takerTokenFillAmount = new BigNumber(5);
let signedOrder: SignedOrder;
- const config = {
- networkId: constants.TESTRPC_NETWORK_ID,
- blockPollingIntervalMs: 0,
- };
+
before(async () => {
+ const contractAddresses = await migrateOnceAsync();
await blockchainLifecycle.startAsync();
+ const config = {
+ networkId: constants.TESTRPC_NETWORK_ID,
+ contractAddresses,
+ blockPollingIntervalMs: 10,
+ };
contractWrappers = new ContractWrappers(provider, config);
- exchangeContractAddress = contractWrappers.exchange.getContractAddress();
+ exchangeContractAddress = contractWrappers.exchange.address;
userAddresses = await web3Wrapper.getAvailableAddressesAsync();
- const zrxTokenAddress = tokenUtils.getProtocolTokenAddress();
+ const zrxTokenAddress = contractWrappers.exchange.zrxTokenAddress;
fillScenarios = new FillScenarios(
provider,
userAddresses,
zrxTokenAddress,
exchangeContractAddress,
- contractWrappers.erc20Proxy.getContractAddress(),
- contractWrappers.erc721Proxy.getContractAddress(),
+ contractWrappers.erc20Proxy.address,
+ contractWrappers.erc721Proxy.address,
);
[coinbase, makerAddress, takerAddress, senderAddress] = userAddresses;
[makerTokenAddress, takerTokenAddress] = tokenUtils.getDummyERC20TokenAddresses();
diff --git a/packages/contract-wrappers/test/utils/migrate.ts b/packages/contract-wrappers/test/utils/migrate.ts
new file mode 100644
index 000000000..53319a383
--- /dev/null
+++ b/packages/contract-wrappers/test/utils/migrate.ts
@@ -0,0 +1,18 @@
+import { ContractAddresses } from '@0xproject/contract-addresses';
+import { devConstants } from '@0xproject/dev-utils';
+import { runMigrationsOnceAsync } from '@0xproject/migrations';
+
+import { provider } from './web3_wrapper';
+
+/**
+ * Configures and runs the migrations exactly once. Any subsequent times this is
+ * called, it returns the cached addresses.
+ * @returns The addresses of contracts that were deployed during the migrations.
+ */
+export async function migrateOnceAsync(): Promise<ContractAddresses> {
+ const txDefaults = {
+ gas: devConstants.GAS_LIMIT,
+ from: devConstants.TESTRPC_FIRST_ADDRESS,
+ };
+ return runMigrationsOnceAsync(provider, txDefaults);
+}
diff --git a/packages/contract-wrappers/test/utils/token_utils.ts b/packages/contract-wrappers/test/utils/token_utils.ts
index 06a82ff6e..c9e1e7434 100644
--- a/packages/contract-wrappers/test/utils/token_utils.ts
+++ b/packages/contract-wrappers/test/utils/token_utils.ts
@@ -1,14 +1,13 @@
+import { DummyERC721TokenContract } from '@0xproject/abi-gen-wrappers';
+import { DummyERC721Token } from '@0xproject/contract-artifacts';
import { generatePseudoRandomSalt } from '@0xproject/order-utils';
import { BigNumber } from '@0xproject/utils';
-import { artifacts } from '../../src/artifacts';
-import { DummyERC721TokenContract } from '../../src/contract_wrappers/generated/dummy_erc721_token';
-
-import { constants } from './constants';
import { provider, txDefaults, web3Wrapper } from './web3_wrapper';
// Those addresses come from migrations. They're deterministic so it's relatively safe to hard-code them here.
// Before we were fetching them from the TokenRegistry but now we can't as it's deprecated and removed.
+// TODO(albrow): Import these from the migrations package instead of hard-coding them.
const DUMMY_ERC_20_ADRESSES = [
'0x6dfff22588be9b3ef8cf0ad6dc9b84796f9fb45f',
'0xcfc18cec799fbd1793b5c43e773c98d4d61cc2db',
@@ -20,12 +19,6 @@ const DUMMY_ERC_20_ADRESSES = [
const DUMMY_ERC_721_ADRESSES = ['0x131855dda0aaff096f6854854c55a4debf61077a'];
export const tokenUtils = {
- getProtocolTokenAddress(): string {
- return artifacts.ZRXToken.networks[constants.TESTRPC_NETWORK_ID].address;
- },
- getWethTokenAddress(): string {
- return artifacts.EtherToken.networks[constants.TESTRPC_NETWORK_ID].address;
- },
getDummyERC20TokenAddresses(): string[] {
return DUMMY_ERC_20_ADRESSES;
},
@@ -33,12 +26,7 @@ export const tokenUtils = {
return DUMMY_ERC_721_ADRESSES;
},
async mintDummyERC721Async(address: string, tokenOwner: string): Promise<BigNumber> {
- const erc721 = new DummyERC721TokenContract(
- artifacts.DummyERC721Token.compilerOutput.abi,
- address,
- provider,
- txDefaults,
- );
+ const erc721 = new DummyERC721TokenContract(DummyERC721Token.compilerOutput.abi, address, provider, txDefaults);
const tokenId = generatePseudoRandomSalt();
const txHash = await erc721.mint.sendTransactionAsync(tokenOwner, tokenId);
web3Wrapper.awaitTransactionSuccessAsync(txHash);
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